forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lldb/DWARF] Unique enums parsed from declarations
This is a regression from llvm#96484 caught by @ZequanWu. Note that we will still create separate enum types for types parsed from two definitions. This is different from how we handle classes, but it is not a regression. I'm also adding the DieToType check to the class type parsing code, although in this case, the type uniqueness should be enforced by the UniqueDWARFASTType map.
- Loading branch information
Showing
2 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
lldb/test/Shell/SymbolFile/DWARF/enum-declaration-uniqueness.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// RUN: %clangxx_host -gdwarf -c -o %t_a.o %s -DFILE_A | ||
// RUN: %clangxx_host -gdwarf -c -o %t_b.o %s -DFILE_B | ||
// RUN: %clangxx_host -o %t %t_a.o %t_b.o | ||
// RUN: %lldb %t \ | ||
// RUN: -o "target variable my_enum my_enum_ref" -o "image dump ast" \ | ||
// RUN: -o exit | FileCheck %s | ||
|
||
|
||
// CHECK: (lldb) target variable | ||
// CHECK: (MyEnum) my_enum = MyEnum_A | ||
// CHECK: (MyEnum &) my_enum_ref = | ||
// CHECK-SAME: &::my_enum_ref = MyEnum_A | ||
|
||
// CHECK: (lldb) image dump ast | ||
// CHECK: EnumDecl {{.*}} MyEnum | ||
// CHECK-NEXT: EnumConstantDecl {{.*}} MyEnum_A 'MyEnum' | ||
// CHECK-NOT: MyEnum | ||
|
||
enum MyEnum : int; | ||
|
||
extern MyEnum my_enum; | ||
|
||
#ifdef FILE_A | ||
enum MyEnum : int { MyEnum_A }; | ||
|
||
MyEnum my_enum = MyEnum_A; | ||
|
||
int main() {} | ||
#endif | ||
#ifdef FILE_B | ||
MyEnum &my_enum_ref = my_enum; | ||
#endif |