[clang] cda3198 - [clang] Add missing field to TLSModelAttr json AST dump
via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 15 13:40:18 PDT 2023
Author: serge-sans-paille
Date: 2023-08-15T22:24:42+02:00
New Revision: cda319851fe7facf603c3930d5587e127d46b3b7
URL: https://github.com/llvm/llvm-project/commit/cda319851fe7facf603c3930d5587e127d46b3b7
DIFF: https://github.com/llvm/llvm-project/commit/cda319851fe7facf603c3930d5587e127d46b3b7.diff
LOG: [clang] Add missing field to TLSModelAttr json AST dump
Recommit with test case updated.
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 059ac488cc31d5..051c2956abfdf7 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": 748,
+// CHECK-NEXT: "line": 22,
+// CHECK-NEXT: "col": 57,
+// CHECK-NEXT: "tokLen": 13
+// CHECK-NEXT: },
+// CHECK-NEXT: "range": {
+// CHECK-NEXT: "begin": {
+// CHECK-NEXT: "offset": 692,
+// CHECK-NEXT: "col": 1,
+// CHECK-NEXT: "tokLen": 8
+// CHECK-NEXT: },
+// CHECK-NEXT: "end": {
+// CHECK-NEXT: "offset": 748,
+// 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": 717,
+// CHECK-NEXT: "col": 26,
+// CHECK-NEXT: "tokLen": 9
+// CHECK-NEXT: },
+// CHECK-NEXT: "end": {
+// CHECK-NEXT: "offset": 740,
+// 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