Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions clang/lib/CodeGen/CodeGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8172,12 +8172,17 @@ void CodeGenModule::printPostfixForExternalizedDecl(llvm::raw_ostream &OS,

// Get the UniqueID for the file containing the decl.
llvm::sys::fs::UniqueID ID;
if (llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID)) {
auto Status = FS->status(PLoc.getFilename());
if (!Status) {
PLoc = SM.getPresumedLoc(D->getLocation(), /*UseLineDirectives=*/false);
assert(PLoc.isValid() && "Source location is expected to be valid.");
if (auto EC = llvm::sys::fs::getUniqueID(PLoc.getFilename(), ID))
SM.getDiagnostics().Report(diag::err_cannot_open_file)
<< PLoc.getFilename() << EC.message();
Status = FS->status(PLoc.getFilename());
}
if (!Status) {
SM.getDiagnostics().Report(diag::err_cannot_open_file)
<< PLoc.getFilename() << Status.getError().message();
} else {
ID = Status->getUniqueID();
}
OS << llvm::format("%x", ID.getFile()) << llvm::format("%x", ID.getDevice())
<< "_" << llvm::utohexstr(Result.low(), /*LowerCase=*/true, /*Width=*/8);
Expand Down