summaryrefslogtreecommitdiffstats
path: root/clang/lib/Basic/Module.cpp
diff options
context:
space:
mode:
authorBen Langmuir <blangmuir@apple.com>2016-02-11 17:04:42 +0000
committerBen Langmuir <blangmuir@apple.com>2016-02-11 17:04:42 +0000
commit6d25fdc41b7444e15395f5e8f9961825f1d0a163 (patch)
tree6d668aafd4320ea590d8c594e8a7e7294a29c7a8 /clang/lib/Basic/Module.cpp
parentc97efa46f3b3ecfff03cbde04db9703a2886d7e9 (diff)
downloadbcm5719-llvm-6d25fdc41b7444e15395f5e8f9961825f1d0a163.tar.gz
bcm5719-llvm-6d25fdc41b7444e15395f5e8f9961825f1d0a163.zip
[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
Diffstat (limited to 'clang/lib/Basic/Module.cpp')
-rw-r--r--clang/lib/Basic/Module.cpp1
1 files changed, 1 insertions, 0 deletions
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;
OpenPOWER on IntegriCloud