[clang] Remove redundant assertion & fix ClearStatName error (PR #130667)

Ayush Pareek via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 12 02:11:57 PDT 2025


================
@@ -126,7 +126,8 @@ class CachedFileSystemEntry {
 
 private:
   void clearStatName() {
-    if (MaybeStat)
+      
+    if (MaybeStat && MaybeStat->getName().empty())   //If MaybeStat is an error, calling copyWithNewName() can cause undefined behavior
----------------
ayushpareek2003 wrote:

I initially thought it would be good to explicitly set the name to an empty string to ensure consistency across versions. However, since the condition is only updating the name, this extra check is unnecessary

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


More information about the cfe-commits mailing list