[PATCH] D62974: Add cdb test for global constants

Amy Huang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 12:35:44 PDT 2019


akhuang created this revision.
akhuang added a reviewer: rnk.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This creates an integration test for global constants


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D62974

Files:
  debuginfo-tests/win_cdb/global-constant.cpp


Index: debuginfo-tests/win_cdb/global-constant.cpp
===================================================================
--- /dev/null
+++ debuginfo-tests/win_cdb/global-constant.cpp
@@ -0,0 +1,32 @@
+// RUN: %clang_cl %s -o %t.exe -fuse-ld=lld -Z7
+// RUN: grep DE[B]UGGER: %s | sed -e 's/.*DE[B]UGGER: //' > %t.script
+// RUN: %cdb -cf %t.script %t.exe | FileCheck %s --check-prefixes=DEBUGGER,CHECK
+
+// Check that global constants have debug info.
+
+const float TestPi = 3.14;
+struct S {
+  static const char TestCharA = 'a';
+};
+enum TestEnum : int {
+  ENUM_POS = 2147000000,
+  ENUM_NEG = -2147000000,
+};
+void useConst(int) {}
+int main() {
+  useConst(TestPi);
+  useConst(S::TestCharA);
+  useConst(ENUM_NEG);
+  // DEBUGGER: g
+  // DEBUGGER: ?? TestPi
+  // CHECK: float 3.140000105
+  // DEBUGGER: ?? S::TestCharA
+  // CHECK: char 0n97 'a'
+  // DEBUGGER: ?? ENUM_NEG
+  // CHECK: TestEnum ENUM_NEG (0n-2147000000)
+  // DEBUGGER: ?? ENUM_POS
+  // CHECK: Couldn't resolve error at 'ENUM_POS'
+  // DEBUGGER: q
+  __debugbreak();
+  return 0;
+}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D62974.203419.patch
Type: text/x-patch
Size: 1063 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190606/460eedc4/attachment.bin>


More information about the llvm-commits mailing list