Skip to content

Commit e377bb8

Browse files
Slight refactoring of CGDebugInfo::getOrCreateFile.
It's a non-functional change.
1 parent 28e024f commit e377bb8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -565,20 +565,20 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
565565
FileID FID;
566566
std::optional<llvm::DIFile::ChecksumInfo<StringRef>> CSInfo;
567567

568+
llvm::DIFile *CUFile = TheCU->getFile();
568569
if (Loc.isInvalid()) {
569570
// The DIFile used by the CU is distinct from the main source file. Call
570571
// createFile() below for canonicalization if the source file was specified
571572
// with an absolute path.
572-
FileName = TheCU->getFile()->getFilename();
573-
CSInfo = TheCU->getFile()->getChecksum();
573+
FileName = CUFile->getFilename();
574+
CSInfo = CUFile->getChecksum();
575+
FID = SM.getFileID(Loc);
574576
} else {
575577
PresumedLoc PLoc = SM.getPresumedLoc(SM.getFileLoc(Loc));
576578
FileName = PLoc.getFilename();
577579

578580
if (FileName.empty()) {
579-
FileName = TheCU->getFile()->getFilename();
580-
} else {
581-
FileName = PLoc.getFilename();
581+
FileName = CUFile->getFilename();
582582
}
583583
FID = PLoc.getFileID();
584584
}
@@ -599,8 +599,7 @@ llvm::DIFile *CGDebugInfo::getOrCreateFile(SourceLocation Loc) {
599599
if (CSKind)
600600
CSInfo.emplace(*CSKind, Checksum);
601601
}
602-
return createFile(FileName, CSInfo,
603-
getSource(SM, SM.getFileID(SM.getFileLoc(Loc))));
602+
return createFile(FileName, CSInfo, getSource(SM, FID));
604603
}
605604

606605
llvm::DIFile *CGDebugInfo::createFile(

0 commit comments

Comments
 (0)