summaryrefslogtreecommitdiffstats
path: root/clang/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
commite003dd172101030fbfb81d45b323b60441cc5fd5 (patch)
treefa88df2a9df1d16a68d8e79056c4d4b2eaf2fc97 /clang/lib/CodeGen/CGDebugInfo.cpp
parent0827e040e0071bdc59b26d6a8936459e1304f682 (diff)
downloadbcm5719-llvm-e003dd172101030fbfb81d45b323b60441cc5fd5.tar.gz
bcm5719-llvm-e003dd172101030fbfb81d45b323b60441cc5fd5.zip
Cache new compile unit.
llvm-svn: 95952
Diffstat (limited to 'clang/lib/CodeGen/CGDebugInfo.cpp')
-rw-r--r--clang/lib/CodeGen/CGDebugInfo.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp
index 620ecc81629..e5162ed7f15 100644
--- a/clang/lib/CodeGen/CGDebugInfo.cpp
+++ b/clang/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
OpenPOWER on IntegriCloud