This revision was landed with ongoing or failed builds. This revision was automatically updated to reflect the committed changes. Closed by commit rG2105c32b32bf: [clang] Add missing field to TLSModelAttr json AST dump (authored by serge-sans-paille).
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D157814/new/ https://reviews.llvm.org/D157814 Files: clang/include/clang/AST/JSONNodeDumper.h clang/lib/AST/JSONNodeDumper.cpp clang/test/AST/ast-dump-attr-json.cpp Index: clang/test/AST/ast-dump-attr-json.cpp =================================================================== --- clang/test/AST/ast-dump-attr-json.cpp +++ clang/test/AST/ast-dump-attr-json.cpp @@ -19,6 +19,7 @@ __attribute__ ((visibility ("hidden"))) int visibility_var; +__thread __attribute__ ((tls_model ("local-exec"))) int tls_model_var; // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py // using --filters=VarDecl @@ -479,3 +480,51 @@ // CHECK-NEXT: } // CHECK-NEXT: ] // CHECK-NEXT: } + + +// CHECK-NOT: {{^}}Dumping +// CHECK: "kind": "VarDecl", +// CHECK-NEXT: "loc": { +// CHECK-NEXT: "offset": 724, +// CHECK-NEXT: "line": 22, +// CHECK-NEXT: "col": 57, +// CHECK-NEXT: "tokLen": 13 +// CHECK-NEXT: }, +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 668, +// CHECK-NEXT: "col": 1, +// CHECK-NEXT: "tokLen": 8 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 724, +// CHECK-NEXT: "col": 57, +// CHECK-NEXT: "tokLen": 13 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "name": "tls_model_var", +// CHECK-NEXT: "mangledName": "tls_model_var", +// CHECK-NEXT: "type": { +// CHECK-NEXT: "qualType": "int" +// CHECK-NEXT: }, +// CHECK-NEXT: "tls": "static", +// CHECK-NEXT: "inner": [ +// CHECK-NEXT: { +// CHECK-NEXT: "id": "0x{{.*}}", +// CHECK-NEXT: "kind": "TLSModelAttr", +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 693, +// CHECK-NEXT: "col": 26, +// CHECK-NEXT: "tokLen": 9 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 716, +// CHECK-NEXT: "col": 49, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "tls_model": "local-exec" +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: } Index: clang/lib/AST/JSONNodeDumper.cpp =================================================================== --- clang/lib/AST/JSONNodeDumper.cpp +++ clang/lib/AST/JSONNodeDumper.cpp @@ -559,6 +559,10 @@ VA->getVisibility())); } +void JSONNodeDumper::VisitTLSModelAttr(const TLSModelAttr *TA) { + JOS.attribute("tls_model", TA->getModel()); +} + void JSONNodeDumper::VisitTypedefType(const TypedefType *TT) { JOS.attribute("decl", createBareDeclRef(TT->getDecl())); if (!TT->typeMatchesDecl()) Index: clang/include/clang/AST/JSONNodeDumper.h =================================================================== --- clang/include/clang/AST/JSONNodeDumper.h +++ clang/include/clang/AST/JSONNodeDumper.h @@ -214,6 +214,7 @@ void VisitUnavailableAttr(const UnavailableAttr *UA); void VisitSectionAttr(const SectionAttr *SA); void VisitVisibilityAttr(const VisibilityAttr *VA); + void VisitTLSModelAttr(const TLSModelAttr *TA); void VisitTypedefType(const TypedefType *TT); void VisitUsingType(const UsingType *TT);
Index: clang/test/AST/ast-dump-attr-json.cpp =================================================================== --- clang/test/AST/ast-dump-attr-json.cpp +++ clang/test/AST/ast-dump-attr-json.cpp @@ -19,6 +19,7 @@ __attribute__ ((visibility ("hidden"))) int visibility_var; +__thread __attribute__ ((tls_model ("local-exec"))) int tls_model_var; // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py // using --filters=VarDecl @@ -479,3 +480,51 @@ // CHECK-NEXT: } // CHECK-NEXT: ] // CHECK-NEXT: } + + +// CHECK-NOT: {{^}}Dumping +// CHECK: "kind": "VarDecl", +// CHECK-NEXT: "loc": { +// CHECK-NEXT: "offset": 724, +// CHECK-NEXT: "line": 22, +// CHECK-NEXT: "col": 57, +// CHECK-NEXT: "tokLen": 13 +// CHECK-NEXT: }, +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 668, +// CHECK-NEXT: "col": 1, +// CHECK-NEXT: "tokLen": 8 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 724, +// CHECK-NEXT: "col": 57, +// CHECK-NEXT: "tokLen": 13 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "name": "tls_model_var", +// CHECK-NEXT: "mangledName": "tls_model_var", +// CHECK-NEXT: "type": { +// CHECK-NEXT: "qualType": "int" +// CHECK-NEXT: }, +// CHECK-NEXT: "tls": "static", +// CHECK-NEXT: "inner": [ +// CHECK-NEXT: { +// CHECK-NEXT: "id": "0x{{.*}}", +// CHECK-NEXT: "kind": "TLSModelAttr", +// CHECK-NEXT: "range": { +// CHECK-NEXT: "begin": { +// CHECK-NEXT: "offset": 693, +// CHECK-NEXT: "col": 26, +// CHECK-NEXT: "tokLen": 9 +// CHECK-NEXT: }, +// CHECK-NEXT: "end": { +// CHECK-NEXT: "offset": 716, +// CHECK-NEXT: "col": 49, +// CHECK-NEXT: "tokLen": 1 +// CHECK-NEXT: } +// CHECK-NEXT: }, +// CHECK-NEXT: "tls_model": "local-exec" +// CHECK-NEXT: } +// CHECK-NEXT: ] +// CHECK-NEXT: } Index: clang/lib/AST/JSONNodeDumper.cpp =================================================================== --- clang/lib/AST/JSONNodeDumper.cpp +++ clang/lib/AST/JSONNodeDumper.cpp @@ -559,6 +559,10 @@ VA->getVisibility())); } +void JSONNodeDumper::VisitTLSModelAttr(const TLSModelAttr *TA) { + JOS.attribute("tls_model", TA->getModel()); +} + void JSONNodeDumper::VisitTypedefType(const TypedefType *TT) { JOS.attribute("decl", createBareDeclRef(TT->getDecl())); if (!TT->typeMatchesDecl()) Index: clang/include/clang/AST/JSONNodeDumper.h =================================================================== --- clang/include/clang/AST/JSONNodeDumper.h +++ clang/include/clang/AST/JSONNodeDumper.h @@ -214,6 +214,7 @@ void VisitUnavailableAttr(const UnavailableAttr *UA); void VisitSectionAttr(const SectionAttr *SA); void VisitVisibilityAttr(const VisibilityAttr *VA); + void VisitTLSModelAttr(const TLSModelAttr *TA); void VisitTypedefType(const TypedefType *TT); void VisitUsingType(const UsingType *TT);
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits