Skip to content

Commit 581f8bc

Browse files
mjklemmMeinersbur
andauthored
[clang][OpenMP] Fix bug #62099 - use hash value when inode ID cannot be determined (#131646)
When creating the name of an outlined region, Clang uses the file's inode ID to generate a unique name. When the file does not exist, this causes a fatal abort of the compiler. This PR switches to a has value that is used instead. --------- Co-authored-by: Michael Kruse <[email protected]>
1 parent 2b7daaf commit 581f8bc

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9539,14 +9539,16 @@ OpenMPIRBuilder::getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
95399539
StringRef ParentName) {
95409540
sys::fs::UniqueID ID;
95419541
auto FileIDInfo = CallBack();
9542-
if (auto EC = sys::fs::getUniqueID(std::get<0>(FileIDInfo), ID)) {
9543-
report_fatal_error(("Unable to get unique ID for file, during "
9544-
"getTargetEntryUniqueInfo, error message: " +
9545-
EC.message())
9546-
.c_str());
9547-
}
9542+
uint64_t FileID = 0;
9543+
std::error_code EC = sys::fs::getUniqueID(std::get<0>(FileIDInfo), ID);
9544+
// If the inode ID could not be determined, create a hash value
9545+
// the current file name and use that as an ID.
9546+
if (EC)
9547+
FileID = hash_value(std::get<0>(FileIDInfo));
9548+
else
9549+
FileID = ID.getFile();
95489550

9549-
return TargetRegionEntryInfo(ParentName, ID.getDevice(), ID.getFile(),
9551+
return TargetRegionEntryInfo(ParentName, ID.getDevice(), FileID,
95509552
std::get<1>(FileIDInfo));
95519553
}
95529554

0 commit comments

Comments
 (0)