================
@@ -0,0 +1,140 @@
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm 
-debug-info-kind=limited %s -o - | FileCheck %s --check-prefixes=CHECK
+// RUN: %clang_cc1 -triple x86_64-none-linux-gnu -emit-llvm 
-debug-info-kind=unused-types %s -o - | FileCheck %s 
--check-prefixes=UNUSED_TYPES
+
+// Test that debug info nodes for function-local types are emitted in their
+// lexical block scopes, including cases when types have forward declarations.
+
+void test() {
+#line 10
+  {
+    struct S { int a; };
+    class C { int b; };
+    S s;
+#line 20
+    {
+      C c;
+    }
+  }
+
+#line 30
+  {
+    typedef char Char;
+    using Int = int;
+    Char c;
+#line 40
+    {
+      Int i;
+    }
+  }
+
+#line 50
+  {
+    enum E { a, b, c };
+    enum class T { aa, bb, cc };
+    E e = E::a;
+#line 60
+    {
+      T t = T::aa;
+    }
+  }
+
+#line 70
+  {
+    union U { int i; char c; };
+    U u = { 256 };
+  }
+
+  // Opaque complete declaration.
+#line 80
+  {
+    enum OpaqueE : int;
+    OpaqueE opaqueE{};
+// With #include between forward declaration of the enum, and its definition,
+// this code block should be split into two DILexicalBlocks.
+#include "Inputs/noop.inc"
----------------
dzhidzhoev wrote:

I reworded the comment. I meant that the lexical block on top of CGDebugInfo's 
stack changes after include directive. I added a variable after `#include` and 
check lines for its scope, so that it is clear in the test.

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

Reply via email to