diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp --- a/clang/lib/AST/JSONNodeDumper.cpp +++ b/clang/lib/AST/JSONNodeDumper.cpp @@ -744,11 +744,18 @@ JOS.attribute("name", ND->getNameAsString()); // FIXME: There are likely other contexts in which it makes no sense to ask // for a mangled name. - if (!isa(ND->getDeclContext())) { - std::string MangledName = ASTNameGen.getName(ND); - if (!MangledName.empty()) - JOS.attribute("mangledName", MangledName); - } + if (isa(ND->getDeclContext())) + return; + + // Mangled names are not meaningful for locals, and may not be well-defined + // in the case of VLAs. + auto *VD = dyn_cast(ND); + if (VD && VD->hasLocalStorage()) + return; + + std::string MangledName = ASTNameGen.getName(ND); + if (!MangledName.empty()) + JOS.attribute("mangledName", MangledName); } } diff --git a/clang/test/AST/ast-dump-decl-json.c b/clang/test/AST/ast-dump-decl-json.c --- a/clang/test/AST/ast-dump-decl-json.c +++ b/clang/test/AST/ast-dump-decl-json.c @@ -1178,7 +1178,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1204,7 +1203,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "y", -// CHECK-NEXT: "mangledName": "y", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "enum (unnamed at {{.*}}:69:29)", // CHECK-NEXT: "qualType": "enum (unnamed enum at {{.*}}:69:29)" @@ -1352,7 +1350,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "enum Enum", // CHECK-NEXT: "qualType": "enum Enum" @@ -1523,7 +1520,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1888,7 +1884,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "TestParmVarDecl", -// CHECK-NEXT: "mangledName": "TestParmVarDecl", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-decl-json.m b/clang/test/AST/ast-dump-decl-json.m --- a/clang/test/AST/ast-dump-decl-json.m +++ b/clang/test/AST/ast-dump-decl-json.m @@ -344,7 +344,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -393,7 +392,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "self", -// CHECK-NEXT: "mangledName": "_self", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "testObjCMethodDecl *" // CHECK-NEXT: } @@ -408,7 +406,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "_cmd", -// CHECK-NEXT: "mangledName": "__cmd", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "SEL *", // CHECK-NEXT: "qualType": "SEL", @@ -437,7 +434,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -735,7 +731,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "self", -// CHECK-NEXT: "mangledName": "_self", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "TestObjCClass *" // CHECK-NEXT: } @@ -750,7 +745,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "_cmd", -// CHECK-NEXT: "mangledName": "__cmd", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "SEL *", // CHECK-NEXT: "qualType": "SEL", @@ -999,7 +993,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "self", -// CHECK-NEXT: "mangledName": "_self", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "TestObjCClass *" // CHECK-NEXT: } @@ -1014,7 +1007,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "_cmd", -// CHECK-NEXT: "mangledName": "__cmd", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "SEL *", // CHECK-NEXT: "qualType": "SEL", @@ -1258,7 +1250,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "foo", -// CHECK-NEXT: "mangledName": "_foo", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1343,7 +1334,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "bar", -// CHECK-NEXT: "mangledName": "_bar", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1593,7 +1583,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "foo", -// CHECK-NEXT: "mangledName": "_foo", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1679,7 +1668,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "bar", -// CHECK-NEXT: "mangledName": "_bar", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1741,7 +1729,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1854,7 +1841,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "y", -// CHECK-NEXT: "mangledName": "_y", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1960,7 +1946,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "y", -// CHECK-NEXT: "mangledName": "_y", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1999,7 +1984,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "Test", -// CHECK-NEXT: "mangledName": "_Test", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int", // CHECK-NEXT: "qualType": "typeof (B.foo)" diff --git a/clang/test/AST/ast-dump-expr-json.c b/clang/test/AST/ast-dump-expr-json.c --- a/clang/test/AST/ast-dump-expr-json.c +++ b/clang/test/AST/ast-dump-expr-json.c @@ -322,7 +322,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -582,7 +581,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1017,7 +1015,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -1044,7 +1041,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -3391,7 +3387,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -3418,7 +3413,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int *" // CHECK-NEXT: } @@ -4059,7 +4053,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int *" // CHECK-NEXT: } @@ -4086,7 +4079,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "b", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "struct S", // CHECK-NEXT: "qualType": "struct S" @@ -4114,7 +4106,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "c", -// CHECK-NEXT: "mangledName": "c", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "struct S *" // CHECK-NEXT: } @@ -4957,7 +4948,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-expr-json.cpp b/clang/test/AST/ast-dump-expr-json.cpp --- a/clang/test/AST/ast-dump-expr-json.cpp +++ b/clang/test/AST/ast-dump-expr-json.cpp @@ -324,7 +324,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "obj1", -// CHECK-NEXT: "mangledName": "_ZZ19TestPointerToMember1SPS_MS_iMS_FviEE4obj1", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "S" // CHECK-NEXT: } @@ -351,7 +350,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "obj2", -// CHECK-NEXT: "mangledName": "_ZZ19TestPointerToMember1SPS_MS_iMS_FviEE4obj2", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "S *" // CHECK-NEXT: } @@ -378,7 +376,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "data", -// CHECK-NEXT: "mangledName": "_ZZ19TestPointerToMember1SPS_MS_iMS_FviEE4data", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int S::*" // CHECK-NEXT: } @@ -405,7 +402,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "call", -// CHECK-NEXT: "mangledName": "_ZZ19TestPointerToMember1SPS_MS_iMS_FviEE4call", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "void (S::*)(int)" // CHECK-NEXT: } @@ -1072,7 +1068,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "s", -// CHECK-NEXT: "mangledName": "_ZZ11TestCastingPK1SE1s", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "const S *" // CHECK-NEXT: } @@ -1512,7 +1507,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "p", -// CHECK-NEXT: "mangledName": "_ZZ20TestUnaryExpressionsPiE1p", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int *" // CHECK-NEXT: } @@ -2539,7 +2533,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ22TestPostfixExpressions1SPS_P1UIiEE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "S" // CHECK-NEXT: } @@ -2566,7 +2559,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "p", -// CHECK-NEXT: "mangledName": "_ZZ22TestPostfixExpressions1SPS_P1UIiEE1p", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "S *" // CHECK-NEXT: } @@ -2593,7 +2585,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "r", -// CHECK-NEXT: "mangledName": "_ZZ22TestPostfixExpressions1SPS_P1UIiEE1r", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "U *" // CHECK-NEXT: } @@ -3669,7 +3660,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ22TestPrimaryExpressionsDpT_E1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "Ts..." // CHECK-NEXT: }, @@ -4369,7 +4359,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "_ZZ22TestPrimaryExpressionsDpT_E1b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -4396,7 +4385,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "c", -// CHECK-NEXT: "mangledName": "_ZZ22TestPrimaryExpressionsDpT_E1c", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -4735,7 +4723,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZZ22TestPrimaryExpressionsDpT_ENKUlizE_clEizE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -4836,7 +4823,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZZ22TestPrimaryExpressionsDpT_ENUlizE_8__invokeEizE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -7851,7 +7837,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_ZZ11TestADLCallvE1x", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "NS::X", // CHECK-NEXT: "qualType": "NS::X" @@ -8290,7 +8275,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_ZZ14TestNonADLCallvE1x", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "NS::X", // CHECK-NEXT: "qualType": "NS::X" @@ -8572,7 +8556,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_ZZ15TestNonADLCall2vE1x", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "NS::X", // CHECK-NEXT: "qualType": "NS::X" @@ -9056,7 +9039,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_ZZN19test_adl_call_three15TestNonADLCall3EvE1x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "NS::X" // CHECK-NEXT: }, diff --git a/clang/test/AST/ast-dump-expr-json.m b/clang/test/AST/ast-dump-expr-json.m --- a/clang/test/AST/ast-dump-expr-json.m +++ b/clang/test/AST/ast-dump-expr-json.m @@ -296,7 +296,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Obj", -// CHECK-NEXT: "mangledName": "Obj", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "I *" // CHECK-NEXT: } @@ -673,7 +672,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "s", -// CHECK-NEXT: "mangledName": "s", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "SEL *", // CHECK-NEXT: "qualType": "SEL", @@ -765,7 +763,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Obj", -// CHECK-NEXT: "mangledName": "Obj", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "id", // CHECK-NEXT: "qualType": "id", @@ -953,7 +950,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Obj", -// CHECK-NEXT: "mangledName": "Obj", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "J *" // CHECK-NEXT: } @@ -1593,7 +1589,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -1977,7 +1972,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Array", -// CHECK-NEXT: "mangledName": "Array", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "NSMutableArray *" // CHECK-NEXT: } @@ -2004,7 +1998,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Dict", -// CHECK-NEXT: "mangledName": "Dict", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "NSMutableDictionary *" // CHECK-NEXT: } @@ -2870,7 +2863,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "i", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "id", // CHECK-NEXT: "qualType": "id", @@ -4826,7 +4818,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "Ptr", -// CHECK-NEXT: "mangledName": "Ptr", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "I *" // CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-funcs-json.cpp b/clang/test/AST/ast-dump-funcs-json.cpp --- a/clang/test/AST/ast-dump-funcs-json.cpp +++ b/clang/test/AST/ast-dump-funcs-json.cpp @@ -628,7 +628,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ5Test3iiE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -654,7 +653,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "_ZZ5Test3iiE1b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -711,7 +709,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ5Test4iiE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -737,7 +734,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "_ZZ5Test4iiE1b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, diff --git a/clang/test/AST/ast-dump-if-json.cpp b/clang/test/AST/ast-dump-if-json.cpp --- a/clang/test/AST/ast-dump-if-json.cpp +++ b/clang/test/AST/ast-dump-if-json.cpp @@ -711,7 +711,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ4funciE1i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -894,7 +893,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ4funciE1i_0", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, diff --git a/clang/test/AST/ast-dump-stmt-json.c b/clang/test/AST/ast-dump-stmt-json.c --- a/clang/test/AST/ast-dump-stmt-json.c +++ b/clang/test/AST/ast-dump-stmt-json.c @@ -147,6 +147,10 @@ #undef FOO } +void TestVLA(int n) { + double vla[n]; +} + // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py // using --filters=VarDecl,CompoundStmt @@ -377,7 +381,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -446,7 +449,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "y", -// CHECK-NEXT: "mangledName": "y", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -472,7 +474,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "z", -// CHECK-NEXT: "mangledName": "z", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -720,7 +721,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "T1", -// CHECK-NEXT: "mangledName": "T1", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "char" // CHECK-NEXT: }, @@ -813,7 +813,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "T2", -// CHECK-NEXT: "mangledName": "T2", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -1937,7 +1936,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "j", -// CHECK-NEXT: "mangledName": "j", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -2221,7 +2219,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "ptr", -// CHECK-NEXT: "mangledName": "ptr", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "void *" // CHECK-NEXT: }, @@ -3883,7 +3880,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -5179,7 +5175,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -5325,7 +5320,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -5371,7 +5365,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -5419,3 +5412,69 @@ // CHECK-NEXT: } // CHECK-NEXT: ] // CHECK-NEXT: } + + +// CHECK-NOT: {{^}}Dumping +// CHECK: "kind": "CompoundStmt", +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 1683, +// CHECK-NEXT: "col": 21, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 1702, +// CHECK-NEXT: "line": 152, +// CHECK-NEXT: "presumedLine": 200007, +// CHECK-NEXT: "col": 1, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "inner": [ +// CHECK-NEXT: { +// CHECK-NEXT: "id": "0x{{.*}}", +// CHECK-NEXT: "kind": "DeclStmt", +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 1687, +// CHECK-NEXT: "line": 151, +// CHECK-NEXT: "presumedLine": 200006, +// CHECK-NEXT: "col": 3, +// CHECK-NEXT: "tokLen": 6 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 1700, +// CHECK-NEXT: "col": 16, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "inner": [ +// CHECK-NEXT: { +// CHECK-NEXT: "id": "0x{{.*}}", +// CHECK-NEXT: "kind": "VarDecl", +// CHECK-NEXT: "loc": { +// CHECK-NEXT: "offset": 1694, +// CHECK-NEXT: "col": 10, +// CHECK-NEXT: "tokLen": 3 +// CHECK-NEXT: }, +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 1687, +// CHECK-NEXT: "col": 3, +// CHECK-NEXT: "tokLen": 6 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 1699, +// CHECK-NEXT: "col": 15, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "name": "vla", +// CHECK-NEXT: "type": { +// CHECK-NEXT: "qualType": "double[n]" +// CHECK-NEXT: } +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-stmt-json.cpp b/clang/test/AST/ast-dump-stmt-json.cpp --- a/clang/test/AST/ast-dump-stmt-json.cpp +++ b/clang/test/AST/ast-dump-stmt-json.cpp @@ -366,7 +366,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "f", -// CHECK-NEXT: "mangledName": "_ZZ12TestFunctionvE1f", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "void (*)()" // CHECK-NEXT: }, @@ -639,7 +638,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "_ZZ10TestCatch1vE1x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -885,7 +883,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "p", -// CHECK-NEXT: "mangledName": "_ZZ19TestAllocationExprsvE1p", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int *" // CHECK-NEXT: } @@ -2036,7 +2033,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "p", -// CHECK-NEXT: "mangledName": "_ZZ27TestDependentAllocationExprvE1p", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "T *" // CHECK-NEXT: }, @@ -2260,7 +2256,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "obj", -// CHECK-NEXT: "mangledName": "_ZZ28TestDependentScopeMemberExprvE3obj", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "DependentScopeMemberExprWrapper" // CHECK-NEXT: } @@ -2768,7 +2763,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "obj", -// CHECK-NEXT: "mangledName": "_ZZ36TestDependentScopeTemplateMemberExprvE3obj", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "OtherDependentScopeMemberExprWrapper" // CHECK-NEXT: } @@ -2984,7 +2978,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "us", -// CHECK-NEXT: "mangledName": "_ZZ17TestUnionInitListvE2us", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "U[3]" // CHECK-NEXT: }, @@ -3151,7 +3144,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ10TestSwitchiE1i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -3230,7 +3222,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ10TestSwitchiE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -3363,7 +3354,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "b", -// CHECK-NEXT: "mangledName": "_ZZ6TestIfbE1b", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "bool" // CHECK-NEXT: } @@ -3443,7 +3433,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ6TestIfbE1i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "const int" // CHECK-NEXT: }, @@ -4100,7 +4089,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -4169,7 +4157,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "j", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1j", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -4414,7 +4401,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "vals", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE4vals", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int[10]" // CHECK-NEXT: } @@ -4480,7 +4466,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__range1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__range1", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int (&)[10]" // CHECK-NEXT: }, @@ -4557,7 +4542,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__begin1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__begin1", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -4658,7 +4642,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__end1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE6__end1", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -4987,7 +4970,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "v", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1v", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -5157,7 +5139,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "C", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1C", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "Container" // CHECK-NEXT: }, @@ -5251,7 +5232,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__range1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__range1_0", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "Container &" // CHECK-NEXT: }, @@ -5328,7 +5308,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__begin1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__begin1_0", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -5476,7 +5455,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__end1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE6__end1_0", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -5808,7 +5786,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "v", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1v_0", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -5995,7 +5972,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -6041,7 +6017,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__range1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__range1_1", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int (&)[10]" // CHECK-NEXT: }, @@ -6118,7 +6093,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__begin1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE8__begin1_1", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -6219,7 +6193,6 @@ // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "__end1", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE6__end1_1", // CHECK-NEXT: "type": { // CHECK-NEXT: "desugaredQualType": "int *", // CHECK-NEXT: "qualType": "int *" @@ -6548,7 +6521,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "v", -// CHECK-NEXT: "mangledName": "_ZZ13TestIterationvE1v_1", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: }, @@ -6786,7 +6758,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isReferenced": true, // CHECK-NEXT: "name": "T", -// CHECK-NEXT: "mangledName": "_ZZ33TestDependentGenericSelectionExprT_E1T", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "Ty" // CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-stmt-json.m b/clang/test/AST/ast-dump-stmt-json.m --- a/clang/test/AST/ast-dump-stmt-json.m +++ b/clang/test/AST/ast-dump-stmt-json.m @@ -73,7 +73,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -307,7 +306,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isUsed": true, // CHECK-NEXT: "name": "x", -// CHECK-NEXT: "mangledName": "x", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: } @@ -611,7 +609,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "a", -// CHECK-NEXT: "mangledName": "a", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "A *" // CHECK-NEXT: } @@ -758,7 +755,6 @@ // CHECK-NEXT: }, // CHECK-NEXT: "isImplicit": true, // CHECK-NEXT: "name": "__context", -// CHECK-NEXT: "mangledName": "__context", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "struct (unnamed at {{.*}}:18:14) *" // CHECK-NEXT: } diff --git a/clang/test/AST/ast-dump-template-decls-json.cpp b/clang/test/AST/ast-dump-template-decls-json.cpp --- a/clang/test/AST/ast-dump-template-decls-json.cpp +++ b/clang/test/AST/ast-dump-template-decls-json.cpp @@ -1040,7 +1040,6 @@ // CHECK-NEXT: } // CHECK-NEXT: }, // CHECK-NEXT: "name": "i", -// CHECK-NEXT: "mangledName": "_ZZ1fiE1i", // CHECK-NEXT: "type": { // CHECK-NEXT: "qualType": "int" // CHECK-NEXT: },