]> granicus.if.org Git - clang/commitdiff
Cache new compile unit.
authorDevang Patel <dpatel@apple.com>
Fri, 12 Feb 2010 01:30:31 +0000 (01:30 +0000)
committerDevang Patel <dpatel@apple.com>
Fri, 12 Feb 2010 01:30:31 +0000 (01:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@95952 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index 620ecc81629612a8434fb1b88fcc6ea18729a295..e5162ed7f15f2267a563b19fe4e45d41a58ed592 100644 (file)
@@ -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