From: Scott Linder Date: Mon, 26 Feb 2018 16:31:08 +0000 (+0000) Subject: [CodeGen][DebugInfo] Refactor duplicated code, NFC X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cf3546e69e119b4ceb8b7f599f341e12a32979d3;p=clang [CodeGen][DebugInfo] Refactor duplicated code, NFC git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@326099 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index bed531eac3..3dab8c3884 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -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();