From 5e0461f6741c5eed0ee1cf79e0517a3d9b93f3b2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 18 Mar 2014 14:48:39 -0400 Subject: Output: Decay Function Argument types Report the actual function argument type even if it decayed from the type originally specified. --- src/Output.cxx | 8 +++++++- test/CMakeLists.txt | 1 + test/expect/gccxml.Function-Argument-decay-xml.txt | 17 +++++++++++++++++ test/input/Function-Argument-decay.cxx | 1 + 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/expect/gccxml.Function-Argument-decay-xml.txt create mode 100644 test/input/Function-Argument-decay.cxx diff --git a/src/Output.cxx b/src/Output.cxx index e3a8ffb..0cee6ca 100644 --- a/src/Output.cxx +++ b/src/Output.cxx @@ -416,6 +416,12 @@ unsigned int ASTVisitor::AddDumpNode(DumpType dt, bool complete) { // Replace some types with their decls. if(!t.hasLocalQualifiers()) { switch (t->getTypeClass()) { + case clang::Type::Adjusted: + return this->AddDumpNode(DumpType( + t->getAs()->getAdjustedType(), c), complete); + case clang::Type::Decayed: + return this->AddDumpNode(DumpType( + t->getAs()->getDecayedType(), c), complete); case clang::Type::Elaborated: return this->AddDumpNode(DumpType( t->getAs()->getNamedType(), c), complete); @@ -1047,7 +1053,7 @@ void ASTVisitor::OutputFunctionArgument(clang::ParmVarDecl const* a, if(!name.empty()) { this->PrintNameAttribute(name); } - this->PrintTypeAttribute(a->getOriginalType(), complete); + this->PrintTypeAttribute(a->getType(), complete); this->PrintLocationAttribute(a); if(def) { this->OS << " default=\""; diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 6fc5cf8..e95af68 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -98,6 +98,7 @@ castxml_test_gccxml(Enumeration) castxml_test_gccxml(Enumeration-anonymous) castxml_test_gccxml(Field) castxml_test_gccxml(Function) +castxml_test_gccxml(Function-Argument-decay) castxml_test_gccxml(Function-Argument-default) castxml_test_gccxml(Function-template) castxml_test_gccxml(Function-throw) diff --git a/test/expect/gccxml.Function-Argument-decay-xml.txt b/test/expect/gccxml.Function-Argument-decay-xml.txt new file mode 100644 index 0000000..d295f6d --- /dev/null +++ b/test/expect/gccxml.Function-Argument-decay-xml.txt @@ -0,0 +1,17 @@ +^<\?xml version="1.0"\?> +]*> + + + + + + + + + + + + + + +$ diff --git a/test/input/Function-Argument-decay.cxx b/test/input/Function-Argument-decay.cxx new file mode 100644 index 0000000..1b2e3d1 --- /dev/null +++ b/test/input/Function-Argument-decay.cxx @@ -0,0 +1 @@ +void start(int[2], int[], int(int)); -- cgit v0.12