@@ -209,7 +209,7 @@ class StoreDiags : public DiagnosticConsumer {
209
209
if (!L.isValid ()) return ;
210
210
const SourceManager &SM = Info.getSourceManager ();
211
211
StringRef Filename = SM.getFilename (Info.getLocation ());
212
- bool concerned = IsConcerned (SM, Info. getLocation () );
212
+ bool concerned = SM. isWrittenInMainFile (L );
213
213
auto fillDiagBase = [&](DiagBase &d) {
214
214
llvm::SmallString<64 > Message;
215
215
Info.FormatDiagnostic (Message);
@@ -303,6 +303,11 @@ void BuildPreamble(CompletionSession &session, CompilerInvocation &CI,
303
303
auto Bounds = ComputePreambleBounds (*CI.getLangOpts (), Buf.get (), 0 );
304
304
if (OldP && OldP->Preamble .CanReuse (CI, Buf.get (), Bounds, FS.get ()))
305
305
return ;
306
+ // -Werror makes warnings issued as errors, which stops parsing
307
+ // prematurely because of -ferror-limit=. This also works around the issue
308
+ // of -Werror + -Wunused-parameter in interaction with SkipFunctionBodies.
309
+ auto &Ws = CI.getDiagnosticOpts ().Warnings ;
310
+ Ws.erase (std::remove (Ws.begin (), Ws.end (), " error" ), Ws.end ());
306
311
CI.getDiagnosticOpts ().IgnoreWarnings = false ;
307
312
CI.getFrontendOpts ().SkipFunctionBodies = true ;
308
313
CI.getLangOpts ()->CommentOpts .ParseAllComments = g_config->index .comments > 1 ;
0 commit comments