[clang] [llvm] [Clang] Add `-fsanitize-prefix-map` for remapping source paths in sanitizer metadata (PR #186908)
Vitaly Buka via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 28 12:11:48 PST 2026
================
@@ -2866,8 +2873,19 @@ GlobalVariable *ModuleAddressSanitizer::getOrCreateModuleName() {
if (!ModuleName) {
// We shouldn't merge same module names, as this string serves as unique
// module ID in runtime.
+ std::string ModuleNameStr = M.getModuleIdentifier();
+
+ // Apply prefix map remapping.
+ SmallString<256> RemappedName(ModuleNameStr);
+ for (const auto &[Old, New] : PrefixMap) {
----------------
vitalybuka wrote:
```suggestion
for (const auto &[Old, New] : llvm::reverse(PrefixMap)) {
```
Iterate in reverse so the last matching prefix wins, consistent with -fdebug-prefix-map, -fcoverage-prefix-map, and -ffile-prefix-map.
https://github.com/llvm/llvm-project/pull/186908
More information about the cfe-commits
mailing list