Skip to content

Commit c39e85d

Browse files
committed
[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 llvm-svn: 332491
1 parent 11fd14c commit c39e85d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Sema/SemaType.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7613,7 +7613,7 @@ bool Sema::RequireCompleteTypeImpl(SourceLocation Loc, QualType T,
76137613
// If the user is going to see an error here, recover by making the
76147614
// definition visible.
76157615
bool TreatAsComplete = Diagnoser && !isSFINAEContext();
7616-
if (Diagnoser)
7616+
if (Diagnoser && SuggestedDef)
76177617
diagnoseMissingImport(Loc, SuggestedDef, MissingImportKind::Definition,
76187618
/*Recover*/TreatAsComplete);
76197619
return !TreatAsComplete;

0 commit comments

Comments
 (0)