Author: bruno Date: Wed May 16 10:00:24 2018 New Revision: 332491 URL: http://llvm.org/viewvc/llvm-project?rev=332491&view=rev Log: [Modules] Do not diagnose missing import in recovery mode if there isn't a decl to lookup
Clang often tries to create implicit module import for error recovery, which does a great job helping out with diagnostics. However, sometimes clang does not have enough information given that it's using an invalid context to move on. Be more strict in those cases to avoid crashes. We hit crash on invalids because of this but unfortunately there are no testcases and I couldn't manage to create one. The crashtrace however indicates pretty clear why it's happening. rdar://problem/39313933 Modified: cfe/trunk/lib/Sema/SemaType.cpp Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=332491&r1=332490&r2=332491&view=diff ============================================================================== --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Wed May 16 10:00:24 2018 @@ -7613,7 +7613,7 @@ bool Sema::RequireCompleteTypeImpl(Sourc // If the user is going to see an error here, recover by making the // definition visible. bool TreatAsComplete = Diagnoser && !isSFINAEContext(); - if (Diagnoser) + if (Diagnoser && SuggestedDef) diagnoseMissingImport(Loc, SuggestedDef, MissingImportKind::Definition, /*Recover*/TreatAsComplete); return !TreatAsComplete; _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits