[PATCH] D79274: Fix template class debug info for Visual Studio visualizers
Adrian McCarthy via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed May 13 14:44:03 PDT 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGa549c0d00486: Fix template class debug info for Visual Studio visualizers (authored by amccarth).
Herald added a project: clang.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D79274/new/
https://reviews.llvm.org/D79274
Files:
clang/lib/CodeGen/CGDebugInfo.cpp
clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
Index: clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
===================================================================
--- clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
+++ clang/test/CodeGenCXX/debug-info-codeview-display-name.cpp
@@ -1,11 +1,19 @@
// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
-// RUN: -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
// RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
// RUN: %clang_cc1 -fblocks -debug-info-kind=line-tables-only -gcodeview -emit-llvm %s \
-// RUN: -o - -triple=x86_64-pc-win32 -std=c++98 | \
+// RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++98 | \
// RUN: grep 'DISubprogram' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=QUAL
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
+// RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null -std=c++11 | \
+// RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
+// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
+// RUN: %clang_cc1 -fblocks -debug-info-kind=limited -gcodeview -emit-llvm %s \
+// RUN: -o - -triple=x86_64-pc-win32 -Wno-new-returns-null | \
+// RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \
+// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=UNQUAL
void freefunc() { }
// CHECK-DAG: "freefunc"
@@ -94,5 +102,7 @@
template <typename A, typename B, typename C> struct ClassTemplate { A a; B b; C c; };
ClassTemplate<char, short, ClassTemplate<int, int, int> > f;
-// This will only show up in normal debug builds.
+// This will only show up in normal debug builds. The space in `> >` is
+// important for compatibility with Windows debuggers, so it should always be
+// there when generating CodeView.
// UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >"
Index: clang/lib/CodeGen/CGDebugInfo.cpp
===================================================================
--- clang/lib/CodeGen/CGDebugInfo.cpp
+++ clang/lib/CodeGen/CGDebugInfo.cpp
@@ -231,9 +231,12 @@
// If we're emitting codeview, it's important to try to match MSVC's naming so
// that visualizers written for MSVC will trigger for our class names. In
// particular, we can't have spaces between arguments of standard templates
- // like basic_string and vector.
- if (CGM.getCodeGenOpts().EmitCodeView)
+ // like basic_string and vector, but we must have spaces between consecutive
+ // angle brackets that close nested template argument lists.
+ if (CGM.getCodeGenOpts().EmitCodeView) {
PP.MSVCFormatting = true;
+ PP.SplitTemplateClosers = true;
+ }
// Apply -fdebug-prefix-map.
PP.Callbacks = &PrintCB;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79274.263863.patch
Type: text/x-patch
Size: 3054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200513/c8205a20/attachment-0001.bin>
More information about the cfe-commits
mailing list