From 25ff73764f1a54a0c3689df949f2d7e9ab41a014 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Mar 2014 15:15:40 -0400 Subject: Output: Report Typedef underlying type When a typedef is "moded" the underlying type may be different from the named type. Report the real type. --- src/Output.cxx | 2 +- test/CMakeLists.txt | 1 + test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt | 7 +++++++ test/input/Typedef-to-FundamentalType-mode.cxx | 1 + 4 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt create mode 100644 test/input/Typedef-to-FundamentalType-mode.cxx diff --git a/src/Output.cxx b/src/Output.cxx index 0cee6ca..dab1230 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -1169,7 +1169,7 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d, this->OS << " PrintIdAttribute(dn); this->PrintNameAttribute(d->getName().str()); - this->PrintTypeAttribute(d->getTypeSourceInfo()->getType(), dn->Complete); + this->PrintTypeAttribute(d->getUnderlyingType(), dn->Complete); this->PrintContextAttribute(d); this->PrintLocationAttribute(d); this->OS << "/>\n"; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index e95af68..0441ce7 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -121,6 +121,7 @@ castxml_test_gccxml(Typedef-paren) castxml_test_gccxml(Typedef-to-Class-template) castxml_test_gccxml(Typedef-to-Enumeration) castxml_test_gccxml(Typedef-to-Enumeration-anonymous) +castxml_test_gccxml(Typedef-to-FundamentalType-mode) castxml_test_gccxml(Variable) castxml_test_gccxml(Variable-in-Class) castxml_test_gccxml(Variable-init) diff --git a/test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt b/test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt new file mode 100644 index 0000000..c43eca1 --- /dev/null +++ b/test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt @@ -0,0 +1,7 @@ +^<\?xml version="1.0"\?> +]*> + + + + +$ diff --git a/test/input/Typedef-to-FundamentalType-mode.cxx b/test/input/Typedef-to-FundamentalType-mode.cxx new file mode 100644 index 0000000..03869e9 --- /dev/null +++ b/test/input/Typedef-to-FundamentalType-mode.cxx @@ -0,0 +1 @@ +typedef int start __attribute__ ((__mode__ (__HI__))); -- cgit v0.12