summaryrefslogtreecommitdiffstats
path: root/src/Output.cxx
diff options
context:
space:
mode:
authorJörg Wollenschläger <joerg.wollenschlaeger@gmail.com>2015-08-22 20:04:35 (GMT)
committerBrad King <brad.king@kitware.com>2015-08-24 14:27:01 (GMT)
commit8f5ae0e19203b51a6405533139caec1816ea919d (patch)
tree8444ddda1d70469b108927b4bbc1b8a8ecb0e90a /src/Output.cxx
parent2e55b356f9ed1a97d3bdfcb981c919b3d4defc7b (diff)
downloadCastXML-8f5ae0e19203b51a6405533139caec1816ea919d.zip
CastXML-8f5ae0e19203b51a6405533139caec1816ea919d.tar.gz
CastXML-8f5ae0e19203b51a6405533139caec1816ea919d.tar.bz2
Output: Add annotate() to more declaration attributes=""
Extend the change from commit e73fba54 (Output: Add annotate() to function declaration attributes="", 2015-08-18) to support record, enum, field, variable, and typedef since gccxml also supported attributes in these.
Diffstat (limited to 'src/Output.cxx')
-rw-r--r--src/Output.cxx22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/Output.cxx b/src/Output.cxx
index bba375d..9561ca8 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -343,6 +343,10 @@ class ASTVisitor: public ASTVisitorBase
/** Print an attributes="..." attribute listing the given attributes. */
void PrintAttributesAttribute(std::vector<std::string> const& attrs);
+ /** Print an attributes="..." attribute listing the given
+ declaration's attributes. */
+ void PrintAttributesAttribute(clang::Decl const* d);
+
/** Get the attributes of the given function type. */
void GetFunctionTypeAttributes(clang::FunctionProtoType const* t,
std::vector<std::string>& attrs);
@@ -1216,6 +1220,14 @@ void ASTVisitor::PrintAttributesAttribute(
}
//----------------------------------------------------------------------------
+void ASTVisitor::PrintAttributesAttribute(clang::Decl const* d)
+{
+ std::vector<std::string> attributes;
+ this->GetDeclAttributes(d, attributes);
+ this->PrintAttributesAttribute(attributes);
+}
+
+//----------------------------------------------------------------------------
void ASTVisitor::GetFunctionTypeAttributes(clang::FunctionProtoType const* t,
std::vector<std::string>& attrs)
{
@@ -1433,9 +1445,7 @@ void ASTVisitor::OutputFunctionArgument(clang::ParmVarDecl const* a,
this->OS << encodeXML(rso.str());
this->OS << "\"";
}
- std::vector<std::string> attributes;
- this->GetDeclAttributes(a, attributes);
- this->PrintAttributesAttribute(attributes);
+ this->PrintAttributesAttribute(a);
this->OS << "/>\n";
}
@@ -1514,6 +1524,7 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
this->OS << " incomplete=\"1\"";
}
this->PrintABIAttributes(d);
+ this->PrintAttributesAttribute(d);
if(doBases) {
this->OS << ">\n";
for(clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
@@ -1576,6 +1587,7 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d,
this->PrintTypeAttribute(d->getUnderlyingType(), dn->Complete);
this->PrintContextAttribute(d);
this->PrintLocationAttribute(d);
+ this->PrintAttributesAttribute(d);
this->OS << "/>\n";
}
@@ -1593,6 +1605,7 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
this->PrintNameAttribute(name);
this->PrintContextAttribute(d);
this->PrintLocationAttribute(d);
+ this->PrintAttributesAttribute(d);
clang::EnumDecl::enumerator_iterator enum_begin = d->enumerator_begin();
clang::EnumDecl::enumerator_iterator enum_end = d->enumerator_end();
if(enum_begin != enum_end) {
@@ -1603,6 +1616,7 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
this->OS << " <EnumValue";
this->PrintNameAttribute(ecd->getName());
this->OS << " init=\"" << ecd->getInitVal() << "\"";
+ this->PrintAttributesAttribute(ecd);
this->OS << "/>\n";
}
this->OS << " </Enumeration>\n";
@@ -1628,6 +1642,7 @@ void ASTVisitor::OutputFieldDecl(clang::FieldDecl const* d, DumpNode const* dn)
if(d->isMutable()) {
this->OS << " mutable=\"1\"";
}
+ this->PrintAttributesAttribute(d);
this->OS << "/>\n";
}
@@ -1656,6 +1671,7 @@ void ASTVisitor::OutputVarDecl(clang::VarDecl const* d, DumpNode const* dn)
this->OS << " extern=\"1\"";
}
this->PrintMangledAttribute(d);
+ this->PrintAttributesAttribute(d);
this->OS << "/>\n";
}