[CodeView][DebugInfo] Add test case to show that linkage names are not
authorAmy Huang <akhuang@google.com>
Fri, 15 Jan 2021 17:31:10 +0000 (09:31 -0800)
committerAmy Huang <akhuang@google.com>
Fri, 15 Jan 2021 20:05:33 +0000 (12:05 -0800)
being added to class types in -gline-tables-only.
Also changed the name of the test file for clarity.
(follow up to D94639)

clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp [deleted file]
clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp [new file with mode: 0644]

diff --git a/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp b/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
deleted file mode 100644 (file)
index f096e33..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -debug-info-kind=line-tables-only -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix LINUX %s
-// RUN: %clang_cc1 -triple x86_64-windows-msvc -debug-info-kind=line-tables-only -gcodeview -S -emit-llvm -std=c++11 -o - %s | FileCheck --check-prefix MSVC %s
-
-// Check that we emit type information for function scopes in line tables for
-// CodeView.
-
-namespace A {
-void f() {}
-
-struct S {
-  static void m() {}
-};
-}
-
-int main() {
-  A::f();
-  A::S::m();
-  return 0;
-  // MSVC:       !{{[0-9]+}} = distinct !DISubprogram(name: "f"
-  // MSVC-SAME:     scope: [[SCOPE1:![0-9]+]]
-  // MSVC-SAME:     )
-  // MSVC:       [[SCOPE1]] = !DINamespace(name: "A", {{.*}})
-  // MSVC:       !{{[0-9]+}} = distinct !DISubprogram(name: "m"
-  // MSVC-SAME:     scope: [[SCOPE2:![0-9]+]]
-  // MSVC-SAME:     )
-  // MSVC:       [[SCOPE2]] = !DICompositeType(tag: DW_TAG_structure_type,
-  // MSVC-SAME:     name: "S",
-  // MSVC-SAME:     scope: [[SCOPE1]]
-  // MSVC-SAME:     )
-
-  // LINUX-NOT: !DINamespace
-  // LINUX-NOT: !DICompositeType
-  return 0;
-}
diff --git a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp
new file mode 100644 (file)
index 0000000..25f8017
--- /dev/null
@@ -0,0 +1,30 @@
+// RUN: %clang_cc1 %s -gcodeview -debug-info-kind=line-tables-only -S \
+// RUN:   -emit-llvm -o - | FileCheck %s
+// Checks that clang with "-gline-tables-only" with CodeView emits some debug
+// info for variables and types when they appear in function scopes.
+
+namespace NS {
+struct C {
+public:
+  void m() {}
+};
+void f() {}
+}
+
+NS::C c;
+
+void test() {
+  // CHECK: ![[EMPTY:[0-9]+]] = !{}
+  // CHECK: !DISubprogram(name: "f", scope: ![[NS:[0-9]+]],
+  // CHECK-SAME:          type: ![[F:[0-9]+]]
+  // CHECK: ![[NS]] = !DINamespace(name: "NS", scope: null)
+  // CHECK: ![[F]] = !DISubroutineType(types: ![[EMPTY]])
+  NS::f();
+
+  // CHECK: !DISubprogram(name: "m", scope: ![[C:[0-9]+]],
+  // CHECK-SAME:          type: ![[F]]
+  // CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C",
+  // CHECK-SAME:                      flags: DIFlagFwdDecl
+  // CHECK-NOT: identifier
+  c.m();
+}