================
@@ -4175,6 +4175,19 @@ llvm::Constant 
*CodeGenFunction::EmitCheckSourceLocation(SourceLocation Loc) {
   if (PLoc.isValid()) {
     StringRef FilenameString = PLoc.getFilename();
 
+    // If a sanitize compilation dir is set, make absolute paths relative to 
it.
+    llvm::SmallString<256> FileBuf(FilenameString);
+    if (!CGM.getCodeGenOpts().SanitizeCompilationDir.empty() &&
+        llvm::sys::path::is_absolute(FilenameString)) {
----------------
vitalybuka wrote:

Normalize dot components on the file path before prefix matching so out-of-tree 
paths with parent segments still match.
```suggestion
    llvm::SmallString<256> FileBuf;
    if (!CGM.getCodeGenOpts().SanitizeCompilationDir.empty() &&
        llvm::sys::path::is_absolute(FilenameString)) {
      FileBuf = FilenameString;
      llvm::sys::path::remove_dots(FileBuf, /*remove_dot_dot=*/true);
```

https://github.com/llvm/llvm-project/pull/201803
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to