aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGDebugInfo.cpp
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2010-02-12 01:30:31 +0000
committerDevang Patel <dpatel@apple.com>2010-02-12 01:30:31 +0000
commit4cb159ccc67a2b9814c412a47ca751995f8d3b64 (patch)
treec5af002156890c96143362e79e01a04fc1af4d34 /lib/CodeGen/CGDebugInfo.cpp
parent6492200c313937adf8c9dd206790933a228e3ef3 (diff)
Cache new compile unit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95952 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp
index 620ecc8162..e5162ed7f1 100644
--- a/lib/CodeGen/CGDebugInfo.cpp
+++ b/lib/CodeGen/CGDebugInfo.cpp
@@ -149,9 +149,16 @@ llvm::DICompileUnit CGDebugInfo::getOrCreateCompileUnit(SourceLocation Loc) {
RuntimeVers = LO.ObjCNonFragileABI ? 2 : 1;
// Create new compile unit.
- return DebugFactory.CreateCompileUnit(
+ llvm::DICompileUnit Unit = DebugFactory.CreateCompileUnit(
LangTag, AbsFileName.getLast(), AbsFileName.getDirname(), Producer, isMain,
LO.Optimize, CGM.getCodeGenOpts().DwarfDebugFlags, RuntimeVers);
+
+ if (Loc.isValid()) {
+ PresumedLoc PLoc = SM.getPresumedLoc(Loc);
+ unsigned FID = PLoc.getIncludeLoc().getRawEncoding();
+ CompileUnitCache[FID] = Unit;
+ }
+ return Unit;
}
/// CreateType - Get the Basic type from the cache or create a new