mirror of
https://github.com/MaskRay/ccls.git
synced 2025-06-10 18:22:14 +00:00
setWarningsAsErrors(false); use SM.isInMainFile
SM.isInMainFile is to work around preamble bug: spurious err_pp_unterminated_conditional with circular #include
This commit is contained in:
parent
0f2bef0f3f
commit
8515e24dd7
@ -221,7 +221,7 @@ public:
|
|||||||
if (!L.isValid()) return;
|
if (!L.isValid()) return;
|
||||||
const SourceManager &SM = Info.getSourceManager();
|
const SourceManager &SM = Info.getSourceManager();
|
||||||
StringRef Filename = SM.getFilename(Info.getLocation());
|
StringRef Filename = SM.getFilename(Info.getLocation());
|
||||||
bool concerned = IsConcerned(SM, Info.getLocation());
|
bool concerned = SM.isInMainFile(L);
|
||||||
auto fillDiagBase = [&](DiagBase &d) {
|
auto fillDiagBase = [&](DiagBase &d) {
|
||||||
llvm::SmallString<64> Message;
|
llvm::SmallString<64> Message;
|
||||||
Info.FormatDiagnostic(Message);
|
Info.FormatDiagnostic(Message);
|
||||||
@ -285,6 +285,10 @@ std::unique_ptr<CompilerInstance> BuildCompilerInstance(
|
|||||||
Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
|
Clang->getDiagnostics(), Clang->getInvocation().TargetOpts));
|
||||||
if (!Clang->hasTarget())
|
if (!Clang->hasTarget())
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
// Otherwise -Werror makes warnings issued as errors, which stops parsing
|
||||||
|
// prematurely when reaching the limit. This also works around the issue of
|
||||||
|
// -Wunused-parameter in interaction with SkipFunctionBodies.
|
||||||
|
Clang->getDiagnostics().setWarningsAsErrors(false);
|
||||||
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
// Construct SourceManager with UserFilesAreVolatile: true because otherwise
|
||||||
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
// RequiresNullTerminator: true may cause out-of-bounds read when a file is
|
||||||
// mmap'ed but is saved concurrently.
|
// mmap'ed but is saved concurrently.
|
||||||
|
Loading…
Reference in New Issue
Block a user