Do not traverse attributes during JSON generation (Fixes
Previously, __attribute__((aligned(sizeof(...)))) would cause the type
inside sizeof() to be appended after the JSON type information for the
struct in some clang versions, generating invalid JSON. Inhibit
attribute traversal, since we only want to visit the fields.
@@ -43,6 +43,7 @@ class BMapDeclVisitor : public clang::RecursiveASTVisitor<BMapDeclVisitor> {
bool VisitPointerType(const clang::PointerType *T);
bool VisitEnumConstantDecl(clang::EnumConstantDecl *D);
bool VisitEnumDecl(clang::EnumDecl *D);
+ bool VisitAttr(clang::Attr *A);
private:
bool shouldSkipPadding(const RecordDecl *D);
@@ -183,6 +184,7 @@ bool BMapDeclVisitor::VisitBuiltinType(const BuiltinType *T) {
result_ += "\"";
return true;
}
+bool BMapDeclVisitor::VisitAttr(clang::Attr *A) { return false; }
class JsonMapTypesVisitor : public virtual MapTypesVisitor {
public:
