llvmorg-github-actions[bot] wrote:

<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Thurston Dang (thurstond)

<details>
<summary>Changes</summary>

As reported in 
https://github.com/llvm/llvm-project/pull/216307#issuecomment-5311023374, the 
new tests fail on UBSan buildbots (e.g., 
https://lab.llvm.org/buildbot/#/builders/25/builds/19323) because the directory 
may be empty (only the file is initialized), and the StringRef from 
getDirectory() is default-initialized.

This patch attempts to fix-forward by not hashing the output of getDirectory() 
if it is empty.

---
Full diff: https://github.com/llvm/llvm-project/pull/216625.diff


1 Files Affected:

- (modified) clang/lib/CodeGen/BackendUtil.cpp (+3-1) 


``````````diff
diff --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 75c3d16e455f1..e55d242cde68a 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1527,7 +1527,9 @@ static void createAndEmbedModuleForDynamicDebugging(
     // the same source file compiled twice won't generate unique hashes.
     Hash.update(CGOpts.CmdArgs);
     for (auto *CU : M->debug_compile_units()) {
-      Hash.update(CU->getDirectory());
+      if (CU->getDirectory().size() > 0)
+        Hash.update(CU->getDirectory());
+
       Hash.update(CU->getFilename());
     }
 

``````````

</details>


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

Reply via email to