summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-09-29 20:44:46 +0000
committerAdrian Prantl <aprantl@apple.com>2015-09-29 20:44:46 +0000
commit9e8ea3599e9898a1c5eb26831ac9b16c5de68e22 (patch)
tree1b1f672a949eff2cacf31ad6abdea28fc664ba4c /clang/lib/CodeGen/CGDebugInfo.cpp
parent4315012769fed1c055d039d549a5c0f944271bfd (diff)
downloadbcm5719-llvm-9e8ea3599e9898a1c5eb26831ac9b16c5de68e22.tar.gz
bcm5719-llvm-9e8ea3599e9898a1c5eb26831ac9b16c5de68e22.zip
CGDebugInfo: Don't reuse a reference into a DenseMap if the DenseMap may
be modified in between. (NFC) llvm-svn: 248826
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index c2cc49a0c5e..443c45cc64a 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp
@@ -1680,9 +1680,9 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod,
// nullptr if the "Module" is a PCH, which is safe because we don't
// support chained PCH debug info, so there can only be a single PCH.
const Module *M = Mod.getModuleOrNull();
- auto &ModRef = ModuleCache[M];
- if (ModRef)
- return cast<llvm::DIModule>(ModRef);
+ auto ModRef = ModuleCache.find(M);
+ if (ModRef != ModuleCache.end())
+ return cast<llvm::DIModule>(ModRef->second);
// Macro definitions that were defined with "-D" on the command line.
SmallString<128> ConfigMacros;
@@ -1724,7 +1724,7 @@ CGDebugInfo::getOrCreateModuleRef(ExternalASTSource::ASTSourceDescriptor Mod,
llvm::DIModule *DIMod =
DBuilder.createModule(Parent, Mod.getModuleName(), ConfigMacros,
Mod.getPath(), CGM.getHeaderSearchOpts().Sysroot);
- ModRef.reset(DIMod);
+ ModuleCache[M].reset(DIMod);
return DIMod;
}
OpenPOWER on IntegriCloud