diff options
author | Brad King <brad.king@kitware.com> | 2014-03-18 19:15:40 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-24 15:37:20 (GMT) |
commit | 25ff73764f1a54a0c3689df949f2d7e9ab41a014 (patch) | |
tree | 21a70f6c0e31c684271767b094efb6ba1f22528d | |
parent | 5e0461f6741c5eed0ee1cf79e0517a3d9b93f3b2 (diff) | |
download | CastXML-25ff73764f1a54a0c3689df949f2d7e9ab41a014.zip CastXML-25ff73764f1a54a0c3689df949f2d7e9ab41a014.tar.gz CastXML-25ff73764f1a54a0c3689df949f2d7e9ab41a014.tar.bz2 |
Output: Report Typedef underlying type
When a typedef is "moded" the underlying type may be different from the
named type. Report the real type.
-rw-r--r-- | src/Output.cxx | 2 | ||||
-rw-r--r-- | test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | test/expect/gccxml.Typedef-to-FundamentalType-mode-xml.txt | 7 | ||||
-rw-r--r-- | test/input/Typedef-to-FundamentalType-mode.cxx | 1 |
4 files changed, 10 insertions, 1 deletions
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 << " <Typedef"; this->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"\?> +<GCC_XML[^>]*> + <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/> + <FundamentalType id="_2" name="short int"/> + <Namespace id="_3" name="::"/> + <File id="f1" name=".*/test/input/Typedef-to-FundamentalType-mode.cxx"/> +</GCC_XML>$ 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__))); |