[clang] [Clang] Remap paths in OpenMP runtime calls (#82541) (PR #141250)

Dan McGregor via cfe-commits cfe-commits at lists.llvm.org
Fri May 23 12:08:37 PDT 2025


================
@@ -1370,10 +1375,14 @@ llvm::Value *CGOpenMPRuntime::emitUpdateLocation(CodeGenFunction &CGF,
     SrcLocStr = OMPBuilder.getOrCreateDefaultSrcLocStr(SrcLocStrSize);
   } else {
     std::string FunctionName;
+    std::string FileName;
     if (const auto *FD = dyn_cast_or_null<FunctionDecl>(CGF.CurFuncDecl))
       FunctionName = FD->getQualifiedNameAsString();
     PresumedLoc PLoc = CGF.getContext().getSourceManager().getPresumedLoc(Loc);
-    const char *FileName = PLoc.getFilename();
+    if (CGF.getDebugInfo())
----------------
dankm wrote:

I'm *fairly* sure that this check is redundant, because in this branch debug info should be available, but an extra null check seems safer than randomly crashing.

I considered replacing this with an assert and running it through clang's test suite, but my machine is rather slow :/

https://github.com/llvm/llvm-project/pull/141250


More information about the cfe-commits mailing list