[PATCH] D79274: Fix template class debug info for Visual Studio visualizers

Adrian McCarthy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 1 17:18:15 PDT 2020


amccarth created this revision.
amccarth added reviewers: rnk, hans.
Herald added a subscriber: aprantl.

An earlier change eliminated spaces between the close brackets of nested
template lists.  Unfortunately that prevents the Windows debuggers from
matching some types to their corresponding visualizers (e.g., std::map).

This selects the SeparateTemplateClosers flag when generating COFF debug
info.  Note that we were already making formatting adjustments under
similar circumstances for similar reasons.

This solves the immediate problem, but there aren't many tests for COFF
debug info (that I can see).  I will be looking into integrated tests with
Dexter next.


https://reviews.llvm.org/D79274

Files:
  clang/lib/CodeGen/CGDebugInfo.cpp


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.261567.patch
Type: text/x-patch
Size: 845 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200502/3096e1f4/attachment-0001.bin>


More information about the cfe-commits mailing list