From ab558c0e515e84e768835a13bab218ce487c8f89 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 12 Feb 2014 16:23:32 -0500 Subject: Output: Generate FundamentalType elements Implement the OutputBuiltinType method to generate the FundamentalType element. Report the name="" of the type. --- src/Output.cxx | 12 ++++++++++++ test/CMakeLists.txt | 1 + test/expect/gccxml.FundamentalType-xml.txt | 7 +++++++ test/input/FundamentalType.cxx | 1 + 4 files changed, 21 insertions(+) create mode 100644 test/expect/gccxml.FundamentalType-xml.txt create mode 100644 test/input/FundamentalType.cxx diff --git a/src/Output.cxx b/src/Output.cxx index 0aa099f..487fd7c 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -213,6 +213,9 @@ class ASTVisitor: public ASTVisitorBase void OutputNamespaceDecl(clang::NamespaceDecl const* d, DumpNode const* dn); void OutputTypedefDecl(clang::TypedefDecl const* d, DumpNode const* dn); + // Type node output methods. + void OutputBuiltinType(clang::BuiltinType const* t, DumpNode const* dn); + /** Queue declarations matching given qualified name in given context. */ void LookupStart(clang::DeclContext const* dc, std::string const& name); @@ -599,7 +602,16 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d, this->PrintTypeAttribute(d->getTypeSourceInfo()->getType(), dn->Complete); this->PrintContextAttribute(d); this->PrintLocationAttribute(d); + this->OS << "/>\n"; +} +//---------------------------------------------------------------------------- +void ASTVisitor::OutputBuiltinType(clang::BuiltinType const* t, + DumpNode const* dn) +{ + this->OS << " PrintIdAttribute(dn); + this->PrintNameAttribute(t->getName(this->CTX.getPrintingPolicy()).str()); this->OS << "/>\n"; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index dd90307..67cc9c0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -51,4 +51,5 @@ castxml_test_cmd(gccxml-twice --castxml-gccxml --castxml-gccxml) castxml_test_cmd(o-missing -o) castxml_test_cmd(start-missing --castxml-start) +castxml_test_gccxml(FundamentalType) castxml_test_gccxml(Namespace) diff --git a/test/expect/gccxml.FundamentalType-xml.txt b/test/expect/gccxml.FundamentalType-xml.txt new file mode 100644 index 0000000..29a48b2 --- /dev/null +++ b/test/expect/gccxml.FundamentalType-xml.txt @@ -0,0 +1,7 @@ +^<\?xml version="1.0"\?> +]*> + + + + +$ diff --git a/test/input/FundamentalType.cxx b/test/input/FundamentalType.cxx new file mode 100644 index 0000000..ed6c3c8 --- /dev/null +++ b/test/input/FundamentalType.cxx @@ -0,0 +1 @@ +typedef int start; -- cgit v0.12