[llvm] 5fc1ed4 - [Clang][OpenMP][OMPIRBuilder] Fix getTargetEntryUniqueInfo to fatal error instead of assert when it cannot generate a unique ID

Andrew Gozillon via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 17:38:34 PDT 2023


Author: Andrew Gozillon
Date: 2023-06-07T19:28:00-05:00
New Revision: 5fc1ed471dc24691dbb40b7c3431732da2ef96cd

URL: https://github.com/llvm/llvm-project/commit/5fc1ed471dc24691dbb40b7c3431732da2ef96cd
DIFF: https://github.com/llvm/llvm-project/commit/5fc1ed471dc24691dbb40b7c3431732da2ef96cd.diff

LOG: [Clang][OpenMP][OMPIRBuilder] Fix getTargetEntryUniqueInfo to fatal error instead of assert when it cannot generate a unique ID

This prevents access of uninitialized ID components later, or continuing progress
further making errors harder to track down.

Hoepfully this will be the last in my long series of mistakes in recent
commits relating to this area of code!

Added: 
    

Modified: 
    llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
index a84b668e0e452..245f952906b7a 100644
--- a/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
+++ b/llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
@@ -5200,8 +5200,10 @@ OpenMPIRBuilder::getTargetEntryUniqueInfo(FileIdentifierInfoCallbackTy CallBack,
   sys::fs::UniqueID ID;
   auto FileIDInfo = CallBack();
   if (auto EC = sys::fs::getUniqueID(std::get<0>(FileIDInfo), ID)) {
-    assert(!EC &&
-           "Unable to get unique ID for file during getTargetEntryUniqueInfo");
+    report_fatal_error(("Unable to get unique ID for file, during "
+                        "getTargetEntryUniqueInfo, error message: " +
+                        EC.message())
+                           .c_str());
   }
 
   return TargetRegionEntryInfo(ParentName, ID.getDevice(), ID.getFile(),


        


More information about the llvm-commits mailing list