================
@@ -98,3 +98,6 @@ enum E8 { A8 = -128, B8 = 127 } x8;
 // CHECK-NOT: DIFlagEnumClass
 // CHECK: !DIEnumerator(name: "A8", value: -128)
 
+// Forward declaration of an enum class.
+enum class Color : int;
+// CHECK-NOT: !DICompositeType(tag: DW_TAG_enumeration_type, name: "Color"
----------------
tahonermann wrote:

I spent some time experimenting and debugging today but have not been able to 
find a way for `CGDebugInfo::CreateTypeDefinition(const EnumType *)` to be 
invoked without an available definition. I tried various uses of non-standard 
enumeration forward declarations, but non-suppressible errors were issued for 
every case I tried that I thought might lead to generation of a debug info type.

The most interesting scenario I played with involved use of the enumeration 
type within its own definition. In that context, the type is incomplete, but a 
definition is (being made) available. I wouldn't expect generation of debug 
info to ever be sensitive to such a context though. I know little about how 
debug information is generated, but seeing as the function under discussion is 
part of code generation, I wouldn't expect a not-yet-completed definition to 
ever be observed.

I think adding an assert as proposed in 
https://github.com/llvm/llvm-project/pull/105556 suffices to address the static 
analysis concern.

https://github.com/llvm/llvm-project/pull/97105
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to