[clang] 2105c32 - [clang] Add missing field to TLSModelAttr json AST dump
via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 14 14:00:17 PDT 2023
Author: serge-sans-paille
Date: 2023-08-14T22:59:45+02:00
New Revision: 2105c32b32bf3360f524f1f3a1e5af605821eff8
URL: https://github.com/llvm/llvm-project/commit/2105c32b32bf3360f524f1f3a1e5af605821eff8
DIFF: https://github.com/llvm/llvm-project/commit/2105c32b32bf3360f524f1f3a1e5af605821eff8.diff
LOG: [clang] Add missing field to TLSModelAttr json AST dump
Differential Revision: https://reviews.llvm.org/D157814
Added:
Modified:
clang/include/clang/AST/JSONNodeDumper.h
clang/lib/AST/JSONNodeDumper.cpp
clang/test/AST/ast-dump-attr-json.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/AST/JSONNodeDumper.h b/clang/include/clang/AST/JSONNodeDumper.h
index 03c903069ad877..0ce272df8df65b 100644
--- a/clang/include/clang/AST/JSONNodeDumper.h
+++ b/clang/include/clang/AST/JSONNodeDumper.h
@@ -214,6 +214,7 @@ class JSONNodeDumper
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);
diff --git a/clang/lib/AST/JSONNodeDumper.cpp b/clang/lib/AST/JSONNodeDumper.cpp
index 134938a1ef19a0..139dfce41e914c 100644
--- a/clang/lib/AST/JSONNodeDumper.cpp
+++ b/clang/lib/AST/JSONNodeDumper.cpp
@@ -559,6 +559,10 @@ void JSONNodeDumper::VisitVisibilityAttr(const VisibilityAttr *VA) {
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())
diff --git a/clang/test/AST/ast-dump-attr-json.cpp b/clang/test/AST/ast-dump-attr-json.cpp
index 0eb930b851a15e..24a5ff08887870 100644
--- a/clang/test/AST/ast-dump-attr-json.cpp
+++ b/clang/test/AST/ast-dump-attr-json.cpp
@@ -19,6 +19,7 @@ __attribute__ ((section ("SECTION_NAME"))) int section_var;
__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 @@ __attribute__ ((visibility ("hidden"))) int visibility_var;
// 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: }
More information about the cfe-commits
mailing list