[Lldb-commits] [lldb] 6be3cc5 - [LLDB][NativePDB] Fix name access for classes in `CVTagRecord::name` (#151190)

via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 30 09:12:01 PDT 2025


Author: nerix
Date: 2025-07-30T09:11:57-07:00
New Revision: 6be3cc5ad5ee0d33264bc202005e93c667b67698

URL: https://github.com/llvm/llvm-project/commit/6be3cc5ad5ee0d33264bc202005e93c667b67698
DIFF: https://github.com/llvm/llvm-project/commit/6be3cc5ad5ee0d33264bc202005e93c667b67698.diff

LOG: [LLDB][NativePDB] Fix name access for classes in `CVTagRecord::name` (#151190)

From
https://github.com/llvm/llvm-project/pull/149876#discussion_r2240478480:
The `name()` accessor checked for `m_kind == Union` and accessed
`cvclass` instead of `cvunion`. This is technically wrong (maybe UB
even?).
In practice, this wasn't an issue, because all types in the union
(`ClassRecord`/`EnumRecord`/`UnionRecord`) inherit from `TagRecord`.

Added: 
    

Modified: 
    lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
index 1f888f4de1fed..98b965c361a77 100644
--- a/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
+++ b/lldb/source/Plugins/SymbolFile/NativePDB/PdbUtil.h
@@ -65,7 +65,7 @@ struct CVTagRecord {
   }
 
   llvm::StringRef name() const {
-    if (m_kind == Struct || m_kind == Union)
+    if (m_kind == Struct || m_kind == Class)
       return cvclass.Name;
     if (m_kind == Enum)
       return cvenum.Name;


        


More information about the lldb-commits mailing list