[llvm] [openmp] [Offload][OpenMP] remove SourceInfo::removePath (PR #226283)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 24 12:49:57 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-offload
Author: Jason Van Beusekom (Jason-Van-Beusekom)
<details>
<summary>Changes</summary>
Following discussion on https://discourse.llvm.org/t/rfc-add-opt-in-option-for-full-source-paths-in-offload-info-output/91901 this commit removes SourceInfo::removePath which changes LIBOMPTARGET_INFO to provide a non truncated source path:
``` c
#include <stdio.h>
#define N 4
int main(void) {
int a[N];
for (int i = 0; i < N; ++i)
a[i] = 0;
#pragma omp target map(tofrom : a[0 : N])
{
a[0] = 1;
}
printf("%d\n", a[0]); /* expect 1 */
return 0;
}
```
``` bash
clang -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -g ./test/test.c
# new
LIBOMPTARGET_INFO=-1 ./a.out
omptarget device 0 info: Entering OpenMP kernel at ./test/test.c:9:1 with 1 arguments:
# old
LIBOMPTARGET_INFO=-1 ./a.out
omptarget device 0 info: Entering OpenMP kernel at test.c:9:1 with 1 arguments:
```
---
Full diff: https://github.com/llvm/llvm-project/pull/226283.diff
2 Files Affected:
- (modified) offload/include/Shared/SourceInfo.h (+2-8)
- (modified) openmp/docs/ReleaseNotes.md (+3)
``````````diff
diff --git a/offload/include/Shared/SourceInfo.h b/offload/include/Shared/SourceInfo.h
index 63488ff0e8cac..4f77448f6ed63 100644
--- a/offload/include/Shared/SourceInfo.h
+++ b/offload/include/Shared/SourceInfo.h
@@ -75,21 +75,15 @@ class SourceInfo {
return SourceStr.substr(Begin + 1, End - Begin - 1);
};
- /// Get the filename from a full path.
- std::string removePath(const std::string &Path) const {
- std::size_t Pos = (OSWindows) ? Path.rfind('\\') : Path.rfind('/');
- return Path.substr(Pos + 1);
- };
-
public:
SourceInfo(const ident_t *Loc)
: SourceStr(initStr(Loc)), Name(getSubstring(1)),
- Filename(removePath(getSubstring(0))), Line(std::stoi(getSubstring(2))),
+ Filename(getSubstring(0)), Line(std::stoi(getSubstring(2))),
Column(std::stoi(getSubstring(3))) {}
SourceInfo(const map_var_info_t Name)
: SourceStr(initStr(Name)), Name(getSubstring(0)),
- Filename(removePath(getSubstring(1))), Line(std::stoi(getSubstring(2))),
+ Filename(getSubstring(1)), Line(std::stoi(getSubstring(2))),
Column(std::stoi(getSubstring(3))) {}
const char *getName() const { return Name.c_str(); }
diff --git a/openmp/docs/ReleaseNotes.md b/openmp/docs/ReleaseNotes.md
index ba597999938ac..ada8321ed256c 100644
--- a/openmp/docs/ReleaseNotes.md
+++ b/openmp/docs/ReleaseNotes.md
@@ -18,6 +18,9 @@ from the [LLVM releases web site](https://llvm.org/releases/).
- Removed the standalone build mode. It is redundant with the runtimes default
build.
+- `LIBOMPTARGET_INFO` and offloading error messages now report the full path to
+ the source file instead of only the base filename
+
### Device Runtime
- Changed the OpenMP DeviceRTL to use 'generic' IR. The
``````````
</details>
https://github.com/llvm/llvm-project/pull/226283
More information about the llvm-commits
mailing list