<div dir="ltr"><div dir="ltr">On Thu, 28 Jan 2021 at 16:41, Amy Huang via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Author: Amy Huang<br>
Date: 2021-01-28T16:41:26-08:00<br>
New Revision: 9b21d4b9434d2d4796b0d60d64f6ded9bac95441<br>
<br>
URL: <a href="https://github.com/llvm/llvm-project/commit/9b21d4b9434d2d4796b0d60d64f6ded9bac95441" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/9b21d4b9434d2d4796b0d60d64f6ded9bac95441</a><br>
DIFF: <a href="https://github.com/llvm/llvm-project/commit/9b21d4b9434d2d4796b0d60d64f6ded9bac95441.diff" rel="noreferrer" target="_blank">https://github.com/llvm/llvm-project/commit/9b21d4b9434d2d4796b0d60d64f6ded9bac95441.diff</a><br>
<br>
LOG: Revert "[DebugInfo][CodeView] Use <lambda_n> as the display name for lambdas."<br>
for test failures.<br>
<br>
This reverts commit d73564c510036b2d4f5858effdcd23fe54fc1063.<br></blockquote><div><br></div><div>Please include a reason for the revert in the commit message in future reverts -- this helps people looking back over the history to understand what happened and why. Thanks!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Added: <br>
<br>
<br>
Modified: <br>
clang/include/clang/AST/Mangle.h<br>
clang/lib/AST/ItaniumMangle.cpp<br>
clang/lib/AST/MicrosoftMangle.cpp<br>
clang/lib/CodeGen/CGDebugInfo.cpp<br>
clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp<br>
clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp<br>
<br>
Removed: <br>
<br>
<br>
<br>
################################################################################<br>
diff --git a/clang/include/clang/AST/Mangle.h b/clang/include/clang/AST/Mangle.h<br>
index f8f44853567f..0e8d6dd53d8a 100644<br>
--- a/clang/include/clang/AST/Mangle.h<br>
+++ b/clang/include/clang/AST/Mangle.h<br>
@@ -89,17 +89,6 @@ class MangleContext {<br>
return Result.first->second;<br>
}<br>
<br>
- uint64_t getAnonymousStructIdForDebugInfo(const NamedDecl *D) {<br>
- llvm::DenseMap<const NamedDecl *, uint64_t>::iterator Result =<br>
- AnonStructIds.find(D);<br>
- // The decl should already be inserted, but return 0 in case it is not.<br>
- if (Result == AnonStructIds.end())<br>
- return 0;<br>
- return Result->second;<br>
- }<br>
-<br>
- virtual StringRef getLambdaString(const CXXRecordDecl *Lambda) = 0;<br>
-<br>
/// @name Mangler Entry Points<br>
/// @{<br>
<br>
<br>
diff --git a/clang/lib/AST/ItaniumMangle.cpp b/clang/lib/AST/ItaniumMangle.cpp<br>
index 265c2172801c..4420f6a2c1c3 100644<br>
--- a/clang/lib/AST/ItaniumMangle.cpp<br>
+++ b/clang/lib/AST/ItaniumMangle.cpp<br>
@@ -203,36 +203,6 @@ class ItaniumMangleContextImpl : public ItaniumMangleContext {<br>
disc = discriminator-2;<br>
return true;<br>
}<br>
-<br>
- StringRef getLambdaString(const CXXRecordDecl *Lambda) override {<br>
- // This function matches the one in MicrosoftMangle, which returns<br>
- // the string that is used in lambda mangled names.<br>
- assert(Lambda->isLambda() && "RD must be a lambda!");<br>
- llvm::SmallString<10> Name("<lambda");<br>
- Decl *LambdaContextDecl = Lambda->getLambdaContextDecl();<br>
- unsigned LambdaManglingNumber = Lambda->getLambdaManglingNumber();<br>
- unsigned LambdaId;<br>
- const ParmVarDecl *Parm = dyn_cast_or_null<ParmVarDecl>(LambdaContextDecl);<br>
- const FunctionDecl *Func =<br>
- Parm ? dyn_cast<FunctionDecl>(Parm->getDeclContext()) : nullptr;<br>
-<br>
- if (Func) {<br>
- unsigned DefaultArgNo =<br>
- Func->getNumParams() - Parm->getFunctionScopeIndex();<br>
- Name += llvm::utostr(DefaultArgNo);<br>
- Name += "_";<br>
- }<br>
-<br>
- if (LambdaManglingNumber)<br>
- LambdaId = LambdaManglingNumber;<br>
- else<br>
- LambdaId = getAnonymousStructIdForDebugInfo(Lambda);<br>
-<br>
- Name += llvm::utostr(LambdaId);<br>
- Name += '>';<br>
- return StringRef(Name);<br>
- }<br>
-<br>
/// @}<br>
};<br>
<br>
<br>
diff --git a/clang/lib/AST/MicrosoftMangle.cpp b/clang/lib/AST/MicrosoftMangle.cpp<br>
index aaaba62a0fd4..9eac3586c871 100644<br>
--- a/clang/lib/AST/MicrosoftMangle.cpp<br>
+++ b/clang/lib/AST/MicrosoftMangle.cpp<br>
@@ -228,34 +228,6 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {<br>
return true;<br>
}<br>
<br>
- StringRef getLambdaString(const CXXRecordDecl *Lambda) override {<br>
- assert(Lambda->isLambda() && "RD must be a lambda!");<br>
- llvm::SmallString<10> Name("<lambda_");<br>
-<br>
- Decl *LambdaContextDecl = Lambda->getLambdaContextDecl();<br>
- unsigned LambdaManglingNumber = Lambda->getLambdaManglingNumber();<br>
- unsigned LambdaId;<br>
- const ParmVarDecl *Parm = dyn_cast_or_null<ParmVarDecl>(LambdaContextDecl);<br>
- const FunctionDecl *Func =<br>
- Parm ? dyn_cast<FunctionDecl>(Parm->getDeclContext()) : nullptr;<br>
-<br>
- if (Func) {<br>
- unsigned DefaultArgNo =<br>
- Func->getNumParams() - Parm->getFunctionScopeIndex();<br>
- Name += llvm::utostr(DefaultArgNo);<br>
- Name += "_";<br>
- }<br>
-<br>
- if (LambdaManglingNumber)<br>
- LambdaId = LambdaManglingNumber;<br>
- else<br>
- LambdaId = getLambdaIdForDebugInfo(Lambda);<br>
-<br>
- Name += llvm::utostr(LambdaId);<br>
- Name += ">";<br>
- return StringRef(Name);<br>
- }<br>
-<br>
unsigned getLambdaId(const CXXRecordDecl *RD) {<br>
assert(RD->isLambda() && "RD must be a lambda!");<br>
assert(!RD->isExternallyVisible() && "RD must not be visible!");<br>
@@ -266,19 +238,6 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {<br>
return Result.first->second;<br>
}<br>
<br>
- unsigned getLambdaIdForDebugInfo(const CXXRecordDecl *RD) {<br>
- assert(RD->isLambda() && "RD must be a lambda!");<br>
- assert(!RD->isExternallyVisible() && "RD must not be visible!");<br>
- assert(RD->getLambdaManglingNumber() == 0 &&<br>
- "RD must not have a mangling number!");<br>
- llvm::DenseMap<const CXXRecordDecl *, unsigned>::iterator Result =<br>
- LambdaIds.find(RD);<br>
- // The lambda should exist, but return 0 in case it doesn't.<br>
- if (Result == LambdaIds.end())<br>
- return 0;<br>
- return Result->second;<br>
- }<br>
-<br>
/// Return a character sequence that is (somewhat) unique to the TU suitable<br>
/// for mangling anonymous namespaces.<br>
StringRef getAnonymousNamespaceHash() const {<br>
<br>
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp<br>
index fb1d465fca4e..99944afaad14 100644<br>
--- a/clang/lib/CodeGen/CGDebugInfo.cpp<br>
+++ b/clang/lib/CodeGen/CGDebugInfo.cpp<br>
@@ -317,9 +317,8 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) {<br>
if (const IdentifierInfo *II = RD->getIdentifier())<br>
return II->getName();<br>
<br>
- // The CodeView printer in LLVM wants to see the names of unnamed types<br>
- // because they need to have a unique identifier.<br>
- // These names are used to reconstruct the fully qualified type names.<br>
+ // The CodeView printer in LLVM wants to see the names of unnamed types: it is<br>
+ // used to reconstruct the fully qualified type names.<br>
if (CGM.getCodeGenOpts().EmitCodeView) {<br>
if (const TypedefNameDecl *D = RD->getTypedefNameForAnonDecl()) {<br>
assert(RD->getDeclContext() == D->getDeclContext() &&<br>
@@ -343,14 +342,6 @@ StringRef CGDebugInfo::getClassName(const RecordDecl *RD) {<br>
// associate typedef mangled in if they have one.<br>
Name = TND->getName();<br>
<br>
- // Give lambdas a display name based on their name mangling.<br>
- if (const CXXRecordDecl *CXXRD = dyn_cast<CXXRecordDecl>(RD))<br>
- if (CXXRD->isLambda()) {<br>
- StringRef LambdaName =<br>
- CGM.getCXXABI().getMangleContext().getLambdaString(CXXRD);<br>
- return internString(LambdaName);<br>
- }<br>
-<br>
if (!Name.empty()) {<br>
SmallString<256> UnnamedType("<unnamed-type-");<br>
UnnamedType += Name;<br>
<br>
diff --git a/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp b/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp<br>
index b4c79936ab33..dd4cc9cb4787 100644<br>
--- a/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp<br>
+++ b/clang/test/CodeGenCXX/debug-info-codeview-unnamed.cpp<br>
@@ -100,7 +100,7 @@ int main(int argc, char* argv[], char* arge[]) {<br>
// MSVC-SAME: )<br>
// MSVC: [[TYPE_OF_FOUR]] = distinct !DICompositeType<br>
// MSVC-SAME: tag: DW_TAG_class_type<br>
- // MSVC-SAME: name: "<lambda_0>"<br>
+ // MSVC-NOT: name:<br>
// MSVC-SAME: identifier: ".?AV<lambda_0>@?0??main@@9@"<br>
// MSVC-SAME: )<br>
<br>
<br>
diff --git a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp<br>
index e3ca6bf8a187..409b62da62c1 100644<br>
--- a/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp<br>
+++ b/clang/test/CodeGenCXX/debug-info-gline-tables-only-codeview.cpp<br>
@@ -1,26 +1,17 @@<br>
-// RUN: %clang_cc1 %s -gcodeview -debug-info-kind=line-tables-only -emit-llvm \<br>
-// RUN: -o - | FileCheck %s<br>
+// RUN: %clang_cc1 %s -gcodeview -debug-info-kind=line-tables-only -S \<br>
+// RUN: -emit-llvm -o - | FileCheck %s<br>
// Checks that clang with "-gline-tables-only" with CodeView emits some debug<br>
// info for variables and types when they appear in function scopes.<br>
<br>
namespace NS {<br>
struct C {<br>
void m() {}<br>
- // Test externally visible lambda.<br>
- void lambda2() { []() {}(); }<br>
- <br>
- // Test naming for function parameters.<br>
- void lambda_params(int x = [](){ return 0; }(), int y = [](){ return 1; }()) {}<br>
};<br>
void f() {}<br>
}<br>
<br>
-// Test non- externally visible lambda.<br>
-auto lambda1 = []() { return 1; };<br>
-<br>
NS::C c;<br>
<br>
-<br>
void test() {<br>
// CHECK: !DISubprogram(name: "f", scope: ![[NS:[0-9]+]],<br>
// CHECK-SAME: type: ![[F:[0-9]+]]<br>
@@ -30,30 +21,10 @@ void test() {<br>
NS::f();<br>
<br>
// CHECK: ![[M:[0-9]+]] = distinct !DISubprogram(name: "m", scope: ![[C:[0-9]+]],<br>
- // CHECK-SAME: type: ![[MTYPE:[0-9]+]],<br>
+ // CHECK-SAME: type: ![[MTYPE:[0-9]+]]<br>
// CHECK: ![[C]] = !DICompositeType(tag: DW_TAG_structure_type, name: "C",<br>
// CHECK-SAME: flags: DIFlagFwdDecl<br>
// CHECK-NOT: identifier<br>
// CHECK: ![[MTYPE]] = !DISubroutineType({{.*}}types: !{{.*}})<br>
c.m();<br>
-<br>
- // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA0:[0-9]+]],<br>
- // CHECK: ![[LAMBDA0]] = !DICompositeType(tag: DW_TAG_class_type,<br>
- // CHECK-SAME: name: "<lambda_0>",<br>
- // CHECK-SAME: flags: DIFlagFwdDecl<br>
- lambda1();<br>
-<br>
- // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA1_1:[0-9]+]],<br>
- // CHECK: ![[LAMBDA1_1]] = !DICompositeType(tag: DW_TAG_class_type,<br>
- // CHECK-SAME: name: "<lambda_1_1>",<br>
- // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA2_1:[0-9]+]],<br>
- // CHECK: ![[LAMBDA2_1]] = !DICompositeType(tag: DW_TAG_class_type,<br>
- // CHECK-SAME: name: "<lambda_2_1>",<br>
- c.lambda_params();<br>
-<br>
- // CHECK: !DISubprogram(name: "operator()", scope: ![[LAMBDA1:[0-9]+]],<br>
- // CHECK: ![[LAMBDA1]] = !DICompositeType(tag: DW_TAG_class_type,<br>
- // CHECK-SAME: name: "<lambda_1>",<br>
- // CHECK-SAME: flags: DIFlagFwdDecl<br>
- c.lambda2();<br>
}<br>
<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@lists.llvm.org" target="_blank">cfe-commits@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br>
</blockquote></div></div>