[clang] a1be47b - [CodeView][DebugInfo] Add test case to show that linkage names are not

Amy Huang via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 15 12:29:51 PST 2021


Author: Amy Huang
Date: 2021-01-15T12:05:33-08:00
New Revision: a1be47b4771467998d7549dcd1b9f9cebdaa9af9

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

LOG: [CodeView][DebugInfo] Add test case to show that linkage names are not
being added to class types in -gline-tables-only.
Also changed the name of the test file for clarity.
(follow up to D94639)

Added: 
    clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp

Modified: 
    

Removed: 
    clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp


################################################################################
diff  --git a/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp b/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
deleted file mode 100644
index f096e334a158..000000000000
--- a/clang/test/CodeGenCXX/debug-info-codeview-scopes.cpp
+++ /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
index 000000000000..25f801737f74
--- /dev/null
+++ b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp
@@ -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();
+}


        


More information about the cfe-commits mailing list