]> granicus.if.org Git - clang/commitdiff
[CodeGen][DebugInfo] Refactor duplicated code, NFC
authorScott Linder <scott@scottlinder.com>
Mon, 26 Feb 2018 16:31:08 +0000 (16:31 +0000)
committerScott Linder <scott@scottlinder.com>
Mon, 26 Feb 2018 16:31:08 +0000 (16:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326099 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp

index bed531eac33c5e112efedfb1a9390bd24720e779..3dab8c388438c6888c12f402527dc9c124642386 100644 (file)
@@ -388,18 +388,14 @@ CGDebugInfo::computeChecksum(FileID FID, SmallString<32> &Checksum) const {
 llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
   if (!Loc.isValid())
     // If Location is not valid then use main input file.
-    return DBuilder.createFile(remapDIPath(TheCU->getFilename()),
-                               remapDIPath(TheCU->getDirectory()),
-                               TheCU->getFile()->getChecksum());
+    return getOrCreateMainFile();
 
   SourceManager &SM = CGM.getContext().getSourceManager();
   PresumedLoc PLoc = SM.getPresumedLoc(Loc);
 
   if (PLoc.isInvalid() || StringRef(PLoc.getFilename()).empty())
     // If the location is not valid then use main input file.
-    return DBuilder.createFile(remapDIPath(TheCU->getFilename()),
-                               remapDIPath(TheCU->getDirectory()),
-                               TheCU->getFile()->getChecksum());
+    return getOrCreateMainFile();
 
   // Cache the results.
   const char *fname = PLoc.getFilename();