amccarth updated this revision to Diff 262499. amccarth added a comment. Updated an existing test. Thanks for the pointer; I had gotten myself completely confused about the organization of the test directories.
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,15 @@ // 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 -fms-compatibility | \ +// RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \ +// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=MSCOMPAT void freefunc() { } // CHECK-DAG: "freefunc" @@ -96,3 +100,7 @@ ClassTemplate<char, short, ClassTemplate<int, int, int> > f; // This will only show up in normal debug builds. // UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >" + +// Without -std=c++98, the nested template ends with ">>" instead of "> >". +// We need to ensure -fms-compatibility keeps the space. +// MSCOMPAT-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;
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,15 @@ // 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 -fms-compatibility | \ +// RUN: grep -E 'DISubprogram|DICompositeType' | sed -e 's/.*name: "\([^"]*\)".*/"\1"/' | \ +// RUN: FileCheck %s --check-prefix=CHECK --check-prefix=MSCOMPAT void freefunc() { } // CHECK-DAG: "freefunc" @@ -96,3 +100,7 @@ ClassTemplate<char, short, ClassTemplate<int, int, int> > f; // This will only show up in normal debug builds. // UNQUAL-DAG: "ClassTemplate<char,short,ClassTemplate<int,int,int> >" + +// Without -std=c++98, the nested template ends with ">>" instead of "> >". +// We need to ensure -fms-compatibility keeps the space. +// MSCOMPAT-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;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits