forked from OSchip/llvm-project
[CodeGen][DebugInfo] Refactor duplicated code, NFC
llvm-svn: 326099
This commit is contained in:
parent
31a90468e1
commit
39ceac1ceb
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue