From 6d25fdc41b7444e15395f5e8f9961825f1d0a163 Mon Sep 17 00:00:00 2001 From: Ben Langmuir Date: Thu, 11 Feb 2016 17:04:42 +0000 Subject: [Modules] Don't infinite recurse on implicit import of circular modules in preamble Update the Preprocessor's VisibleModuleSet when typo-correction creates an implicit module import so that we won't accidentally write an invalid SourceLocation into the preamble AST. This would later lead to infinite recursion when loading the preamble AST because we use the value in ImportLocs to prevent visiting a module twice. rdar://problem/24440990 llvm-svn: 260543 --- clang/lib/Basic/Module.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'clang/lib/Basic/Module.cpp') diff --git a/clang/lib/Basic/Module.cpp b/clang/lib/Basic/Module.cpp index baeeb9edbdd..e119c0535eb 100644 --- a/clang/lib/Basic/Module.cpp +++ b/clang/lib/Basic/Module.cpp @@ -492,6 +492,7 @@ LLVM_DUMP_METHOD void Module::dump() const { void VisibleModuleSet::setVisible(Module *M, SourceLocation Loc, VisibleCallback Vis, ConflictCallback Cb) { + assert(Loc.isValid() && "setVisible expects a valid import location"); if (isVisible(M)) return; -- cgit v1.2.3