[med-svn] [castxml] 01/06: New upstream version 0.1+git20161215

Gert Wollny gewo at moszumanska.debian.org
Mon Jan 30 11:23:10 UTC 2017


This is an automated email from the git hooks/post-receive script.

gewo pushed a commit to branch master
in repository castxml.

commit b1b9ee7f5314e5a44fdcbad4cbfea12d9352795d
Author: Gert Wollny <gw.fossdev at gmail.com>
Date:   Thu Dec 15 07:59:53 2016 +0000

    New upstream version 0.1+git20161215
---
 .clang-format                                      |    9 +
 README.rst                                         |    3 +-
 doc/manual/castxml.1.rst                           |   84 +-
 src/CMakeLists.txt                                 |    3 +
 src/Detect.cxx                                     |   99 +-
 src/Detect.h                                       |    6 +-
 src/Options.h                                      |   24 +-
 src/Output.cxx                                     | 1240 +++++++++++---------
 src/Output.h                                       |   12 +-
 src/RunClang.cxx                                   |  327 +++---
 src/RunClang.h                                     |    3 +-
 src/Utils.cxx                                      |  136 +--
 src/Utils.h                                        |    5 +-
 src/Version.cmake                                  |    2 +-
 src/castxml.cxx                                    |  157 ++-
 src/clang-format.bash                              |  116 ++
 test/CMakeLists.txt                                |  496 ++++----
 .../castxml1.any.ArrayType-incomplete.xml.txt      |    8 +
 test/expect/castxml1.any.ArrayType.xml.txt         |    8 +
 test/expect/castxml1.any.CXXLiteral.xml.txt        |    5 +
 ...xml.txt => castxml1.any.Class-abstract.xml.txt} |   12 +-
 ...xml.txt => castxml1.any.Class-annotate.xml.txt} |   10 +-
 ....txt => castxml1.any.Class-base-offset.xml.txt} |    6 +-
 ...txt => castxml1.any.Class-base-typedef.xml.txt} |   18 +-
 ....xml.txt => castxml1.any.Class-forward.xml.txt} |   16 +-
 ....xml.txt => castxml1.any.Class-friends.xml.txt} |   20 +-
 ...y.Class-implicit-member-access-mutable.xml.txt} |   24 +-
 ...txml1.any.Class-implicit-member-access.xml.txt} |   22 +-
 ...stxml1.any.Class-implicit-member-array.xml.txt} |    6 +-
 ...ml1.any.Class-implicit-member-bad-base.xml.txt} |   16 +-
 ....Class-implicit-member-const-aggregate.xml.txt} |    6 +-
 ...stxml1.any.Class-implicit-member-const.xml.txt} |    8 +-
 ...l1.any.Class-implicit-member-reference.xml.txt} |    8 +-
 ...=> castxml1.any.Class-implicit-members.xml.txt} |    8 +-
 .../castxml1.any.Class-incomplete-twice.xml.txt    |    7 +
 test/expect/castxml1.any.Class-incomplete.xml.txt  |    6 +
 ...txml1.any.Class-member-template-access.xml.txt} |   22 +-
 ... => castxml1.any.Class-member-template.xml.txt} |    8 +-
 ....Class-partial-template-member-Typedef.xml.txt} |   24 +-
 ...y.Class-template-Method-Argument-const.xml.txt} |   22 +-
 ...Class-template-Method-Argument-default.xml.txt} |   22 +-
 ...any.Class-template-Method-return-const.xml.txt} |   20 +-
 ...ny.Class-template-constructor-template.xml.txt} |   20 +-
 .../castxml1.any.Class-template-friends.xml.txt    |   22 +
 ...ny.Class-template-member-Typedef-const.xml.txt} |   24 +-
 ...xml1.any.Class-template-member-Typedef.xml.txt} |   24 +-
 ...ass-template-member-nontemplate-Typedef.xml.txt |   10 +
 ...ml1.any.Class-template-member-template.xml.txt} |   22 +-
 ...=> castxml1.any.Class-template-recurse.xml.txt} |   20 +-
 test/expect/castxml1.any.Class-template.xml.txt    |   30 +
 ...structor.xml.txt => castxml1.any.Class.xml.txt} |    8 +-
 ...t => castxml1.any.Constructor-annotate.xml.txt} |    6 +-
 ...or.xml.txt => castxml1.any.Constructor.xml.txt} |    6 +-
 ...txt => castxml1.any.Converter-annotate.xml.txt} |    6 +-
 ...rter.xml.txt => castxml1.any.Converter.xml.txt} |    6 +-
 test/expect/castxml1.any.CvQualifiedType.xml.txt   |    8 +
 ...xt => castxml1.any.Destructor-annotate.xml.txt} |    6 +-
 ...tor.xml.txt => castxml1.any.Destructor.xml.txt} |    6 +-
 .../castxml1.any.Enumeration-annotate.xml.txt      |    8 +
 .../castxml1.any.Enumeration-anonymous.xml.txt     |   10 +
 test/expect/castxml1.any.Enumeration.xml.txt       |    9 +
 ...xml.txt => castxml1.any.Field-annotate.xml.txt} |    6 +-
 ...ny.Field.xml.txt => castxml1.any.Field.xml.txt} |   10 +-
 ...castxml1.any.Function-Argument-Annotate.xml.txt |   10 +
 .../castxml1.any.Function-Argument-decay.xml.txt   |   17 +
 ...ml1.any.Function-Argument-default-cast.xml.txt} |   42 +-
 ...txml1.any.Function-Argument-default-ns.xml.txt} |   10 +-
 .../castxml1.any.Function-Argument-default.xml.txt |   14 +
 test/expect/castxml1.any.Function-annotate.xml.txt |   10 +
 ...unction-calling-convention-ms-annotate.xml.txt} |   18 +-
 ...ml1.any.Function-calling-convention-ms.xml.txt} |   14 +-
 .../castxml1.any.Function-rvalue-reference.xml.txt |    9 +
 ....txt => castxml1.any.Function-template.xml.txt} |   12 +-
 test/expect/castxml1.any.Function-throw.xml.txt    |   11 +
 test/expect/castxml1.any.Function-variadic.xml.txt |   11 +
 test/expect/castxml1.any.Function.xml.txt          |   10 +
 .../castxml1.any.FunctionType-variadic.xml.txt     |   12 +
 test/expect/castxml1.any.FunctionType.xml.txt      |   11 +
 test/expect/castxml1.any.FundamentalType.xml.txt   |    7 +
 test/expect/castxml1.any.FundamentalTypes.xml.txt  |   32 +
 .../castxml1.any.GNU-float128-nostart.xml.txt      |    5 +
 ...8.xml.txt => castxml1.any.GNU-float128.xml.txt} |   14 +-
 test/expect/castxml1.any.GNU-va_arg_pack.xml.txt   |   10 +
 ...txml1.any.Method-Argument-default-cast.xml.txt} |   16 +-
 ...> castxml1.any.Method-Argument-default.xml.txt} |   10 +-
 ...ml.txt => castxml1.any.Method-annotate.xml.txt} |    8 +-
 ...l.txt => castxml1.any.Method-overrides.xml.txt} |   26 +-
 ...> castxml1.any.Method-rvalue-reference.xml.txt} |   16 +-
 ....Method.xml.txt => castxml1.any.Method.xml.txt} |    8 +-
 test/expect/castxml1.any.MethodType-cv.xml.txt     |   13 +
 test/expect/castxml1.any.MethodType.xml.txt        |   12 +
 ...> castxml1.any.Namespace-Class-members.xml.txt} |    6 +-
 ...amespace-Class-partial-template-members.xml.txt |    5 +
 ...l1.any.Namespace-Class-template-members.xml.txt |    5 +
 ...any.Namespace-Function-template-members.xml.txt |    5 +
 .../castxml1.any.Namespace-anonymous.xml.txt       |    8 +
 test/expect/castxml1.any.Namespace-empty.xml.txt   |    5 +
 ...castxml1.any.Namespace-extern-C-members.xml.txt |   11 +
 .../castxml1.any.Namespace-inline-start.xml.txt    |    3 +
 ...castxml1.any.Namespace-inline-template.xml.txt} |    8 +-
 test/expect/castxml1.any.Namespace-inline.xml.txt  |    8 +
 .../expect/castxml1.any.Namespace-nested-1.xml.txt |   11 +
 .../expect/castxml1.any.Namespace-nested-2.xml.txt |   11 +
 test/expect/castxml1.any.Namespace-nested.xml.txt  |   13 +
 .../castxml1.any.Namespace-repeat-start.xml.txt    |    9 +
 test/expect/castxml1.any.Namespace-repeat.xml.txt  |   10 +
 test/expect/castxml1.any.Namespace.xml.txt         |    5 +
 test/expect/castxml1.any.OffsetType-cv.xml.txt     |   11 +
 test/expect/castxml1.any.OffsetType.xml.txt        |    9 +
 .../castxml1.any.OperatorFunction-annotate.xml.txt |   13 +
 test/expect/castxml1.any.OperatorFunction.xml.txt  |   13 +
 ...> castxml1.any.OperatorMethod-annotate.xml.txt} |    8 +-
 ...xml.txt => castxml1.any.OperatorMethod.xml.txt} |    8 +-
 test/expect/castxml1.any.PointerType.xml.txt       |    8 +
 .../castxml1.any.RValueReferenceType.xml.txt       |    5 +
 test/expect/castxml1.any.ReferenceType.xml.txt     |    8 +
 test/expect/castxml1.any.TypeAlias.xml.txt         |    5 +
 test/expect/castxml1.any.TypeAliasTemplate.xml.txt |    5 +
 test/expect/castxml1.any.Typedef-annotate.xml.txt  |    7 +
 test/expect/castxml1.any.Typedef-paren.xml.txt     |    7 +
 ...castxml1.any.Typedef-to-Class-template.xml.txt} |    8 +-
 ...1.any.Typedef-to-Enumeration-anonymous.xml.txt} |    6 +-
 ...=> castxml1.any.Typedef-to-Enumeration.xml.txt} |    6 +-
 ...ml1.any.Typedef-to-FundamentalType-mode.xml.txt |    7 +
 ...ypedef-to-extern-C-FundamentalType-mode.xml.txt |    7 +
 test/expect/castxml1.any.Variable-annotate.xml.txt |    7 +
 ....txt => castxml1.any.Variable-in-Class.xml.txt} |    6 +-
 .../expect/castxml1.any.Variable-init-cast.xml.txt |   10 +
 test/expect/castxml1.any.Variable-init-ns.xml.txt  |   10 +
 test/expect/castxml1.any.Variable-init.xml.txt     |   12 +
 test/expect/castxml1.any.Variable.xml.txt          |    7 +
 test/expect/castxml1.any.implicit-decl-ms.xml.txt  |   11 +
 test/expect/castxml1.any.inline-asm-ms.xml.txt     |    7 +
 ... => castxml1.any.invalid-decl-for-type.xml.txt} |   38 +-
 test/expect/castxml1.any.nostart.xml.txt           |   10 +
 ...xt => castxml1.any.qualified-type-name.xml.txt} |    8 +-
 ...> castxml1.any.using-declaration-class.xml.txt} |   26 +-
 .../castxml1.any.using-declaration-ns.xml.txt      |    7 +
 .../castxml1.any.using-declaration-start.xml.txt   |    7 +
 .../expect/castxml1.any.using-directive-ns.xml.txt |    5 +
 .../castxml1.any.using-directive-start.xml.txt     |    7 +
 ...en.any.ReferenceType-to-Class-template.xml.txt} |   24 +-
 ....xml.txt => castxml1.c++11.Class-bases.xml.txt} |   46 +-
 ...=> castxml1.c++11.Class-template-bases.xml.txt} |   32 +-
 ....xml.txt => castxml1.c++14.Class-bases.xml.txt} |   46 +-
 ...=> castxml1.c++14.Class-template-bases.xml.txt} |   32 +-
 test/expect/castxml1.c++98.CXXLiteral.result.txt   |    1 +
 test/expect/castxml1.c++98.CXXLiteral.stderr.txt   |    1 +
 test/expect/castxml1.c++98.CXXLiteral.xml.txt      |    1 +
 ....xml.txt => castxml1.c++98.Class-bases.xml.txt} |   46 +-
 ...=> castxml1.c++98.Class-template-bases.xml.txt} |   32 +-
 ...xml1.c++98.Function-rvalue-reference.stderr.txt |    1 +
 ...stxml1.c++98.Method-rvalue-reference.stderr.txt |    1 +
 .../castxml1.c++98.RValueReferenceType.stderr.txt  |    1 +
 test/expect/castxml1.c++98.TypeAlias.stderr.txt    |    1 +
 .../castxml1.c++98.TypeAliasTemplate.stderr.txt    |    1 +
 test/expect/castxml1.c.FunctionNoProto.xml.txt     |    7 +
 test/expect/castxml1.c.FundamentalType.xml.txt     |    7 +
 .../expect/castxml1.c.GNU-float128-nostart.xml.txt |    5 +
 test/expect/castxml1.c.GNU-float128.xml.txt        |    9 +
 test/expect/castxml1.c.GNU-va_arg_pack.xml.txt     |   10 +
 .../expect/castxml1.c.Typedef-called-class.xml.txt |    8 +
 test/expect/castxml1.c.invalid.result.txt          |    1 +
 test/expect/castxml1.c.invalid.stderr.txt          |    1 +
 test/expect/cmd.castxml-and-objc1.result.txt       |    1 +
 test/expect/cmd.castxml-and-objc1.stderr.txt       |    1 +
 test/expect/cmd.castxml-and-objc2.result.txt       |    1 +
 test/expect/cmd.castxml-and-objc2.stderr.txt       |    1 +
 test/expect/cmd.castxml-empty-c++98-E.stdout.txt   |    2 +
 test/expect/cmd.castxml-mix1.result.txt            |    1 +
 test/expect/cmd.castxml-mix1.stderr.txt            |    3 +
 test/expect/cmd.castxml-mix2.result.txt            |    1 +
 test/expect/cmd.castxml-mix2.stderr.txt            |    3 +
 test/expect/cmd.castxml-twice.result.txt           |    1 +
 test/expect/cmd.castxml-twice.stderr.txt           |    3 +
 .../cmd.castxml-wrong-epic-version.result.txt      |    1 +
 .../cmd.castxml-wrong-epic-version.stderr.txt      |    3 +
 test/expect/gccxml.any.CXXLiteral.xml.txt          |    5 +
 test/expect/gccxml.any.Class-abstract.xml.txt      |    8 +-
 test/expect/gccxml.any.Class-base-offset.xml.txt   |    2 +-
 test/expect/gccxml.any.Class-base-typedef.xml.txt  |   14 +-
 test/expect/gccxml.any.Class-forward.xml.txt       |   12 +-
 test/expect/gccxml.any.Class-friends.xml.txt       |   16 +-
 ...ny.Class-implicit-member-access-mutable.xml.txt |   20 +-
 ...gccxml.any.Class-implicit-member-access.xml.txt |   18 +-
 .../gccxml.any.Class-implicit-member-array.xml.txt |    2 +-
 ...cxml.any.Class-implicit-member-bad-base.xml.txt |   12 +-
 ...y.Class-implicit-member-const-aggregate.xml.txt |    2 +-
 .../gccxml.any.Class-implicit-member-const.xml.txt |    4 +-
 ...xml.any.Class-implicit-member-reference.xml.txt |    4 +-
 .../gccxml.any.Class-implicit-members.xml.txt      |    4 +-
 ...gccxml.any.Class-member-template-access.xml.txt |   18 +-
 .../gccxml.any.Class-member-template.xml.txt       |    4 +-
 ...y.Class-partial-template-member-Typedef.xml.txt |   20 +-
 ...ny.Class-template-Method-Argument-const.xml.txt |   18 +-
 ....Class-template-Method-Argument-default.xml.txt |   18 +-
 ....any.Class-template-Method-return-const.xml.txt |   16 +-
 ...any.Class-template-constructor-template.xml.txt |   16 +-
 .../gccxml.any.Class-template-friends.xml.txt      |   20 +-
 ...any.Class-template-member-Typedef-const.xml.txt |   20 +-
 ...ccxml.any.Class-template-member-Typedef.xml.txt |   20 +-
 ...ass-template-member-nontemplate-Typedef.xml.txt |   10 +
 ...cxml.any.Class-template-member-template.xml.txt |   18 +-
 .../gccxml.any.Class-template-recurse.xml.txt      |   16 +-
 test/expect/gccxml.any.Class-template.xml.txt      |   30 +-
 .../expect/gccxml.any.Constructor-annotate.xml.txt |    2 +-
 test/expect/gccxml.any.Constructor.xml.txt         |    2 +-
 test/expect/gccxml.any.Converter-annotate.xml.txt  |    2 +-
 test/expect/gccxml.any.Converter.xml.txt           |    2 +-
 test/expect/gccxml.any.Destructor-annotate.xml.txt |    2 +-
 test/expect/gccxml.any.Destructor.xml.txt          |    2 +-
 test/expect/gccxml.any.Field-annotate.xml.txt      |    2 +-
 test/expect/gccxml.any.Field.xml.txt               |    6 +-
 ...cxml.any.Function-Argument-default-cast.xml.txt |   38 +-
 ...gccxml.any.Function-Argument-default-ns.xml.txt |    6 +-
 ...Function-calling-convention-ms-annotate.xml.txt |   14 +-
 test/expect/gccxml.any.Function-template.xml.txt   |    8 +-
 test/expect/gccxml.any.GNU-float128.xml.txt        |   10 +-
 ...gccxml.any.Method-Argument-default-cast.xml.txt |   12 +-
 .../gccxml.any.Method-Argument-default.xml.txt     |    6 +-
 test/expect/gccxml.any.Method-annotate.xml.txt     |    4 +-
 test/expect/gccxml.any.Method-overrides.xml.txt    |   22 +-
 .../gccxml.any.Method-rvalue-reference.xml.txt     |   12 +-
 test/expect/gccxml.any.Method.xml.txt              |    4 +-
 .../gccxml.any.Namespace-Class-members.xml.txt     |    2 +-
 .../gccxml.any.Namespace-inline-template.xml.txt   |    4 +-
 .../gccxml.any.OperatorMethod-annotate.xml.txt     |    4 +-
 test/expect/gccxml.any.OperatorMethod.xml.txt      |    4 +-
 .../gccxml.any.Typedef-to-Class-template.xml.txt   |    4 +-
 ...ml.any.Typedef-to-Enumeration-anonymous.xml.txt |    2 +-
 .../gccxml.any.Typedef-to-Enumeration.xml.txt      |    2 +-
 test/expect/gccxml.any.Variable-in-Class.xml.txt   |    2 +-
 .../gccxml.any.invalid-decl-for-type.xml.txt       |   34 +-
 test/expect/gccxml.any.qualified-type-name.xml.txt |    4 +-
 .../gccxml.any.using-declaration-class.xml.txt     |   22 +-
 ...ken.any.ReferenceType-to-Class-template.xml.txt |   20 +-
 test/expect/gccxml.c++11.Class-bases.xml.txt       |   42 +-
 .../gccxml.c++11.Class-template-bases.xml.txt      |   28 +-
 test/expect/gccxml.c++14.Class-bases.xml.txt       |   42 +-
 .../gccxml.c++14.Class-template-bases.xml.txt      |   28 +-
 test/expect/gccxml.c++98.CXXLiteral.result.txt     |    1 +
 test/expect/gccxml.c++98.CXXLiteral.stderr.txt     |    1 +
 test/expect/gccxml.c++98.CXXLiteral.xml.txt        |    1 +
 test/expect/gccxml.c++98.Class-bases.xml.txt       |   42 +-
 .../gccxml.c++98.Class-template-bases.xml.txt      |   28 +-
 test/input/CXXLiteral.cxx                          |    3 +
 test/input/Class-abstract.cxx                      |    3 +-
 test/input/Class-annotate.cxx                      |    4 +-
 test/input/Class-base-offset.cxx                   |   19 +-
 test/input/Class-base-typedef.cxx                  |    8 +-
 test/input/Class-bases.cxx                         |   19 +-
 test/input/Class-forward.cxx                       |    3 +-
 test/input/Class-friends.cxx                       |    7 +-
 .../input/Class-implicit-member-access-mutable.cxx |    8 +-
 test/input/Class-implicit-member-access.cxx        |    8 +-
 test/input/Class-implicit-member-array.cxx         |    3 +-
 test/input/Class-implicit-member-bad-base.cxx      |   12 +-
 .../Class-implicit-member-const-aggregate.cxx      |    3 +-
 test/input/Class-implicit-member-const.cxx         |    4 +-
 test/input/Class-implicit-member-reference.cxx     |    4 +-
 test/input/Class-implicit-members.cxx              |    6 +-
 test/input/Class-incomplete-twice.cxx              |    4 +-
 test/input/Class-member-template-access.cxx        |    9 +-
 test/input/Class-member-template.cxx               |    9 +-
 .../Class-partial-template-member-Typedef.cxx      |    8 +-
 .../input/Class-template-Method-Argument-const.cxx |    4 +-
 .../Class-template-Method-Argument-default.cxx     |    4 +-
 test/input/Class-template-Method-return-const.cxx  |    4 +-
 test/input/Class-template-bases.cxx                |   14 +-
 test/input/Class-template-constructor-template.cxx |   12 +-
 test/input/Class-template-friends.cxx              |   13 +-
 test/input/Class-template-member-Typedef-const.cxx |    5 +-
 test/input/Class-template-member-Typedef.cxx       |    5 +-
 .../Class-template-member-nontemplate-Typedef.cxx  |   10 +
 test/input/Class-template-member-template.cxx      |   10 +-
 test/input/Class-template-recurse.cxx              |   19 +-
 test/input/Class-template.cxx                      |   15 +-
 test/input/Class.cxx                               |    4 +-
 test/input/Constructor-annotate.cxx                |    5 +-
 test/input/Constructor.cxx                         |    3 +-
 test/input/Converter-annotate.cxx                  |    5 +-
 test/input/Converter.cxx                           |    3 +-
 test/input/Destructor-annotate.cxx                 |    5 +-
 test/input/Destructor.cxx                          |    3 +-
 test/input/Enumeration-annotate.cxx                |    5 +-
 test/input/Enumeration-anonymous.cxx               |    9 +-
 test/input/Enumeration.cxx                         |    3 +-
 test/input/Field-annotate.cxx                      |    5 +-
 test/input/Field.cxx                               |    5 +-
 test/input/Function-Argument-annotate.cxx          |    2 +-
 test/input/Function-Argument-default-cast.cxx      |   25 +-
 test/input/Function-Argument-default-ns.cxx        |    9 +-
 test/input/Function-annotate.cxx                   |    2 +-
 .../Function-calling-convention-ms-annotate.cxx    |   12 +-
 test/input/Function-calling-convention-ms.cxx      |    8 +-
 test/input/Function-template.cxx                   |    9 +-
 test/input/Function-variadic.cxx                   |    2 +-
 test/input/FunctionType-variadic.cxx               |    2 +-
 test/input/FundamentalTypes.cxx                    |   26 +-
 test/input/GNU-float128.cxx                        |    9 +-
 test/input/GNU-va_arg_pack.cxx                     |    3 +-
 test/input/Method-Argument-default-cast.cxx        |    7 +-
 test/input/Method-Argument-default.cxx             |    3 +-
 test/input/Method-annotate.cxx                     |    5 +-
 test/input/Method-overrides.cxx                    |    6 +-
 test/input/Method-rvalue-reference.cxx             |    3 +-
 test/input/Method.cxx                              |    3 +-
 test/input/MethodType-cv.cxx                       |    2 +-
 test/input/MethodType.cxx                          |    2 +-
 test/input/Namespace-Class-members.cxx             |    9 +-
 .../Namespace-Class-partial-template-members.cxx   |   14 +-
 test/input/Namespace-Class-template-members.cxx    |   11 +-
 test/input/Namespace-Function-template-members.cxx |    3 +-
 test/input/Namespace-anonymous.cxx                 |    6 +-
 test/input/Namespace-empty.cxx                     |    2 +-
 test/input/Namespace-extern-C-members.cxx          |    8 +-
 test/input/Namespace-inline-start.cxx              |    3 +-
 test/input/Namespace-inline-template.cxx           |   11 +-
 test/input/Namespace-inline.cxx                    |   12 +-
 test/input/Namespace-nested.cxx                    |   18 +-
 test/input/Namespace-repeat-start.cxx              |    4 +-
 test/input/Namespace-repeat.cxx                    |   12 +-
 test/input/Namespace.cxx                           |    3 +-
 test/input/OffsetType-cv.cxx                       |    2 +-
 test/input/OffsetType.cxx                          |    2 +-
 test/input/OperatorFunction-annotate.cxx           |    2 +-
 test/input/OperatorFunction.cxx                    |    2 +-
 test/input/OperatorMethod-annotate.cxx             |    5 +-
 test/input/OperatorMethod.cxx                      |    3 +-
 test/input/PointerType.cxx                         |    2 +-
 test/input/RValueReferenceType.cxx                 |    2 +-
 test/input/ReferenceType-to-Class-template.cxx     |    5 +-
 test/input/ReferenceType.cxx                       |    2 +-
 test/input/TypeAlias.cxx                           |    2 +-
 test/input/TypeAliasTemplate.cxx                   |    9 +-
 test/input/Typedef-annotate.cxx                    |    2 +-
 test/input/Typedef-paren.cxx                       |    2 +-
 test/input/Typedef-to-Class-template.cxx           |    3 +-
 test/input/Typedef-to-Enumeration-anonymous.cxx    |    3 +-
 test/input/Typedef-to-Enumeration.cxx              |    4 +-
 test/input/Typedef-to-FundamentalType-mode.cxx     |    2 +-
 .../Typedef-to-extern-C-FundamentalType-mode.cxx   |    2 +-
 test/input/Variable-annotate.cxx                   |    2 +-
 test/input/Variable-in-Class.cxx                   |    3 +-
 test/input/Variable-init-cast.cxx                  |    6 +-
 test/input/Variable-init-ns.cxx                    |    4 +-
 test/input/Variable-init.cxx                       |    4 +-
 test/input/inline-asm-ms.cxx                       |    5 +-
 test/input/invalid-decl-for-type.cxx               |   15 +-
 test/input/make_integer_seq.cxx                    |   15 +-
 test/input/nostart.cxx                             |    2 +-
 test/input/qualified-type-name.cxx                 |    4 +-
 test/input/using-declaration-class.cxx             |    6 +-
 test/input/using-declaration-ns.cxx                |    2 +-
 test/input/using-declaration-start.cxx             |    2 +-
 test/input/using-directive-ns.cxx                  |    4 +-
 test/input/using-directive-start.cxx               |    2 +-
 357 files changed, 3715 insertions(+), 2314 deletions(-)

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..a77589a
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,9 @@
+---
+# This configuration requires clang-format 3.8 or higher.
+BasedOnStyle: Mozilla
+AlignOperands: false
+AlwaysBreakAfterReturnType: None
+AlwaysBreakAfterDefinitionReturnType: None
+ColumnLimit: 79
+Standard: Cpp11
+...
diff --git a/README.rst b/README.rst
index 075dce9..24ca753 100644
--- a/README.rst
+++ b/README.rst
@@ -46,7 +46,8 @@ To build CastXML from source, first obtain the prerequisites:
 * `LLVM/Clang`_ compiler SDK install tree built using the C++ compiler.
   This version of CastXML has been tested with LLVM/Clang
 
-  - SVN revision ``267153``
+  - SVN revision ``280011``
+  - Release ``3.9``
   - Release ``3.8``
   - Release ``3.7``
   - Release ``3.6``
diff --git a/doc/manual/castxml.1.rst b/doc/manual/castxml.1.rst
index 82791cb..f934c60 100644
--- a/doc/manual/castxml.1.rst
+++ b/doc/manual/castxml.1.rst
@@ -18,9 +18,7 @@ Abstract Syntax Tree (AST) to a representation in XML.
 
 Source files are parsed as complete translation units using an
 internal `Clang`_ compiler.  XML output is enabled by the
-``--castxml-gccxml`` option and produces a format close to
-that of `gccxml`_.  Future versions of ``castxml`` may support
-alternative output formats.
+``--castxml-output=<v>`` or ``--castxml-gccxml`` option.
 
 .. _`Clang`: http://clang.llvm.org/
 .. _`gccxml`: http://gccxml.org
@@ -50,6 +48,11 @@ Remaining options are given to the internal Clang compiler.
   The language standard level detected from the given compiler
   may be overridden by a separate Clang ``-std=`` option.
 
+``--castxml-output=<v>``
+  Write XML output to to ``<src>.xml`` or file named by ``-o``.
+  The ``<v>`` specifies the "epic" format version number to generate,
+  and must be ``1``.
+
 ``--castxml-gccxml``
   Generate XML output in a format close to that of `gccxml`_.
   Write output to ``<src>.xml`` or file named by ``-o``.
@@ -69,12 +72,50 @@ Remaining options are given to the internal Clang compiler.
   Print ``castxml`` and internal Clang compiler usage information.
 
 ``-o <file>``
-  Write output to ``<file>``.  At most one ``<src>`` file may
-  be specified as input.
+  If output is generated (e.g. via ``--castxml-output=<v>``), write
+  the output to ``<file>``.  At most one ``<src>`` file may be specified
+  as input.
 
 ``--version``
   Print ``castxml`` and internal Clang compiler version information.
 
+
+Output Format Versions
+======================
+
+With ``--castxml-output=<v>``
+-----------------------------
+
+The XML root element tag will be of the form:
+
+.. code-block:: xml
+
+  <CastXML format="1.0.0">
+
+* The first component is the ``epic`` format version number given to the
+  ``--castxml-output=<v>`` flag, and currently must always be ``1``.
+* The second component is the ``major`` format version number and increments
+  when a new XML element is added or for other major changes.
+  Clients will need updating.
+* The third component is the ``minor`` format version number and increments
+  whenever a new XML attribute is added to an existing element or a minor
+  bug is fixed in the XML output of an existing element or attribute
+  (clients should work unchanged unless they want the new info).
+
+With ``--castxml-gccxml``
+-------------------------
+
+The XML root element tag will be of the form:
+
+.. code-block:: xml
+
+  <GCC_XML version="0.9.0" cvs_revision="1.139">
+
+The ``version`` number corresponds to the last `gccxml`_ version that was
+ever released (for backward compatibility).  The ``cvs_revision`` number is
+a running number that is incremented for each minor change in the xml format.
+
+
 Preprocessing
 =============
 
@@ -99,3 +140,36 @@ case, CastXML always adds the following predefined macros:
 
 Source files may use these to identify the tool that is actually doing the
 preprocessing even when ``--castxml-cc-<id>`` changes the predefined macros.
+
+FAQ
+===
+
+Why are C++ function bodies not dumped in XML?
+----------------------------------------------
+
+This feature has not been implemented because the driving project for which
+CastXML was written had no need for function bodies.
+
+Is there a DTD specifying the XML format dumped?
+------------------------------------------------
+
+No.
+
+Why don't I see templates in the output?
+----------------------------------------
+
+This feature has not been implemented because the driving project for which
+CastXML was written had no need for uninstantiated templates.
+Template instantiations will still be dumped, though. For example:
+
+.. code-block:: c++
+
+  template <class T> struct foo {};
+  typedef foo<int>::foo foo_int;
+
+will instantiate ``foo<int>``, which will be included in the output.
+However, there will be no place that explicitly lists the set of types used
+for the instantiation other than in the name. This is because the proper way to
+do it is to dump the templates too and reference them from the instantiations
+with the template arguments listed. Since the features will be linked they
+should be implemented together.
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 667f04e..478568c 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -50,6 +50,9 @@ llvm_map_components_to_libnames(llvm_libs
   support
   ${LLVM_TARGETS_TO_BUILD}
   )
+if(WIN32)
+  list(APPEND llvm_libs version.lib)
+endif()
 
 add_executable(castxml
   castxml.cxx
diff --git a/src/Detect.cxx b/src/Detect.cxx
index ec1e8e6..21bfef2 100644
--- a/src/Detect.cxx
+++ b/src/Detect.cxx
@@ -29,27 +29,24 @@
 #include <iostream>
 #include <string.h>
 
-//----------------------------------------------------------------------------
 static std::string getClangBuiltinIncludeDir()
 {
   return getClangResourceDir() + "/include";
 }
 
-//----------------------------------------------------------------------------
-static bool failedCC(const char* id,
-                     std::vector<const char*> const& args,
-                     std::string const& out,
-                     std::string const& err,
+static bool failedCC(const char* id, std::vector<const char*> const& args,
+                     std::string const& out, std::string const& err,
                      std::string const& msg)
 {
   std::cerr << "error: '--castxml-cc-" << id
             << "' compiler command failed:\n\n";
-  for(std::vector<const char*>::const_iterator i = args.begin(),
-        e = args.end(); i != e; ++i) {
+  for (std::vector<const char *>::const_iterator i = args.begin(),
+                                                 e = args.end();
+       i != e; ++i) {
     std::cerr << " '" << *i << "'";
   }
   std::cerr << "\n";
-  if(!msg.empty()) {
+  if (!msg.empty()) {
     std::cerr << msg << "\n";
   } else {
     std::cerr << out << "\n";
@@ -58,54 +55,47 @@ static bool failedCC(const char* id,
   return false;
 }
 
-//----------------------------------------------------------------------------
 static void fixPredefines(Options& opts)
 {
   // Remove any detected conflicting definition of a Clang builtin macro.
   std::string& pd = opts.Predefines;
   std::string::size_type beg = 0;
-  while ((beg = pd.find("#define __has", beg),
-          beg != std::string::npos)) {
+  while ((beg = pd.find("#define __has", beg), beg != std::string::npos)) {
     std::string::size_type end = pd.find('\n', beg);
     if (end != std::string::npos) {
-      pd.erase(beg, end+1 - beg);
+      pd.erase(beg, end + 1 - beg);
     } else {
       pd.erase(beg);
     }
   }
 }
 
-//----------------------------------------------------------------------------
 static void setTriple(Options& opts)
 {
   std::string const& pd = opts.Predefines;
   llvm::Triple triple(llvm::sys::getDefaultTargetTriple());
-  if(pd.find("#define __x86_64__ 1") != pd.npos ||
-     pd.find("#define _M_X64 ") != pd.npos) {
+  if (pd.find("#define __x86_64__ 1") != pd.npos ||
+      pd.find("#define _M_X64 ") != pd.npos) {
     triple.setArchName("x86_64");
-  } else if(pd.find("#define __amd64__ 1") != pd.npos ||
-            pd.find("#define _M_AMD64 ") != pd.npos) {
+  } else if (pd.find("#define __amd64__ 1") != pd.npos ||
+             pd.find("#define _M_AMD64 ") != pd.npos) {
     triple.setArchName("amd64");
-  } else if(pd.find("#define __i386__ 1") != pd.npos ||
-            pd.find("#define _M_IX86 ") != pd.npos) {
+  } else if (pd.find("#define __i386__ 1") != pd.npos ||
+             pd.find("#define _M_IX86 ") != pd.npos) {
     triple.setArchName("i386");
   }
-  if(pd.find("#define _WIN32 1") != pd.npos) {
+  if (pd.find("#define _WIN32 1") != pd.npos) {
     triple.setVendorName("pc");
     triple.setOSName("windows");
   }
-  if(pd.find("#define __MINGW32__ 1") != pd.npos) {
+  if (pd.find("#define __MINGW32__ 1") != pd.npos) {
     triple.setEnvironmentName("gnu");
   }
   opts.Triple = triple.getTriple();
 }
 
-//----------------------------------------------------------------------------
-static bool detectCC_GNU(const char* const* argBeg,
-                         const char* const* argEnd,
-                         Options& opts,
-                         const char* id,
-                         const char* ext)
+static bool detectCC_GNU(const char* const* argBeg, const char* const* argEnd,
+                         Options& opts, const char* id, const char* ext)
 {
   std::string const fwExplicitSuffix = " (framework directory)";
   std::string const fwImplicitSuffix = "/Frameworks";
@@ -119,33 +109,33 @@ static bool detectCC_GNU(const char* const* argBeg,
   cc_args.push_back("-dM");
   cc_args.push_back("-v");
   cc_args.push_back(empty_cpp.c_str());
-  if(runCommand(int(cc_args.size()), &cc_args[0], ret, out, err, msg) &&
-     ret == 0) {
+  if (runCommand(int(cc_args.size()), &cc_args[0], ret, out, err, msg) &&
+      ret == 0) {
     opts.Predefines = out;
     const char* start_line = "#include <...> search starts here:";
-    if(const char* c = strstr(err.c_str(), start_line)) {
-      if((c = strchr(c, '\n'), c++)) {
-        while(*c++ == ' ') {
-          if(const char* e = strchr(c, '\n')) {
+    if (const char* c = strstr(err.c_str(), start_line)) {
+      if ((c = strchr(c, '\n'), c++)) {
+        while (*c++ == ' ') {
+          if (const char* e = strchr(c, '\n')) {
             const char* s = c;
             c = e + 1;
-            if(*(e - 1) == '\r') {
+            if (*(e - 1) == '\r') {
               --e;
             }
-            std::string inc(s, e-s);
+            std::string inc(s, e - s);
             std::replace(inc.begin(), inc.end(), '\\', '/');
             bool fw = ((inc.size() > fwExplicitSuffix.size()) &&
-                       (inc.substr(inc.size()-fwExplicitSuffix.size()) ==
+                       (inc.substr(inc.size() - fwExplicitSuffix.size()) ==
                         fwExplicitSuffix));
-            if(fw) {
-              inc = inc.substr(0, inc.size()-fwExplicitSuffix.size());
+            if (fw) {
+              inc = inc.substr(0, inc.size() - fwExplicitSuffix.size());
             } else {
               fw = ((inc.size() > fwImplicitSuffix.size()) &&
-                    (inc.substr(inc.size()-fwImplicitSuffix.size()) ==
+                    (inc.substr(inc.size() - fwImplicitSuffix.size()) ==
                      fwImplicitSuffix));
             }
             // Replace the compiler builtin include directory with ours.
-            if (!fw && llvm::sys::fs::exists(inc+"/emmintrin.h")) {
+            if (!fw && llvm::sys::fs::exists(inc + "/emmintrin.h")) {
               inc = getClangBuiltinIncludeDir();
             }
             opts.Includes.push_back(Options::Include(inc, fw));
@@ -161,12 +151,8 @@ static bool detectCC_GNU(const char* const* argBeg,
   }
 }
 
-//----------------------------------------------------------------------------
-static bool detectCC_MSVC(const char* const* argBeg,
-                          const char* const* argEnd,
-                          Options& opts,
-                          const char* id,
-                          const char* ext)
+static bool detectCC_MSVC(const char* const* argBeg, const char* const* argEnd,
+                          Options& opts, const char* id, const char* ext)
 {
   std::vector<const char*> cc_args(argBeg, argEnd);
   std::string detect_vs_cpp = getResourceDir() + "/detect_vs." + ext;
@@ -177,16 +163,16 @@ static bool detectCC_MSVC(const char* const* argBeg,
   cc_args.push_back("-c");
   cc_args.push_back("-FoNUL");
   cc_args.push_back(detect_vs_cpp.c_str());
-  if(runCommand(int(cc_args.size()), &cc_args[0], ret, out, err, msg) &&
-     ret == 0) {
-    if(const char* predefs = strstr(out.c_str(), "\n#define")) {
-      opts.Predefines = predefs+1;
+  if (runCommand(int(cc_args.size()), &cc_args[0], ret, out, err, msg) &&
+      ret == 0) {
+    if (const char* predefs = strstr(out.c_str(), "\n#define")) {
+      opts.Predefines = predefs + 1;
     }
-    if(const char* includes_str = std::getenv("INCLUDE")) {
+    if (const char* includes_str = std::getenv("INCLUDE")) {
       llvm::SmallVector<llvm::StringRef, 8> includes;
       llvm::StringRef includes_ref(includes_str);
       includes_ref.split(includes, ";", -1, false);
-      for (llvm::StringRef i: includes) {
+      for (llvm::StringRef i : includes) {
         if (!i.empty()) {
           std::string inc = i;
           std::replace(inc.begin(), inc.end(), '\\', '/');
@@ -202,11 +188,8 @@ static bool detectCC_MSVC(const char* const* argBeg,
   }
 }
 
-//----------------------------------------------------------------------------
-bool detectCC(const char* id,
-              const char* const* argBeg,
-              const char* const* argEnd,
-              Options& opts)
+bool detectCC(const char* id, const char* const* argBeg,
+              const char* const* argEnd, Options& opts)
 {
   if (strcmp(id, "gnu") == 0) {
     return detectCC_GNU(argBeg, argEnd, opts, id, "cpp");
diff --git a/src/Detect.h b/src/Detect.h
index 1877433..652d712 100644
--- a/src/Detect.h
+++ b/src/Detect.h
@@ -20,9 +20,7 @@ struct Options;
 
 /// detectCC - Detect settings from given compiler command.
 
-bool detectCC(const char* id,
-              const char* const* argBeg,
-              const char* const* argEnd,
-              Options& opts);
+bool detectCC(const char* id, const char* const* argBeg,
+              const char* const* argEnd, Options& opts);
 
 #endif // CASTXML_DETECT_H
diff --git a/src/Options.h b/src/Options.h
index 34f5089..0c7ffd9 100644
--- a/src/Options.h
+++ b/src/Options.h
@@ -22,16 +22,30 @@
 
 struct Options
 {
-  Options(): PPOnly(false), GccXml(false), HaveCC(false),
-    HaveStd(false), HaveTarget(false) {}
+  Options()
+    : PPOnly(false)
+    , GccXml(false)
+    , CastXml(false)
+    , HaveCC(false)
+    , HaveStd(false)
+    , HaveTarget(false)
+    , CastXmlEpicFormatVersion(1)
+  {
+  }
   bool PPOnly;
   bool GccXml;
+  bool CastXml;
   bool HaveCC;
   bool HaveStd;
   bool HaveTarget;
-  struct Include {
-    Include(std::string const& d, bool f = false):
-      Directory(d), Framework(f) {}
+  unsigned int CastXmlEpicFormatVersion;
+  struct Include
+  {
+    Include(std::string const& d, bool f = false)
+      : Directory(d)
+      , Framework(f)
+    {
+    }
     std::string Directory;
     bool Framework;
   };
diff --git a/src/Output.cxx b/src/Output.cxx
index e16d9b9..fe70d17 100644
--- a/src/Output.cxx
+++ b/src/Output.cxx
@@ -42,7 +42,6 @@
 #include <string>
 #include <vector>
 
-//----------------------------------------------------------------------------
 class ASTVisitorBase
 {
 protected:
@@ -50,12 +49,17 @@ protected:
   clang::ASTContext const& CTX;
   llvm::raw_ostream& OS;
 
-  ASTVisitorBase(clang::CompilerInstance& ci,
-                 clang::ASTContext const& ctx,
-                 llvm::raw_ostream& os): CI(ci), CTX(ctx), OS(os) {}
+  ASTVisitorBase(clang::CompilerInstance& ci, clang::ASTContext const& ctx,
+                 llvm::raw_ostream& os)
+    : CI(ci)
+    , CTX(ctx)
+    , OS(os)
+  {
+  }
 
   // Represent cv qualifier state of one dump node.
-  struct DumpQual {
+  struct DumpQual
+  {
   private:
     typedef void (DumpQual::*bool_type)() const;
     void bool_true() const {}
@@ -63,12 +67,20 @@ protected:
     bool IsConst;
     bool IsVolatile;
     bool IsRestrict;
-    DumpQual(): IsConst(false), IsVolatile(false), IsRestrict(false) {}
-    operator bool_type() const {
-      return (this->IsConst || this->IsVolatile || this->IsRestrict)?
-        &DumpQual::bool_true : nullptr;
+    DumpQual()
+      : IsConst(false)
+      , IsVolatile(false)
+      , IsRestrict(false)
+    {
+    }
+    operator bool_type() const
+    {
+      return (this->IsConst || this->IsVolatile || this->IsRestrict)
+        ? &DumpQual::bool_true
+        : nullptr;
     }
-    friend bool operator < (DumpQual const& l, DumpQual const& r) {
+    friend bool operator<(DumpQual const& l, DumpQual const& r)
+    {
       if (!l.IsConst && r.IsConst) {
         return true;
       } else if (l.IsConst && !r.IsConst) {
@@ -85,28 +97,39 @@ protected:
         return false;
       }
     }
-    friend llvm::raw_ostream& operator << (llvm::raw_ostream& os,
-                                           DumpQual const& dq) {
-      return os << (dq.IsConst? "c":"")
-                << (dq.IsVolatile? "v":"")
-                << (dq.IsRestrict? "r":"");
+    friend llvm::raw_ostream& operator<<(llvm::raw_ostream& os,
+                                         DumpQual const& dq)
+    {
+      return os << (dq.IsConst ? "c" : "") << (dq.IsVolatile ? "v" : "")
+                << (dq.IsRestrict ? "r" : "");
     }
   };
 
   // Represent id of one dump node.
-  struct DumpId {
+  struct DumpId
+  {
   private:
     typedef void (DumpId::*bool_type)() const;
     void bool_true() const {}
   public:
     unsigned int Id;
     DumpQual Qual;
-    DumpId(): Id(0), Qual() {}
-    DumpId(unsigned int id, DumpQual dq): Id(id), Qual(dq) {}
-    operator bool_type() const {
-      return this->Id != 0? &DumpId::bool_true : nullptr;
+    DumpId()
+      : Id(0)
+      , Qual()
+    {
+    }
+    DumpId(unsigned int id, DumpQual dq)
+      : Id(id)
+      , Qual(dq)
+    {
+    }
+    operator bool_type() const
+    {
+      return this->Id != 0 ? &DumpId::bool_true : nullptr;
     }
-    friend bool operator < (DumpId const& l, DumpId const& r) {
+    friend bool operator<(DumpId const& l, DumpId const& r)
+    {
       if (l.Id < r.Id) {
         return true;
       } else if (l.Id > r.Id) {
@@ -115,15 +138,21 @@ protected:
         return l.Qual < r.Qual;
       }
     }
-    friend llvm::raw_ostream& operator << (llvm::raw_ostream& os,
-                                           DumpId const& id) {
+    friend llvm::raw_ostream& operator<<(llvm::raw_ostream& os,
+                                         DumpId const& id)
+    {
       return os << id.Id << id.Qual;
     }
   };
 
   // Record status of one AST node to be dumped.
-  struct DumpNode {
-    DumpNode(): Index(), Complete(false) {}
+  struct DumpNode
+  {
+    DumpNode()
+      : Index()
+      , Complete(false)
+    {
+    }
 
     // Index in nodes ordered by first encounter.
     DumpId Index;
@@ -132,76 +161,110 @@ protected:
     bool Complete;
   };
 
-  // Report all decl nodes as unimplemented until overridden.
+// Report all decl nodes as unimplemented until overridden.
 #define ABSTRACT_DECL(DECL)
-#define DECL(CLASS, BASE) \
-  void Output##CLASS##Decl(clang::CLASS##Decl const* d, DumpNode const* dn) { \
-    this->OutputUnimplementedDecl(d, dn); \
+#define DECL(CLASS, BASE)                                                     \
+  void Output##CLASS##Decl(clang::CLASS##Decl const* d, DumpNode const* dn)   \
+  {                                                                           \
+    this->OutputUnimplementedDecl(d, dn);                                     \
   }
 #include "clang/AST/DeclNodes.inc"
 
-  void OutputUnimplementedDecl(clang::Decl const* d, DumpNode const* dn) {
+  void OutputUnimplementedDecl(clang::Decl const* d, DumpNode const* dn)
+  {
+    /* clang-format off */
     this->OS << "  <Unimplemented id=\"_" << dn->Index
              << "\" kind=\"" << encodeXML(d->getDeclKindName()) << "\"/>\n";
+    /* clang-format on */
   }
 
-  // Report all type nodes as unimplemented until overridden.
+// Report all type nodes as unimplemented until overridden.
 #define ABSTRACT_TYPE(CLASS, BASE)
-#define TYPE(CLASS, BASE) \
-  void Output##CLASS##Type(clang::CLASS##Type const* t, DumpNode const* dn) { \
-    this->OutputUnimplementedType(t, dn); \
-    }
+#define TYPE(CLASS, BASE)                                                     \
+  void Output##CLASS##Type(clang::CLASS##Type const* t, DumpNode const* dn)   \
+  {                                                                           \
+    this->OutputUnimplementedType(t, dn);                                     \
+  }
 #include "clang/AST/TypeNodes.def"
 
-  void OutputUnimplementedType(clang::Type const* t, DumpNode const* dn) {
+  void OutputUnimplementedType(clang::Type const* t, DumpNode const* dn)
+  {
+    /* clang-format off */
     this->OS << "  <Unimplemented id=\"_" << dn->Index
              << "\" type_class=\"" << encodeXML(t->getTypeClassName())
              << "\"/>\n";
+    /* clang-format on */
   }
 };
 
-//----------------------------------------------------------------------------
-class ASTVisitor: public ASTVisitorBase
+class ASTVisitor : public ASTVisitorBase
 {
   // Store a type to be visited, possibly as a record member.
-  struct DumpType {
-    DumpType(): Type(), Class(0) {}
-    DumpType(clang::QualType t, clang::Type const* c = 0): Type(t), Class(c) {}
-    friend bool operator < (DumpType const& l, DumpType const& r) {
+  struct DumpType
+  {
+    DumpType()
+      : Type()
+      , Class(0)
+    {
+    }
+    DumpType(clang::QualType t, clang::Type const* c = 0)
+      : Type(t)
+      , Class(c)
+    {
+    }
+    friend bool operator<(DumpType const& l, DumpType const& r)
+    {
       // Order by pointer value without discarding low-order
       // bits used to encode qualifiers.
       void const* lpp = &l.Type;
       void const* rpp = &r.Type;
       void const* lpv = *static_cast<void const* const*>(lpp);
       void const* rpv = *static_cast<void const* const*>(rpp);
-      if(lpv < rpv) {
+      if (lpv < rpv) {
         return true;
-      } else if(lpv > rpv) {
+      } else if (lpv > rpv) {
         return false;
       } else {
         return l.Class < r.Class;
       }
     }
 
-    clang::QualType    Type;
+    clang::QualType Type;
     clang::Type const* Class;
   };
 
   // Store an entry in the node traversal queue.
-  struct QueueEntry {
+  struct QueueEntry
+  {
     // Available node kinds.
-    enum Kinds {
+    enum Kinds
+    {
       KindQual,
       KindDecl,
       KindType
     };
 
-    QueueEntry(DumpNode const* dn):
-      Kind(KindQual), Decl(nullptr), Type(), DN(dn) {}
-    QueueEntry(clang::Decl const* d, DumpNode const* dn):
-      Kind(KindDecl), Decl(d), Type(), DN(dn) {}
-    QueueEntry(DumpType t, DumpNode const* dn):
-      Kind(KindType), Decl(nullptr), Type(t), DN(dn) {}
+    QueueEntry(DumpNode const* dn)
+      : Kind(KindQual)
+      , Decl(nullptr)
+      , Type()
+      , DN(dn)
+    {
+    }
+    QueueEntry(clang::Decl const* d, DumpNode const* dn)
+      : Kind(KindDecl)
+      , Decl(d)
+      , Type()
+      , DN(dn)
+    {
+    }
+    QueueEntry(DumpType t, DumpNode const* dn)
+      : Kind(KindType)
+      , Decl(nullptr)
+      , Type(t)
+      , DN(dn)
+    {
+    }
 
     // Kind of node at this entry.
     Kinds Kind;
@@ -215,32 +278,36 @@ class ASTVisitor: public ASTVisitorBase
     // The dump status for this node.
     DumpNode const* DN;
 
-    friend bool operator < (QueueEntry const& l, QueueEntry const& r) {
+    friend bool operator<(QueueEntry const& l, QueueEntry const& r)
+    {
       return l.DN->Index < r.DN->Index;
     }
   };
 
-  class PrinterHelper: public clang::PrinterHelper {
+  class PrinterHelper : public clang::PrinterHelper
+  {
     ASTVisitor& Visitor;
+
   public:
-    PrinterHelper(ASTVisitor& v): Visitor(v) {}
-    bool handledStmt(clang::Stmt* s, llvm::raw_ostream& os) override {
+    PrinterHelper(ASTVisitor& v)
+      : Visitor(v)
+    {
+    }
+    bool handledStmt(clang::Stmt* s, llvm::raw_ostream& os) override
+    {
       return this->Visitor.PrintHelpStmt(s, os);
     }
   };
 
   /** Get the dump status node for a Clang declaration.  */
-  DumpNode* GetDumpNode(clang::Decl const* d) {
-    return &this->DeclNodes[d];
-  }
+  DumpNode* GetDumpNode(clang::Decl const* d) { return &this->DeclNodes[d]; }
 
   /** Get the dump status node for a Clang type.  */
-  DumpNode* GetDumpNode(DumpType t) {
-    return &this->TypeNodes[t];
-  }
+  DumpNode* GetDumpNode(DumpType t) { return &this->TypeNodes[t]; }
 
   /** Get the dump status node for a qualified DumpId.  */
-  DumpNode* GetDumpNode(DumpId id) {
+  DumpNode* GetDumpNode(DumpId id)
+  {
     assert(id.Qual);
     return &this->QualNodes[id];
   }
@@ -258,7 +325,8 @@ class ASTVisitor: public ASTVisitorBase
   DumpId AddQualDumpNode(DumpId id);
 
   /** Helper common to AddDeclDumpNode and AddTypeDumpNode.  */
-  template <typename K> DumpId AddDumpNodeImpl(K k, bool complete);
+  template <typename K>
+  DumpId AddDumpNodeImpl(K k, bool complete);
 
   /** Allocate a dump node for a source file entry.  */
   unsigned int AddDumpFile(clang::FileEntry const* f);
@@ -285,6 +353,12 @@ class ASTVisitor: public ASTVisitorBase
   void ProcessQueue();
   void ProcessFileQueue();
 
+  /** Output start tags on top of xml file. */
+  void OutputStartXMLTags();
+
+  /** Output end tags. */
+  void OutputEndXMLTags();
+
   /** Dispatch output of a declaration.  */
   void OutputDecl(clang::Decl const* d, DumpNode const* dn);
 
@@ -383,13 +457,14 @@ class ASTVisitor: public ASTVisitorBase
 
   /** Flags used by function output methods to pass information
       to the OutputFunctionHelper method.  */
-  enum FunctionHelperFlags {
-    FH_Returns    = (1<<0),
-    FH_Static     = (1<<1),
-    FH_Explicit   = (1<<2),
-    FH_Const      = (1<<3),
-    FH_Virtual    = (1<<4),
-    FH_Pure       = (1<<5),
+  enum FunctionHelperFlags
+  {
+    FH_Returns = (1 << 0),
+    FH_Static = (1 << 1),
+    FH_Explicit = (1 << 2),
+    FH_Const = (1 << 3),
+    FH_Virtual = (1 << 4),
+    FH_Pure = (1 << 5),
     FH__Last
   };
 
@@ -514,17 +589,17 @@ private:
   std::queue<clang::FileEntry const*> FileQueue;
 
 public:
-  ASTVisitor(clang::CompilerInstance& ci,
-             clang::ASTContext& ctx,
-             llvm::raw_ostream& os,
-             Options const& opts):
-    ASTVisitorBase(ci, ctx, os),
-    Opts(opts),
-    NodeCount(0), FileCount(0),
-    FileBuiltin(false),
-    RequireComplete(true),
-    MangleContext(ctx.createMangleContext()),
-    PrintingPolicy(ctx.getPrintingPolicy()) {
+  ASTVisitor(clang::CompilerInstance& ci, clang::ASTContext& ctx,
+             llvm::raw_ostream& os, Options const& opts)
+    : ASTVisitorBase(ci, ctx, os)
+    , Opts(opts)
+    , NodeCount(0)
+    , FileCount(0)
+    , FileBuiltin(false)
+    , RequireComplete(true)
+    , MangleContext(ctx.createMangleContext())
+    , PrintingPolicy(ctx.getPrintingPolicy())
+  {
     this->PrintingPolicy.SuppressUnwrittenScope = true;
   }
 
@@ -533,31 +608,31 @@ public:
   void HandleTranslationUnit(clang::TranslationUnitDecl const* tu);
 };
 
-//----------------------------------------------------------------------------
 ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
-                                               bool complete, bool forType) {
+                                               bool complete, bool forType)
+{
   // Select the definition or canonical declaration.
   d = d->getCanonicalDecl();
-  if(clang::RecordDecl const* rd = clang::dyn_cast<clang::RecordDecl>(d)) {
-    if(clang::RecordDecl const* rdd = rd->getDefinition()) {
+  if (clang::RecordDecl const* rd = clang::dyn_cast<clang::RecordDecl>(d)) {
+    if (clang::RecordDecl const* rdd = rd->getDefinition()) {
       d = rdd;
     }
   }
 
   // Replace some decls with those they reference.
   switch (d->getKind()) {
-  case clang::Decl::UsingShadow:
-    return this->AddDeclDumpNode(
-      static_cast<clang::UsingShadowDecl const*>(d)->getTargetDecl(),
-      complete, forType);
-  case clang::Decl::LinkageSpec: {
-    clang::DeclContext const* dc =
-      static_cast<clang::LinkageSpecDecl const*>(d)->getDeclContext();
-    return this->AddDeclDumpNode(clang::Decl::castFromDeclContext(dc),
-                                 complete, forType);
-  } break;
-  default:
-    break;
+    case clang::Decl::UsingShadow:
+      return this->AddDeclDumpNode(
+        static_cast<clang::UsingShadowDecl const*>(d)->getTargetDecl(),
+        complete, forType);
+    case clang::Decl::LinkageSpec: {
+      clang::DeclContext const* dc =
+        static_cast<clang::LinkageSpecDecl const*>(d)->getDeclContext();
+      return this->AddDeclDumpNode(clang::Decl::castFromDeclContext(dc),
+                                   complete, forType);
+    } break;
+    default:
+      break;
   }
 
   // Skip invalid declarations that are not needed for a type element.
@@ -566,22 +641,27 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
   }
 
   // Skip C++11 declarations gccxml does not support.
-  if (this->Opts.GccXml) {
+  if (this->Opts.GccXml || this->Opts.CastXml) {
     if (clang::FunctionDecl const* fd =
-        clang::dyn_cast<clang::FunctionDecl>(d)) {
+          clang::dyn_cast<clang::FunctionDecl>(d)) {
       if (fd->isDeleted()) {
         return DumpId();
       }
 
+      if (fd->getLiteralIdentifier()) {
+        return DumpId();
+      }
+
       if (clang::FunctionProtoType const* fpt =
-          fd->getType()->getAs<clang::FunctionProtoType>()) {
+            fd->getType()->getAs<clang::FunctionProtoType>()) {
         if (fpt->getReturnType()->isRValueReferenceType()) {
           return DumpId();
         }
         for (clang::FunctionProtoType::param_type_iterator
-               i = fpt->param_type_begin(), e = fpt->param_type_end();
+               i = fpt->param_type_begin(),
+               e = fpt->param_type_end();
              i != e; ++i) {
-          if((*i)->isRValueReferenceType()) {
+          if ((*i)->isRValueReferenceType()) {
             return DumpId();
           }
         }
@@ -597,7 +677,7 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
     }
 
     if (clang::TypedefDecl const* td =
-        clang::dyn_cast<clang::TypedefDecl>(d)) {
+          clang::dyn_cast<clang::TypedefDecl>(d)) {
       if (td->getUnderlyingType()->isRValueReferenceType()) {
         return DumpId();
       }
@@ -607,10 +687,10 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNode(clang::Decl const* d,
   return this->AddDumpNodeImpl(d, complete);
 }
 
-//----------------------------------------------------------------------------
 ASTVisitor::DumpId ASTVisitor::AddDeclDumpNodeForType(clang::Decl const* d,
                                                       bool complete,
-                                                      DumpQual dq) {
+                                                      DumpQual dq)
+{
   // Get the id for the canonical decl.
   DumpId id = this->AddDeclDumpNode(d, complete, true);
 
@@ -623,14 +703,14 @@ ASTVisitor::DumpId ASTVisitor::AddDeclDumpNodeForType(clang::Decl const* d,
   return id;
 }
 
-//----------------------------------------------------------------------------
 ASTVisitor::DumpId ASTVisitor::AddTypeDumpNode(DumpType dt, bool complete,
-                                               DumpQual dq) {
+                                               DumpQual dq)
+{
   clang::QualType t = dt.Type;
   clang::Type const* c = dt.Class;
 
   // Extract local qualifiers and recurse with locally unqualified type.
-  if(t.hasLocalQualifiers()) {
+  if (t.hasLocalQualifiers()) {
     dq.IsConst = dq.IsConst || t.isLocalConstQualified();
     dq.IsVolatile = dq.IsVolatile || t.isLocalVolatileQualified();
     dq.IsRestrict = dq.IsRestrict || t.isLocalRestrictQualified();
@@ -640,67 +720,74 @@ ASTVisitor::DumpId ASTVisitor::AddTypeDumpNode(DumpType dt, bool complete,
 
   // Replace some types with their decls.
   switch (t->getTypeClass()) {
-  case clang::Type::Adjusted:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::AdjustedType>()->getAdjustedType(), c),
-      complete, dq);
-  case clang::Type::Attributed:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::AttributedType>()->getEquivalentType(), c),
-      complete, dq);
-  case clang::Type::Decayed:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::DecayedType>()->getDecayedType(), c),
-      complete, dq);
-  case clang::Type::Elaborated:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::ElaboratedType>()->getNamedType(), c),
-      complete, dq);
-  case clang::Type::Enum:
-    return this->AddDeclDumpNodeForType(
-      t->getAs<clang::EnumType>()->getDecl(), complete, dq);
-  case clang::Type::Paren:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::ParenType>()->getInnerType(), c),
-      complete, dq);
-  case clang::Type::Record:
-    return this->AddDeclDumpNodeForType(
-      t->getAs<clang::RecordType>()->getDecl(), complete, dq);
-  case clang::Type::SubstTemplateTypeParm:
-    return this->AddTypeDumpNode(DumpType(
-      t->getAs<clang::SubstTemplateTypeParmType>()->getReplacementType(), c),
-      complete, dq);
-  case clang::Type::TemplateSpecialization: {
-    clang::TemplateSpecializationType const* tst =
-      t->getAs<clang::TemplateSpecializationType>();
-    if(tst->isSugared()) {
-      return this->AddTypeDumpNode(DumpType(tst->desugar(), c),
-                                   complete, dq);
-    }
-  } break;
-  case clang::Type::Typedef: {
-    clang::TypedefType const* tdt = t->getAs<clang::TypedefType>();
-    if(!tdt->isInstantiationDependentType() && tdt->isSugared()) {
-      if(clang::DeclContext const* tdc = tdt->getDecl()->getDeclContext()) {
-        if(clang::CXXRecordDecl const* tdx =
-           clang::dyn_cast<clang::CXXRecordDecl>(tdc)) {
-          if(tdx->getDescribedClassTemplate() ||
-             clang::isa<clang::ClassTemplatePartialSpecializationDecl>(tdx)
-             ) {
-            // This TypedefType refers to a non-dependent
-            // TypedefDecl member of a class template.  Since gccxml
-            // format does not include uninstantiated templates we
-            // must use the desugared type so that we do not end up
-            // referencing a class template as context.
-            return this->AddTypeDumpNode(tdt->desugar(), complete, dq);
+    case clang::Type::Adjusted:
+      return this->AddTypeDumpNode(
+        DumpType(t->getAs<clang::AdjustedType>()->getAdjustedType(), c),
+        complete, dq);
+    case clang::Type::Attributed:
+      return this->AddTypeDumpNode(
+        DumpType(t->getAs<clang::AttributedType>()->getEquivalentType(), c),
+        complete, dq);
+    case clang::Type::Decayed:
+      return this->AddTypeDumpNode(
+        DumpType(t->getAs<clang::DecayedType>()->getDecayedType(), c),
+        complete, dq);
+    case clang::Type::Elaborated:
+      return this->AddTypeDumpNode(
+        DumpType(t->getAs<clang::ElaboratedType>()->getNamedType(), c),
+        complete, dq);
+    case clang::Type::Enum:
+      return this->AddDeclDumpNodeForType(
+        t->getAs<clang::EnumType>()->getDecl(), complete, dq);
+    case clang::Type::Paren:
+      return this->AddTypeDumpNode(
+        DumpType(t->getAs<clang::ParenType>()->getInnerType(), c), complete,
+        dq);
+    case clang::Type::Record:
+      return this->AddDeclDumpNodeForType(
+        t->getAs<clang::RecordType>()->getDecl(), complete, dq);
+    case clang::Type::SubstTemplateTypeParm:
+      return this->AddTypeDumpNode(
+        DumpType(
+          t->getAs<clang::SubstTemplateTypeParmType>()->getReplacementType(),
+          c),
+        complete, dq);
+    case clang::Type::TemplateSpecialization: {
+      clang::TemplateSpecializationType const* tst =
+        t->getAs<clang::TemplateSpecializationType>();
+      if (tst->isSugared()) {
+        return this->AddTypeDumpNode(DumpType(tst->desugar(), c), complete,
+                                     dq);
+      }
+    } break;
+    case clang::Type::Typedef: {
+      clang::TypedefType const* tdt = t->getAs<clang::TypedefType>();
+      if (!tdt->isInstantiationDependentType() && tdt->isSugared()) {
+        // Make sure all containing contexts are not templates.
+        clang::Decl const* d = tdt->getDecl();
+        while (clang::DeclContext const* tdc = d->getDeclContext()) {
+          if (clang::CXXRecordDecl const* tdx =
+                clang::dyn_cast<clang::CXXRecordDecl>(tdc)) {
+            d = tdx;
+            if (tdx->getDescribedClassTemplate() ||
+                clang::isa<clang::ClassTemplatePartialSpecializationDecl>(
+                  tdx)) {
+              // This TypedefType refers to a non-dependent
+              // TypedefDecl member of a class template.  Since gccxml
+              // format does not include uninstantiated templates we
+              // must use the desugared type so that we do not end up
+              // referencing a class template as context.
+              return this->AddTypeDumpNode(tdt->desugar(), complete, dq);
+            }
+          } else {
+            break;
           }
         }
       }
-    }
-    return this->AddDeclDumpNodeForType(tdt->getDecl(), complete, dq);
-  } break;
-  default:
-    break;
+      return this->AddDeclDumpNodeForType(tdt->getDecl(), complete, dq);
+    } break;
+    default:
+      break;
   }
 
   // Get the id for the fully desugared, unqualified type.
@@ -715,8 +802,8 @@ ASTVisitor::DumpId ASTVisitor::AddTypeDumpNode(DumpType dt, bool complete,
   return id;
 }
 
-//----------------------------------------------------------------------------
-ASTVisitor::DumpId ASTVisitor::AddQualDumpNode(DumpId id) {
+ASTVisitor::DumpId ASTVisitor::AddQualDumpNode(DumpId id)
+{
   DumpNode* dn = this->GetDumpNode(id);
   if (!dn->Index) {
     dn->Index = id;
@@ -727,7 +814,6 @@ ASTVisitor::DumpId ASTVisitor::AddQualDumpNode(DumpId id) {
   return dn->Index;
 }
 
-//----------------------------------------------------------------------------
 template <typename K>
 ASTVisitor::DumpId ASTVisitor::AddDumpNodeImpl(K k, bool complete)
 {
@@ -735,7 +821,7 @@ ASTVisitor::DumpId ASTVisitor::AddDumpNodeImpl(K k, bool complete)
   DumpNode* dn = this->GetDumpNode(k);
   if (dn->Index) {
     // Node was already encountered.  See if it is now complete.
-    if(complete && !dn->Complete) {
+    if (complete && !dn->Complete) {
       // Node is now complete, but wasn't before.  Queue it.
       dn->Complete = true;
       this->Queue.insert(QueueEntry(k, dn));
@@ -744,7 +830,7 @@ ASTVisitor::DumpId ASTVisitor::AddDumpNodeImpl(K k, bool complete)
     // This is a new node.  Assign it an index.
     dn->Index.Id = ++this->NodeCount;
     dn->Complete = complete;
-    if(complete || !this->RequireComplete) {
+    if (complete || !this->RequireComplete) {
       // Node is complete.  Queue it.
       this->Queue.insert(QueueEntry(k, dn));
     }
@@ -753,59 +839,58 @@ ASTVisitor::DumpId ASTVisitor::AddDumpNodeImpl(K k, bool complete)
   return dn->Index;
 }
 
-//----------------------------------------------------------------------------
 unsigned int ASTVisitor::AddDumpFile(clang::FileEntry const* f)
 {
   unsigned int& index = this->FileNodes[f];
-  if(index == 0) {
+  if (index == 0) {
     index = ++this->FileCount;
     this->FileQueue.push(f);
   }
   return index;
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::AddClassTemplateDecl(clang::ClassTemplateDecl const* d,
                                       std::set<DumpId>* emitted)
 {
   // Queue all the instantiations of this class template.
-  for(clang::ClassTemplateDecl::spec_iterator i = d->spec_begin(),
-        e = d->spec_end(); i != e; ++i) {
+  for (clang::ClassTemplateDecl::spec_iterator i = d->spec_begin(),
+                                               e = d->spec_end();
+       i != e; ++i) {
     clang::CXXRecordDecl const* rd = *i;
     DumpId id = this->AddDeclDumpNode(rd, true);
-    if(id && emitted) {
+    if (id && emitted) {
       emitted->insert(id);
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::AddFunctionTemplateDecl(clang::FunctionTemplateDecl const* d,
                                          std::set<DumpId>* emitted)
 {
   // Queue all the instantiations of this function template.
-  for(clang::FunctionTemplateDecl::spec_iterator i = d->spec_begin(),
-        e = d->spec_end(); i != e; ++i) {
+  for (clang::FunctionTemplateDecl::spec_iterator i = d->spec_begin(),
+                                                  e = d->spec_end();
+       i != e; ++i) {
     clang::FunctionDecl const* fd = *i;
     DumpId id = this->AddDeclDumpNode(fd, true);
-    if(id && emitted) {
+    if (id && emitted) {
       emitted->insert(id);
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::AddDeclContextMembers(clang::DeclContext const* dc,
                                        std::set<DumpId>& emitted)
 {
   bool const isTranslationUnit = clang::isa<clang::TranslationUnitDecl>(dc);
 
-  for(clang::DeclContext::decl_iterator i = dc->decls_begin(),
-        e = dc->decls_end(); i != e; ++i) {
+  for (clang::DeclContext::decl_iterator i = dc->decls_begin(),
+                                         e = dc->decls_end();
+       i != e; ++i) {
     clang::Decl const* d = *i;
 
     // Skip declarations that are not really members of this context.
-    if(d->getDeclContext() != dc) {
+    if (d->getDeclContext() != dc) {
       continue;
     }
 
@@ -822,195 +907,194 @@ void ASTVisitor::AddDeclContextMembers(clang::DeclContext const* dc,
 
     // Ignore certain members.
     switch (d->getKind()) {
-    case clang::Decl::CXXRecord: {
-      clang::CXXRecordDecl const* rd =
-        static_cast<clang::CXXRecordDecl const*>(d);
-      if (rd->isInjectedClassName()) {
+      case clang::Decl::CXXRecord: {
+        clang::CXXRecordDecl const* rd =
+          static_cast<clang::CXXRecordDecl const*>(d);
+        if (rd->isInjectedClassName()) {
+          continue;
+        }
+      } break;
+      case clang::Decl::AccessSpec: {
         continue;
-      }
-    } break;
-    case clang::Decl::AccessSpec: {
-      continue;
-    } break;
-    case clang::Decl::ClassTemplate: {
-      this->AddClassTemplateDecl(
-        static_cast<clang::ClassTemplateDecl const*>(d), &emitted);
-      continue;
-    } break;
-    case clang::Decl::ClassTemplatePartialSpecialization: {
-      continue;
-    } break;
-    case clang::Decl::Empty: {
-      continue;
-    } break;
-    case clang::Decl::Friend: {
-      continue;
-    } break;
-    case clang::Decl::FunctionTemplate: {
-      this->AddFunctionTemplateDecl(
-        static_cast<clang::FunctionTemplateDecl const*>(d), &emitted);
-      continue;
-    } break;
-    case clang::Decl::LinkageSpec: {
-      this->AddDeclContextMembers(
-        static_cast<clang::LinkageSpecDecl const*>(d), emitted);
-      continue;
-    } break;
-    case clang::Decl::Namespace: {
-      clang::NamespaceDecl const* nd =
-        static_cast<clang::NamespaceDecl const*>(d);
-      if (nd->isInline()) {
-        this->AddDeclContextMembers(nd, emitted);
+      } break;
+      case clang::Decl::ClassTemplate: {
+        this->AddClassTemplateDecl(
+          static_cast<clang::ClassTemplateDecl const*>(d), &emitted);
         continue;
-      }
-    } break;
-    case clang::Decl::Using: {
-      continue;
-    } break;
-    case clang::Decl::UsingDirective: {
-      continue;
-    } break;
-    default:
-      break;
+      } break;
+      case clang::Decl::ClassTemplatePartialSpecialization: {
+        continue;
+      } break;
+      case clang::Decl::Empty: {
+        continue;
+      } break;
+      case clang::Decl::Friend: {
+        continue;
+      } break;
+      case clang::Decl::FunctionTemplate: {
+        this->AddFunctionTemplateDecl(
+          static_cast<clang::FunctionTemplateDecl const*>(d), &emitted);
+        continue;
+      } break;
+      case clang::Decl::LinkageSpec: {
+        this->AddDeclContextMembers(
+          static_cast<clang::LinkageSpecDecl const*>(d), emitted);
+        continue;
+      } break;
+      case clang::Decl::Namespace: {
+        clang::NamespaceDecl const* nd =
+          static_cast<clang::NamespaceDecl const*>(d);
+        if (nd->isInline()) {
+          this->AddDeclContextMembers(nd, emitted);
+          continue;
+        }
+      } break;
+      case clang::Decl::Using: {
+        continue;
+      } break;
+      case clang::Decl::UsingDirective: {
+        continue;
+      } break;
+      default:
+        break;
     }
 
     // Queue this decl and print its id.
-    if(DumpId id = this->AddDeclDumpNode(d, true)) {
+    if (DumpId id = this->AddDeclDumpNode(d, true)) {
       emitted.insert(id);
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::AddStartDecl(clang::Decl const* d)
 {
   switch (d->getKind()) {
-  case clang::Decl::ClassTemplate:
-    this->AddClassTemplateDecl(
-      static_cast<clang::ClassTemplateDecl const*>(d));
-    break;
-  case clang::Decl::FunctionTemplate:
-    this->AddFunctionTemplateDecl(
-      static_cast<clang::FunctionTemplateDecl const*>(d));
-    break;
-  case clang::Decl::Namespace: {
-    if (!static_cast<clang::NamespaceDecl const*>(d)->isInline()) {
-      this->AddDeclDumpNode(d, true);
-    }
-  } break;
-  case clang::Decl::Using: {
+    case clang::Decl::ClassTemplate:
+      this->AddClassTemplateDecl(
+        static_cast<clang::ClassTemplateDecl const*>(d));
+      break;
+    case clang::Decl::FunctionTemplate:
+      this->AddFunctionTemplateDecl(
+        static_cast<clang::FunctionTemplateDecl const*>(d));
+      break;
+    case clang::Decl::Namespace: {
+      if (!static_cast<clang::NamespaceDecl const*>(d)->isInline()) {
+        this->AddDeclDumpNode(d, true);
+      }
+    } break;
+    case clang::Decl::Using: {
       clang::UsingDecl const* ud = static_cast<clang::UsingDecl const*>(d);
-      for(clang::UsingDecl::shadow_iterator i = ud->shadow_begin(),
-            e = ud->shadow_end(); i != e; ++i) {
+      for (clang::UsingDecl::shadow_iterator i = ud->shadow_begin(),
+                                             e = ud->shadow_end();
+           i != e; ++i) {
         this->AddDeclDumpNode(*i, true);
       }
-  } break;
-  default:
-    this->AddDeclDumpNode(d, true);
-    break;
+    } break;
+    default:
+      this->AddDeclDumpNode(d, true);
+      break;
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::QueueIncompleteDumpNodes()
 {
   // Queue declaration nodes that do not need complete output.
-  for(DeclNodesMap::const_iterator i = this->DeclNodes.begin(),
-        e = this->DeclNodes.end(); i != e; ++i) {
-    if(!i->second.Complete) {
+  for (DeclNodesMap::const_iterator i = this->DeclNodes.begin(),
+                                    e = this->DeclNodes.end();
+       i != e; ++i) {
+    if (!i->second.Complete) {
       this->Queue.insert(QueueEntry(i->first, &i->second));
     }
   }
 
   // Queue type nodes that do not need complete output.
-  for(TypeNodesMap::const_iterator i = this->TypeNodes.begin(),
-        e = this->TypeNodes.end(); i != e; ++i) {
-    if(!i->second.Complete) {
+  for (TypeNodesMap::const_iterator i = this->TypeNodes.begin(),
+                                    e = this->TypeNodes.end();
+       i != e; ++i) {
+    if (!i->second.Complete) {
       this->Queue.insert(QueueEntry(i->first, &i->second));
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::ProcessQueue()
 {
   // Dispatch each entry in the queue based on its node kind.
-  while(!this->Queue.empty()) {
+  while (!this->Queue.empty()) {
     QueueEntry qe = *this->Queue.begin();
     this->Queue.erase(this->Queue.begin());
-    switch(qe.Kind) {
-    case QueueEntry::KindQual:
-      this->OutputCvQualifiedType(qe.DN);
-      break;
-    case QueueEntry::KindDecl:
-      this->OutputDecl(qe.Decl, qe.DN);
-      break;
-    case QueueEntry::KindType:
-      this->OutputType(qe.Type, qe.DN);
-      break;
+    switch (qe.Kind) {
+      case QueueEntry::KindQual:
+        this->OutputCvQualifiedType(qe.DN);
+        break;
+      case QueueEntry::KindDecl:
+        this->OutputDecl(qe.Decl, qe.DN);
+        break;
+      case QueueEntry::KindType:
+        this->OutputType(qe.Type, qe.DN);
+        break;
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::ProcessFileQueue()
 {
-  if(this->FileBuiltin) {
+  if (this->FileBuiltin) {
+    /* clang-format off */
     this->OS <<
       "  <File id=\"f0\" name=\"" << encodeXML("<builtin>") << "\"/>\n"
       ;
+    /* clang-format on */
   }
-  while(!this->FileQueue.empty()) {
+  while (!this->FileQueue.empty()) {
     clang::FileEntry const* f = this->FileQueue.front();
     this->FileQueue.pop();
+    /* clang-format off */
     this->OS <<
       "  <File"
       " id=\"f" << this->FileNodes[f] << "\""
       " name=\"" << encodeXML(f->getName()) << "\""
       "/>\n"
       ;
+    /* clang-format on */
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputDecl(clang::Decl const* d, DumpNode const* dn)
 {
   // Dispatch output of the declaration.
   switch (d->getKind()) {
 #define ABSTRACT_DECL(DECL)
-#define DECL(CLASS, BASE) \
-  case clang::Decl::CLASS: \
-    this->Output##CLASS##Decl( \
-      static_cast<clang::CLASS##Decl const*>(d), dn); \
+#define DECL(CLASS, BASE)                                                     \
+  case clang::Decl::CLASS:                                                    \
+    this->Output##CLASS##Decl(static_cast<clang::CLASS##Decl const*>(d), dn); \
     break;
 #include "clang/AST/DeclNodes.inc"
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputType(DumpType dt, DumpNode const* dn)
 {
   clang::QualType t = dt.Type;
   clang::Type const* c = dt.Class;
 
-  if(c) {
+  if (c) {
     // Output the method type.
     this->OutputMethodType(t->getAs<clang::FunctionProtoType>(), c, dn);
   } else {
     // Dispatch output of the unqualified type.
     switch (t->getTypeClass()) {
 #define ABSTRACT_TYPE(CLASS, BASE)
-#define TYPE(CLASS, BASE) \
-      case clang::Type::CLASS: \
-        this->Output##CLASS##Type( \
-          static_cast<clang::CLASS##Type const*>(t.getTypePtr()), dn); \
-        break;
+#define TYPE(CLASS, BASE)                                                     \
+  case clang::Type::CLASS:                                                    \
+    this->Output##CLASS##Type(                                                \
+      static_cast<clang::CLASS##Type const*>(t.getTypePtr()), dn);            \
+    break;
 #include "clang/AST/TypeNodes.def"
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCvQualifiedType(DumpNode const* dn)
 {
   DumpId id = dn->Index;
@@ -1035,31 +1119,28 @@ void ASTVisitor::OutputCvQualifiedType(DumpNode const* dn)
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 ASTVisitor::DumpId ASTVisitor::GetContextIdRef(clang::DeclContext const* dc)
 {
   while (dc->isInlineNamespace()) {
     dc = dc->getParent();
   }
 
-  if(clang::Decl const* d = clang::dyn_cast<clang::Decl>(dc)) {
+  if (clang::Decl const* d = clang::dyn_cast<clang::Decl>(dc)) {
     return this->AddDeclDumpNode(d, false);
   } else {
     return DumpId();
   }
 }
 
-//----------------------------------------------------------------------------
 std::string ASTVisitor::GetContextName(clang::CXXMethodDecl const* d)
 {
   clang::DeclContext const* dc = d->getDeclContext();
-  if(clang::RecordDecl const* rd = clang::dyn_cast<clang::RecordDecl>(dc)) {
+  if (clang::RecordDecl const* rd = clang::dyn_cast<clang::RecordDecl>(dc)) {
     return rd->getName().str();
   }
   return "";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintTypeIdRef(clang::QualType t, bool complete)
 {
   // Add the type node.
@@ -1069,20 +1150,17 @@ void ASTVisitor::PrintTypeIdRef(clang::QualType t, bool complete)
   this->OS << "_" << id;
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintIdAttribute(DumpNode const* dn)
 {
   this->OS << " id=\"_" << dn->Index << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintNameAttribute(std::string const& name)
 {
   std::string n = stringReplace(name, "__castxml__float128_s", "__float128");
   this->OS << " name=\"" << encodeXML(n) << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintMangledAttribute(clang::NamedDecl const* d)
 {
   // Compute the mangled name.
@@ -1106,31 +1184,27 @@ void ASTVisitor::PrintMangledAttribute(clang::NamedDecl const* d)
   this->OS << " mangled=\"" << encodeXML(s) << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintOffsetAttribute(unsigned int const& offset)
 {
   this->OS << " offset=\"" << offset << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintABIAttributes(clang::TypeDecl const* d)
 {
-  if(clang::TypeDecl const* td = clang::dyn_cast<clang::TypeDecl>(d)) {
+  if (clang::TypeDecl const* td = clang::dyn_cast<clang::TypeDecl>(d)) {
     clang::Type const* ty = td->getTypeForDecl();
-    if(!ty->isIncompleteType()) {
+    if (!ty->isIncompleteType()) {
       this->PrintABIAttributes(this->CTX.getTypeInfo(ty));
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintABIAttributes(clang::TypeInfo const& t)
 {
   this->OS << " size=\"" << t.Width << "\"";
   this->OS << " align=\"" << t.Align << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintBaseTypeAttribute(clang::Type const* c, bool complete)
 {
   this->OS << " basetype=\"";
@@ -1138,7 +1212,6 @@ void ASTVisitor::PrintBaseTypeAttribute(clang::Type const* c, bool complete)
   this->OS << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintTypeAttribute(clang::QualType t, bool complete)
 {
   this->OS << " type=\"";
@@ -1146,7 +1219,6 @@ void ASTVisitor::PrintTypeAttribute(clang::QualType t, bool complete)
   this->OS << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintReturnsAttribute(clang::QualType t, bool complete)
 {
   this->OS << " returns=\"";
@@ -1154,122 +1226,119 @@ void ASTVisitor::PrintReturnsAttribute(clang::QualType t, bool complete)
   this->OS << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintLocationAttribute(clang::Decl const* d)
 {
   clang::SourceLocation sl = d->getLocation();
-  if(sl.isValid()) {
+  if (sl.isValid()) {
     clang::FullSourceLoc fsl = this->CTX.getFullLoc(sl).getExpansionLoc();
     if (clang::FileEntry const* f =
-        this->CI.getSourceManager().getFileEntryForID(fsl.getFileID())) {
+          this->CI.getSourceManager().getFileEntryForID(fsl.getFileID())) {
       unsigned int id = this->AddDumpFile(f);
       unsigned int line = fsl.getExpansionLineNumber();
+      /* clang-format off */
       this->OS <<
         " location=\"f" << id << ":" << line << "\""
         " file=\"f" << id << "\""
         " line=\"" << line << "\"";
+      /* clang-format on */
       return;
     }
   }
-  if(d->isImplicit()) {
+  if (d->isImplicit()) {
     this->FileBuiltin = true;
     this->OS << " location=\"f0:0\" file=\"f0\" line=\"0\"";
   }
 }
 
-//----------------------------------------------------------------------------
 bool ASTVisitor::PrintHelpStmt(clang::Stmt const* s, llvm::raw_ostream& os)
 {
   switch (s->getStmtClass()) {
-  case clang::Stmt::CStyleCastExprClass: {
-    // Duplicate clang::StmtPrinter::VisitCStyleCastExpr
-    // but with canonical type so we do not print an unqualified name.
-    clang::CStyleCastExpr const* e =
-      static_cast<clang::CStyleCastExpr const*>(s);
-    os << "(";
-    e->getTypeAsWritten().getCanonicalType().print(os, this->PrintingPolicy);
-    os << ")";
-    PrinterHelper ph(*this);
-    e->getSubExpr()->printPretty(os, &ph, this->PrintingPolicy);
-    return true;
-  } break;
-  case clang::Stmt::CXXConstCastExprClass: // fallthrough
-  case clang::Stmt::CXXDynamicCastExprClass: // fallthrough
-  case clang::Stmt::CXXReinterpretCastExprClass: // fallthrough
-  case clang::Stmt::CXXStaticCastExprClass: {
-    // Duplicate clang::StmtPrinter::VisitCXXNamedCastExpr
-    // but with canonical type so we do not print an unqualified name.
-    clang::CXXNamedCastExpr const* e =
-      static_cast<clang::CXXNamedCastExpr const*>(s);
-    os << e->getCastName() << '<';
-    e->getTypeAsWritten().getCanonicalType().print(os, this->PrintingPolicy);
-    os << ">(";
-    PrinterHelper ph(*this);
-    e->getSubExpr()->printPretty(os, &ph, this->PrintingPolicy);
-    os << ")";
-    return true;
-  } break;
-  case clang::Stmt::DeclRefExprClass: {
-    // Print the fully qualified name of the referenced declaration.
-    clang::DeclRefExpr const* e = static_cast<clang::DeclRefExpr const*>(s);
-    if (clang::NamedDecl const* d =
-        clang::dyn_cast<clang::NamedDecl>(e->getDecl())) {
-      std::string s;
-      {
-        llvm::raw_string_ostream rso(s);
-        d->printQualifiedName(rso, this->PrintingPolicy);
-        rso.str();
-      }
-      if (clang::isa<clang::EnumConstantDecl>(d)) {
-        // Clang does not exclude the "::" after an unnamed enum type.
-        std::string::size_type pos = s.find("::::");
-        if (pos != s.npos) {
-          s.erase(pos, 2);
+    case clang::Stmt::CStyleCastExprClass: {
+      // Duplicate clang::StmtPrinter::VisitCStyleCastExpr
+      // but with canonical type so we do not print an unqualified name.
+      clang::CStyleCastExpr const* e =
+        static_cast<clang::CStyleCastExpr const*>(s);
+      os << "(";
+      e->getTypeAsWritten().getCanonicalType().print(os, this->PrintingPolicy);
+      os << ")";
+      PrinterHelper ph(*this);
+      e->getSubExpr()->printPretty(os, &ph, this->PrintingPolicy);
+      return true;
+    } break;
+    case clang::Stmt::CXXConstCastExprClass:       // fallthrough
+    case clang::Stmt::CXXDynamicCastExprClass:     // fallthrough
+    case clang::Stmt::CXXReinterpretCastExprClass: // fallthrough
+    case clang::Stmt::CXXStaticCastExprClass: {
+      // Duplicate clang::StmtPrinter::VisitCXXNamedCastExpr
+      // but with canonical type so we do not print an unqualified name.
+      clang::CXXNamedCastExpr const* e =
+        static_cast<clang::CXXNamedCastExpr const*>(s);
+      os << e->getCastName() << '<';
+      e->getTypeAsWritten().getCanonicalType().print(os, this->PrintingPolicy);
+      os << ">(";
+      PrinterHelper ph(*this);
+      e->getSubExpr()->printPretty(os, &ph, this->PrintingPolicy);
+      os << ")";
+      return true;
+    } break;
+    case clang::Stmt::DeclRefExprClass: {
+      // Print the fully qualified name of the referenced declaration.
+      clang::DeclRefExpr const* e = static_cast<clang::DeclRefExpr const*>(s);
+      if (clang::NamedDecl const* d =
+            clang::dyn_cast<clang::NamedDecl>(e->getDecl())) {
+        std::string s;
+        {
+          llvm::raw_string_ostream rso(s);
+          d->printQualifiedName(rso, this->PrintingPolicy);
+          rso.str();
         }
+        if (clang::isa<clang::EnumConstantDecl>(d)) {
+          // Clang does not exclude the "::" after an unnamed enum type.
+          std::string::size_type pos = s.find("::::");
+          if (pos != s.npos) {
+            s.erase(pos, 2);
+          }
+        }
+        os << s;
+        return true;
       }
-      os << s;
-      return true;
-    }
-  } break;
-  default:
-    break;
+    } break;
+    default:
+      break;
   }
   return false;
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintAccessAttribute(clang::AccessSpecifier as)
 {
   switch (as) {
-  case clang::AS_private:
-    this->OS << " access=\"private\"";
-    break;
-  case clang::AS_protected:
-    this->OS << " access=\"protected\"";
-    break;
-  case clang::AS_public:
-    this->OS << " access=\"public\"";
-    break;
-  case clang::AS_none:
-    break;
+    case clang::AS_private:
+      this->OS << " access=\"private\"";
+      break;
+    case clang::AS_protected:
+      this->OS << " access=\"protected\"";
+      break;
+    case clang::AS_public:
+      this->OS << " access=\"public\"";
+      break;
+    case clang::AS_none:
+      break;
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintContextAttribute(clang::Decl const* d,
                                        clang::AccessSpecifier alt)
 {
   clang::DeclContext const* dc = d->getDeclContext();
-  if(DumpId id = this->GetContextIdRef(dc)) {
+  if (DumpId id = this->GetContextIdRef(dc)) {
     this->OS << " context=\"_" << id << "\"";
     if (dc->isRecord()) {
       clang::AccessSpecifier as = d->getAccess();
-      this->PrintAccessAttribute(as != clang::AS_none? as : alt);
+      this->PrintAccessAttribute(as != clang::AS_none ? as : alt);
     }
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintMembersAttribute(clang::DeclContext const* dc)
 {
   std::set<DumpId> emitted;
@@ -1277,14 +1346,14 @@ void ASTVisitor::PrintMembersAttribute(clang::DeclContext const* dc)
   this->PrintMembersAttribute(emitted);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintMembersAttribute(std::set<DumpId> const& emitted)
 {
-  if(!emitted.empty()) {
+  if (!emitted.empty()) {
     this->OS << " members=\"";
     const char* sep = "";
-    for(std::set<DumpId>::const_iterator i = emitted.begin(),
-          e = emitted.end(); i != e; ++i) {
+    for (std::set<DumpId>::const_iterator i = emitted.begin(),
+                                          e = emitted.end();
+         i != e; ++i) {
       this->OS << sep << "_" << *i;
       sep = " ";
     }
@@ -1292,26 +1361,30 @@ void ASTVisitor::PrintMembersAttribute(std::set<DumpId> const& emitted)
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintBasesAttribute(clang::CXXRecordDecl const* dx)
 {
   this->OS << " bases=\"";
   const char* sep = "";
-  for(clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
-        e = dx->bases_end(); i != e; ++i) {
+  for (clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
+                                                       e = dx->bases_end();
+       i != e; ++i) {
     this->OS << sep;
     sep = " ";
     switch (i->getAccessSpecifier()) {
-    case clang::AS_private: this->OS << "private:"; break;
-    case clang::AS_protected: this->OS << "protected:"; break;
-    default: break;
+      case clang::AS_private:
+        this->OS << "private:";
+        break;
+      case clang::AS_protected:
+        this->OS << "protected:";
+        break;
+      default:
+        break;
     }
     this->PrintTypeIdRef(i->getType().getCanonicalType(), true);
   }
   this->OS << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintAttributesAttribute(
   std::vector<std::string> const& attrs)
 {
@@ -1320,14 +1393,13 @@ void ASTVisitor::PrintAttributesAttribute(
   }
   this->OS << " attributes=\"";
   const char* sep = "";
-  for (std::string const& a: attrs) {
+  for (std::string const& a : attrs) {
     this->OS << sep << encodeXML(a);
     sep = " ";
   }
   this->OS << "\"";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintAttributesAttribute(clang::Decl const* d)
 {
   std::vector<std::string> attributes;
@@ -1335,46 +1407,43 @@ void ASTVisitor::PrintAttributesAttribute(clang::Decl const* d)
   this->PrintAttributesAttribute(attributes);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::GetFunctionTypeAttributes(clang::FunctionProtoType const* t,
                                            std::vector<std::string>& attrs)
 {
   switch (t->getExtInfo().getCC()) {
-  case clang::CallingConv::CC_C:
-    break;
-  case clang::CallingConv::CC_X86StdCall:
-    attrs.push_back("__stdcall__");
-    break;
-  case clang::CallingConv::CC_X86FastCall:
-    attrs.push_back("__fastcall__");
-    break;
-  case clang::CallingConv::CC_X86ThisCall:
-    attrs.push_back("__thiscall__");
-    break;
-  default:
-    break;
+    case clang::CallingConv::CC_C:
+      break;
+    case clang::CallingConv::CC_X86StdCall:
+      attrs.push_back("__stdcall__");
+      break;
+    case clang::CallingConv::CC_X86FastCall:
+      attrs.push_back("__fastcall__");
+      break;
+    case clang::CallingConv::CC_X86ThisCall:
+      attrs.push_back("__thiscall__");
+      break;
+    default:
+      break;
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::GetDeclAttributes(clang::Decl const* d,
                                    std::vector<std::string>& attrs)
 {
-  for (auto const* a: d->specific_attrs<clang::AnnotateAttr>()) {
+  for (auto const* a : d->specific_attrs<clang::AnnotateAttr>()) {
     attrs.push_back("annotate(" + a->getAnnotation().str() + ")");
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintThrowsAttribute(clang::FunctionProtoType const* fpt,
                                       bool complete)
 {
-  if(fpt && fpt->hasDynamicExceptionSpec()) {
+  if (fpt && fpt->hasDynamicExceptionSpec()) {
     clang::FunctionProtoType::exception_iterator i = fpt->exception_begin();
     clang::FunctionProtoType::exception_iterator e = fpt->exception_end();
     this->OS << " throw=\"";
     const char* sep = "";
-    for(;i != e; ++i) {
+    for (; i != e; ++i) {
       this->OS << sep;
       this->PrintTypeIdRef(*i, complete);
       sep = " ";
@@ -1383,26 +1452,26 @@ void ASTVisitor::PrintThrowsAttribute(clang::FunctionProtoType const* fpt,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintBefriendingAttribute(clang::CXXRecordDecl const* dx)
 {
-  if(dx && dx->hasFriends()) {
+  if (dx && dx->hasFriends()) {
     this->OS << " befriending=\"";
     const char* sep = "";
-    for(clang::CXXRecordDecl::friend_iterator i = dx->friend_begin(),
-          e = dx->friend_end(); i != e; ++i) {
+    for (clang::CXXRecordDecl::friend_iterator i = dx->friend_begin(),
+                                               e = dx->friend_end();
+         i != e; ++i) {
       clang::FriendDecl const* fd = *i;
-      if(clang::NamedDecl const* nd = fd->getFriendDecl()) {
-        if(nd->isTemplateDecl()) {
+      if (clang::NamedDecl const* nd = fd->getFriendDecl()) {
+        if (nd->isTemplateDecl()) {
           // gccxml output format does not have uninstantiated templates
           continue;
         }
 
-        if(DumpId id = this->AddDeclDumpNode(nd, false)) {
+        if (DumpId id = this->AddDeclDumpNode(nd, false)) {
           this->OS << sep << "_" << id;
           sep = " ";
         }
-      } else if(clang::TypeSourceInfo const* tsi = fd->getFriendType()) {
+      } else if (clang::TypeSourceInfo const* tsi = fd->getFriendType()) {
         this->OS << sep;
         this->PrintTypeIdRef(tsi->getType(), false);
         sep = " ";
@@ -1412,7 +1481,6 @@ void ASTVisitor::PrintBefriendingAttribute(clang::CXXRecordDecl const* dx)
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::PrintFloat128Type(DumpNode const* dn)
 {
   this->OS << "  <FundamentalType";
@@ -1420,51 +1488,49 @@ void ASTVisitor::PrintFloat128Type(DumpNode const* dn)
   this->OS << " name=\"__float128\" size=\"128\" align=\"128\"/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
-                                      DumpNode const* dn,
-                                      const char* tag,
+                                      DumpNode const* dn, const char* tag,
                                       std::string const& name,
                                       unsigned int flags)
 {
   this->OS << "  <" << tag;
   this->PrintIdAttribute(dn);
-  if(!name.empty()) {
+  if (!name.empty()) {
     this->PrintNameAttribute(name);
   }
-  if(flags & FH_Returns) {
+  if (flags & FH_Returns) {
     this->PrintReturnsAttribute(d->getReturnType(), dn->Complete);
   }
   this->PrintContextAttribute(d);
   this->PrintLocationAttribute(d);
 
-  if(flags & FH_Static) {
+  if (flags & FH_Static) {
     this->OS << " static=\"1\"";
   }
-  if(flags & FH_Explicit) {
+  if (flags & FH_Explicit) {
     this->OS << " explicit=\"1\"";
   }
-  if(flags & FH_Const) {
+  if (flags & FH_Const) {
     this->OS << " const=\"1\"";
   }
-  if(flags & FH_Virtual) {
+  if (flags & FH_Virtual) {
     this->OS << " virtual=\"1\"";
   }
-  if(flags & FH_Pure) {
+  if (flags & FH_Pure) {
     this->OS << " pure_virtual=\"1\"";
   }
-  if(d->isInlined()) {
+  if (d->isInlined()) {
     this->OS << " inline=\"1\"";
   }
-  if(d->getStorageClass() == clang::SC_Extern) {
+  if (d->getStorageClass() == clang::SC_Extern) {
     this->OS << " extern=\"1\"";
   }
-  if(d->isImplicit()) {
+  if (d->isImplicit()) {
     this->OS << " artificial=\"1\"";
   }
 
   if (clang::CXXMethodDecl const* md =
-      clang::dyn_cast<clang::CXXMethodDecl>(d)) {
+        clang::dyn_cast<clang::CXXMethodDecl>(d)) {
     if (md->size_overridden_methods() > 0) {
       this->OS << " overrides=\"";
       const char* sep = "";
@@ -1484,7 +1550,7 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
   std::vector<std::string> attributes;
 
   if (clang::FunctionProtoType const* fpt =
-      d->getType()->getAs<clang::FunctionProtoType>()) {
+        d->getType()->getAs<clang::FunctionProtoType>()) {
     this->PrintThrowsAttribute(fpt, dn->Complete);
     if (!clang::isa<clang::CXXConstructorDecl>(d) &&
         !clang::isa<clang::CXXDestructorDecl>(d)) {
@@ -1496,7 +1562,7 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
   this->GetDeclAttributes(d, attributes);
   this->PrintAttributesAttribute(attributes);
 
-  if(unsigned np = d->getNumParams()) {
+  if (unsigned np = d->getNumParams()) {
     this->OS << ">\n";
     for (unsigned i = 0; i < np; ++i) {
       // Use the default argument from the most recent declaration.
@@ -1504,14 +1570,14 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
       // them all.
       clang::ParmVarDecl const* pd = d->getMostRecentDecl()->getParamDecl(i);
       clang::Expr const* def = pd->getInit();
-      if(!def && pd->hasUninstantiatedDefaultArg()) {
+      if (!def && pd->hasUninstantiatedDefaultArg()) {
         def = pd->getUninstantiatedDefaultArg();
       }
 
       // Use the parameter located in the canonical declaration.
       this->OutputFunctionArgument(d->getParamDecl(i), dn->Complete, def);
     }
-    if(d->isVariadic()) {
+    if (d->isVariadic()) {
       this->OS << "    <Ellipsis/>\n";
     }
     this->OS << "  </" << tag << ">\n";
@@ -1520,38 +1586,39 @@ void ASTVisitor::OutputFunctionHelper(clang::FunctionDecl const* d,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionTypeHelper(clang::FunctionProtoType const* t,
                                           DumpNode const* dn, const char* tag,
                                           clang::Type const* c)
 {
   this->OS << "  <" << tag;
   this->PrintIdAttribute(dn);
-  if(c) {
+  if (c) {
     this->PrintBaseTypeAttribute(c, dn->Complete);
   }
   this->PrintReturnsAttribute(t->getReturnType(), dn->Complete);
-  if(t->isConst()) {
+  if (t->isConst()) {
     this->OS << " const=\"1\"";
   }
-  if(t->isVolatile()) {
+  if (t->isVolatile()) {
     this->OS << " volatile=\"1\"";
   }
-  if(t->isRestrict()) {
+  if (t->isRestrict()) {
     this->OS << " restrict=\"1\"";
   }
   std::vector<std::string> attributes;
   this->GetFunctionTypeAttributes(t, attributes);
   this->PrintAttributesAttribute(attributes);
-  if(t->param_type_begin() != t->param_type_end()) {
+  if (t->param_type_begin() != t->param_type_end()) {
     this->OS << ">\n";
     for (clang::FunctionProtoType::param_type_iterator
-           i = t->param_type_begin(), e = t->param_type_end(); i != e; ++i) {
+           i = t->param_type_begin(),
+           e = t->param_type_end();
+         i != e; ++i) {
       this->OS << "    <Argument";
       this->PrintTypeAttribute(*i, dn->Complete);
       this->OS << "/>\n";
     }
-    if(t->isVariadic()) {
+    if (t->isVariadic()) {
       this->OS << "    <Ellipsis/>\n";
     }
     this->OS << "  </" << tag << ">\n";
@@ -1560,18 +1627,17 @@ void ASTVisitor::OutputFunctionTypeHelper(clang::FunctionProtoType const* t,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionArgument(clang::ParmVarDecl const* a,
                                         bool complete, clang::Expr const* def)
 {
   this->OS << "    <Argument";
   std::string name = a->getName().str();
-  if(!name.empty()) {
+  if (!name.empty()) {
     this->PrintNameAttribute(name);
   }
   this->PrintTypeAttribute(a->getType(), complete);
   this->PrintLocationAttribute(a);
-  if(def) {
+  if (def) {
     this->OS << " default=\"";
     std::string s;
     llvm::raw_string_ostream rso(s);
@@ -1584,22 +1650,20 @@ void ASTVisitor::OutputFunctionArgument(clang::ParmVarDecl const* a,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
-void ASTVisitor::OutputTranslationUnitDecl(
-  clang::TranslationUnitDecl const* d, DumpNode const* dn)
+void ASTVisitor::OutputTranslationUnitDecl(clang::TranslationUnitDecl const* d,
+                                           DumpNode const* dn)
 {
   this->OS << "  <Namespace";
   this->PrintIdAttribute(dn);
   this->PrintNameAttribute("::");
-  if(dn->Complete) {
+  if (dn->Complete) {
     this->PrintMembersAttribute(d);
   }
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
-void ASTVisitor::OutputNamespaceDecl(
-  clang::NamespaceDecl const* d, DumpNode const* dn)
+void ASTVisitor::OutputNamespaceDecl(clang::NamespaceDecl const* d,
+                                     DumpNode const* dn)
 {
   this->OS << "  <Namespace";
   this->PrintIdAttribute(dn);
@@ -1608,9 +1672,9 @@ void ASTVisitor::OutputNamespaceDecl(
     this->PrintNameAttribute(name);
   }
   this->PrintContextAttribute(d);
-  if(dn->Complete) {
+  if (dn->Complete) {
     std::set<DumpId> emitted;
-    for (clang::NamespaceDecl const* r: d->redecls()) {
+    for (clang::NamespaceDecl const* r : d->redecls()) {
       this->AddDeclContextMembers(r, emitted);
     }
     this->PrintMembersAttribute(emitted);
@@ -1618,24 +1682,31 @@ void ASTVisitor::OutputNamespaceDecl(
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
                                   DumpNode const* dn)
 {
   const char* tag;
   switch (d->getTagKind()) {
-  case clang::TTK_Class: tag = "Class"; break;
-  case clang::TTK_Union: tag = "Union"; break;
-  case clang::TTK_Struct: tag = "Struct"; break;
-  case clang::TTK_Interface: return;
-  case clang::TTK_Enum: return;
+    case clang::TTK_Class:
+      tag = "Class";
+      break;
+    case clang::TTK_Union:
+      tag = "Union";
+      break;
+    case clang::TTK_Struct:
+      tag = "Struct";
+      break;
+    case clang::TTK_Interface:
+      return;
+    case clang::TTK_Enum:
+      return;
   }
   clang::CXXRecordDecl const* dx = clang::dyn_cast<clang::CXXRecordDecl>(d);
   bool doBases = false;
 
   this->OS << "  <" << tag;
   this->PrintIdAttribute(dn);
-  if(!d->isAnonymousStructOrUnion()) {
+  if (!d->isAnonymousStructOrUnion()) {
     std::string s;
     llvm::raw_string_ostream rso(s);
     d->getNameForDiagnostic(rso, this->PrintingPolicy, false);
@@ -1643,24 +1714,23 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
   }
   clang::AccessSpecifier access = clang::AS_none;
   if (clang::ClassTemplateSpecializationDecl const* dxts =
-      clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(d)) {
+        clang::dyn_cast<clang::ClassTemplateSpecializationDecl>(d)) {
     // This is a template instantiation so get the access of the original
     // template.  Access of the instantiation itself has no meaning.
-    if (clang::ClassTemplateDecl const* dxt =
-        dxts->getSpecializedTemplate()) {
+    if (clang::ClassTemplateDecl const* dxt = dxts->getSpecializedTemplate()) {
       access = dxt->getAccess();
     }
   }
   this->PrintContextAttribute(d, access);
   this->PrintLocationAttribute(d);
-  if(d->getDefinition()) {
-    if(dx && dx->isAbstract()) {
+  if (d->getDefinition()) {
+    if (dx && dx->isAbstract()) {
       this->OS << " abstract=\"1\"";
     }
     if (dn->Complete && !d->isInvalidDecl()) {
       this->PrintMembersAttribute(d);
       doBases = dx && dx->getNumBases();
-      if(doBases) {
+      if (doBases) {
         this->PrintBasesAttribute(dx);
       }
       this->PrintBefriendingAttribute(dx);
@@ -1670,21 +1740,22 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
   }
   this->PrintABIAttributes(d);
   this->PrintAttributesAttribute(d);
-  if(doBases) {
+  if (doBases) {
     this->OS << ">\n";
     clang::ASTRecordLayout const& layout = this->CTX.getASTRecordLayout(dx);
-    for(clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
-          e = dx->bases_end(); i != e; ++i) {
+    for (clang::CXXRecordDecl::base_class_const_iterator i = dx->bases_begin(),
+                                                         e = dx->bases_end();
+         i != e; ++i) {
       clang::QualType bt = i->getType().getCanonicalType();
       clang::CXXRecordDecl const* bd = clang::dyn_cast<clang::CXXRecordDecl>(
         bt->getAs<clang::RecordType>()->getDecl());
       this->OS << "    <Base";
       this->PrintTypeAttribute(bt, true);
       this->PrintAccessAttribute(i->getAccessSpecifier());
-      this->OS << " virtual=\"" << (i->isVirtual()? 1 : 0) << "\"";
+      this->OS << " virtual=\"" << (i->isVirtual() ? 1 : 0) << "\"";
       if (bd && !i->isVirtual()) {
-        this->OS << " offset=\"" <<
-          layout.getBaseClassOffset(bd).getQuantity() << "\"";
+        this->OS << " offset=\"" << layout.getBaseClassOffset(bd).getQuantity()
+                 << "\"";
       }
       this->OS << "/>\n";
     }
@@ -1694,11 +1765,10 @@ void ASTVisitor::OutputRecordDecl(clang::RecordDecl const* d,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCXXRecordDecl(clang::CXXRecordDecl const* d,
                                      DumpNode const* dn)
 {
-  if(d->getDescribedClassTemplate()) {
+  if (d->getDescribedClassTemplate()) {
     // We do not implement class template output yet.
     this->ASTVisitorBase::OutputCXXRecordDecl(d, dn);
     return;
@@ -1707,14 +1777,12 @@ void ASTVisitor::OutputCXXRecordDecl(clang::CXXRecordDecl const* d,
   this->OutputRecordDecl(d, dn);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputClassTemplateSpecializationDecl(
   clang::ClassTemplateSpecializationDecl const* d, DumpNode const* dn)
 {
   this->OutputCXXRecordDecl(d, dn);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d,
                                    DumpNode const* dn)
 {
@@ -1742,14 +1810,13 @@ void ASTVisitor::OutputTypedefDecl(clang::TypedefDecl const* d,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
 {
   this->OS << "  <Enumeration";
   this->PrintIdAttribute(dn);
   std::string name = d->getName().str();
-  if(name.empty()) {
-    if(clang::TypedefNameDecl const* td = d->getTypedefNameForAnonDecl()) {
+  if (name.empty()) {
+    if (clang::TypedefNameDecl const* td = d->getTypedefNameForAnonDecl()) {
       name = td->getName().str();
     }
   }
@@ -1759,10 +1826,10 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
   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) {
+  if (enum_begin != enum_end) {
     this->OS << ">\n";
-    for(clang::EnumDecl::enumerator_iterator i = enum_begin;
-        i != enum_end; ++i) {
+    for (clang::EnumDecl::enumerator_iterator i = enum_begin; i != enum_end;
+         ++i) {
       clang::EnumConstantDecl const* ecd = *i;
       this->OS << "    <EnumValue";
       this->PrintNameAttribute(ecd->getName());
@@ -1776,21 +1843,20 @@ void ASTVisitor::OutputEnumDecl(clang::EnumDecl const* d, DumpNode const* dn)
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFieldDecl(clang::FieldDecl const* d, DumpNode const* dn)
 {
   this->OS << "  <Field";
   this->PrintIdAttribute(dn);
   this->PrintNameAttribute(d->getName().str());
   this->PrintTypeAttribute(d->getType(), dn->Complete);
-  if(d->isBitField()) {
+  if (d->isBitField()) {
     unsigned bits = d->getBitWidthValue(this->CTX);
     this->OS << " bits=\"" << bits << "\"";
   }
   this->PrintContextAttribute(d);
   this->PrintLocationAttribute(d);
   this->PrintOffsetAttribute(this->CTX.getFieldOffset(d));
-  if(d->isMutable()) {
+  if (d->isMutable()) {
     this->OS << " mutable=\"1\"";
   }
   this->PrintAttributesAttribute(d);
@@ -1798,14 +1864,13 @@ void ASTVisitor::OutputFieldDecl(clang::FieldDecl const* d, DumpNode const* dn)
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputVarDecl(clang::VarDecl const* d, DumpNode const* dn)
 {
   this->OS << "  <Variable";
   this->PrintIdAttribute(dn);
   this->PrintNameAttribute(d->getName().str());
   this->PrintTypeAttribute(d->getType(), dn->Complete);
-  if(clang::Expr const* init = d->getInit()) {
+  if (clang::Expr const* init = d->getInit()) {
     this->OS << " init=\"";
     std::string s;
     llvm::raw_string_ostream rso(s);
@@ -1816,10 +1881,10 @@ void ASTVisitor::OutputVarDecl(clang::VarDecl const* d, DumpNode const* dn)
   }
   this->PrintContextAttribute(d);
   this->PrintLocationAttribute(d);
-  if(d->getStorageClass() == clang::SC_Static) {
+  if (d->getStorageClass() == clang::SC_Static) {
     this->OS << " static=\"1\"";
   }
-  if(d->getStorageClass() == clang::SC_Extern) {
+  if (d->getStorageClass() == clang::SC_Extern) {
     this->OS << " extern=\"1\"";
   }
   this->PrintMangledAttribute(d);
@@ -1828,122 +1893,122 @@ void ASTVisitor::OutputVarDecl(clang::VarDecl const* d, DumpNode const* dn)
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionDecl(clang::FunctionDecl const* d,
                                     DumpNode const* dn)
 {
-  if(d->getDescribedFunctionTemplate()) {
+  if (d->getDescribedFunctionTemplate()) {
     // We do not implement function template output yet.
     this->ASTVisitorBase::OutputFunctionDecl(d, dn);
     return;
   }
 
   unsigned int flags = FH_Returns;
-  if(d->getStorageClass() == clang::SC_Static) {
+  if (d->getStorageClass() == clang::SC_Static) {
     flags |= FH_Static;
   }
-  if(d->isOverloadedOperator()) {
-    this->OutputFunctionHelper(d, dn, "OperatorFunction",
+  if (d->isOverloadedOperator()) {
+    this->OutputFunctionHelper(
+      d, dn, "OperatorFunction",
       clang::getOperatorSpelling(d->getOverloadedOperator()), flags);
+  } else if (clang::IdentifierInfo const* ii = d->getIdentifier()) {
+    this->OutputFunctionHelper(d, dn, "Function", ii->getName().str(), flags);
   } else {
-    this->OutputFunctionHelper(d, dn, "Function", d->getName().str(), flags);
+    this->OutputUnimplementedDecl(d, dn);
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCXXMethodDecl(clang::CXXMethodDecl const* d,
                                      DumpNode const* dn)
 {
-  if(d->getDescribedFunctionTemplate()) {
+  if (d->getDescribedFunctionTemplate()) {
     // We do not implement function template output yet.
     this->ASTVisitorBase::OutputCXXMethodDecl(d, dn);
     return;
   }
 
   unsigned int flags = FH_Returns;
-  if(d->isStatic()) {
+  if (d->isStatic()) {
     flags |= FH_Static;
   }
-  if(d->isConst()) {
+  if (d->isConst()) {
     flags |= FH_Const;
   }
-  if(d->isVirtual()) {
+  if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if(d->isPure()) {
+  if (d->isPure()) {
     flags |= FH_Pure;
   }
-  if(d->isOverloadedOperator()) {
-    this->OutputFunctionHelper(d, dn, "OperatorMethod",
+  if (d->isOverloadedOperator()) {
+    this->OutputFunctionHelper(
+      d, dn, "OperatorMethod",
       clang::getOperatorSpelling(d->getOverloadedOperator()), flags);
+  } else if (clang::IdentifierInfo const* ii = d->getIdentifier()) {
+    this->OutputFunctionHelper(d, dn, "Method", ii->getName().str(), flags);
   } else {
-    this->OutputFunctionHelper(d, dn, "Method", d->getName().str(), flags);
+    this->OutputUnimplementedDecl(d, dn);
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCXXConversionDecl(clang::CXXConversionDecl const* d,
                                          DumpNode const* dn)
 {
-  if(d->getDescribedFunctionTemplate()) {
+  if (d->getDescribedFunctionTemplate()) {
     // We do not implement function template output yet.
     this->ASTVisitorBase::OutputCXXConversionDecl(d, dn);
     return;
   }
 
   unsigned int flags = FH_Returns;
-  if(d->isConst()) {
+  if (d->isConst()) {
     flags |= FH_Const;
   }
-  if(d->isVirtual()) {
+  if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if(d->isPure()) {
+  if (d->isPure()) {
     flags |= FH_Pure;
   }
   this->OutputFunctionHelper(d, dn, "Converter", "", flags);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCXXConstructorDecl(clang::CXXConstructorDecl const* d,
                                           DumpNode const* dn)
 {
-  if(d->getDescribedFunctionTemplate()) {
+  if (d->getDescribedFunctionTemplate()) {
     // We do not implement function template output yet.
     this->ASTVisitorBase::OutputCXXConstructorDecl(d, dn);
     return;
   }
 
   unsigned int flags = 0;
-  if(d->isExplicit()) {
+  if (d->isExplicit()) {
     flags |= FH_Explicit;
   }
-  this->OutputFunctionHelper(d, dn, "Constructor",
-                             this->GetContextName(d), flags);
+  this->OutputFunctionHelper(d, dn, "Constructor", this->GetContextName(d),
+                             flags);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputCXXDestructorDecl(clang::CXXDestructorDecl const* d,
                                          DumpNode const* dn)
 {
-  if(d->getDescribedFunctionTemplate()) {
+  if (d->getDescribedFunctionTemplate()) {
     // We do not implement function template output yet.
     this->ASTVisitorBase::OutputCXXDestructorDecl(d, dn);
     return;
   }
 
   unsigned int flags = 0;
-  if(d->isVirtual()) {
+  if (d->isVirtual()) {
     flags |= FH_Virtual;
   }
-  if(d->isPure()) {
+  if (d->isPure()) {
     flags |= FH_Pure;
   }
-  this->OutputFunctionHelper(d, dn, "Destructor",
-                             this->GetContextName(d), flags);
+  this->OutputFunctionHelper(d, dn, "Destructor", this->GetContextName(d),
+                             flags);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputBuiltinType(clang::BuiltinType const* t,
                                    DumpNode const* dn)
 {
@@ -1953,13 +2018,27 @@ void ASTVisitor::OutputBuiltinType(clang::BuiltinType const* t,
   // gccxml used different name variants than Clang for some types
   std::string name;
   switch (t->getKind()) {
-  case clang::BuiltinType::Short: name = "short int"; break;
-  case clang::BuiltinType::UShort: name = "short unsigned int"; break;
-  case clang::BuiltinType::Long: name = "long int"; break;
-  case clang::BuiltinType::ULong: name = "long unsigned int"; break;
-  case clang::BuiltinType::LongLong: name = "long long int"; break;
-  case clang::BuiltinType::ULongLong: name = "long long unsigned int"; break;
-  default: name = t->getName(this->PrintingPolicy).str(); break;
+    case clang::BuiltinType::Short:
+      name = "short int";
+      break;
+    case clang::BuiltinType::UShort:
+      name = "short unsigned int";
+      break;
+    case clang::BuiltinType::Long:
+      name = "long int";
+      break;
+    case clang::BuiltinType::ULong:
+      name = "long unsigned int";
+      break;
+    case clang::BuiltinType::LongLong:
+      name = "long long int";
+      break;
+    case clang::BuiltinType::ULongLong:
+      name = "long long unsigned int";
+      break;
+    default:
+      name = t->getName(this->PrintingPolicy).str();
+      break;
   };
   this->PrintNameAttribute(name);
   this->PrintABIAttributes(this->CTX.getTypeInfo(t));
@@ -1967,18 +2046,16 @@ void ASTVisitor::OutputBuiltinType(clang::BuiltinType const* t,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputConstantArrayType(clang::ConstantArrayType const* t,
                                          DumpNode const* dn)
 {
   this->OS << "  <ArrayType";
   this->PrintIdAttribute(dn);
-  this->OS << " min=\"0\" max=\"" << (t->getSize()-1) << "\"";
+  this->OS << " min=\"0\" max=\"" << (t->getSize() - 1) << "\"";
   this->PrintTypeAttribute(t->getElementType(), dn->Complete);
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputIncompleteArrayType(clang::IncompleteArrayType const* t,
                                            DumpNode const* dn)
 {
@@ -1989,14 +2066,12 @@ void ASTVisitor::OutputIncompleteArrayType(clang::IncompleteArrayType const* t,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputFunctionProtoType(clang::FunctionProtoType const* t,
                                          DumpNode const* dn)
 {
   this->OutputFunctionTypeHelper(t, dn, "FunctionType", 0);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputLValueReferenceType(clang::LValueReferenceType const* t,
                                            DumpNode const* dn)
 {
@@ -2006,11 +2081,10 @@ void ASTVisitor::OutputLValueReferenceType(clang::LValueReferenceType const* t,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputMemberPointerType(clang::MemberPointerType const* t,
                                          DumpNode const* dn)
 {
-  if(t->isMemberDataPointerType()) {
+  if (t->isMemberDataPointerType()) {
     this->OutputOffsetType(t->getPointeeType(), t->getClass(), dn);
   } else {
     this->OS << "  <PointerType";
@@ -2022,14 +2096,12 @@ void ASTVisitor::OutputMemberPointerType(clang::MemberPointerType const* t,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputMethodType(clang::FunctionProtoType const* t,
                                   clang::Type const* c, DumpNode const* dn)
 {
   this->OutputFunctionTypeHelper(t, dn, "MethodType", c);
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputOffsetType(clang::QualType t, clang::Type const* c,
                                   DumpNode const* dn)
 {
@@ -2040,7 +2112,6 @@ void ASTVisitor::OutputOffsetType(clang::QualType t, clang::Type const* c,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::OutputPointerType(clang::PointerType const* t,
                                    DumpNode const* dn)
 {
@@ -2050,7 +2121,48 @@ void ASTVisitor::OutputPointerType(clang::PointerType const* t,
   this->OS << "/>\n";
 }
 
-//----------------------------------------------------------------------------
+void ASTVisitor::OutputStartXMLTags()
+{
+  /* clang-format off */
+  this->OS <<
+    "<?xml version=\"1.0\"?>\n"
+    ;
+  /* clang-format on */
+  if (this->Opts.CastXml) {
+    // Start dump with castxml-compatible format.
+    /* clang-format off */
+    this->OS <<
+      "<CastXML format=\"" << Opts.CastXmlEpicFormatVersion << ".0.0\">\n"
+      ;
+    /* clang-format on */
+  } else if (this->Opts.GccXml) {
+    // Start dump with gccxml-compatible format (legacy).
+    /* clang-format off */
+    this->OS <<
+      "<GCC_XML version=\"0.9.0\" cvs_revision=\"1.139\">\n"
+      ;
+    /* clang-format on */
+  }
+}
+
+void ASTVisitor::OutputEndXMLTags()
+{
+  // Finish dump.
+  if (this->Opts.CastXml) {
+    /* clang-format off */
+    this->OS <<
+      "</CastXML>\n"
+      ;
+    /* clang-format on */
+  } else if (this->Opts.GccXml) {
+    /* clang-format off */
+    this->OS <<
+      "</GCC_XML>\n"
+      ;
+    /* clang-format on */
+  }
+}
+
 void ASTVisitor::LookupStart(clang::DeclContext const* dc,
                              std::string const& name)
 {
@@ -2059,15 +2171,15 @@ void ASTVisitor::LookupStart(clang::DeclContext const* dc,
 
   clang::IdentifierTable& ids = CI.getPreprocessor().getIdentifierTable();
   auto const& result = dc->lookup(clang::DeclarationName(&ids.get(cur)));
-  if(pos == name.npos) {
-    for (clang::NamedDecl const* n: result) {
+  if (pos == name.npos) {
+    for (clang::NamedDecl const* n : result) {
       this->AddStartDecl(n);
     }
   } else {
-    std::string rest = name.substr(pos+2);
-    for (clang::NamedDecl const* n: result) {
+    std::string rest = name.substr(pos + 2);
+    for (clang::NamedDecl const* n : result) {
       if (clang::DeclContext const* idc =
-          clang::dyn_cast<clang::DeclContext const>(n)) {
+            clang::dyn_cast<clang::DeclContext const>(n)) {
         this->LookupStart(idc, rest);
       }
     }
@@ -2078,15 +2190,15 @@ void ASTVisitor::LookupStart(clang::DeclContext const* dc,
   }
 }
 
-//----------------------------------------------------------------------------
 void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu)
 {
   // Add the starting nodes for the dump.
-  if(!this->Opts.StartNames.empty()) {
+  if (!this->Opts.StartNames.empty()) {
     // Use the specified starting locations.
-    for(std::vector<std::string>::const_iterator
-          i = this->Opts.StartNames.begin(), e = this->Opts.StartNames.end();
-        i != e; ++i) {
+    for (std::vector<std::string>::const_iterator
+           i = this->Opts.StartNames.begin(),
+           e = this->Opts.StartNames.end();
+         i != e; ++i) {
       this->LookupStart(tu, *i);
     }
   } else {
@@ -2094,11 +2206,8 @@ void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu)
     this->AddStartDecl(tu);
   }
 
-  // Start dump with gccxml-compatible format.
-  this->OS <<
-    "<?xml version=\"1.0\"?>\n"
-    "<GCC_XML version=\"0.9.0\" cvs_revision=\"1.139\">\n"
-    ;
+  // Dump opening tags.
+  this->OutputStartXMLTags();
 
   // Dump the complete nodes.
   this->ProcessQueue();
@@ -2113,17 +2222,12 @@ void ASTVisitor::HandleTranslationUnit(clang::TranslationUnitDecl const* tu)
   // Dump the filename queue.
   this->ProcessFileQueue();
 
-  // Finish dump.
-  this->OS <<
-    "</GCC_XML>\n"
-    ;
+  // Dump end tags.
+  this->OutputEndXMLTags();
 }
 
-//----------------------------------------------------------------------------
-void outputXML(clang::CompilerInstance& ci,
-               clang::ASTContext& ctx,
-               llvm::raw_ostream& os,
-               Options const& opts)
+void outputXML(clang::CompilerInstance& ci, clang::ASTContext& ctx,
+               llvm::raw_ostream& os, Options const& opts)
 {
   ASTVisitor v(ci, ctx, os, opts);
   v.HandleTranslationUnit(ctx.getTranslationUnitDecl());
diff --git a/src/Output.h b/src/Output.h
index 9df6391..db1982b 100644
--- a/src/Output.h
+++ b/src/Output.h
@@ -19,20 +19,18 @@
 #include <cxsys/Configure.h>
 
 namespace llvm {
-  class raw_ostream;
+class raw_ostream;
 }
 
 namespace clang {
-  class CompilerInstance;
-  class ASTContext;
+class CompilerInstance;
+class ASTContext;
 }
 
 struct Options;
 
 /// outputXML - Print a gccxml-compatible AST dump.
-void outputXML(clang::CompilerInstance& ci,
-               clang::ASTContext& ctx,
-               llvm::raw_ostream& os,
-               Options const& opts);
+void outputXML(clang::CompilerInstance& ci, clang::ASTContext& ctx,
+               llvm::raw_ostream& os, Options const& opts);
 
 #endif // CASTXML_OUTPUT_H
diff --git a/src/RunClang.cxx b/src/RunClang.cxx
index 03176a6..37e8ac7 100644
--- a/src/RunClang.cxx
+++ b/src/RunClang.cxx
@@ -50,47 +50,76 @@
 #include <memory>
 #include <queue>
 
-//----------------------------------------------------------------------------
-class ASTConsumer: public clang::ASTConsumer
+#if LLVM_VERSION_MAJOR > 3 ||                                                 \
+  LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 9
+#define CASTXML_OWNS_OSTREAM
+#endif
+
+class ASTConsumer : public clang::ASTConsumer
 {
   clang::CompilerInstance& CI;
+#ifdef CASTXML_OWNS_OSTREAM
+  std::unique_ptr<llvm::raw_ostream> OwnOS;
+#endif
   llvm::raw_ostream& OS;
   Options const& Opts;
-  struct Class {
+  struct Class
+  {
     clang::CXXRecordDecl* RD;
     int Depth;
-    Class(clang::CXXRecordDecl* rd, int depth): RD(rd), Depth(depth) {}
+    Class(clang::CXXRecordDecl* rd, int depth)
+      : RD(rd)
+      , Depth(depth)
+    {
+    }
   };
   std::queue<Class> Classes;
   int ClassImplicitMemberDepth = 0;
+
 public:
+#ifdef CASTXML_OWNS_OSTREAM
+  ASTConsumer(clang::CompilerInstance& ci,
+              std::unique_ptr<llvm::raw_ostream> os, Options const& opts)
+    : CI(ci)
+    , OwnOS(std::move(os))
+    , OS(*OwnOS)
+    , Opts(opts)
+  {
+  }
+#else
   ASTConsumer(clang::CompilerInstance& ci, llvm::raw_ostream& os,
-              Options const& opts):
-    CI(ci), OS(os), Opts(opts) {}
+              Options const& opts)
+    : CI(ci)
+    , OS(os)
+    , Opts(opts)
+  {
+  }
+#endif
 
-  void AddImplicitMembers(Class const& c) {
+  void AddImplicitMembers(Class const& c)
+  {
     clang::CXXRecordDecl* rd = c.RD;
     this->ClassImplicitMemberDepth = c.Depth + 1;
 
     clang::Sema& sema = this->CI.getSema();
     sema.ForceDeclarationOfImplicitMembers(rd);
 
-    for(clang::DeclContext::decl_iterator i = rd->decls_begin(),
-          e = rd->decls_end(); i != e; ++i) {
+    for (clang::DeclContext::decl_iterator i = rd->decls_begin(),
+                                           e = rd->decls_end();
+         i != e; ++i) {
       clang::CXXMethodDecl* m = clang::dyn_cast<clang::CXXMethodDecl>(*i);
-      if(m && !m->isDeleted() && !m->isInvalidDecl()) {
+      if (m && !m->isDeleted() && !m->isInvalidDecl()) {
         bool mark = false;
         clang::CXXConstructorDecl* c =
-           clang::dyn_cast<clang::CXXConstructorDecl>(m);
+          clang::dyn_cast<clang::CXXConstructorDecl>(m);
         if (c) {
-          mark = (c->isDefaultConstructor() ||
-                  c->isCopyConstructor() ||
+          mark = (c->isDefaultConstructor() || c->isCopyConstructor() ||
                   c->isMoveConstructor());
         } else if (clang::dyn_cast<clang::CXXDestructorDecl>(m)) {
           mark = true;
         } else {
-          mark = (m->isCopyAssignmentOperator() ||
-                  m->isMoveAssignmentOperator());
+          mark =
+            (m->isCopyAssignmentOperator() || m->isMoveAssignmentOperator());
         }
         if (mark) {
           /* Ensure the member is defined.  */
@@ -109,9 +138,10 @@ public:
     }
   }
 
-  void HandleTagDeclDefinition(clang::TagDecl* d) {
-    if(clang::CXXRecordDecl* rd = clang::dyn_cast<clang::CXXRecordDecl>(d)) {
-      if(!rd->isDependentContext()) {
+  void HandleTagDeclDefinition(clang::TagDecl* d)
+  {
+    if (clang::CXXRecordDecl* rd = clang::dyn_cast<clang::CXXRecordDecl>(d)) {
+      if (!rd->isDependentContext()) {
         if (this->ClassImplicitMemberDepth < 16) {
           this->Classes.push(Class(rd, this->ClassImplicitMemberDepth));
         }
@@ -119,7 +149,8 @@ public:
     }
   }
 
-  void HandleTranslationUnit(clang::ASTContext& ctx) {
+  void HandleTranslationUnit(clang::ASTContext& ctx)
+  {
     clang::Sema& sema = this->CI.getSema();
 
     // Perform instantiations needed by the original translation unit.
@@ -145,15 +176,18 @@ public:
   }
 };
 
-//----------------------------------------------------------------------------
 template <class T>
-class CastXMLPredefines: public T
+class CastXMLPredefines : public T
 {
 protected:
   Options const& Opts;
 
-  CastXMLPredefines(Options const& opts): Opts(opts) {}
-  std::string UpdatePredefines(clang::CompilerInstance const& CI) {
+  CastXMLPredefines(Options const& opts)
+    : Opts(opts)
+  {
+  }
+  std::string UpdatePredefines(clang::CompilerInstance const& CI)
+  {
     std::string const& predefines = CI.getPreprocessor().getPredefines();
 
     // Identify the portion of the predefines string corresponding to
@@ -163,7 +197,7 @@ protected:
     std::string::size_type start = predefines.find(predef_start);
     std::string::size_type end = std::string::npos;
     if (start != std::string::npos) {
-      start += sizeof(predef_start)-1;
+      start += sizeof(predef_start) - 1;
       end = predefines.find(predef_end, start);
       if (end == std::string::npos) {
         end = predefines.size();
@@ -181,15 +215,19 @@ protected:
     builtins +=
 #define STR(x) STR_(x)
 #define STR_(x) #x
-      "#define __castxml_clang_major__ " STR(CLANG_VERSION_MAJOR) "\n"
-      "#define __castxml_clang_minor__ " STR(CLANG_VERSION_MINOR) "\n"
-      "#define __castxml_clang_patchlevel__ "
+      "#define __castxml_clang_major__ " STR(
+        CLANG_VERSION_MAJOR) "\n"
+                             "#define __castxml_clang_minor__ " STR(
+                               CLANG_VERSION_MINOR) "\n"
+                                                    "#define "
+                                                    "__castxml_clang_"
+                                                    "patchlevel__ "
 #ifdef CLANG_VERSION_PATCHLEVEL
       STR(CLANG_VERSION_PATCHLEVEL)
 #else
-      "0"
+                                                    "0"
 #endif
-      "\n"
+        "\n"
 #undef STR
 #undef STR_
       ;
@@ -203,9 +241,8 @@ protected:
         // Clang does not support this builtin, so fake it to tolerate
         // uses in function bodies while parsing.
         builtins += "\n"
-          "#define __builtin_va_arg_pack() 0\n"
-          "#define __builtin_va_arg_pack_len() 1\n"
-          ;
+                    "#define __builtin_va_arg_pack() 0\n"
+                    "#define __builtin_va_arg_pack_len() 1\n";
       }
 
       // Provide __float128 if simulating the actual GNU compiler.
@@ -214,11 +251,10 @@ protected:
         // diagnostics when it is used in some contexts.  Provide our own
         // approximation of the builtin instead.
         builtins += "\n"
-          "typedef struct __castxml__float128_s { "
-          "  char x[16] __attribute__((aligned(16))); "
-          "} __castxml__float128;\n"
-          "#define __float128 __castxml__float128\n"
-          ;
+                    "typedef struct __castxml__float128_s { "
+                    "  char x[16] __attribute__((aligned(16))); "
+                    "} __castxml__float128;\n"
+                    "#define __float128 __castxml__float128\n";
       }
 
       // Provide __is_assignable builtin if simulating MSVC.
@@ -226,7 +262,8 @@ protected:
       // we can skip this when built against such a Clang.
       if (CI.getLangOpts().MSCompatibilityVersion >= 190000000 &&
           CI.getLangOpts().CPlusPlus11) {
-        builtins += "\n"
+        builtins +=
+          "\n"
           "template <typename T> T&& __castxml__declval() noexcept;\n"
           "template <typename To, typename Fr, typename =\n"
           "  decltype(__castxml__declval<To>() = __castxml__declval<Fr>())>\n"
@@ -235,16 +272,15 @@ protected:
           "  static char (&__castxml__is_assignable_check(...))[2];\n"
           "#define __is_assignable(_To,_Fr) \\\n"
           "  (sizeof(__castxml__is_assignable_check<_To,_Fr>(0)) == \\\n"
-          "   sizeof(char(&)[1]))\n"
-          ;
+          "   sizeof(char(&)[1]))\n";
       }
 
-#if LLVM_VERSION_MAJOR < 3 \
- || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8
+#if LLVM_VERSION_MAJOR < 3 || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR < 8
       // Clang 3.8 and above provide a __make_integer_seq builtin needed
       // in C++14 mode.  Provide it ourselves for older Clang versions.
       if (CI.getLangOpts().CPlusPlus14) {
-        builtins += "\n"
+        builtins +=
+          "\n"
           "template <typename _T, _T> struct __castxml__integral_constant;\n"
           "template <template<typename _U, _U...> class _S,\n"
           "          typename, typename, bool>\n"
@@ -270,25 +306,24 @@ protected:
           "  __castxml__make_integer_seq_impl<_S,\n"
           "      __castxml__integral_constant<_T, _Sz>,\n"
           "     _S<_T>, (_Sz>=0)>::type;\n"
-          "#define __make_integer_seq __castxml__make_integer_seq\n"
-          ;
+          "#define __make_integer_seq __castxml__make_integer_seq\n";
       }
 #endif
 
       // Prevent glibc use of a GNU extension not implemented by Clang.
       if (this->NeedNoMathInlines(this->Opts.Predefines)) {
         builtins += "\n"
-          "#define __NO_MATH_INLINES 1\n"
-          ;
+                    "#define __NO_MATH_INLINES 1\n";
       }
 
     } else {
-      builtins += predefines.substr(start, end-start);
+      builtins += predefines.substr(start, end - start);
     }
     return predefines.substr(0, start) + builtins + predefines.substr(end);
   }
 
-  bool IsActualGNU(std::string const& pd) const {
+  bool IsActualGNU(std::string const& pd) const
+  {
     return (pd.find("#define __GNUC__ ") != pd.npos &&
             pd.find("#define __clang__ ") == pd.npos &&
             pd.find("#define __INTEL_COMPILER ") == pd.npos &&
@@ -296,18 +331,21 @@ protected:
             pd.find("#define __PGI ") == pd.npos);
   }
 
-  bool NeedBuiltinVarArgPack(std::string const& pd) {
+  bool NeedBuiltinVarArgPack(std::string const& pd)
+  {
     return this->IsActualGNU(pd);
   }
 
-  bool NeedFloat128(std::string const& pd) const {
+  bool NeedFloat128(std::string const& pd) const
+  {
     return (this->IsActualGNU(pd) &&
             (pd.find("#define __i386__ ") != pd.npos ||
              pd.find("#define __x86_64__ ") != pd.npos ||
              pd.find("#define __ia64__ ") != pd.npos));
   }
 
-  bool NeedNoMathInlines(std::string const& pd) const {
+  bool NeedNoMathInlines(std::string const& pd) const
+  {
     return (this->IsActualGNU(pd) &&
             (pd.find("#define __i386__ ") != pd.npos &&
              pd.find("#define __OPTIMIZE__ ") != pd.npos &&
@@ -315,7 +353,8 @@ protected:
   }
 
   bool BeginSourceFileAction(clang::CompilerInstance& CI,
-                             llvm::StringRef /*Filename*/) {
+                             llvm::StringRef /*Filename*/)
+  {
     CI.getPreprocessor().setPredefines(this->UpdatePredefines(CI));
 
     // Tell Clang not to tear down the parser at EOF.
@@ -325,120 +364,132 @@ protected:
   }
 };
 
-//----------------------------------------------------------------------------
-class CastXMLPrintPreprocessedAction:
-  public CastXMLPredefines<clang::PrintPreprocessedAction>
+class CastXMLPrintPreprocessedAction
+  : public CastXMLPredefines<clang::PrintPreprocessedAction>
 {
 public:
-  CastXMLPrintPreprocessedAction(Options const& opts):
-    CastXMLPredefines(opts) {}
+  CastXMLPrintPreprocessedAction(Options const& opts)
+    : CastXMLPredefines(opts)
+  {
+  }
 };
 
-//----------------------------------------------------------------------------
-class CastXMLSyntaxOnlyAction:
-  public CastXMLPredefines<clang::SyntaxOnlyAction>
+class CastXMLSyntaxOnlyAction
+  : public CastXMLPredefines<clang::SyntaxOnlyAction>
 {
-  std::unique_ptr<clang::ASTConsumer>
-  CreateASTConsumer(clang::CompilerInstance &CI,
-                    llvm::StringRef InFile) override {
+  std::unique_ptr<clang::ASTConsumer> CreateASTConsumer(
+    clang::CompilerInstance& CI, llvm::StringRef InFile) override
+  {
     using llvm::sys::path::filename;
-    if(!this->Opts.GccXml) {
+    if (!this->Opts.GccXml && !this->Opts.CastXml) {
       return clang::SyntaxOnlyAction::CreateASTConsumer(CI, InFile);
-    } else if(llvm::raw_ostream* OS =
-              CI.createDefaultOutputFile(false, filename(InFile), "xml")) {
+#ifdef CASTXML_OWNS_OSTREAM
+    } else if (std::unique_ptr<llvm::raw_ostream> OS =
+                 CI.createDefaultOutputFile(false, filename(InFile), "xml")) {
+      return llvm::make_unique<ASTConsumer>(CI, std::move(OS), this->Opts);
+#else
+    } else if (llvm::raw_ostream* OS =
+                 CI.createDefaultOutputFile(false, filename(InFile), "xml")) {
       return llvm::make_unique<ASTConsumer>(CI, *OS, this->Opts);
+#endif
     } else {
-      return 0;
+      return nullptr;
     }
   }
+
 public:
-  CastXMLSyntaxOnlyAction(Options const& opts):
-    CastXMLPredefines(opts) {}
+  CastXMLSyntaxOnlyAction(Options const& opts)
+    : CastXMLPredefines(opts)
+  {
+  }
 };
 
-//----------------------------------------------------------------------------
-static clang::FrontendAction*
-CreateFrontendAction(clang::CompilerInstance* CI, Options const& opts)
+static clang::FrontendAction* CreateFrontendAction(clang::CompilerInstance* CI,
+                                                   Options const& opts)
 {
   clang::frontend::ActionKind action =
     CI->getInvocation().getFrontendOpts().ProgramAction;
-  switch(action) {
-  case clang::frontend::PrintPreprocessedInput:
-    return new CastXMLPrintPreprocessedAction(opts);
-  case clang::frontend::ParseSyntaxOnly:
-    return new CastXMLSyntaxOnlyAction(opts);
-  default:
-    std::cerr << "error: unsupported action: " << int(action) << "\n";
-    return 0;
+  switch (action) {
+    case clang::frontend::PrintPreprocessedInput:
+      return new CastXMLPrintPreprocessedAction(opts);
+    case clang::frontend::ParseSyntaxOnly:
+      return new CastXMLSyntaxOnlyAction(opts);
+    default:
+      std::cerr << "error: unsupported action: " << int(action) << "\n";
+      return nullptr;
   }
 }
 
-//----------------------------------------------------------------------------
 static bool runClangCI(clang::CompilerInstance* CI, Options const& opts)
 {
   // Create a diagnostics engine for this compiler instance.
   CI->createDiagnostics();
-  if(!CI->hasDiagnostics()) {
+  if (!CI->hasDiagnostics()) {
     return false;
   }
 
   // Set frontend options we captured directly.
   CI->getFrontendOpts().OutputFile = opts.OutputFile;
 
-  if(opts.GccXml) {
-#   define MSG(x) "error: '--castxml-gccxml' does not work with " x "\n"
-    if(CI->getLangOpts().ObjC1 || CI->getLangOpts().ObjC2) {
+  if (opts.GccXml) {
+#define MSG(x) "error: '--castxml-gccxml' does not work with " x "\n"
+    if (CI->getLangOpts().ObjC1 || CI->getLangOpts().ObjC2) {
+      std::cerr << MSG("Objective C");
+      return false;
+    }
+#undef MSG
+  }
+
+  if (opts.CastXml) {
+#define MSG(x) "error: '--castxml-output=<v>' does not work with " x "\n"
+    if (CI->getLangOpts().ObjC1 || CI->getLangOpts().ObjC2) {
       std::cerr << MSG("Objective C");
       return false;
     }
-#   undef MSG
+#undef MSG
   }
 
   // Construct our Clang front-end action.  This dispatches
   // handling of each input file with an action based on the
   // flags provided (e.g. -E to preprocess-only).
-  std::unique_ptr<clang::FrontendAction>
-    action(CreateFrontendAction(CI, opts));
-  if(action) {
+  std::unique_ptr<clang::FrontendAction> action(
+    CreateFrontendAction(CI, opts));
+  if (action) {
     return CI->ExecuteAction(*action);
   } else {
     return false;
   }
 }
 
-//----------------------------------------------------------------------------
 static llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>
 runClangCreateDiagnostics(const char* const* argBeg, const char* const* argEnd)
 {
-  llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions>
-    diagOpts(new clang::DiagnosticOptions);
-  llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs>
-    diagID(new clang::DiagnosticIDs());
-  std::unique_ptr<llvm::opt::OptTable>
-    opts(clang::driver::createDriverOptTable());
+  llvm::IntrusiveRefCntPtr<clang::DiagnosticOptions> diagOpts(
+    new clang::DiagnosticOptions);
+  llvm::IntrusiveRefCntPtr<clang::DiagnosticIDs> diagID(
+    new clang::DiagnosticIDs());
+  std::unique_ptr<llvm::opt::OptTable> opts(
+    clang::driver::createDriverOptTable());
   unsigned missingArgIndex, missingArgCount;
-#if LLVM_VERSION_MAJOR > 3 \
- || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
-  llvm::opt::InputArgList
-    args(opts->ParseArgs(llvm::makeArrayRef(argBeg, argEnd),
-                         missingArgIndex, missingArgCount));
+#if LLVM_VERSION_MAJOR > 3 ||                                                 \
+  LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
+  llvm::opt::InputArgList args(opts->ParseArgs(
+    llvm::makeArrayRef(argBeg, argEnd), missingArgIndex, missingArgCount));
   clang::ParseDiagnosticArgs(*diagOpts, args);
 #else
-  std::unique_ptr<llvm::opt::InputArgList>
-    args(opts->ParseArgs(argBeg, argEnd, missingArgIndex, missingArgCount));
+  std::unique_ptr<llvm::opt::InputArgList> args(
+    opts->ParseArgs(argBeg, argEnd, missingArgIndex, missingArgCount));
   clang::ParseDiagnosticArgs(*diagOpts, *args);
 #endif
   clang::TextDiagnosticPrinter* diagClient =
     new clang::TextDiagnosticPrinter(llvm::errs(), &*diagOpts);
-  llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine>
-    diags(new clang::DiagnosticsEngine(diagID, &*diagOpts, diagClient));
+  llvm::IntrusiveRefCntPtr<clang::DiagnosticsEngine> diags(
+    new clang::DiagnosticsEngine(diagID, &*diagOpts, diagClient));
   clang::ProcessWarningOptions(*diags, *diagOpts, /*ReportDiags=*/false);
   return diags;
 }
 
-//----------------------------------------------------------------------------
-static int runClangImpl(const char* const* argBeg,
-                        const char* const* argEnd,
+static int runClangImpl(const char* const* argBeg, const char* const* argEnd,
                         Options const& opts)
 {
   // Construct a diagnostics engine for use while processing driver options.
@@ -453,12 +504,12 @@ static int runClangImpl(const char* const* argBeg,
       !llvm::sys::fs::is_directory(d.ResourceDir)) {
     d.ResourceDir = getClangResourceDir();
   }
-  llvm::SmallVector<const char *, 16> cArgs;
+  llvm::SmallVector<const char*, 16> cArgs;
   cArgs.push_back("<clang>");
   cArgs.insert(cArgs.end(), argBeg, argEnd);
 
   // Tell the driver not to generate any commands past syntax parsing.
-  if(opts.PPOnly) {
+  if (opts.PPOnly) {
     cArgs.push_back("-E");
   } else {
     cArgs.push_back("-fsyntax-only");
@@ -471,13 +522,13 @@ static int runClangImpl(const char* const* argBeg,
   }
 
   // For '-###' just print the jobs and exit early.
-  if(c->getArgs().hasArg(clang::driver::options::OPT__HASH_HASH_HASH)) {
+  if (c->getArgs().hasArg(clang::driver::options::OPT__HASH_HASH_HASH)) {
     c->getJobs().Print(llvm::errs(), "\n", true);
     return 0;
   }
 
   // Reject '-o' with multiple inputs.
-  if(!opts.OutputFile.empty() && c->getJobs().size() > 1) {
+  if (!opts.OutputFile.empty() && c->getJobs().size() > 1) {
     diags->Report(clang::diag::err_drv_output_argument_with_multiple_files);
     return 1;
   }
@@ -485,17 +536,17 @@ static int runClangImpl(const char* const* argBeg,
   // Run Clang for each compilation computed by the driver.
   // This should be once per input source file.
   bool result = true;
-  for(auto const& job : c->getJobs()) {
+  for (auto const& job : c->getJobs()) {
     clang::driver::Command const* cmd =
       llvm::dyn_cast<clang::driver::Command>(&job);
-    if(cmd && strcmp(cmd->getCreator().getName(), "clang") == 0) {
+    if (cmd && strcmp(cmd->getCreator().getName(), "clang") == 0) {
       // Invoke Clang with this set of arguments.
-      std::unique_ptr<clang::CompilerInstance>
-        CI(new clang::CompilerInstance());
+      std::unique_ptr<clang::CompilerInstance> CI(
+        new clang::CompilerInstance());
       const char* const* cmdArgBeg = cmd->getArguments().data();
       const char* const* cmdArgEnd = cmdArgBeg + cmd->getArguments().size();
-      if (clang::CompilerInvocation::CreateFromArgs
-          (CI->getInvocation(), cmdArgBeg, cmdArgEnd, *diags)) {
+      if (clang::CompilerInvocation::CreateFromArgs(
+            CI->getInvocation(), cmdArgBeg, cmdArgEnd, *diags)) {
         if (diags->hasErrorOccurred()) {
           return 1;
         }
@@ -509,26 +560,23 @@ static int runClangImpl(const char* const* argBeg,
       llvm::raw_svector_ostream msg(buf);
       job.Print(msg, "\n", true);
       diags->Report(clang::diag::err_fe_expected_clang_command);
-      diags->Report(clang::diag::err_fe_expected_compiler_job)
-        << msg.str();
+      diags->Report(clang::diag::err_fe_expected_compiler_job) << msg.str();
       result = false;
     }
   }
-  return result? 0:1;
+  return result ? 0 : 1;
 }
 
-//----------------------------------------------------------------------------
-int runClang(const char* const* argBeg,
-             const char* const* argEnd,
+int runClang(const char* const* argBeg, const char* const* argEnd,
              Options const& opts)
 {
   llvm::SmallVector<const char*, 32> args(argBeg, argEnd);
   std::string fmsc_version = "-fmsc-version=";
   std::string std_flag = "-std=";
 
-  if(opts.HaveCC) {
+  if (opts.HaveCC) {
     // Configure target to match that of given compiler.
-    if(!opts.HaveTarget && !opts.Triple.empty()) {
+    if (!opts.HaveTarget && !opts.Triple.empty()) {
       args.push_back("-target");
       args.push_back(opts.Triple.c_str());
     }
@@ -538,10 +586,11 @@ int runClang(const char* const* argBeg,
     args.push_back("-nostdlibinc");
 
     // Add header search paths detected from given compiler.
-    for(std::vector<Options::Include>::const_iterator
-          i = opts.Includes.begin(), e = opts.Includes.end();
-        i != e; ++i) {
-      if(i->Framework) {
+    for (std::vector<Options::Include>::const_iterator
+           i = opts.Includes.begin(),
+           e = opts.Includes.end();
+         i != e; ++i) {
+      if (i->Framework) {
         args.push_back("-iframework");
       } else {
         args.push_back("-isystem");
@@ -554,18 +603,18 @@ int runClang(const char* const* argBeg,
 
     // Configure language options to match given compiler.
     std::string const& pd = opts.Predefines;
-    if(pd.find("#define _MSC_EXTENSIONS ") != pd.npos) {
+    if (pd.find("#define _MSC_EXTENSIONS ") != pd.npos) {
       args.push_back("-fms-extensions");
     }
-    if(const char* d = strstr(pd.c_str(), "#define _MSC_VER ")) {
+    if (const char* d = strstr(pd.c_str(), "#define _MSC_VER ")) {
       args.push_back("-fms-compatibility");
       // Extract the _MSC_VER value to give to -fmsc-version=.
       d += 17;
-      if(const char* e = strchr(d, '\n')) {
-        if(*(e - 1) == '\r') {
+      if (const char* e = strchr(d, '\n')) {
+        if (*(e - 1) == '\r') {
           --e;
         }
-        std::string const msc_ver_str(d, e-d);
+        std::string const msc_ver_str(d, e - d);
         fmsc_version += msc_ver_str;
         args.push_back(fmsc_version.c_str());
 
@@ -610,7 +659,7 @@ int runClang(const char* const* argBeg,
           }
 
           // Add the standard year.
-          std::string const std_date_str(d, e-d);
+          std::string const std_date_str(d, e - d);
           errno = 0;
           long std_date = std::strtol(std_date_str.c_str(), nullptr, 10);
           if (errno != 0) {
@@ -629,14 +678,14 @@ int runClang(const char* const* argBeg,
           args.push_back(std_flag.c_str());
         }
       } else if (const char* d =
-                 strstr(pd.c_str(), "#define __STDC_VERSION__ ")) {
+                   strstr(pd.c_str(), "#define __STDC_VERSION__ ")) {
         // Extract the C standard level.
         d += 25;
         if (const char* e = strchr(d, '\n')) {
           if (*(e - 1) == '\r') {
             --e;
           }
-          std::string const std_date_str(d, e-d);
+          std::string const std_date_str(d, e - d);
           errno = 0;
           long std_date = std::strtol(std_date_str.c_str(), nullptr, 10);
           if (errno != 0) {
diff --git a/src/RunClang.h b/src/RunClang.h
index 4918137..5fc6350 100644
--- a/src/RunClang.h
+++ b/src/RunClang.h
@@ -19,8 +19,7 @@
 struct Options;
 
 /// runClang - Run Clang with given user arguments and detected options.
-int runClang(const char* const* argBeg,
-             const char* const* argEnd,
+int runClang(const char* const* argBeg, const char* const* argEnd,
              Options const& opts);
 
 #endif // CASTXML_RUNCLANG_H
diff --git a/src/Utils.cxx b/src/Utils.cxx
index cea0655..160e13c 100644
--- a/src/Utils.cxx
+++ b/src/Utils.cxx
@@ -18,23 +18,21 @@
 #include "Version.h"
 
 #include <cxsys/Process.h>
+#include <fstream>
 #include <llvm/ADT/SmallString.h>
 #include <llvm/Support/FileSystem.h>
 #include <llvm/Support/Path.h>
-#include <fstream>
 #include <vector>
 
 static std::string castxmlResourceDir;
 static std::string castxmlClangResourceDir;
 
-//----------------------------------------------------------------------------
 static std::string GetMainExecutable(const char* argv0)
 {
-  return llvm::sys::fs::getMainExecutable
-    (argv0, (void*)(intptr_t)GetMainExecutable);
+  return llvm::sys::fs::getMainExecutable(argv0,
+                                          (void*)(intptr_t)GetMainExecutable);
 }
 
-//----------------------------------------------------------------------------
 static bool tryBuildDir(std::string const& dir)
 {
   // Build tree has
@@ -46,10 +44,8 @@ static bool tryBuildDir(std::string const& dir)
   std::ifstream cl_fin(cl_dir_txt.c_str());
   std::string src_dir;
   std::string cl_dir;
-  if (std::getline(src_fin, src_dir) &&
-      llvm::sys::fs::is_directory(src_dir) &&
-      std::getline(cl_fin, cl_dir) &&
-      llvm::sys::fs::is_directory(cl_dir)) {
+  if (std::getline(src_fin, src_dir) && llvm::sys::fs::is_directory(src_dir) &&
+      std::getline(cl_fin, cl_dir) && llvm::sys::fs::is_directory(cl_dir)) {
     castxmlResourceDir = src_dir + "/share/castxml";
     castxmlClangResourceDir = cl_dir;
     return true;
@@ -57,7 +53,6 @@ static bool tryBuildDir(std::string const& dir)
   return false;
 }
 
-//----------------------------------------------------------------------------
 bool findResourceDir(const char* argv0, std::ostream& error)
 {
   std::string exe = GetMainExecutable(argv0);
@@ -81,8 +76,7 @@ bool findResourceDir(const char* argv0, std::ostream& error)
     llvm::sys::path::remove_filename(dir2);
     // Build tree has
     //   <build>/bin[/<config>]/castxml
-    if (!tryBuildDir(dir.str()) &&
-        !tryBuildDir(dir2.str())) {
+    if (!tryBuildDir(dir.str()) && !tryBuildDir(dir2.str())) {
       error << "Unable to locate resources for " << exe << "\n";
       return false;
     }
@@ -91,36 +85,29 @@ bool findResourceDir(const char* argv0, std::ostream& error)
   return true;
 }
 
-//----------------------------------------------------------------------------
 std::string getResourceDir()
 {
   return castxmlResourceDir;
 }
 
-//----------------------------------------------------------------------------
 std::string getClangResourceDir()
 {
   return castxmlClangResourceDir;
 }
 
-//----------------------------------------------------------------------------
 std::string getVersionString()
 {
   return CASTXML_VERSION_STRING;
 }
 
-//----------------------------------------------------------------------------
 unsigned int getVersionValue()
 {
-  return (CASTXML_VERSION_MAJOR * 1000000 +
-          CASTXML_VERSION_MINOR *    1000 +
-          CASTXML_VERSION_PATCH *       1);
+  return (CASTXML_VERSION_MAJOR * 1000000 + CASTXML_VERSION_MINOR * 1000 +
+          CASTXML_VERSION_PATCH * 1);
 }
 
-//----------------------------------------------------------------------------
-bool runCommand(int argc, const char* const* argv,
-                int& ret, std::string& out, std::string& err,
-                std::string& msg)
+bool runCommand(int argc, const char* const* argv, int& ret, std::string& out,
+                std::string& err, std::string& msg)
 {
   std::vector<const char*> cmd(argv, argv + argc);
   cmd.push_back(0);
@@ -143,80 +130,86 @@ bool runCommand(int argc, const char* const* argv,
   char* data;
   int length;
   int pipe;
-  while((pipe = cxsysProcess_WaitForData(cp, &data, &length, 0)) > 0) {
-    if(pipe == cxsysProcess_Pipe_STDOUT) {
-      outBuf.insert(outBuf.end(), data, data+length);
-    } else if(pipe == cxsysProcess_Pipe_STDERR) {
-      errBuf.insert(errBuf.end(), data, data+length);
+  while ((pipe = cxsysProcess_WaitForData(cp, &data, &length, 0)) > 0) {
+    if (pipe == cxsysProcess_Pipe_STDOUT) {
+      outBuf.insert(outBuf.end(), data, data + length);
+    } else if (pipe == cxsysProcess_Pipe_STDERR) {
+      errBuf.insert(errBuf.end(), data, data + length);
     }
   }
 
   cxsysProcess_WaitForExit(cp, 0);
-  if(!outBuf.empty()) {
+  if (!outBuf.empty()) {
     out.append(&*outBuf.begin(), outBuf.size());
   }
-  if(!errBuf.empty()) {
+  if (!errBuf.empty()) {
     err.append(&*errBuf.begin(), errBuf.size());
   }
 
   bool result = true;
-  switch(cxsysProcess_GetState(cp)) {
-  case cxsysProcess_State_Exited:
-    ret = cxsysProcess_GetExitValue(cp);
-    break;
-  case cxsysProcess_State_Exception:
-    msg = cxsysProcess_GetExceptionString(cp);
-    result = false;
-    break;
-  case cxsysProcess_State_Error:
-    msg = cxsysProcess_GetErrorString(cp);
-    result = false;
-    break;
-  default:
-    msg = "Process terminated in unexpected state.\n";
-    result = false;
-    break;
+  switch (cxsysProcess_GetState(cp)) {
+    case cxsysProcess_State_Exited:
+      ret = cxsysProcess_GetExitValue(cp);
+      break;
+    case cxsysProcess_State_Exception:
+      msg = cxsysProcess_GetExceptionString(cp);
+      result = false;
+      break;
+    case cxsysProcess_State_Error:
+      msg = cxsysProcess_GetErrorString(cp);
+      result = false;
+      break;
+    default:
+      msg = "Process terminated in unexpected state.\n";
+      result = false;
+      break;
   }
 
   cxsysProcess_Delete(cp);
   return result;
 }
 
-//----------------------------------------------------------------------------
 std::string encodeXML(std::string const& in, bool cdata)
 {
   std::string xml;
   const char* last = in.c_str();
-  for(const char* c = last; *c; ++c) {
-    switch(*c) {
-#   define XML(OUT)               \
-      xml.append(last, c - last); \
-      last = c + 1;               \
-      xml.append(OUT)
-    case '&': XML("&"); break;
-    case '<': XML("<"); break;
-    case '>': XML(">"); break;
-    case '\'':
-      if(!cdata) {
-        XML("'");
-      }
-      break;
-    case '"':
-      if(!cdata) {
-        XML(""");
-      }
-      break;
-    default: break;
-#   undef XML
+  for (const char* c = last; *c; ++c) {
+    switch (*c) {
+#define XML(OUT)                                                              \
+  xml.append(last, c - last);                                                 \
+  last = c + 1;                                                               \
+  xml.append(OUT)
+      case '&':
+        XML("&");
+        break;
+      case '<':
+        XML("<");
+        break;
+      case '>':
+        XML(">");
+        break;
+      case '\'':
+        if (!cdata) {
+          XML("'");
+        }
+        break;
+      case '"':
+        if (!cdata) {
+          XML(""");
+        }
+        break;
+      default:
+        break;
+#undef XML
     }
   }
   xml.append(last);
   return xml;
 }
 
-//----------------------------------------------------------------------------
 std::string stringReplace(std::string str, std::string const& in,
-                          std::string const& out) {
+                          std::string const& out)
+{
   std::string::size_type p = 0;
   while ((p = str.find(in, p)) != std::string::npos) {
     str.replace(p, in.size(), out);
@@ -226,10 +219,9 @@ std::string stringReplace(std::string str, std::string const& in,
 }
 
 #if defined(_WIN32)
-# include <windows.h>
+#include <windows.h>
 #endif
 
-//----------------------------------------------------------------------------
 void suppressInteractiveErrors()
 {
 #if defined(_WIN32)
diff --git a/src/Utils.h b/src/Utils.h
index 7103fa7..a29e96f 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -37,9 +37,8 @@ std::string getVersionString();
 unsigned int getVersionValue();
 
 /// runCommand - Run a given command line and capture the output.
-bool runCommand(int argc, const char* const* argv,
-                int& ret, std::string& out, std::string& err,
-                std::string& msg);
+bool runCommand(int argc, const char* const* argv, int& ret, std::string& out,
+                std::string& err, std::string& msg);
 
 /// suppressInteractiveErrors - Disable Windows error dialog popups
 void suppressInteractiveErrors();
diff --git a/src/Version.cmake b/src/Version.cmake
index fc93788..583819f 100644
--- a/src/Version.cmake
+++ b/src/Version.cmake
@@ -39,7 +39,7 @@ elseif(COMMAND _git)
       set(CastXML_VERSION "${CastXML_VERSION}-git")
     endif()
   endif()
-elseif("d5934bd" MATCHES "^([0-9a-f]+)$")
+elseif("75c7f16" MATCHES "^([0-9a-f]+)$")
   # Use version exported by 'git archive'.
   set(CastXML_VERSION "${CastXML_VERSION}-g${CMAKE_MATCH_1}")
 else()
diff --git a/src/castxml.cxx b/src/castxml.cxx
index f3cb861..7c39e78 100644
--- a/src/castxml.cxx
+++ b/src/castxml.cxx
@@ -29,26 +29,28 @@
 #include "llvm/Support/raw_ostream.h"
 
 #include <iostream>
-#include <sstream>
 #include <set>
+#include <sstream>
+#include <string.h>
 #include <system_error>
 #include <vector>
-#include <string.h>
 
-#if LLVM_VERSION_MAJOR > 3 \
- || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
-# include "llvm/Support/StringSaver.h"
+#if LLVM_VERSION_MAJOR > 3 ||                                                 \
+  LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 7
+#include "llvm/Support/StringSaver.h"
 #else
-class StringSaver: public llvm::cl::StringSaver {
+class StringSaver : public llvm::cl::StringSaver
+{
   std::set<std::string> Strings;
+
 public:
-  const char* SaveString(const char* s) {
+  const char* SaveString(const char* s)
+  {
     return this->Strings.insert(s).first->c_str();
   }
 };
 #endif
 
-//----------------------------------------------------------------------------
 int main(int argc_in, const char** argv_in)
 {
   suppressInteractiveErrors();
@@ -60,18 +62,17 @@ int main(int argc_in, const char** argv_in)
 
   llvm::SmallVector<const char*, 64> argv;
   llvm::SpecificBumpPtrAllocator<char> argAlloc;
-  if(std::error_code e =
-     llvm::sys::Process::GetArgumentVector(
-       argv, llvm::ArrayRef<const char*>(argv_in, argc_in), argAlloc)) {
+  if (std::error_code e = llvm::sys::Process::GetArgumentVector(
+        argv, llvm::ArrayRef<const char*>(argv_in, argc_in), argAlloc)) {
     llvm::errs() << "error: could not get arguments: " << e.message() << "\n";
     return 1;
-  } else if(argv.empty()) {
+  } else if (argv.empty()) {
     llvm::errs() << "error: no argv[0]?!\n";
     return 1;
   }
 
-#if LLVM_VERSION_MAJOR > 3 \
- || LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
+#if LLVM_VERSION_MAJOR > 3 ||                                                 \
+  LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR >= 8
   llvm::BumpPtrAllocator argSaverAlloc;
   llvm::StringSaver argSaver(argSaverAlloc);
 #elif LLVM_VERSION_MAJOR == 3 && LLVM_VERSION_MINOR == 7
@@ -80,15 +81,16 @@ int main(int argc_in, const char** argv_in)
 #else
   StringSaver argSaver;
 #endif
-  llvm::cl::ExpandResponseFiles(
-    argSaver, llvm::cl::TokenizeGNUCommandLine, argv);
+  llvm::cl::ExpandResponseFiles(argSaver, llvm::cl::TokenizeGNUCommandLine,
+                                argv);
 
   size_t const argc = argv.size();
 
-  if(!findResourceDir(argv[0], std::cerr)) {
+  if (!findResourceDir(argv[0], std::cerr)) {
     return 1;
   }
 
+  /* clang-format off */
   const char* usage =
     "Usage: castxml ( <castxml-opt> | <clang-opt> | <src> )...\n"
     "\n"
@@ -105,8 +107,15 @@ int main(int argc_in, const char** argv_in)
     "    <cc> names a compiler (e.g. \"gcc\") and <cc-opt>... specifies\n"
     "    options that may affect its target (e.g. \"-m32\").\n"
     "\n"
+    "  --castxml-output=<v>\n"
+    "    Write castxml-format output to <src>.xml or file named by '-o'\n"
+    "    The <v> specifies the \"epic\" format version number to generate,\n"
+    "    and must be '1'.\n"
+    "\n"
     "  --castxml-gccxml\n"
     "    Write gccxml-format output to <src>.xml or file named by '-o'\n"
+    "    Use this option if you need an output similar to the one generated\n"
+    "    by the legacy gccxml tool.\n"
     "\n"
     "  --castxml-start <name>[,<name>]...\n"
     "    Start AST traversal at declaration(s) with the given (qualified)\n"
@@ -123,85 +132,119 @@ int main(int argc_in, const char** argv_in)
     "    Print castxml and internal Clang compiler version information\n"
     "\n"
     ;
+  /* clang-format on */
 
   Options opts;
-  llvm::SmallVector<const char *, 16> clang_args;
-  llvm::SmallVector<const char *, 16> cc_args;
+  llvm::SmallVector<const char*, 16> clang_args;
+  llvm::SmallVector<const char*, 16> cc_args;
   const char* cc_id = 0;
 
-  for(size_t i=1; i < argc; ++i) {
-    if(strcmp(argv[i], "--castxml-gccxml") == 0) {
-      if(!opts.GccXml) {
+  for (size_t i = 1; i < argc; ++i) {
+    if (strcmp(argv[i], "--castxml-gccxml") == 0) {
+      if (!opts.GccXml) {
         opts.GccXml = true;
       } else {
+        /* clang-format off */
         std::cerr <<
           "error: '--castxml-gccxml' may be given at most once!\n"
           "\n" <<
           usage
           ;
+        /* clang-format on */
+        return 1;
+      }
+    } else if (strncmp(argv[i], "--castxml-output=", 17) == 0) {
+      if (!opts.CastXml) {
+        opts.CastXml = true;
+        opts.CastXmlEpicFormatVersion = atoi(argv[i] + 17);
+        if (opts.CastXmlEpicFormatVersion != 1) {
+          /* clang-format off */
+            std::cerr <<
+              "error: '--castxml-output=<v>' accepts only '1' as '<v>'!\n"
+              "\n" <<
+              usage
+              ;
+          /* clang-format on */
+        }
+      } else {
+        /* clang-format off */
+        std::cerr <<
+          "error: '--castxml-output=<v>' may be given at most once!\n"
+          "\n" <<
+          usage
+          ;
+        /* clang-format on */
         return 1;
       }
-    } else if(strcmp(argv[i], "--castxml-start") == 0) {
-      if((i+1) < argc) {
+    } else if (strcmp(argv[i], "--castxml-start") == 0) {
+      if ((i + 1) < argc) {
         std::string item;
         std::stringstream stream(argv[++i]);
         while (std::getline(stream, item, ',')) {
           opts.StartNames.push_back(item);
         }
       } else {
+        /* clang-format off */
         std::cerr <<
           "error: argument to '--castxml-start' is missing "
           "(expected 1 value)\n"
           "\n" <<
           usage
           ;
+        /* clang-format on */
         return 1;
       }
-    } else if(strncmp(argv[i], "--castxml-cc-", 13) == 0) {
-      if(!cc_id) {
+    } else if (strncmp(argv[i], "--castxml-cc-", 13) == 0) {
+      if (!cc_id) {
         cc_id = argv[i] + 13;
-        if((i+1) >= argc) {
+        if ((i + 1) >= argc) {
           continue;
         }
         ++i;
-        if(strncmp(argv[i], "-", 1) == 0) {
+        if (strncmp(argv[i], "-", 1) == 0) {
+          /* clang-format off */
           std::cerr <<
             "error: argument to '--castxml-cc-" << cc_id <<
             "' may not start with '-'\n"
             "\n" <<
             usage
             ;
+          /* clang-format on */
           return 1;
         }
-        if(strcmp(argv[i], "(") == 0) {
+        if (strcmp(argv[i], "(") == 0) {
           unsigned int depth = 1;
-          for(++i; i < argc && depth > 0; ++i) {
-            if(strncmp(argv[i], "--castxml-", 10) == 0) {
+          for (++i; i < argc && depth > 0; ++i) {
+            if (strncmp(argv[i], "--castxml-", 10) == 0) {
+              /* clang-format off */
               std::cerr <<
                 "error: arguments to '--castxml-cc-" << cc_id <<
                 "' may not start with '--castxml-'\n"
                 "\n" <<
                 usage
                 ;
+              /* clang-format on */
               return 1;
-            } else if(strcmp(argv[i], "(") == 0) {
+            } else if (strcmp(argv[i], "(") == 0) {
               ++depth;
               cc_args.push_back(argv[i]);
-            } else if(strcmp(argv[i], ")") == 0) {
-              if(--depth) {
+            } else if (strcmp(argv[i], ")") == 0) {
+              if (--depth) {
                 cc_args.push_back(argv[i]);
               }
             } else {
               cc_args.push_back(argv[i]);
             }
           }
-          if(depth) {
+          if (depth) {
+            /* clang-format off */
             std::cerr <<
               "error: unbalanced parentheses after '--castxml-cc-" <<
               cc_id << "'\n"
               "\n" <<
               usage
               ;
+            /* clang-format on */
             return 1;
           }
           --i;
@@ -209,28 +252,33 @@ int main(int argc_in, const char** argv_in)
           cc_args.push_back(argv[i]);
         }
       } else {
+        /* clang-format off */
         std::cerr <<
           "error: '--castxml-cc-<id>' may be given at most once!\n"
           "\n" <<
           usage
           ;
+        /* clang-format on */
         return 1;
       }
-    } else if(strcmp(argv[i], "-E") == 0) {
+    } else if (strcmp(argv[i], "-E") == 0) {
       opts.PPOnly = true;
-    } else if(strcmp(argv[i], "-o") == 0) {
-      if((i+1) < argc) {
+    } else if (strcmp(argv[i], "-o") == 0) {
+      if ((i + 1) < argc) {
         opts.OutputFile = argv[++i];
       } else {
+        /* clang-format off */
         std::cerr <<
           "error: argument to '-o' is missing (expected 1 value)\n"
           "\n" <<
           usage
           ;
+        /* clang-format on */
         return 1;
       }
-    } else if(strcmp(argv[i], "-help") == 0 ||
-              strcmp(argv[i], "--help") == 0) {
+    } else if (strcmp(argv[i], "-help") == 0 ||
+               strcmp(argv[i], "--help") == 0) {
+      /* clang-format off */
       std::cout <<
         usage <<
         "\n"
@@ -239,15 +287,18 @@ int main(int argc_in, const char** argv_in)
         "---------------------------------------------------------------"
         "\n" <<
         std::endl;
+      /* clang-format on */
       // Also print Clang help.
       clang_args.push_back(argv[i]);
-    } else if(strcmp(argv[i], "--version") == 0) {
+    } else if (strcmp(argv[i], "--version") == 0) {
+      /* clang-format off */
       std::cout <<
         "castxml version " << getVersionString() << "\n"
         "\n"
         "CastXML project maintained and supported by Kitware "
         "(kitware.com).\n" <<
         std::endl;
+      /* clang-format on */
       // Also print Clang version.
       clang_args.push_back(argv[i]);
     } else {
@@ -263,24 +314,38 @@ int main(int argc_in, const char** argv_in)
     }
   }
 
-  if(cc_id) {
+  if (cc_id) {
     opts.HaveCC = true;
-    if(cc_args.empty()) {
+    if (cc_args.empty()) {
+      /* clang-format off */
       std::cerr <<
         "error: '--castxml-cc-" << cc_id <<
         "' must be followed by a compiler command!\n"
         "\n" <<
         usage
         ;
+      /* clang-format on */
       return 1;
     }
-    if(!detectCC(cc_id, cc_args.data(), cc_args.data() + cc_args.size(),
-                 opts)) {
+    if (!detectCC(cc_id, cc_args.data(), cc_args.data() + cc_args.size(),
+                  opts)) {
       return 1;
     }
   }
 
-  if(clang_args.empty()) {
+  if (opts.GccXml && opts.CastXml) {
+    /* clang-format off */
+    std::cerr <<
+      "error: '--castxml-gccxml' and '--castxml-output=<v>'"
+      " may not be not be used together!\n"
+      "\n" <<
+      usage
+      ;
+    /* clang-format on */
+    return 1;
+  }
+
+  if (clang_args.empty()) {
     return 0;
   }
 
diff --git a/src/clang-format.bash b/src/clang-format.bash
new file mode 100755
index 0000000..827ab5f
--- /dev/null
+++ b/src/clang-format.bash
@@ -0,0 +1,116 @@
+#!/usr/bin/env bash
+#=============================================================================
+# Copyright 2015-2016 Kitware, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#=============================================================================
+
+usage='usage: clang-format.bash [<options>] [--]
+
+    --help                     Print usage plus more detailed help.
+
+    --clang-format <tool>      Use given clang-format tool.
+
+    --amend                    Filter files changed by HEAD.
+    --cached                   Filter files locally staged for commit.
+    --modified                 Filter files locally modified from HEAD.
+    --tracked                  Filter files tracked by Git.
+'
+
+help="$usage"'
+Example to format locally modified files:
+
+    src/clang-format.bash --modified
+
+Example to format locally modified files staged for commit:
+
+    src/clang-format.bash --cached
+
+Example to format files modified by the most recent commit:
+
+    src/clang-format.bash --amend
+
+Example to format all files:
+
+    src/clang-format.bash --tracked
+
+Example to format the current topic:
+
+    git filter-branch \
+      --tree-filter "src/clang-format.bash --tracked" \
+      master..
+'
+
+die() {
+    echo "$@" 1>&2; exit 1
+}
+
+#-----------------------------------------------------------------------------
+
+# Parse command-line arguments.
+clang_format=''
+mode=''
+while test "$#" != 0; do
+    case "$1" in
+    --amend) mode="amend" ;;
+    --cached) mode="cached" ;;
+    --clang-format) shift; clang_format="$1" ;;
+    --help) echo "$help"; exit 0 ;;
+    --modified) mode="modified" ;;
+    --tracked) mode="tracked" ;;
+    --) shift ; break ;;
+    -*) die "$usage" ;;
+    *) break ;;
+    esac
+    shift
+done
+test "$#" = 0 || die "$usage"
+
+# Find a default tool.
+tools='
+  clang-format
+  clang-format-3.8
+'
+if test "x$clang_format" = "x"; then
+    for tool in $tools; do
+        if type -p "$tool" >/dev/null; then
+            clang_format="$tool"
+            break
+        fi
+    done
+fi
+
+# Verify that we have a tool.
+if ! type -p "$clang_format" >/dev/null; then
+    echo "Unable to locate '$clang_format'"
+    exit 1
+fi
+
+# Select listing mode.
+case "$mode" in
+    '')       echo "$usage"; exit 0 ;;
+    amend)    git_ls='git diff-tree  --diff-filter=AM --name-only HEAD -r --no-commit-id' ;;
+    cached)   git_ls='git diff-index --diff-filter=AM --name-only HEAD --cached' ;;
+    modified) git_ls='git diff-index --diff-filter=AM --name-only HEAD' ;;
+    tracked)  git_ls='git ls-files' ;;
+    *) die "invalid mode: $mode" ;;
+esac
+
+# Filter sources to which our style should apply.
+$git_ls -z -- '*.h' '*.cxx' |
+
+  egrep -z -v '^share/castxml/' |
+  egrep -z -v '^src/kwsys/' |
+
+  # Update sources in-place.
+  xargs -0 "$clang_format" -i
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 51da580..6803dd6 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -34,14 +34,14 @@ macro(castxml_test_cmd test)
     )
 endmacro()
 
-macro(castxml_test_gccxml_common prefix ext std test)
-  if(DEFINED castxml_test_gccxml_custom_start)
-    set(_castxml_start ${castxml_test_gccxml_custom_start})
+macro(castxml_test_output_common prefix ext std test)
+  if(DEFINED castxml_test_output_custom_start)
+    set(_castxml_start ${castxml_test_output_custom_start})
   else()
     set(_castxml_start --castxml-start start)
   endif()
-  if(castxml_test_gccxml_custom_input)
-    set(_castxml_input ${castxml_test_gccxml_custom_input})
+  if(castxml_test_output_custom_input)
+    set(_castxml_input ${castxml_test_output_custom_input})
   else()
     set(_castxml_input ${test})
   endif()
@@ -53,13 +53,20 @@ macro(castxml_test_gccxml_common prefix ext std test)
     list(APPEND _castxml_expect ${prefix}.c.${test})
   endif()
   list(APPEND _castxml_expect ${prefix}.any.${test})
+
+  if ("${prefix}" MATCHES "^gccxml(.*)$")
+    set(flag --castxml-gccxml)
+  elseif ("${prefix}" MATCHES "^castxml1(.*)$")
+    set(flag --castxml-output=1)
+  endif()
+
   set(command $<TARGET_FILE:castxml>
-    --castxml-gccxml
+    ${flag}
     ${_castxml_start}
     -std=${std}
     ${CMAKE_CURRENT_LIST_DIR}/input/${_castxml_input}.${ext}
     -o ${prefix}.${std}.${test}.xml
-    ${castxml_test_gccxml_extra_arguments}
+    ${castxml_test_output_extra_arguments}
     )
   add_test(
     NAME ${prefix}.${std}.${test}
@@ -72,103 +79,121 @@ macro(castxml_test_gccxml_common prefix ext std test)
     )
 endmacro()
 
-macro(castxml_test_gccxml_c89 test)
-  castxml_test_gccxml_common(gccxml c c89 ${test})
+macro(castxml_test_output_c89 test)
+  castxml_test_output_common(gccxml c c89 ${test})
+  castxml_test_output_common(castxml1 c c89 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_c99 test)
-  castxml_test_gccxml_common(gccxml c c99 ${test})
+macro(castxml_test_output_c99 test)
+  castxml_test_output_common(gccxml c c99 ${test})
+  castxml_test_output_common(castxml1 c c99 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_c11 test)
-  castxml_test_gccxml_common(gccxml c c11 ${test})
+macro(castxml_test_output_c11 test)
+  castxml_test_output_common(gccxml c c11 ${test})
+  castxml_test_output_common(castxml1 c c11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnu89 test)
-  castxml_test_gccxml_common(gccxml c gnu89 ${test})
+macro(castxml_test_output_gnu89 test)
+  castxml_test_output_common(gccxml c gnu89 ${test})
+  castxml_test_output_common(castxml1 c gnu89 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnu99 test)
-  castxml_test_gccxml_common(gccxml c gnu99 ${test})
+macro(castxml_test_output_gnu99 test)
+  castxml_test_output_common(gccxml c gnu99 ${test})
+  castxml_test_output_common(castxml1 c gnu99 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnu11 test)
-  castxml_test_gccxml_common(gccxml c gnu11 ${test})
+macro(castxml_test_output_gnu11 test)
+  castxml_test_output_common(gccxml c gnu11 ${test})
+  castxml_test_output_common(castxml1 c gnu11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_cxx98 test)
-  castxml_test_gccxml_common(gccxml cxx c++98 ${test})
+macro(castxml_test_output_cxx98 test)
+  castxml_test_output_common(gccxml cxx c++98 ${test})
+  castxml_test_output_common(castxml1 cxx c++98 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnuxx98 test)
-  castxml_test_gccxml_common(gccxml cxx gnu++98 ${test})
+macro(castxml_test_output_gnuxx98 test)
+  castxml_test_output_common(gccxml cxx gnu++98 ${test})
+  castxml_test_output_common(castxml1 cxx gnu++98 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_cxx11 test)
-  castxml_test_gccxml_common(gccxml cxx c++11 ${test})
+macro(castxml_test_output_cxx11 test)
+  castxml_test_output_common(gccxml cxx c++11 ${test})
+  castxml_test_output_common(castxml1 cxx c++11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnuxx11 test)
-  castxml_test_gccxml_common(gccxml cxx gnu++11 ${test})
+macro(castxml_test_output_gnuxx11 test)
+  castxml_test_output_common(gccxml cxx gnu++11 ${test})
+  castxml_test_output_common(castxml1 cxx gnu++11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_cxx14 test)
-  castxml_test_gccxml_common(gccxml cxx c++14 ${test})
+macro(castxml_test_output_cxx14 test)
+  castxml_test_output_common(gccxml cxx c++14 ${test})
+  castxml_test_output_common(castxml1 cxx c++14 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_gnuxx14 test)
-  castxml_test_gccxml_common(gccxml cxx gnu++14 ${test})
+macro(castxml_test_output_gnuxx14 test)
+  castxml_test_output_common(gccxml cxx gnu++14 ${test})
+  castxml_test_output_common(castxml1 cxx gnu++14 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_cxx98 test)
-  castxml_test_gccxml_common(gccxml.broken cxx c++98 ${test})
+macro(castxml_test_output_broken_cxx98 test)
+  castxml_test_output_common(gccxml.broken cxx c++98 ${test})
+  castxml_test_output_common(castxml1.broken cxx c++98 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_gnuxx98 test)
-  castxml_test_gccxml_common(gccxml.broken cxx gnu++98 ${test})
+macro(castxml_test_output_broken_gnuxx98 test)
+  castxml_test_output_common(gccxml.broken cxx gnu++98 ${test})
+  castxml_test_output_common(castxml1.broken cxx gnu++98 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_cxx11 test)
-  castxml_test_gccxml_common(gccxml.broken cxx c++11 ${test})
+macro(castxml_test_output_broken_cxx11 test)
+  castxml_test_output_common(gccxml.broken cxx c++11 ${test})
+  castxml_test_output_common(castxml1.broken cxx c++11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_gnuxx11 test)
-  castxml_test_gccxml_common(gccxml.broken cxx gnu++11 ${test})
+macro(castxml_test_output_broken_gnuxx11 test)
+  castxml_test_output_common(gccxml.broken cxx gnu++11 ${test})
+  castxml_test_output_common(castxml1.broken cxx gnu++11 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_cxx14 test)
-  castxml_test_gccxml_common(gccxml.broken cxx c++14 ${test})
+macro(castxml_test_output_broken_cxx14 test)
+  castxml_test_output_common(gccxml.broken cxx c++14 ${test})
+  castxml_test_output_common(castxml1.broken cxx c++14 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken_gnuxx14 test)
-  castxml_test_gccxml_common(gccxml.broken cxx gnu++14 ${test})
+macro(castxml_test_output_broken_gnuxx14 test)
+  castxml_test_output_common(gccxml.broken cxx gnu++14 ${test})
+  castxml_test_output_common(castxml1.broken cxx gnu++14 ${test})
 endmacro()
 
-macro(castxml_test_gccxml_c test)
-  castxml_test_gccxml_c89(${test})
-  castxml_test_gccxml_gnu89(${test})
-  castxml_test_gccxml_c99(${test})
-  castxml_test_gccxml_gnu99(${test})
-  castxml_test_gccxml_c11(${test})
-  castxml_test_gccxml_gnu11(${test})
+macro(castxml_test_output_c test)
+  castxml_test_output_c89(${test})
+  castxml_test_output_gnu89(${test})
+  castxml_test_output_c99(${test})
+  castxml_test_output_gnu99(${test})
+  castxml_test_output_c11(${test})
+  castxml_test_output_gnu11(${test})
 endmacro()
 
-macro(castxml_test_gccxml test)
-  castxml_test_gccxml_cxx98(${test})
-  castxml_test_gccxml_gnuxx98(${test})
-  castxml_test_gccxml_cxx11(${test})
-  castxml_test_gccxml_gnuxx11(${test})
-  castxml_test_gccxml_cxx14(${test})
-  castxml_test_gccxml_gnuxx14(${test})
+macro(castxml_test_output test)
+  castxml_test_output_cxx98(${test})
+  castxml_test_output_gnuxx98(${test})
+  castxml_test_output_cxx11(${test})
+  castxml_test_output_gnuxx11(${test})
+  castxml_test_output_cxx14(${test})
+  castxml_test_output_gnuxx14(${test})
 endmacro()
 
-macro(castxml_test_gccxml_broken test)
-  castxml_test_gccxml_broken_cxx98(${test})
-  castxml_test_gccxml_broken_gnuxx98(${test})
-  castxml_test_gccxml_broken_cxx11(${test})
-  castxml_test_gccxml_broken_gnuxx11(${test})
-  castxml_test_gccxml_broken_cxx14(${test})
-  castxml_test_gccxml_broken_gnuxx14(${test})
+macro(castxml_test_output_broken test)
+  castxml_test_output_broken_cxx98(${test})
+  castxml_test_output_broken_gnuxx98(${test})
+  castxml_test_output_broken_cxx11(${test})
+  castxml_test_output_broken_gnuxx11(${test})
+  castxml_test_output_broken_cxx14(${test})
+  castxml_test_output_broken_gnuxx14(${test})
 endmacro()
 
 set(input ${CMAKE_CURRENT_LIST_DIR}/input)
@@ -189,17 +214,45 @@ castxml_test_cmd(cc-paren-nested --castxml-cc-gnu "(" "(" ")" ")")
 castxml_test_cmd(cc-paren-unbalanced --castxml-cc-gnu "(")
 castxml_test_cmd(cc-twice --castxml-cc-msvc cl --castxml-cc-gnu gcc)
 castxml_test_cmd(cc-unknown --castxml-cc-unknown cc)
+
 castxml_test_cmd(gccxml-and-E --castxml-gccxml -E)
+castxml_test_cmd(castxml-and-E --castxml-output=1 -E)
+
 castxml_test_cmd(gccxml-twice --castxml-gccxml --castxml-gccxml)
+castxml_test_cmd(castxml-twice --castxml-output=1 --castxml-output=1)
+
+castxml_test_cmd(castxml-mix1 --castxml-gccxml --castxml-output=1)
+castxml_test_cmd(castxml-mix2 --castxml-output=1 --castxml-gccxml)
+
+castxml_test_cmd(castxml-wrong-epic-version --castxml-output=0)
+
 castxml_test_cmd(gccxml-and-c99 --castxml-gccxml -std=c99 ${empty_c})
+castxml_test_cmd(castxml-and-c99 --castxml-output=1 -std=c99 ${empty_c})
+
 castxml_test_cmd(gccxml-and-c11 --castxml-gccxml -std=c11 ${empty_c})
+castxml_test_cmd(castxml-and-c11 --castxml-output=1 -std=c11 ${empty_c})
+
 castxml_test_cmd(gccxml-and-c++11 --castxml-gccxml -std=c++11 ${empty_cxx})
+castxml_test_cmd(castxml-and-c++11 --castxml-output=1 -std=c++11 ${empty_cxx})
+
 castxml_test_cmd(gccxml-and-c++14 --castxml-gccxml -std=c++14 ${empty_cxx})
+castxml_test_cmd(castxml-and-c++14 --castxml-output=1 -std=c++14 ${empty_cxx})
+
 castxml_test_cmd(gccxml-and-objc1 --castxml-gccxml ${empty_m})
+castxml_test_cmd(castxml-and-objc1 --castxml-output=1 ${empty_m})
+
 castxml_test_cmd(gccxml-and-objc2 --castxml-gccxml ${empty_mm})
+castxml_test_cmd(castxml-and-objc2 --castxml-output=1 ${empty_mm})
+
 castxml_test_cmd(gccxml-empty-c++98 --castxml-gccxml -std=c++98 ${empty_cxx})
+castxml_test_cmd(castxml-empty-c++98 --castxml-output=1 -std=c++98 ${empty_cxx})
+
 castxml_test_cmd(gccxml-empty-c++98-E --castxml-gccxml -std=c++98 ${empty_cxx} -E)
+castxml_test_cmd(castxml-empty-c++98-E --castxml-output=1 -std=c++98 ${empty_cxx} -E)
+
 castxml_test_cmd(gccxml-empty-c++98-c --castxml-gccxml -std=c++98 ${empty_cxx} -c)
+castxml_test_cmd(castxml-empty-c++98-c --castxml-output=1 -std=c++98 ${empty_cxx} -c)
+
 castxml_test_cmd(std-c++98-src-c -std=c++98 ${empty_c})
 castxml_test_cmd(std-c89-src-cxx -std=c89 ${empty_cxx})
 castxml_test_cmd(input-missing ${input}/does-not-exist.c)
@@ -214,7 +267,8 @@ math(EXPR __castxml__ "1000000*${CastXML_VERSION_MAJOR} + 1000*${CastXML_VERSION
 configure_file(expect/cmd.predefined-macros.stdout.txt.in
                expect/cmd.predefined-macros.stdout.txt @ONLY)
 set(castxml_test_cmd_expect ${CMAKE_CURRENT_BINARY_DIR}/expect/cmd.predefined-macros)
-castxml_test_cmd(predefined-macros --castxml-gccxml ${empty_cxx} -E -dM)
+castxml_test_cmd(gccxml-predefined-macros --castxml-gccxml ${empty_cxx} -E -dM)
+castxml_test_cmd(castxml-predefined-macros --castxml-output=1 ${empty_cxx} -E -dM)
 unset(castxml_test_cmd_expect)
 
 # Test --castxml-cc-gnu detection.
@@ -275,170 +329,172 @@ castxml_test_cmd(cc-msvc-c-src-c-cmd --castxml-cc-msvc-c $<TARGET_FILE:cc-msvc>
 castxml_test_cmd(cc-msvc-c-std-c89 --castxml-cc-msvc-c "(" $<TARGET_FILE:cc-msvc> ")" ${empty_c} "-###")
 unset(castxml_test_cmd_extra_arguments)
 
-castxml_test_gccxml(ArrayType)
-castxml_test_gccxml(ArrayType-incomplete)
-castxml_test_gccxml(Class)
-castxml_test_gccxml(Class-abstract)
-castxml_test_gccxml(Class-annotate)
-castxml_test_gccxml(Class-base-offset)
-castxml_test_gccxml(Class-base-typedef)
-castxml_test_gccxml(Class-bases)
-castxml_test_gccxml(Class-forward)
-castxml_test_gccxml(Class-friends)
-castxml_test_gccxml(Class-implicit-member-access)
-castxml_test_gccxml(Class-implicit-member-access-mutable)
-castxml_test_gccxml(Class-implicit-member-array)
-castxml_test_gccxml(Class-implicit-member-bad-base)
-castxml_test_gccxml(Class-implicit-member-const)
-castxml_test_gccxml(Class-implicit-member-const-aggregate)
-castxml_test_gccxml(Class-implicit-member-reference)
-castxml_test_gccxml(Class-implicit-members)
-castxml_test_gccxml(Class-incomplete)
-castxml_test_gccxml(Class-incomplete-twice)
-castxml_test_gccxml(Class-member-template)
-castxml_test_gccxml(Class-member-template-access)
-castxml_test_gccxml(Class-partial-template-member-Typedef)
-castxml_test_gccxml(Class-template)
-castxml_test_gccxml(Class-template-Method-Argument-const)
-castxml_test_gccxml(Class-template-Method-Argument-default)
-castxml_test_gccxml(Class-template-Method-return-const)
-castxml_test_gccxml(Class-template-bases)
-castxml_test_gccxml(Class-template-constructor-template)
-castxml_test_gccxml(Class-template-friends)
-castxml_test_gccxml(Class-template-member-Typedef)
-castxml_test_gccxml(Class-template-member-Typedef-const)
-castxml_test_gccxml(Class-template-member-template)
-castxml_test_gccxml(Class-template-recurse)
-castxml_test_gccxml(Constructor)
-castxml_test_gccxml(Constructor-annotate)
-castxml_test_gccxml(Converter)
-castxml_test_gccxml(Converter-annotate)
-castxml_test_gccxml(CvQualifiedType)
-castxml_test_gccxml(Destructor)
-castxml_test_gccxml(Destructor-annotate)
-castxml_test_gccxml(Enumeration)
-castxml_test_gccxml(Enumeration-annotate)
-castxml_test_gccxml(Enumeration-anonymous)
-castxml_test_gccxml(Field)
-castxml_test_gccxml(Field-annotate)
-castxml_test_gccxml(Function)
-castxml_test_gccxml(Function-annotate)
-castxml_test_gccxml(Function-Argument-annotate)
-castxml_test_gccxml(Function-Argument-decay)
-castxml_test_gccxml(Function-Argument-default)
-castxml_test_gccxml(Function-Argument-default-cast)
-castxml_test_gccxml(Function-Argument-default-ns)
-castxml_test_gccxml(Function-rvalue-reference)
-castxml_test_gccxml(Function-template)
-castxml_test_gccxml(Function-throw)
-castxml_test_gccxml(Function-variadic)
-castxml_test_gccxml(FunctionType)
-castxml_test_gccxml(FunctionType-variadic)
-castxml_test_gccxml(FundamentalType)
-castxml_test_gccxml(FundamentalTypes)
-castxml_test_gccxml(Method)
-castxml_test_gccxml(Method-annotate)
-castxml_test_gccxml(Method-Argument-default)
-castxml_test_gccxml(Method-Argument-default-cast)
-castxml_test_gccxml(Method-overrides)
-castxml_test_gccxml(Method-rvalue-reference)
-castxml_test_gccxml(MethodType)
-castxml_test_gccxml(MethodType-cv)
-castxml_test_gccxml(Namespace)
-castxml_test_gccxml(Namespace-anonymous)
-castxml_test_gccxml(Namespace-Class-members)
-castxml_test_gccxml(Namespace-Class-partial-template-members)
-castxml_test_gccxml(Namespace-Class-template-members)
-castxml_test_gccxml(Namespace-Function-template-members)
-castxml_test_gccxml(Namespace-empty)
-castxml_test_gccxml(Namespace-extern-C-members)
-castxml_test_gccxml(Namespace-inline)
-castxml_test_gccxml(Namespace-inline-start)
-castxml_test_gccxml(Namespace-inline-template)
-castxml_test_gccxml(Namespace-nested)
-castxml_test_gccxml(Namespace-repeat)
-castxml_test_gccxml(Namespace-repeat-start)
-castxml_test_gccxml(OffsetType)
-castxml_test_gccxml(OffsetType-cv)
-castxml_test_gccxml(OperatorFunction)
-castxml_test_gccxml(OperatorFunction-annotate)
-castxml_test_gccxml(OperatorMethod)
-castxml_test_gccxml(OperatorMethod-annotate)
-castxml_test_gccxml(PointerType)
-castxml_test_gccxml(ReferenceType)
-castxml_test_gccxml(RValueReferenceType)
-castxml_test_gccxml(TypeAlias)
-castxml_test_gccxml(TypeAliasTemplate)
-castxml_test_gccxml(Typedef-annotate)
-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(Typedef-to-extern-C-FundamentalType-mode)
-castxml_test_gccxml(Variable)
-castxml_test_gccxml(Variable-annotate)
-castxml_test_gccxml(Variable-in-Class)
-castxml_test_gccxml(Variable-init)
-castxml_test_gccxml(Variable-init-cast)
-castxml_test_gccxml(Variable-init-ns)
+castxml_test_output(ArrayType)
+castxml_test_output(ArrayType-incomplete)
+castxml_test_output(Class)
+castxml_test_output(Class-abstract)
+castxml_test_output(Class-annotate)
+castxml_test_output(Class-base-offset)
+castxml_test_output(Class-base-typedef)
+castxml_test_output(Class-bases)
+castxml_test_output(Class-forward)
+castxml_test_output(Class-friends)
+castxml_test_output(Class-implicit-member-access)
+castxml_test_output(Class-implicit-member-access-mutable)
+castxml_test_output(Class-implicit-member-array)
+castxml_test_output(Class-implicit-member-bad-base)
+castxml_test_output(Class-implicit-member-const)
+castxml_test_output(Class-implicit-member-const-aggregate)
+castxml_test_output(Class-implicit-member-reference)
+castxml_test_output(Class-implicit-members)
+castxml_test_output(Class-incomplete)
+castxml_test_output(Class-incomplete-twice)
+castxml_test_output(Class-member-template)
+castxml_test_output(Class-member-template-access)
+castxml_test_output(Class-partial-template-member-Typedef)
+castxml_test_output(Class-template)
+castxml_test_output(Class-template-Method-Argument-const)
+castxml_test_output(Class-template-Method-Argument-default)
+castxml_test_output(Class-template-Method-return-const)
+castxml_test_output(Class-template-bases)
+castxml_test_output(Class-template-constructor-template)
+castxml_test_output(Class-template-friends)
+castxml_test_output(Class-template-member-nontemplate-Typedef)
+castxml_test_output(Class-template-member-Typedef)
+castxml_test_output(Class-template-member-Typedef-const)
+castxml_test_output(Class-template-member-template)
+castxml_test_output(Class-template-recurse)
+castxml_test_output(Constructor)
+castxml_test_output(Constructor-annotate)
+castxml_test_output(Converter)
+castxml_test_output(Converter-annotate)
+castxml_test_output(CvQualifiedType)
+castxml_test_output(CXXLiteral)
+castxml_test_output(Destructor)
+castxml_test_output(Destructor-annotate)
+castxml_test_output(Enumeration)
+castxml_test_output(Enumeration-annotate)
+castxml_test_output(Enumeration-anonymous)
+castxml_test_output(Field)
+castxml_test_output(Field-annotate)
+castxml_test_output(Function)
+castxml_test_output(Function-annotate)
+castxml_test_output(Function-Argument-annotate)
+castxml_test_output(Function-Argument-decay)
+castxml_test_output(Function-Argument-default)
+castxml_test_output(Function-Argument-default-cast)
+castxml_test_output(Function-Argument-default-ns)
+castxml_test_output(Function-rvalue-reference)
+castxml_test_output(Function-template)
+castxml_test_output(Function-throw)
+castxml_test_output(Function-variadic)
+castxml_test_output(FunctionType)
+castxml_test_output(FunctionType-variadic)
+castxml_test_output(FundamentalType)
+castxml_test_output(FundamentalTypes)
+castxml_test_output(Method)
+castxml_test_output(Method-annotate)
+castxml_test_output(Method-Argument-default)
+castxml_test_output(Method-Argument-default-cast)
+castxml_test_output(Method-overrides)
+castxml_test_output(Method-rvalue-reference)
+castxml_test_output(MethodType)
+castxml_test_output(MethodType-cv)
+castxml_test_output(Namespace)
+castxml_test_output(Namespace-anonymous)
+castxml_test_output(Namespace-Class-members)
+castxml_test_output(Namespace-Class-partial-template-members)
+castxml_test_output(Namespace-Class-template-members)
+castxml_test_output(Namespace-Function-template-members)
+castxml_test_output(Namespace-empty)
+castxml_test_output(Namespace-extern-C-members)
+castxml_test_output(Namespace-inline)
+castxml_test_output(Namespace-inline-start)
+castxml_test_output(Namespace-inline-template)
+castxml_test_output(Namespace-nested)
+castxml_test_output(Namespace-repeat)
+castxml_test_output(Namespace-repeat-start)
+castxml_test_output(OffsetType)
+castxml_test_output(OffsetType-cv)
+castxml_test_output(OperatorFunction)
+castxml_test_output(OperatorFunction-annotate)
+castxml_test_output(OperatorMethod)
+castxml_test_output(OperatorMethod-annotate)
+castxml_test_output(PointerType)
+castxml_test_output(ReferenceType)
+castxml_test_output(RValueReferenceType)
+castxml_test_output(TypeAlias)
+castxml_test_output(TypeAliasTemplate)
+castxml_test_output(Typedef-annotate)
+castxml_test_output(Typedef-paren)
+castxml_test_output(Typedef-to-Class-template)
+castxml_test_output(Typedef-to-Enumeration)
+castxml_test_output(Typedef-to-Enumeration-anonymous)
+castxml_test_output(Typedef-to-FundamentalType-mode)
+castxml_test_output(Typedef-to-extern-C-FundamentalType-mode)
+castxml_test_output(Variable)
+castxml_test_output(Variable-annotate)
+castxml_test_output(Variable-in-Class)
+castxml_test_output(Variable-init)
+castxml_test_output(Variable-init-cast)
+castxml_test_output(Variable-init-ns)
 
 # Test multiple start declarations.
-set(castxml_test_gccxml_custom_input Namespace-nested)
-set(castxml_test_gccxml_custom_start --castxml-start start::ns1,start::ns3)
-castxml_test_gccxml(Namespace-nested-1)
-set(castxml_test_gccxml_custom_start --castxml-start start::ns1 --castxml-start start::ns3)
-castxml_test_gccxml(Namespace-nested-2)
-unset(castxml_test_gccxml_custom_start)
-unset(castxml_test_gccxml_custom_input)
-
-castxml_test_gccxml(invalid-decl-for-type)
-castxml_test_gccxml(qualified-type-name)
-castxml_test_gccxml(using-declaration-class)
-castxml_test_gccxml(using-declaration-ns)
-castxml_test_gccxml(using-declaration-start)
-castxml_test_gccxml(using-directive-ns)
-castxml_test_gccxml(using-directive-start)
-
-set(castxml_test_gccxml_custom_start "")
-castxml_test_gccxml(nostart)
-unset(castxml_test_gccxml_custom_start)
+set(castxml_test_output_custom_input Namespace-nested)
+set(castxml_test_output_custom_start --castxml-start start::ns1,start::ns3)
+castxml_test_output(Namespace-nested-1)
+set(castxml_test_output_custom_start --castxml-start start::ns1 --castxml-start start::ns3)
+castxml_test_output(Namespace-nested-2)
+unset(castxml_test_output_custom_start)
+unset(castxml_test_output_custom_input)
+
+castxml_test_output(invalid-decl-for-type)
+castxml_test_output(qualified-type-name)
+castxml_test_output(using-declaration-class)
+castxml_test_output(using-declaration-ns)
+castxml_test_output(using-declaration-start)
+castxml_test_output(using-directive-ns)
+castxml_test_output(using-directive-start)
+
+set(castxml_test_output_custom_start "")
+castxml_test_output(nostart)
+unset(castxml_test_output_custom_start)
 
 if(";${LLVM_TARGETS_TO_BUILD};" MATCHES ";X86;")
-  set(castxml_test_gccxml_extra_arguments -target i386-pc-windows-msvc)
-  castxml_test_gccxml(Function-calling-convention-ms)
-  castxml_test_gccxml(Function-calling-convention-ms-annotate)
-  castxml_test_gccxml(implicit-decl-ms)
-  castxml_test_gccxml(inline-asm-ms)
-  unset(castxml_test_gccxml_extra_arguments)
+  set(castxml_test_output_extra_arguments -target i386-pc-windows-msvc)
+  castxml_test_output(Function-calling-convention-ms)
+  castxml_test_output(Function-calling-convention-ms-annotate)
+  castxml_test_output(implicit-decl-ms)
+  castxml_test_output(inline-asm-ms)
+  unset(castxml_test_output_extra_arguments)
 endif()
 
-castxml_test_gccxml_c(FunctionNoProto)
-castxml_test_gccxml_c(FundamentalType)
-castxml_test_gccxml_c(Typedef-called-class)
+castxml_test_output_c(FunctionNoProto)
+castxml_test_output_c(FundamentalType)
+castxml_test_output_c(Typedef-called-class)
 
-castxml_test_gccxml_c(invalid)
+castxml_test_output_c(invalid)
 
-castxml_test_gccxml_broken(ReferenceType-to-Class-template)
+castxml_test_output_broken(ReferenceType-to-Class-template)
 
-set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
-castxml_test_gccxml_c(GNU-float128)
-set(castxml_test_gccxml_custom_start "")
-castxml_test_gccxml_c(GNU-float128-nostart)
-unset(castxml_test_gccxml_custom_start)
-unset(castxml_test_gccxml_extra_arguments)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu-c "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
+castxml_test_output_c(GNU-float128)
+set(castxml_test_output_custom_start "")
+castxml_test_output_c(GNU-float128-nostart)
+unset(castxml_test_output_custom_start)
+unset(castxml_test_output_extra_arguments)
 
-set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
-castxml_test_gccxml(GNU-float128)
-set(castxml_test_gccxml_custom_start "")
-castxml_test_gccxml(GNU-float128-nostart)
-unset(castxml_test_gccxml_custom_start)
-unset(castxml_test_gccxml_extra_arguments)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu "(" $<TARGET_FILE:cc-gnu> --cc-define=__x86_64__ ")")
+castxml_test_output(GNU-float128)
+set(castxml_test_output_custom_start "")
+castxml_test_output(GNU-float128-nostart)
+unset(castxml_test_output_custom_start)
+unset(castxml_test_output_extra_arguments)
 
-set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu>)
-castxml_test_gccxml_c(GNU-va_arg_pack)
-unset(castxml_test_gccxml_extra_arguments)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu-c $<TARGET_FILE:cc-gnu>)
+castxml_test_output_c(GNU-va_arg_pack)
+unset(castxml_test_output_extra_arguments)
 
-set(castxml_test_gccxml_extra_arguments --castxml-cc-gnu $<TARGET_FILE:cc-gnu>)
-castxml_test_gccxml(GNU-va_arg_pack)
-unset(castxml_test_gccxml_extra_arguments)
+set(castxml_test_output_extra_arguments --castxml-cc-gnu $<TARGET_FILE:cc-gnu>)
+castxml_test_output(GNU-va_arg_pack)
+unset(castxml_test_output_extra_arguments)
diff --git a/test/expect/castxml1.any.ArrayType-incomplete.xml.txt b/test/expect/castxml1.any.ArrayType-incomplete.xml.txt
new file mode 100644
index 0000000..73f2b2d
--- /dev/null
+++ b/test/expect/castxml1.any.ArrayType-incomplete.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <ArrayType id="_2" min="0" max="" type="_4"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/ArrayType-incomplete.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.ArrayType.xml.txt b/test/expect/castxml1.any.ArrayType.xml.txt
new file mode 100644
index 0000000..e37e73c
--- /dev/null
+++ b/test/expect/castxml1.any.ArrayType.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <ArrayType id="_2" min="0" max="1" type="_4"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/ArrayType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.CXXLiteral.xml.txt b/test/expect/castxml1.any.CXXLiteral.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.CXXLiteral.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-abstract.xml.txt b/test/expect/castxml1.any.Class-abstract.xml.txt
similarity index 82%
copy from test/expect/gccxml.any.Class-abstract.xml.txt
copy to test/expect/castxml1.any.Class-abstract.xml.txt
index 935f473..d1774ce 100644
--- a/test/expect/gccxml.any.Class-abstract.xml.txt
+++ b/test/expect/castxml1.any.Class-abstract.xml.txt
@@ -1,11 +1,11 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" abstract="1" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:2" file="f1" line="2" virtual="1" pure_virtual="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" virtual="1" pure_virtual="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </Method>
-  <Converter id="_4" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" virtual="1" pure_virtual="1" mangled="[^"]+"/>
-  <Destructor id="_5" name="start" context="_1" access="private" location="f1:4" file="f1" line="4" virtual="1" pure_virtual="1"/>
+  <Converter id="_4" returns="_9" context="_1" access="private" location="f1:4" file="f1" line="4" virtual="1" pure_virtual="1" mangled="[^"]+"/>
+  <Destructor id="_5" name="start" context="_1" access="private" location="f1:5" file="f1" line="5" virtual="1" pure_virtual="1"/>
   <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
     <Argument type="_11" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
@@ -19,4 +19,4 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-abstract.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Constructor.xml.txt b/test/expect/castxml1.any.Class-annotate.xml.txt
similarity index 77%
copy from test/expect/gccxml.any.Constructor.xml.txt
copy to test/expect/castxml1.any.Class-annotate.xml.txt
index 4aec461..24ac0ea 100644
--- a/test/expect/gccxml.any.Constructor.xml.txt
+++ b/test/expect/castxml1.any.Class-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -13,5 +13,5 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
-  <File id="f1" name=".*/test/input/Constructor.cxx"/>
-</GCC_XML>$
+  <File id="f1" name=".*/test/input/Class-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-base-offset.xml.txt b/test/expect/castxml1.any.Class-base-offset.xml.txt
similarity index 64%
copy from test/expect/gccxml.any.Class-base-offset.xml.txt
copy to test/expect/castxml1.any.Class-base-offset.xml.txt
index 14f49b6..46a09a3 100644
--- a/test/expect/gccxml.any.Class-base-offset.xml.txt
+++ b/test/expect/castxml1.any.Class-base-offset.xml.txt
@@ -1,6 +1,6 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8 _9" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:13" file="f1" line="13" members="_3 _4 _5 _6" bases="_7 _8 _9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="0"/>
     <Base type="_8" access="public" virtual="0" offset="1"/>
     <Base type="_9" access="public" virtual="0" offset="2"/>
@@ -8,4 +8,4 @@
 .*
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-base-offset.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-base-typedef.xml.txt b/test/expect/castxml1.any.Class-base-typedef.xml.txt
similarity index 76%
copy from test/expect/gccxml.any.Class-base-typedef.xml.txt
copy to test/expect/castxml1.any.Class-base-typedef.xml.txt
index f82be8a..b5f8e4d 100644
--- a/test/expect/gccxml.any.Class-base-typedef.xml.txt
+++ b/test/expect/castxml1.any.Class-base-typedef.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:3" file="f1" line="3" members="_3 _4 _5 _6" bases="_7" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6" bases="_7" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="0"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_8" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_8" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <Class id="_7" name="base" context="_2" location="f1:1" file="f1" line="1" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_8" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -28,4 +28,4 @@
   <ReferenceType id="_15" type="_7"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-base-typedef.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-forward.xml.txt b/test/expect/castxml1.any.Class-forward.xml.txt
similarity index 73%
copy from test/expect/gccxml.any.Class-forward.xml.txt
copy to test/expect/castxml1.any.Class-forward.xml.txt
index 59c4902..ed93735 100644
--- a/test/expect/gccxml.any.Class-forward.xml.txt
+++ b/test/expect/castxml1.any.Class-forward.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5">
-    <Argument type="_7" location="f1:5" file="f1" line="5"/>
-  </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:6" file="f1" line="6" mangled="[^"]+">
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6">
     <Argument type="_7" location="f1:6" file="f1" line="6"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_7" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:7" file="f1" line="7"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:8" file="f1" line="8"/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-forward.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-friends.xml.txt b/test/expect/castxml1.any.Class-friends.xml.txt
similarity index 60%
copy from test/expect/gccxml.any.Class-friends.xml.txt
copy to test/expect/castxml1.any.Class-friends.xml.txt
index 353afcd..0575887 100644
--- a/test/expect/gccxml.any.Class-friends.xml.txt
+++ b/test/expect/castxml1.any.Class-friends.xml.txt
@@ -1,20 +1,20 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:3" file="f1" line="3" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
-  <Function id="_7" name="f" returns="_11" context="_2" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Function id="_7" name="f" returns="_11" context="_2" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
   <Class id="_8" name="A" context="_2" location="f1:1" file="f1" line="1" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_11" name="void" size="[0-9]+" align="[0-9]+"/>
   <File id="f1" name=".*/test/input/Class-friends.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt b/test/expect/castxml1.any.Class-implicit-member-access-mutable.xml.txt
similarity index 61%
copy from test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-access-mutable.xml.txt
index 56dece8..86c7f94 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-access-mutable.xml.txt
@@ -1,24 +1,24 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:12" file="f1" line="12" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
     <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
-  <Destructor id="_3" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
   <Class id="_5" name="base" context="_2" location="f1:1" file="f1" line="1" members="_6 _7 _8 _9 _10" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:3" file="f1" line="3"/>
-  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_8" name="base" context="_5" access="private" location="f1:6" file="f1" line="6">
-    <Argument type="_11" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_8" name="base" context="_5" access="private" location="f1:8" file="f1" line="8">
+    <Argument type="_11" location="f1:8" file="f1" line="8"/>
   </Constructor>
-  <OperatorMethod id="_9" name="=" returns="_12" context="_5" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_11" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_9" name="=" returns="_12" context="_5" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Field id="_10" name="data" type="_13" context="_5" access="private" location="f1:8" file="f1" line="8" offset="0" mutable="1"/>
+  <Field id="_10" name="data" type="_13" context="_5" access="private" location="f1:10" file="f1" line="10" offset="0" mutable="1"/>
   <ReferenceType id="_11" type="_5c"/>
   <CvQualifiedType id="_5c" type="_5" const="1"/>
   <ReferenceType id="_12" type="_5"/>
   <FundamentalType id="_13" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-access-mutable.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt b/test/expect/castxml1.any.Class-implicit-member-access.xml.txt
similarity index 58%
copy from test/expect/gccxml.any.Class-implicit-member-access.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-access.xml.txt
index 9cf2a14..a3ca787 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-access.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:11" file="f1" line="11" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
     <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
-  <Destructor id="_3" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_3" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <Class id="_5" name="base" context="_2" location="f1:1" file="f1" line="1" members="_6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:3" file="f1" line="3"/>
-  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_8" name="base" context="_5" access="private" location="f1:6" file="f1" line="6">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_8" name="base" context="_5" access="private" location="f1:8" file="f1" line="8">
+    <Argument type="_10" location="f1:8" file="f1" line="8"/>
   </Constructor>
-  <OperatorMethod id="_9" name="=" returns="_11" context="_5" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_9" name="=" returns="_11" context="_5" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
   <ReferenceType id="_10" type="_5c"/>
   <CvQualifiedType id="_5c" type="_5" const="1"/>
   <ReferenceType id="_11" type="_5"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-access.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-array.xml.txt b/test/expect/castxml1.any.Class-implicit-member-array.xml.txt
similarity index 94%
copy from test/expect/gccxml.any.Class-implicit-member-array.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-array.xml.txt
index f7519c7..dcf4139 100644
--- a/test/expect/gccxml.any.Class-implicit-member-array.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-array.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
+  <Field id="_3" name="data" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
@@ -17,4 +17,4 @@
   <FundamentalType id="_11" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-array.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt b/test/expect/castxml1.any.Class-implicit-member-bad-base.xml.txt
similarity index 80%
copy from test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-bad-base.xml.txt
index 6c98ab9..e55cf63 100644
--- a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-bad-base.xml.txt
@@ -1,5 +1,5 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5" bases="_6" size="[0-9]+" align="[0-9]+">
     <Base type="_6" access="public" virtual="0" offset="0"/>
   </Class>
@@ -8,19 +8,19 @@
     <Argument type="_7" location="f1:9" file="f1" line="9"/>
   </Constructor>
   <Destructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
-  <Class id="_6" name="base<const int>" context="_2" location="f1:1" file="f1" line="1" members="_8 _9 _10 _11" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_6" name="base<const int>" context="_2" location="f1:2" file="f1" line="2" members="_8 _9 _10 _11" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
-  <Field id="_8" name="data" type="_12c" context="_6" access="protected" location="f1:3" file="f1" line="3" offset="0"/>
-  <Constructor id="_9" name="base" context="_6" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_10" name="base" context="_6" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
-    <Argument type="_13" location="f1:1" file="f1" line="1"/>
+  <Field id="_8" name="data" type="_12c" context="_6" access="protected" location="f1:5" file="f1" line="5" offset="0"/>
+  <Constructor id="_9" name="base" context="_6" access="protected" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_10" name="base" context="_6" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
+    <Argument type="_13" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <Destructor id="_11" name="base" context="_6" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_11" name="base" context="_6" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_12" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_12c" type="_12" const="1"/>
   <ReferenceType id="_13" type="_6c"/>
   <CvQualifiedType id="_6c" type="_6" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-bad-base.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt b/test/expect/castxml1.any.Class-implicit-member-const-aggregate.xml.txt
similarity index 91%
copy from test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-const-aggregate.xml.txt
index a6761b4..64b1748 100644
--- a/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-const-aggregate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Struct id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_6c" context="_1" access="public" location="f1:2" file="f1" line="2" offset="0"/>
+  <Field id="_3" name="data" type="_6c" context="_1" access="public" location="f1:3" file="f1" line="3" offset="0"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -12,4 +12,4 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-const-aggregate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-const.xml.txt b/test/expect/castxml1.any.Class-implicit-member-const.xml.txt
similarity index 88%
copy from test/expect/gccxml.any.Class-implicit-member-const.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-const.xml.txt
index fedda86..6cf9176 100644
--- a/test/expect/gccxml.any.Class-implicit-member-const.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-const.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_7c" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Field id="_3" name="data" type="_7c" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6"/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_8" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -13,4 +13,4 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-const.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt b/test/expect/castxml1.any.Class-implicit-member-reference.xml.txt
similarity index 88%
copy from test/expect/gccxml.any.Class-implicit-member-reference.xml.txt
copy to test/expect/castxml1.any.Class-implicit-member-reference.xml.txt
index 619941d..82e939d 100644
--- a/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-member-reference.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="ref" type="_7" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Field id="_3" name="ref" type="_7" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6"/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_8" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -13,4 +13,4 @@
   <Namespace id="_2" name="::"/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <File id="f1" name=".*/test/input/Class-implicit-member-reference.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-implicit-members.xml.txt b/test/expect/castxml1.any.Class-implicit-members.xml.txt
similarity index 88%
copy from test/expect/gccxml.any.Class-implicit-members.xml.txt
copy to test/expect/castxml1.any.Class-implicit-members.xml.txt
index 8676dd6..21b01b0 100644
--- a/test/expect/gccxml.any.Class-implicit-members.xml.txt
+++ b/test/expect/castxml1.any.Class-implicit-members.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_1" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument name="x" type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_1" context="_1" access="private" location="f1:3" file="f1" line="3" inline="1" mangled="[^"]+">
+    <Argument name="x" type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -17,4 +17,4 @@
   <ReferenceType id="_9" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-implicit-members.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Class-incomplete-twice.xml.txt b/test/expect/castxml1.any.Class-incomplete-twice.xml.txt
new file mode 100644
index 0000000..9ed4dee
--- /dev/null
+++ b/test/expect/castxml1.any.Class-incomplete-twice.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <Class id="_3" name="A" context="_1" location="f1:2" file="f1" line="2" incomplete="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Class-incomplete-twice.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Class-incomplete.xml.txt b/test/expect/castxml1.any.Class-incomplete.xml.txt
new file mode 100644
index 0000000..3fc63bb
--- /dev/null
+++ b/test/expect/castxml1.any.Class-incomplete.xml.txt
@@ -0,0 +1,6 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Class-incomplete.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-member-template-access.xml.txt b/test/expect/castxml1.any.Class-member-template-access.xml.txt
similarity index 71%
copy from test/expect/gccxml.any.Class-member-template-access.xml.txt
copy to test/expect/castxml1.any.Class-member-template-access.xml.txt
index 4c2a0fc..142f073 100644
--- a/test/expect/gccxml.any.Class-member-template-access.xml.txt
+++ b/test/expect/castxml1.any.Class-member-template-access.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_3" name="member<char>" context="_1" access="private" location="f1:2" file="f1" line="2" incomplete="1"/>
-  <Class id="_4" name="member<int>" context="_1" access="private" location="f1:6" file="f1" line="6" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_5" name="member_char" type="_3" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Class id="_3" name="member<char>" context="_1" access="private" location="f1:4" file="f1" line="4" incomplete="1"/>
+  <Class id="_4" name="member<int>" context="_1" access="private" location="f1:11" file="f1" line="11" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_5" name="member_char" type="_3" context="_1" access="public" location="f1:9" file="f1" line="9"/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_14" location="f1:1" file="f1" line="1"/>
@@ -12,14 +12,14 @@
     <Argument type="_14" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_9" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_10" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_11" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_16" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_10" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_11" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_16" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_12" name="=" returns="_17" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_16" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_12" name="=" returns="_17" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_16" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_13" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_13" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_14" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_15" type="_1"/>
@@ -28,4 +28,4 @@
   <ReferenceType id="_17" type="_4"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-member-template-access.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-member-template.xml.txt b/test/expect/castxml1.any.Class-member-template.xml.txt
similarity index 88%
copy from test/expect/gccxml.any.Class-member-template.xml.txt
copy to test/expect/castxml1.any.Class-member-template.xml.txt
index cc5ae33..1d36397 100644
--- a/test/expect/gccxml.any.Class-member-template.xml.txt
+++ b/test/expect/castxml1.any.Class-member-template.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument name="v" type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" inline="1" mangled="[^"]+">
+    <Argument name="v" type="_8" location="f1:4" file="f1" line="4"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -18,4 +18,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-member-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt b/test/expect/castxml1.any.Class-partial-template-member-Typedef.xml.txt
similarity index 52%
copy from test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
copy to test/expect/castxml1.any.Class-partial-template-member-Typedef.xml.txt
index 56b2dd4..cb786c6 100644
--- a/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
+++ b/test/expect/castxml1.any.Class-partial-template-member-Typedef.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int &>" context="_2" location="f1:7" file="f1" line="7" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:3" file="f1" line="3"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:5" file="f1" line="5" mangled="[^"]+">
-    <Argument type="_3" location="f1:5" file="f1" line="5"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int &>" context="_2" location="f1:11" file="f1" line="11" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:6" file="f1" line="6"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_3" location="f1:9" file="f1" line="9"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_11" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-partial-template-member-Typedef.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt b/test/expect/castxml1.any.Class-template-Method-Argument-const.xml.txt
similarity index 63%
copy from test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt
copy to test/expect/castxml1.any.Class-template-Method-Argument-const.xml.txt
index 35a9f71..7819a51 100644
--- a/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt
+++ b/test/expect/castxml1.any.Class-template-Method-Argument-const.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_9" location="f1:4" file="f1" line="4"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="void" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_12c"/>
   <ReferenceType id="_10" type="_1c"/>
@@ -21,4 +21,4 @@
   <Namespace id="_2" name="::"/>
   <FundamentalType id="_12" name="int" size="[0-9]+" align="[0-9]+"/>
   <File id="f1" name=".*/test/input/Class-template-Method-Argument-const.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt b/test/expect/castxml1.any.Class-template-Method-Argument-default.xml.txt
similarity index 59%
copy from test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt
copy to test/expect/castxml1.any.Class-template-Method-Argument-default.xml.txt
index 5ebccfb..864bbef 100644
--- a/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt
+++ b/test/expect/castxml1.any.Class-template-Method-Argument-default.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_8" location="f1:2" file="f1" line="2" default="123"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_8" location="f1:4" file="f1" line="4" default="123"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-Method-Argument-default.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt b/test/expect/castxml1.any.Class-template-Method-return-const.xml.txt
similarity index 62%
copy from test/expect/gccxml.any.Class-template-Method-return-const.xml.txt
copy to test/expect/castxml1.any.Class-template-Method-return-const.xml.txt
index aa75b74..85dcfef 100644
--- a/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt
+++ b/test/expect/castxml1.any.Class-template-Method-return-const.xml.txt
@@ -1,15 +1,15 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8c" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8c" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_8c" type="_8" const="1"/>
   <ReferenceType id="_9" type="_1c"/>
@@ -17,4 +17,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-Method-return-const.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-constructor-template.xml.txt b/test/expect/castxml1.any.Class-template-constructor-template.xml.txt
similarity index 60%
copy from test/expect/gccxml.any.Class-template-constructor-template.xml.txt
copy to test/expect/castxml1.any.Class-template-constructor-template.xml.txt
index 4bbdd52..4423318 100644
--- a/test/expect/gccxml.any.Class-template-constructor-template.xml.txt
+++ b/test/expect/castxml1.any.Class-template-constructor-template.xml.txt
@@ -1,20 +1,20 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3">
-    <Argument type="_7" location="f1:3" file="f1" line="3"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5">
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4">
-    <Argument type="_8" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:7" file="f1" line="7">
+    <Argument type="_8" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1c"/>
   <ReferenceType id="_9" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-constructor-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Class-template-friends.xml.txt b/test/expect/castxml1.any.Class-template-friends.xml.txt
new file mode 100644
index 0000000..f1a339a
--- /dev/null
+++ b/test/expect/castxml1.any.Class-template-friends.xml.txt
@@ -0,0 +1,22 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:13" file="f1" line="13" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:13" file="f1" line="13"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:13" file="f1" line="13"/>
+  </OperatorMethod>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_9" type="_1c"/>
+  <CvQualifiedType id="_1c" type="_1" const="1"/>
+  <ReferenceType id="_10" type="_1"/>
+  <Namespace id="_2" name="::"/>
+  <Function id="_7" name="f" returns="_11" context="_2" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  </Function>
+  <Class id="_8" name="A<int>" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
+  <FundamentalType id="_11" name="int" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/Class-template-friends.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt b/test/expect/castxml1.any.Class-template-member-Typedef-const.xml.txt
similarity index 60%
copy from test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt
copy to test/expect/castxml1.any.Class-template-member-Typedef-const.xml.txt
index f918475..2ee0258 100644
--- a/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt
+++ b/test/expect/castxml1.any.Class-template-member-Typedef-const.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="IntConst" type="_9c" context="_1" access="private" location="f1:2" file="f1" line="2"/>
-  <Method id="_4" name="method" returns="_9c" context="_1" access="public" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_3" location="f1:4" file="f1" line="4"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="IntConst" type="_9c" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_4" name="method" returns="_9c" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:7" file="f1" line="7"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <ReferenceType id="_10" type="_1c"/>
@@ -20,4 +20,4 @@
   <ReferenceType id="_11" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-member-Typedef-const.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt b/test/expect/castxml1.any.Class-template-member-Typedef.xml.txt
similarity index 59%
copy from test/expect/gccxml.any.Class-template-member-Typedef.xml.txt
copy to test/expect/castxml1.any.Class-template-member-Typedef.xml.txt
index 859c196..1fb29c0 100644
--- a/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt
+++ b/test/expect/castxml1.any.Class-template-member-Typedef.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:2" file="f1" line="2"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_3" location="f1:4" file="f1" line="4"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:7" file="f1" line="7"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_11" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-member-Typedef.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Class-template-member-nontemplate-Typedef.xml.txt b/test/expect/castxml1.any.Class-template-member-nontemplate-Typedef.xml.txt
new file mode 100644
index 0000000..5a53d7c
--- /dev/null
+++ b/test/expect/castxml1.any.Class-template-member-nontemplate-Typedef.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:10" file="f1" line="10"/>
+  <Typedef id="_2" name="type" type="_4" context="_5" access="public" location="f1:7" file="f1" line="7"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <Struct id="_5" name="B" context="_6" access="public" location="f1:4" file="f1" line="4" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_6" name="A<int>" context="_3" location="f1:2" file="f1" line="2" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/Class-template-member-nontemplate-Typedef.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-member-template.xml.txt b/test/expect/castxml1.any.Class-template-member-template.xml.txt
similarity index 60%
copy from test/expect/gccxml.any.Class-template-member-template.xml.txt
copy to test/expect/castxml1.any.Class-template-member-template.xml.txt
index 8e23b3f..12740fd 100644
--- a/test/expect/gccxml.any.Class-template-member-template.xml.txt
+++ b/test/expect/castxml1.any.Class-template-member-template.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:5" file="f1" line="5" inline="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_9" name="char" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
@@ -19,4 +19,4 @@
   <ReferenceType id="_11" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-member-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Class-template-recurse.xml.txt b/test/expect/castxml1.any.Class-template-recurse.xml.txt
similarity index 53%
copy from test/expect/gccxml.any.Class-template-recurse.xml.txt
copy to test/expect/castxml1.any.Class-template-recurse.xml.txt
index 40106de..3158042 100644
--- a/test/expect/gccxml.any.Class-template-recurse.xml.txt
+++ b/test/expect/castxml1.any.Class-template-recurse.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Variable id="_1" name="start" type="_2" init="" context="_3" location="f1:11" file="f1" line="11" mangled="[^"]+"/>
-  <Struct id="_2" name="C<void>" context="_3" location="f1:6" file="f1" line="6" members="_4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_4" name="C" context="_2" access="public" location="f1:7" file="f1" line="7" inline="1"/>
-  <Constructor id="_5" name="C" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+<CastXML[^>]*>
+  <Variable id="_1" name="start" type="_2" init="" context="_3" location="f1:20" file="f1" line="20" mangled="[^"]+"/>
+  <Struct id="_2" name="C<void>" context="_3" location="f1:11" file="f1" line="11" members="_4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_4" name="C" context="_2" access="public" location="f1:13" file="f1" line="13" inline="1"/>
+  <Constructor id="_5" name="C" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_8" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_9" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_6" name="=" returns="_9" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_8" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_7" name="C" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="C" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_8" type="_2c"/>
   <CvQualifiedType id="_2c" type="_2" const="1"/>
   <ReferenceType id="_9" type="_2"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-recurse.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Class-template.xml.txt b/test/expect/castxml1.any.Class-template.xml.txt
new file mode 100644
index 0000000..617a12b
--- /dev/null
+++ b/test/expect/castxml1.any.Class-template.xml.txt
@@ -0,0 +1,30 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Class id="_1" name="start<char>" context="_4" location="f1:10" file="f1" line="10" incomplete="1"/>
+  <Class id="_2" name="start<int>" context="_4" location="f1:11" file="f1" line="11" members="_5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_3" name="start<int &>" context="_4" location="f1:12" file="f1" line="12" members="_9 _10 _11 _12" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_5" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_13" location="f1:11" file="f1" line="11"/>
+  </Constructor>
+  <OperatorMethod id="_7" name="=" returns="_14" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_13" location="f1:11" file="f1" line="11"/>
+  </OperatorMethod>
+  <Destructor id="_8" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_9" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_10" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?>
+    <Argument type="_15" location="f1:12" file="f1" line="12"/>
+  </Constructor>
+  <OperatorMethod id="_11" name="=" returns="_16" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_15" location="f1:12" file="f1" line="12"/>
+  </OperatorMethod>
+  <Destructor id="_12" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <ReferenceType id="_13" type="_2c"/>
+  <CvQualifiedType id="_2c" type="_2" const="1"/>
+  <ReferenceType id="_14" type="_2"/>
+  <ReferenceType id="_15" type="_3c"/>
+  <CvQualifiedType id="_3c" type="_3" const="1"/>
+  <ReferenceType id="_16" type="_3"/>
+  <Namespace id="_4" name="::"/>
+  <File id="f1" name=".*/test/input/Class-template.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Constructor.xml.txt b/test/expect/castxml1.any.Class.xml.txt
similarity index 80%
copy from test/expect/gccxml.any.Constructor.xml.txt
copy to test/expect/castxml1.any.Class.xml.txt
index 4aec461..6b270fd 100644
--- a/test/expect/gccxml.any.Constructor.xml.txt
+++ b/test/expect/castxml1.any.Class.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -13,5 +13,5 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
-  <File id="f1" name=".*/test/input/Constructor.cxx"/>
-</GCC_XML>$
+  <File id="f1" name=".*/test/input/Class.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Constructor-annotate.xml.txt b/test/expect/castxml1.any.Constructor-annotate.xml.txt
similarity index 92%
copy from test/expect/gccxml.any.Constructor-annotate.xml.txt
copy to test/expect/castxml1.any.Constructor-annotate.xml.txt
index 90c7f02..e4f9b54 100644
--- a/test/expect/gccxml.any.Constructor-annotate.xml.txt
+++ b/test/expect/castxml1.any.Constructor-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -14,4 +14,4 @@
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Constructor-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Constructor.xml.txt b/test/expect/castxml1.any.Constructor.xml.txt
similarity index 94%
copy from test/expect/gccxml.any.Constructor.xml.txt
copy to test/expect/castxml1.any.Constructor.xml.txt
index 4aec461..23460b4 100644
--- a/test/expect/gccxml.any.Constructor.xml.txt
+++ b/test/expect/castxml1.any.Constructor.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -14,4 +14,4 @@
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Constructor.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Converter-annotate.xml.txt b/test/expect/castxml1.any.Converter-annotate.xml.txt
similarity index 93%
copy from test/expect/gccxml.any.Converter-annotate.xml.txt
copy to test/expect/castxml1.any.Converter-annotate.xml.txt
index 0642674..37e05ea 100644
--- a/test/expect/gccxml.any.Converter-annotate.xml.txt
+++ b/test/expect/castxml1.any.Converter-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
@@ -16,4 +16,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Converter-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Converter.xml.txt b/test/expect/castxml1.any.Converter.xml.txt
similarity index 93%
copy from test/expect/gccxml.any.Converter.xml.txt
copy to test/expect/castxml1.any.Converter.xml.txt
index 0c563a3..98bdda8 100644
--- a/test/expect/gccxml.any.Converter.xml.txt
+++ b/test/expect/castxml1.any.Converter.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
@@ -16,4 +16,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Converter.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.CvQualifiedType.xml.txt b/test/expect/castxml1.any.CvQualifiedType.xml.txt
new file mode 100644
index 0000000..7294fa3
--- /dev/null
+++ b/test/expect/castxml1.any.CvQualifiedType.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2c" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <CvQualifiedType id="_2c" type="_2" const="1"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/CvQualifiedType.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Destructor-annotate.xml.txt b/test/expect/castxml1.any.Destructor-annotate.xml.txt
similarity index 92%
copy from test/expect/gccxml.any.Destructor-annotate.xml.txt
copy to test/expect/castxml1.any.Destructor-annotate.xml.txt
index 0660f79..b21a772 100644
--- a/test/expect/gccxml.any.Destructor-annotate.xml.txt
+++ b/test/expect/castxml1.any.Destructor-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
@@ -14,4 +14,4 @@
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Destructor-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Destructor.xml.txt b/test/expect/castxml1.any.Destructor.xml.txt
similarity index 94%
copy from test/expect/gccxml.any.Destructor.xml.txt
copy to test/expect/castxml1.any.Destructor.xml.txt
index 130b197..5298fb4 100644
--- a/test/expect/gccxml.any.Destructor.xml.txt
+++ b/test/expect/castxml1.any.Destructor.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
@@ -14,4 +14,4 @@
   <ReferenceType id="_8" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Destructor.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Enumeration-annotate.xml.txt b/test/expect/castxml1.any.Enumeration-annotate.xml.txt
new file mode 100644
index 0000000..0040743
--- /dev/null
+++ b/test/expect/castxml1.any.Enumeration-annotate.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Enumeration id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)">
+    <EnumValue name="ev0" init="0" attributes="annotate\(an annotation\)"/>
+  </Enumeration>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Enumeration-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Enumeration-anonymous.xml.txt b/test/expect/castxml1.any.Enumeration-anonymous.xml.txt
new file mode 100644
index 0000000..f0de02d
--- /dev/null
+++ b/test/expect/castxml1.any.Enumeration-anonymous.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <Enumeration id="_3" name="" context="_1" location="f1:2" file="f1" line="2">
+    <EnumValue name="ev0" init="0"/>
+    <EnumValue name="ev1" init="1"/>
+  </Enumeration>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Enumeration-anonymous.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Enumeration.xml.txt b/test/expect/castxml1.any.Enumeration.xml.txt
new file mode 100644
index 0000000..664a6c8
--- /dev/null
+++ b/test/expect/castxml1.any.Enumeration.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Enumeration id="_1" name="start" context="_2" location="f1:1" file="f1" line="1">
+    <EnumValue name="ev0" init="0"/>
+    <EnumValue name="ev2" init="2"/>
+  </Enumeration>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Enumeration.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Field-annotate.xml.txt b/test/expect/castxml1.any.Field-annotate.xml.txt
similarity index 93%
copy from test/expect/gccxml.any.Field-annotate.xml.txt
copy to test/expect/castxml1.any.Field-annotate.xml.txt
index d5d524e..f8fd8c2 100644
--- a/test/expect/gccxml.any.Field-annotate.xml.txt
+++ b/test/expect/castxml1.any.Field-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="field" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0" attributes="annotate\(an annotation\)"/>
+  <Field id="_3" name="field" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
@@ -16,4 +16,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Field-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Field.xml.txt b/test/expect/castxml1.any.Field.xml.txt
similarity index 87%
copy from test/expect/gccxml.any.Field.xml.txt
copy to test/expect/castxml1.any.Field.xml.txt
index a3389c1..0bf7a8a 100644
--- a/test/expect/gccxml.any.Field.xml.txt
+++ b/test/expect/castxml1.any.Field.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="field" type="_10" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Field id="_4" name="bit_field" type="_11" bits="2" context="_1" access="private" location="f1:3" file="f1" line="3" offset="32"/>
-  <Field id="_5" name="mutable_field" type="_10" context="_1" access="private" location="f1:4" file="f1" line="4" offset="64" mutable="1"/>
+  <Field id="_3" name="field" type="_10" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Field id="_4" name="bit_field" type="_11" bits="2" context="_1" access="private" location="f1:4" file="f1" line="4" offset="32"/>
+  <Field id="_5" name="mutable_field" type="_10" context="_1" access="private" location="f1:5" file="f1" line="5" offset="64" mutable="1"/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_12" location="f1:1" file="f1" line="1"/>
   </Constructor>
@@ -19,4 +19,4 @@
   <ReferenceType id="_13" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Field.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-Argument-Annotate.xml.txt b/test/expect/castxml1.any.Function-Argument-Annotate.xml.txt
new file mode 100644
index 0000000..52ad224
--- /dev/null
+++ b/test/expect/castxml1.any.Function-Argument-Annotate.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-Argument-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-Argument-decay.xml.txt b/test/expect/castxml1.any.Function-Argument-decay.xml.txt
new file mode 100644
index 0000000..9d1d6f6
--- /dev/null
+++ b/test/expect/castxml1.any.Function-Argument-decay.xml.txt
@@ -0,0 +1,17 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+    <Argument type="_5" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <PointerType id="_4" type="_6"/>
+  <PointerType id="_5" type="_7"/>
+  <Namespace id="_3" name="::"/>
+  <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
+  <FunctionType id="_7" returns="_6">
+    <Argument type="_6"/>
+  </FunctionType>
+  <File id="f1" name=".*/test/input/Function-Argument-decay.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt b/test/expect/castxml1.any.Function-Argument-default-cast.xml.txt
similarity index 65%
copy from test/expect/gccxml.any.Function-Argument-default-cast.xml.txt
copy to test/expect/castxml1.any.Function-Argument-default-cast.xml.txt
index 577adb1..e2b7051 100644
--- a/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt
+++ b/test/expect/castxml1.any.Function-Argument-default-cast.xml.txt
@@ -1,36 +1,36 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5 _6 _7 _8"/>
   <Struct id="_3" name="Base" context="_1" location="f1:2" file="f1" line="2" members="_9 _10 _11 _12" size="[0-9]+" align="[0-9]+"/>
-  <Struct id="_4" name="Derived" context="_1" location="f1:3" file="f1" line="3" members="_13 _14 _15 _16" bases="_3" size="[0-9]+" align="[0-9]+">
+  <Struct id="_4" name="Derived" context="_1" location="f1:7" file="f1" line="7" members="_13 _14 _15 _16" bases="_3" size="[0-9]+" align="[0-9]+">
     <Base type="_3" access="public" virtual="0" offset="0"/>
   </Struct>
-  <Function id="_5" name="b" returns="_17" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
-  <Function id="_6" name="bc" returns="_18" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]+"/>
-  <Typedef id="_7" name="Int" type="_19" context="_1" location="f1:6" file="f1" line="6"/>
-  <Function id="_8" name="f" returns="_20" context="_1" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_7" location="f1:7" file="f1" line="7" default="\(int\)0"/>
-    <Argument type="_17" location="f1:8" file="f1" line="8" default="\(start::Base \*\)0"/>
-    <Argument type="_17" location="f1:9" file="f1" line="9" default="static_cast<start::Base \*>\(0\)"/>
-    <Argument type="_17" location="f1:10" file="f1" line="10" default="reinterpret_cast<start::Base \*>\(0\)"/>
-    <Argument type="_17" location="f1:11" file="f1" line="11" default="const_cast<start::Base \*>\(start::bc\(\)\)"/>
-    <Argument type="_21" location="f1:12" file="f1" line="12" default="dynamic_cast<start::Derived \*>\(start::b\(\)\)"/>
+  <Function id="_5" name="b" returns="_17" context="_1" location="f1:10" file="f1" line="10" mangled="[^"]+"/>
+  <Function id="_6" name="bc" returns="_18" context="_1" location="f1:11" file="f1" line="11" mangled="[^"]+"/>
+  <Typedef id="_7" name="Int" type="_19" context="_1" location="f1:12" file="f1" line="12"/>
+  <Function id="_8" name="f" returns="_20" context="_1" location="f1:13" file="f1" line="13" mangled="[^"]+">
+    <Argument type="_7" location="f1:13" file="f1" line="13" default="\(int\)0"/>
+    <Argument type="_17" location="f1:13" file="f1" line="13" default="\(start::Base \*\)0"/>
+    <Argument type="_17" location="f1:13" file="f1" line="13" default="static_cast<start::Base \*>\(0\)"/>
+    <Argument type="_17" location="f1:14" file="f1" line="14" default="reinterpret_cast<start::Base \*>\(0\)"/>
+    <Argument type="_17" location="f1:14" file="f1" line="14" default="const_cast<start::Base \*>\(start::bc\(\)\)"/>
+    <Argument type="_21" location="f1:15" file="f1" line="15" default="dynamic_cast<start::Derived \*>\(start::b\(\)\)"/>
   </Function>
-  <Constructor id="_9" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2"/>
-  <Destructor id="_10" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2" virtual="1"/>
+  <Constructor id="_9" name="Base" context="_3" access="public" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_10" name="Base" context="_3" access="public" location="f1:5" file="f1" line="5" virtual="1"/>
   <OperatorMethod id="_11" name="=" returns="_22" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
     <Argument type="_23" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
   <Constructor id="_12" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
     <Argument type="_23" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <OperatorMethod id="_13" name="=" returns="_24" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_25" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_13" name="=" returns="_24" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_25" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_14" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" virtual="1" inline="1" artificial="1"( throw="")? overrides="_10"/>
-  <Constructor id="_15" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_25" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_14" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" virtual="1" inline="1" artificial="1"( throw="")? overrides="_10"/>
+  <Constructor id="_15" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_16" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
+    <Argument type="_25" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <PointerType id="_17" type="_3"/>
   <PointerType id="_18" type="_3c"/>
@@ -45,4 +45,4 @@
   <CvQualifiedType id="_4c" type="_4" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Function-Argument-default-cast.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt b/test/expect/castxml1.any.Function-Argument-default-ns.xml.txt
similarity index 79%
copy from test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
copy to test/expect/castxml1.any.Function-Argument-default-ns.xml.txt
index c6a3282..b2625fd 100644
--- a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
+++ b/test/expect/castxml1.any.Function-Argument-default-ns.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
   <Variable id="_3" name="C" type="_6c" init="0" context="_1" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
   <Enumeration id="_4" name="" context="_1" location="f1:3" file="f1" line="3">
     <EnumValue name="E" init="0"/>
   </Enumeration>
-  <Function id="_5" name="f" returns="_7" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_6" location="f1:4" file="f1" line="4" default="start::C"/>
-    <Argument type="_6" location="f1:4" file="f1" line="4" default="start::E"/>
+  <Function id="_5" name="f" returns="_7" context="_1" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_6" location="f1:7" file="f1" line="7" default="start::C"/>
+    <Argument type="_6" location="f1:7" file="f1" line="7" default="start::E"/>
   </Function>
   <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_6c" type="_6" const="1"/>
   <FundamentalType id="_7" name="void" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Function-Argument-default-ns.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-Argument-default.xml.txt b/test/expect/castxml1.any.Function-Argument-default.xml.txt
new file mode 100644
index 0000000..98d8079
--- /dev/null
+++ b/test/expect/castxml1.any.Function-Argument-default.xml.txt
@@ -0,0 +1,14 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1" default="123"/>
+    <Argument type="_5" location="f1:1" file="f1" line="1" default=""abc""/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <PointerType id="_5" type="_6c"/>
+  <CvQualifiedType id="_6c" type="_6" const="1"/>
+  <Namespace id="_3" name="::"/>
+  <FundamentalType id="_6" name="char" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/Function-Argument-default.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-annotate.xml.txt b/test/expect/castxml1.any.Function-annotate.xml.txt
new file mode 100644
index 0000000..1bd3eef
--- /dev/null
+++ b/test/expect/castxml1.any.Function-annotate.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt b/test/expect/castxml1.any.Function-calling-convention-ms-annotate.xml.txt
similarity index 70%
copy from test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
copy to test/expect/castxml1.any.Function-calling-convention-ms-annotate.xml.txt
index ba7fb08..7512e13 100644
--- a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
+++ b/test/expect/castxml1.any.Function-calling-convention-ms-annotate.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Function id="_1" name="start" returns="_5" context="_6" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+    <Argument type="_7" location="f1:2" file="f1" line="2"/>
   </Function>
-  <Function id="_2" name="start" returns="_5" context="_6" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Function id="_2" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
+    <Argument type="_8" location="f1:4" file="f1" line="4"/>
   </Function>
-  <Function id="_3" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <Function id="_3" name="start" returns="_5" context="_6" location="f1:5" file="f1" line="5" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Function>
-  <Function id="_4" name="start" returns="_5" context="_6" location="f1:4" file="f1" line="4" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <Function id="_4" name="start" returns="_5" context="_6" location="f1:7" file="f1" line="7" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
+    <Argument type="_10" location="f1:8" file="f1" line="8"/>
   </Function>
   <FundamentalType id="_5" name="void" size="[0-9]+" align="[0-9]+"/>
   <PointerType id="_7" type="_11"/>
@@ -23,4 +23,4 @@
   <FunctionType id="_13" returns="_5" attributes="__fastcall__"/>
   <FunctionType id="_14" returns="_5" attributes="__thiscall__"/>
   <File id="f1" name=".*/test/input/Function-calling-convention-ms-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt b/test/expect/castxml1.any.Function-calling-convention-ms.xml.txt
similarity index 84%
copy from test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
copy to test/expect/castxml1.any.Function-calling-convention-ms.xml.txt
index ba7fb08..450b3da 100644
--- a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
+++ b/test/expect/castxml1.any.Function-calling-convention-ms.xml.txt
@@ -1,15 +1,15 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_5" context="_6" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_5" context="_6" location="f1:1" file="f1" line="1" mangled="[^"]+">
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Function>
-  <Function id="_2" name="start" returns="_5" context="_6" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
+  <Function id="_2" name="start" returns="_5" context="_6" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="__stdcall__">
     <Argument type="_8" location="f1:2" file="f1" line="2"/>
   </Function>
-  <Function id="_3" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
+  <Function id="_3" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__fastcall__">
     <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </Function>
-  <Function id="_4" name="start" returns="_5" context="_6" location="f1:4" file="f1" line="4" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
+  <Function id="_4" name="start" returns="_5" context="_6" location="f1:4" file="f1" line="4" mangled="[^"]+" attributes="__thiscall__">
     <Argument type="_10" location="f1:4" file="f1" line="4"/>
   </Function>
   <FundamentalType id="_5" name="void" size="[0-9]+" align="[0-9]+"/>
@@ -22,5 +22,5 @@
   <FunctionType id="_12" returns="_5" attributes="__stdcall__"/>
   <FunctionType id="_13" returns="_5" attributes="__fastcall__"/>
   <FunctionType id="_14" returns="_5" attributes="__thiscall__"/>
-  <File id="f1" name=".*/test/input/Function-calling-convention-ms-annotate.cxx"/>
-</GCC_XML>$
+  <File id="f1" name=".*/test/input/Function-calling-convention-ms.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-rvalue-reference.xml.txt b/test/expect/castxml1.any.Function-rvalue-reference.xml.txt
new file mode 100644
index 0000000..f8067ce
--- /dev/null
+++ b/test/expect/castxml1.any.Function-rvalue-reference.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_2" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-rvalue-reference.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Function-template.xml.txt b/test/expect/castxml1.any.Function-template.xml.txt
similarity index 70%
copy from test/expect/gccxml.any.Function-template.xml.txt
copy to test/expect/castxml1.any.Function-template.xml.txt
index f74aaba..3c8b78c 100644
--- a/test/expect/gccxml.any.Function-template.xml.txt
+++ b/test/expect/castxml1.any.Function-template.xml.txt
@@ -1,13 +1,13 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_3" context="_4" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_3" location="f1:1" file="f1" line="1"/>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_3" context="_4" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:2" file="f1" line="2"/>
   </Function>
-  <Function id="_2" name="start" returns="_5" context="_4" location="f1:1" file="f1" line="1" mangled="[^"]+">
-    <Argument type="_5" location="f1:1" file="f1" line="1"/>
+  <Function id="_2" name="start" returns="_5" context="_4" location="f1:2" file="f1" line="2" mangled="[^"]+">
+    <Argument type="_5" location="f1:2" file="f1" line="2"/>
   </Function>
   <FundamentalType id="_3" name="char" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_4" name="::"/>
   <File id="f1" name=".*/test/input/Function-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-throw.xml.txt b/test/expect/castxml1.any.Function-throw.xml.txt
new file mode 100644
index 0000000..661916f
--- /dev/null
+++ b/test/expect/castxml1.any.Function-throw.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" throw="_4 _5" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_5" name="char" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-throw.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function-variadic.xml.txt b/test/expect/castxml1.any.Function-variadic.xml.txt
new file mode 100644
index 0000000..3d4c7eb
--- /dev/null
+++ b/test/expect/castxml1.any.Function-variadic.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+    <Ellipsis/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function-variadic.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Function.xml.txt b/test/expect/castxml1.any.Function.xml.txt
new file mode 100644
index 0000000..c75871e
--- /dev/null
+++ b/test/expect/castxml1.any.Function.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_4" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Function.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.FunctionType-variadic.xml.txt b/test/expect/castxml1.any.FunctionType-variadic.xml.txt
new file mode 100644
index 0000000..80a9371
--- /dev/null
+++ b/test/expect/castxml1.any.FunctionType-variadic.xml.txt
@@ -0,0 +1,12 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FunctionType id="_2" returns="_4">
+    <Argument type="_5"/>
+    <Ellipsis/>
+  </FunctionType>
+  <FundamentalType id="_4" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/FunctionType-variadic.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.FunctionType.xml.txt b/test/expect/castxml1.any.FunctionType.xml.txt
new file mode 100644
index 0000000..144e7bf
--- /dev/null
+++ b/test/expect/castxml1.any.FunctionType.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FunctionType id="_2" returns="_4">
+    <Argument type="_5"/>
+  </FunctionType>
+  <FundamentalType id="_4" name="void" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/FunctionType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.FundamentalType.xml.txt b/test/expect/castxml1.any.FundamentalType.xml.txt
new file mode 100644
index 0000000..2b13ffc
--- /dev/null
+++ b/test/expect/castxml1.any.FundamentalType.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/FundamentalType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.FundamentalTypes.xml.txt b/test/expect/castxml1.any.FundamentalTypes.xml.txt
new file mode 100644
index 0000000..31c8fdd
--- /dev/null
+++ b/test/expect/castxml1.any.FundamentalTypes.xml.txt
@@ -0,0 +1,32 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4 _5 _6 _7 _8 _9 _10 _11 _12 _13 _14 _15"/>
+  <Typedef id="_3" name="t_Char" type="_16" context="_1" location="f1:2" file="f1" line="2"/>
+  <Typedef id="_4" name="t_SChar" type="_17" context="_1" location="f1:3" file="f1" line="3"/>
+  <Typedef id="_5" name="t_UChar" type="_18" context="_1" location="f1:4" file="f1" line="4"/>
+  <Typedef id="_6" name="t_Short" type="_19" context="_1" location="f1:5" file="f1" line="5"/>
+  <Typedef id="_7" name="t_UShort" type="_20" context="_1" location="f1:6" file="f1" line="6"/>
+  <Typedef id="_8" name="t_Int" type="_21" context="_1" location="f1:7" file="f1" line="7"/>
+  <Typedef id="_9" name="t_UInt" type="_22" context="_1" location="f1:8" file="f1" line="8"/>
+  <Typedef id="_10" name="t_Long" type="_23" context="_1" location="f1:9" file="f1" line="9"/>
+  <Typedef id="_11" name="t_ULong" type="_24" context="_1" location="f1:10" file="f1" line="10"/>
+  <Typedef id="_12" name="t_LongLong" type="_25" context="_1" location="f1:11" file="f1" line="11"/>
+  <Typedef id="_13" name="t_ULongLong" type="_26" context="_1" location="f1:12" file="f1" line="12"/>
+  <Typedef id="_14" name="t_Float" type="_27" context="_1" location="f1:13" file="f1" line="13"/>
+  <Typedef id="_15" name="t_Double" type="_28" context="_1" location="f1:14" file="f1" line="14"/>
+  <FundamentalType id="_16" name="char" size="8" align="8"/>
+  <FundamentalType id="_17" name="signed char" size="8" align="8"/>
+  <FundamentalType id="_18" name="unsigned char" size="8" align="8"/>
+  <FundamentalType id="_19" name="short int" size="16" align="16"/>
+  <FundamentalType id="_20" name="short unsigned int" size="16" align="16"/>
+  <FundamentalType id="_21" name="int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_22" name="unsigned int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_23" name="long int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_24" name="long unsigned int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_25" name="long long int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_26" name="long long unsigned int" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_27" name="float" size="[0-9]+" align="[0-9]+"/>
+  <FundamentalType id="_28" name="double" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/FundamentalTypes.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.GNU-float128-nostart.xml.txt b/test/expect/castxml1.any.GNU-float128-nostart.xml.txt
new file mode 100644
index 0000000..c46a97b
--- /dev/null
+++ b/test/expect/castxml1.any.GNU-float128-nostart.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+.*<FundamentalType id="_[0-9]+" name="__float128" size="128" align="128"/>.*
+  <File id="f1" name=".*/test/input/GNU-float128-nostart.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.GNU-float128.xml.txt b/test/expect/castxml1.any.GNU-float128.xml.txt
similarity index 67%
copy from test/expect/gccxml.any.GNU-float128.xml.txt
copy to test/expect/castxml1.any.GNU-float128.xml.txt
index 8ae15a6..1f0d86f 100644
--- a/test/expect/gccxml.any.GNU-float128.xml.txt
+++ b/test/expect/castxml1.any.GNU-float128.xml.txt
@@ -1,14 +1,14 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
-  <Function id="_3" name="f" returns="_6" context="_1" location="f1:3" file="f1" line="3" mangled="">
-    <Argument type="_6" location="f1:3" file="f1" line="3"/>
+  <Function id="_3" name="f" returns="_6" context="_1" location="f1:4" file="f1" line="4" mangled="">
+    <Argument type="_6" location="f1:4" file="f1" line="4"/>
   </Function>
-  <Variable id="_4" name="v" type="_6" init="" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]*"/>
-  <Variable id="_5" name="pa" type="_7" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]*"/>
+  <Variable id="_4" name="v" type="_6" init="" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]*"/>
+  <Variable id="_5" name="pa" type="_7" context="_1" location="f1:6" file="f1" line="6" mangled="[^"]*"/>
   <FundamentalType id="_6" name="__float128" size="128" align="128"/>
   <PointerType id="_7" type="_8"/>
   <Namespace id="_2" name="::"/>
-  <Struct id="_8" name="A<__float128>" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Struct id="_8" name="A<__float128>" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
   <File id="f1" name=".*/test/input/GNU-float128.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.GNU-va_arg_pack.xml.txt b/test/expect/castxml1.any.GNU-va_arg_pack.xml.txt
new file mode 100644
index 0000000..b688e54
--- /dev/null
+++ b/test/expect/castxml1.any.GNU-va_arg_pack.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" inline="1" mangled="[^"]+">
+    <Argument name="n" type="_2" location="f1:1" file="f1" line="1"/>
+    <Ellipsis/>
+  </Function>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-va_arg_pack.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt b/test/expect/castxml1.any.Method-Argument-default-cast.xml.txt
similarity index 84%
copy from test/expect/gccxml.any.Method-Argument-default-cast.xml.txt
copy to test/expect/castxml1.any.Method-Argument-default-cast.xml.txt
index e7f93f2..e3ef009 100644
--- a/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt
+++ b/test/expect/castxml1.any.Method-Argument-default-cast.xml.txt
@@ -1,13 +1,13 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_3" name="Class" context="_1" access="private" location="f1:2" file="f1" line="2" incomplete="1"/>
-  <Typedef id="_4" name="Int" type="_10" context="_1" access="private" location="f1:3" file="f1" line="3"/>
-  <Method id="_5" name="f" returns="_10" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_4" location="f1:4" file="f1" line="4" default="\(int\)0"/>
+  <Class id="_3" name="Class" context="_1" access="private" location="f1:3" file="f1" line="3" incomplete="1"/>
+  <Typedef id="_4" name="Int" type="_10" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_5" name="f" returns="_10" context="_1" access="private" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_4" location="f1:5" file="f1" line="5" default="\(int\)0"/>
     <Argument type="_11" location="f1:5" file="f1" line="5" default="\(start::Class \*\)0"/>
-    <Argument type="_11" location="f1:6" file="f1" line="6" default="static_cast<start::Class \*>\(0\)"/>
-    <Argument type="_11" location="f1:7" file="f1" line="7" default="reinterpret_cast<start::Class \*>\(0\)"/>
+    <Argument type="_11" location="f1:5" file="f1" line="5" default="static_cast<start::Class \*>\(0\)"/>
+    <Argument type="_11" location="f1:6" file="f1" line="6" default="reinterpret_cast<start::Class \*>\(0\)"/>
   </Method>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -24,4 +24,4 @@
   <ReferenceType id="_13" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method-Argument-default-cast.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method-Argument-default.xml.txt b/test/expect/castxml1.any.Method-Argument-default.xml.txt
similarity index 86%
copy from test/expect/gccxml.any.Method-Argument-default.xml.txt
copy to test/expect/castxml1.any.Method-Argument-default.xml.txt
index 0e10cbf..e7481e3 100644
--- a/test/expect/gccxml.any.Method-Argument-default.xml.txt
+++ b/test/expect/castxml1.any.Method-Argument-default.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_3" name="C" type="_9c" init="0" context="_1" access="private" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_9" location="f1:3" file="f1" line="3" default="start::C"/>
+  <Variable id="_3" name="C" type="_9c" init="0" context="_1" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_9" location="f1:4" file="f1" line="4" default="start::C"/>
   </Method>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -20,4 +20,4 @@
   <ReferenceType id="_11" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method-Argument-default.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method-annotate.xml.txt b/test/expect/castxml1.any.Method-annotate.xml.txt
similarity index 89%
copy from test/expect/gccxml.any.Method-annotate.xml.txt
copy to test/expect/castxml1.any.Method-annotate.xml.txt
index 3e4f2f3..66cdb40 100644
--- a/test/expect/gccxml.any.Method-annotate.xml.txt
+++ b/test/expect/castxml1.any.Method-annotate.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -18,4 +18,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method-overrides.xml.txt b/test/expect/castxml1.any.Method-overrides.xml.txt
similarity index 71%
copy from test/expect/gccxml.any.Method-overrides.xml.txt
copy to test/expect/castxml1.any.Method-overrides.xml.txt
index dc95285..d3ffc30 100644
--- a/test/expect/gccxml.any.Method-overrides.xml.txt
+++ b/test/expect/castxml1.any.Method-overrides.xml.txt
@@ -1,23 +1,23 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" bases="_8" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6 _7" bases="_8" size="[0-9]+" align="[0-9]+">
     <Base type="_8" access="public" virtual="0" offset="0"/>
   </Class>
-  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:5" file="f1" line="5" virtual="1" overrides="_10" mangled="[^"]+">
-    <Argument type="_9" location="f1:5" file="f1" line="5"/>
+  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:7" file="f1" line="7" virtual="1" overrides="_10" mangled="[^"]+">
+    <Argument type="_9" location="f1:7" file="f1" line="7"/>
   </Method>
-  <OperatorMethod id="_4" name="=" returns="_11" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_4" name="=" returns="_11" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_12" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_5" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_7" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_12" location="f1:5" file="f1" line="5"/>
   </Constructor>
   <Class id="_8" name="base" context="_2" location="f1:1" file="f1" line="1" members="_10 _13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_10" name="method" returns="_9" context="_8" access="private" location="f1:2" file="f1" line="2" virtual="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Method id="_10" name="method" returns="_9" context="_8" access="private" location="f1:3" file="f1" line="3" virtual="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </Method>
   <ReferenceType id="_11" type="_1"/>
   <ReferenceType id="_12" type="_1c"/>
@@ -35,4 +35,4 @@
   <CvQualifiedType id="_8c" type="_8" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method-overrides.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method-rvalue-reference.xml.txt b/test/expect/castxml1.any.Method-rvalue-reference.xml.txt
similarity index 66%
copy from test/expect/gccxml.any.Method-rvalue-reference.xml.txt
copy to test/expect/castxml1.any.Method-rvalue-reference.xml.txt
index 1fd1126..039564d 100644
--- a/test/expect/gccxml.any.Method-rvalue-reference.xml.txt
+++ b/test/expect/castxml1.any.Method-rvalue-reference.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2">
-    <Argument type="_7" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3">
+    <Argument type="_7" location="f1:3" file="f1" line="3"/>
   </Constructor>
-  <OperatorMethod id="_4" name="=" returns="_7" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_7" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_4" name="=" returns="_7" context="_1" access="private" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Method id="_5" name="method" returns="_8" context="_1" access="private" location="f1:6" file="f1" line="6" mangled="[^"]+">
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+  <Method id="_5" name="method" returns="_8" context="_1" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_8" location="f1:7" file="f1" line="7"/>
   </Method>
   <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_7" type="_1"/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method-rvalue-reference.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Method.xml.txt b/test/expect/castxml1.any.Method.xml.txt
similarity index 89%
copy from test/expect/gccxml.any.Method.xml.txt
copy to test/expect/castxml1.any.Method.xml.txt
index 953620a..ba942c4 100644
--- a/test/expect/gccxml.any.Method.xml.txt
+++ b/test/expect/castxml1.any.Method.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
+    <Argument type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -18,4 +18,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Method.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.MethodType-cv.xml.txt b/test/expect/castxml1.any.MethodType-cv.xml.txt
new file mode 100644
index 0000000..c778606
--- /dev/null
+++ b/test/expect/castxml1.any.MethodType-cv.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2cv" context="_3" location="f1:2" file="f1" line="2"/>
+  <PointerType id="_2" type="_4"/>
+  <CvQualifiedType id="_2cv" type="_2" const="1" volatile="1"/>
+  <Namespace id="_3" name="::"/>
+  <MethodType id="_4" basetype="_5" returns="_6" const="1" volatile="1">
+    <Argument type="_6"/>
+  </MethodType>
+  <Class id="_5" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/MethodType-cv.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.MethodType.xml.txt b/test/expect/castxml1.any.MethodType.xml.txt
new file mode 100644
index 0000000..59b62dd
--- /dev/null
+++ b/test/expect/castxml1.any.MethodType.xml.txt
@@ -0,0 +1,12 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <PointerType id="_2" type="_4"/>
+  <Namespace id="_3" name="::"/>
+  <MethodType id="_4" basetype="_5" returns="_6">
+    <Argument type="_6"/>
+  </MethodType>
+  <Class id="_5" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/MethodType.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Namespace-Class-members.xml.txt b/test/expect/castxml1.any.Namespace-Class-members.xml.txt
similarity index 93%
copy from test/expect/gccxml.any.Namespace-Class-members.xml.txt
copy to test/expect/castxml1.any.Namespace-Class-members.xml.txt
index 9f434ae..90a81fa 100644
--- a/test/expect/gccxml.any.Namespace-Class-members.xml.txt
+++ b/test/expect/castxml1.any.Namespace-Class-members.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3"/>
   <Class id="_3" name="A" context="_1" location="f1:2" file="f1" line="2" members="_4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_4" name="data" type="_9" context="_3" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
+  <Variable id="_4" name="data" type="_9" context="_3" access="private" location="f1:4" file="f1" line="4" static="1" mangled="[^"]+"/>
   <Constructor id="_5" name="A" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_6" name="A" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
     <Argument type="_10" location="f1:2" file="f1" line="2"/>
@@ -17,4 +17,4 @@
   <ReferenceType id="_11" type="_3"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Namespace-Class-members.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-Class-partial-template-members.xml.txt b/test/expect/castxml1.any.Namespace-Class-partial-template-members.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-Class-partial-template-members.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-Class-template-members.xml.txt b/test/expect/castxml1.any.Namespace-Class-template-members.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-Class-template-members.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-Function-template-members.xml.txt b/test/expect/castxml1.any.Namespace-Function-template-members.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-Function-template-members.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-anonymous.xml.txt b/test/expect/castxml1.any.Namespace-anonymous.xml.txt
new file mode 100644
index 0000000..d2a82ad
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-anonymous.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <Namespace id="_3" context="_1" members="_4"/>
+  <Struct id="_4" name="A" context="_3" location="f1:3" file="f1" line="3" incomplete="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-anonymous.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-empty.xml.txt b/test/expect/castxml1.any.Namespace-empty.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-empty.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-extern-C-members.xml.txt b/test/expect/castxml1.any.Namespace-extern-C-members.xml.txt
new file mode 100644
index 0000000..59b8d0a
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-extern-C-members.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+  <Typedef id="_3" name="Int" type="_5" context="_1" location="f1:3" file="f1" line="3"/>
+  <Function id="_4" name="function" returns="_3" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_3" location="f1:4" file="f1" line="4"/>
+  </Function>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-extern-C-members.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-inline-start.xml.txt b/test/expect/castxml1.any.Namespace-inline-start.xml.txt
new file mode 100644
index 0000000..526e8fe
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-inline-start.xml.txt
@@ -0,0 +1,3 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Namespace-inline-template.xml.txt b/test/expect/castxml1.any.Namespace-inline-template.xml.txt
similarity index 81%
copy from test/expect/gccxml.any.Namespace-inline-template.xml.txt
copy to test/expect/castxml1.any.Namespace-inline-template.xml.txt
index fc966fb..daba4eb 100644
--- a/test/expect/gccxml.any.Namespace-inline-template.xml.txt
+++ b/test/expect/castxml1.any.Namespace-inline-template.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
   <Struct id="_3" name="A" context="_1" location="f1:4" file="f1" line="4" incomplete="1"/>
-  <Struct id="_4" name="B<start::A>" context="_1" location="f1:6" file="f1" line="6" incomplete="1"/>
-  <Typedef id="_5" name="B_A" type="_4" context="_1" location="f1:7" file="f1" line="7"/>
+  <Struct id="_4" name="B<start::A>" context="_1" location="f1:7" file="f1" line="7" incomplete="1"/>
+  <Typedef id="_5" name="B_A" type="_4" context="_1" location="f1:8" file="f1" line="8"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Namespace-inline-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-inline.xml.txt b/test/expect/castxml1.any.Namespace-inline.xml.txt
new file mode 100644
index 0000000..190d36b
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-inline.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+  <Struct id="_3" name="A" context="_1" location="f1:4" file="f1" line="4" incomplete="1"/>
+  <Struct id="_4" name="B" context="_1" location="f1:6" file="f1" line="6" incomplete="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-inline.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-nested-1.xml.txt b/test/expect/castxml1.any.Namespace-nested-1.xml.txt
new file mode 100644
index 0000000..3ffe471
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-nested-1.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="ns1" context="_3" members="_4"/>
+  <Namespace id="_2" name="ns3" context="_3" members="_5"/>
+  <Function id="_4" name="f1" returns="_6" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <Function id="_5" name="f3" returns="_6" context="_2" location="f1:9" file="f1" line="9" mangled="[^"]+"/>
+  <FundamentalType id="_6" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="start" context="_7"/>
+  <Namespace id="_7" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-nested.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-nested-2.xml.txt b/test/expect/castxml1.any.Namespace-nested-2.xml.txt
new file mode 100644
index 0000000..3ffe471
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-nested-2.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="ns1" context="_3" members="_4"/>
+  <Namespace id="_2" name="ns3" context="_3" members="_5"/>
+  <Function id="_4" name="f1" returns="_6" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <Function id="_5" name="f3" returns="_6" context="_2" location="f1:9" file="f1" line="9" mangled="[^"]+"/>
+  <FundamentalType id="_6" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="start" context="_7"/>
+  <Namespace id="_7" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-nested.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-nested.xml.txt b/test/expect/castxml1.any.Namespace-nested.xml.txt
new file mode 100644
index 0000000..1d1dcbc
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-nested.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
+  <Namespace id="_3" name="ns1" context="_1" members="_6"/>
+  <Namespace id="_4" name="ns2" context="_1" members="_7"/>
+  <Namespace id="_5" name="ns3" context="_1" members="_8"/>
+  <Function id="_6" name="f1" returns="_9" context="_3" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <Function id="_7" name="f2" returns="_9" context="_4" location="f1:6" file="f1" line="6" mangled="[^"]+"/>
+  <Function id="_8" name="f3" returns="_9" context="_5" location="f1:9" file="f1" line="9" mangled="[^"]+"/>
+  <FundamentalType id="_9" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-nested.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-repeat-start.xml.txt b/test/expect/castxml1.any.Namespace-repeat-start.xml.txt
new file mode 100644
index 0000000..74c15a8
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-repeat-start.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+  <Function id="_3" name="f1" returns="_5" context="_1" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Function id="_4" name="f2" returns="_5" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]+"/>
+  <FundamentalType id="_5" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-repeat-start.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace-repeat.xml.txt b/test/expect/castxml1.any.Namespace-repeat.xml.txt
new file mode 100644
index 0000000..1fb3a8b
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace-repeat.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <Namespace id="_3" name="ns" context="_1" members="_4 _5"/>
+  <Function id="_4" name="f1" returns="_6" context="_3" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <Function id="_5" name="f2" returns="_6" context="_3" location="f1:6" file="f1" line="6" mangled="[^"]+"/>
+  <FundamentalType id="_6" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Namespace-repeat.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Namespace.xml.txt b/test/expect/castxml1.any.Namespace.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.Namespace.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.OffsetType-cv.xml.txt b/test/expect/castxml1.any.OffsetType-cv.xml.txt
new file mode 100644
index 0000000..5bd48fd
--- /dev/null
+++ b/test/expect/castxml1.any.OffsetType-cv.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2cv" context="_3" location="f1:2" file="f1" line="2"/>
+  <OffsetType id="_2" basetype="_4" type="_5cv"/>
+  <CvQualifiedType id="_2cv" type="_2" const="1" volatile="1"/>
+  <Class id="_4" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <CvQualifiedType id="_5cv" type="_5" const="1" volatile="1"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/OffsetType-cv.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.OffsetType.xml.txt b/test/expect/castxml1.any.OffsetType.xml.txt
new file mode 100644
index 0000000..291efe9
--- /dev/null
+++ b/test/expect/castxml1.any.OffsetType.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <OffsetType id="_2" basetype="_4" type="_5"/>
+  <Class id="_4" name="A" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/OffsetType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.OperatorFunction-annotate.xml.txt b/test/expect/castxml1.any.OperatorFunction-annotate.xml.txt
new file mode 100644
index 0000000..1d71226
--- /dev/null
+++ b/test/expect/castxml1.any.OperatorFunction-annotate.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <OperatorFunction id="_3" name="<<" returns="_4" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_4" location="f1:3" file="f1" line="3"/>
+    <Argument type="_5" location="f1:3" file="f1" line="3"/>
+  </OperatorFunction>
+  <ReferenceType id="_4" type="_6"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <Class id="_6" name="A" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <File id="f1" name=".*/test/input/OperatorFunction-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.OperatorFunction.xml.txt b/test/expect/castxml1.any.OperatorFunction.xml.txt
new file mode 100644
index 0000000..5c2f5bc
--- /dev/null
+++ b/test/expect/castxml1.any.OperatorFunction.xml.txt
@@ -0,0 +1,13 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <OperatorFunction id="_3" name="<<" returns="_4" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+">
+    <Argument type="_4" location="f1:3" file="f1" line="3"/>
+    <Argument type="_5" location="f1:3" file="f1" line="3"/>
+  </OperatorFunction>
+  <ReferenceType id="_4" type="_6"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <Class id="_6" name="A" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <File id="f1" name=".*/test/input/OperatorFunction.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt b/test/expect/castxml1.any.OperatorMethod-annotate.xml.txt
similarity index 89%
copy from test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
copy to test/expect/castxml1.any.OperatorMethod-annotate.xml.txt
index 692cd5e..cefeba6 100644
--- a/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
+++ b/test/expect/castxml1.any.OperatorMethod-annotate.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </OperatorMethod>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -18,4 +18,4 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/OperatorMethod-annotate.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.OperatorMethod.xml.txt b/test/expect/castxml1.any.OperatorMethod.xml.txt
similarity index 89%
copy from test/expect/gccxml.any.OperatorMethod.xml.txt
copy to test/expect/castxml1.any.OperatorMethod.xml.txt
index fad0f46..3435b94 100644
--- a/test/expect/gccxml.any.OperatorMethod.xml.txt
+++ b/test/expect/castxml1.any.OperatorMethod.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </OperatorMethod>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
@@ -18,4 +18,4 @@
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/OperatorMethod.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.PointerType.xml.txt b/test/expect/castxml1.any.PointerType.xml.txt
new file mode 100644
index 0000000..e6c5cb2
--- /dev/null
+++ b/test/expect/castxml1.any.PointerType.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <PointerType id="_2" type="_4"/>
+  <Namespace id="_3" name="::"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/PointerType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.RValueReferenceType.xml.txt b/test/expect/castxml1.any.RValueReferenceType.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.RValueReferenceType.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.ReferenceType.xml.txt b/test/expect/castxml1.any.ReferenceType.xml.txt
new file mode 100644
index 0000000..16e8809
--- /dev/null
+++ b/test/expect/castxml1.any.ReferenceType.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <ReferenceType id="_2" type="_4"/>
+  <Namespace id="_3" name="::"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/ReferenceType.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.TypeAlias.xml.txt b/test/expect/castxml1.any.TypeAlias.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.TypeAlias.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.TypeAliasTemplate.xml.txt b/test/expect/castxml1.any.TypeAliasTemplate.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.TypeAliasTemplate.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Typedef-annotate.xml.txt b/test/expect/castxml1.any.Typedef-annotate.xml.txt
new file mode 100644
index 0000000..d6dd968
--- /dev/null
+++ b/test/expect/castxml1.any.Typedef-annotate.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1" attributes="annotate\(an annotation\)"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Typedef-paren.xml.txt b/test/expect/castxml1.any.Typedef-paren.xml.txt
new file mode 100644
index 0000000..719da1d
--- /dev/null
+++ b/test/expect/castxml1.any.Typedef-paren.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-paren.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt b/test/expect/castxml1.any.Typedef-to-Class-template.xml.txt
similarity index 54%
copy from test/expect/gccxml.any.Typedef-to-Class-template.xml.txt
copy to test/expect/castxml1.any.Typedef-to-Class-template.xml.txt
index 3e6f75d..d387b85 100644
--- a/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt
+++ b/test/expect/castxml1.any.Typedef-to-Class-template.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
-  <Class id="_2" name="A<int>" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:3" file="f1" line="3"/>
+  <Class id="_2" name="A<int>" context="_3" location="f1:2" file="f1" line="2" incomplete="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Class-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt b/test/expect/castxml1.any.Typedef-to-Enumeration-anonymous.xml.txt
similarity index 83%
copy from test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt
copy to test/expect/castxml1.any.Typedef-to-Enumeration-anonymous.xml.txt
index bb21d49..f403de1 100644
--- a/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt
+++ b/test/expect/castxml1.any.Typedef-to-Enumeration-anonymous.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
   <Enumeration id="_2" name="start" context="_3" location="f1:1" file="f1" line="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Enumeration-anonymous.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt b/test/expect/castxml1.any.Typedef-to-Enumeration.xml.txt
similarity index 83%
copy from test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt
copy to test/expect/castxml1.any.Typedef-to-Enumeration.xml.txt
index 1e8ec8f..d5e89f3 100644
--- a/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt
+++ b/test/expect/castxml1.any.Typedef-to-Enumeration.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:4" file="f1" line="4"/>
   <Enumeration id="_2" name="E" context="_3" location="f1:1" file="f1" line="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Enumeration.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Typedef-to-FundamentalType-mode.xml.txt b/test/expect/castxml1.any.Typedef-to-FundamentalType-mode.xml.txt
new file mode 100644
index 0000000..9bcaa51
--- /dev/null
+++ b/test/expect/castxml1.any.Typedef-to-FundamentalType-mode.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="short int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-to-FundamentalType-mode.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Typedef-to-extern-C-FundamentalType-mode.xml.txt b/test/expect/castxml1.any.Typedef-to-extern-C-FundamentalType-mode.xml.txt
new file mode 100644
index 0000000..a0bfc3d
--- /dev/null
+++ b/test/expect/castxml1.any.Typedef-to-extern-C-FundamentalType-mode.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <FundamentalType id="_2" name="short int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-to-extern-C-FundamentalType-mode.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Variable-annotate.xml.txt b/test/expect/castxml1.any.Variable-annotate.xml.txt
new file mode 100644
index 0000000..ebb379d
--- /dev/null
+++ b/test/expect/castxml1.any.Variable-annotate.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Variable id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Variable-annotate.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.Variable-in-Class.xml.txt b/test/expect/castxml1.any.Variable-in-Class.xml.txt
similarity index 93%
copy from test/expect/gccxml.any.Variable-in-Class.xml.txt
copy to test/expect/castxml1.any.Variable-in-Class.xml.txt
index 510e985..60e7b70 100644
--- a/test/expect/gccxml.any.Variable-in-Class.xml.txt
+++ b/test/expect/castxml1.any.Variable-in-Class.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
+<CastXML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_3" name="static_field" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
+  <Variable id="_3" name="static_field" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
@@ -16,4 +16,4 @@
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Variable-in-Class.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.Variable-init-cast.xml.txt b/test/expect/castxml1.any.Variable-init-cast.xml.txt
new file mode 100644
index 0000000..64d90c0
--- /dev/null
+++ b/test/expect/castxml1.any.Variable-init-cast.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
+  <Typedef id="_3" name="Int" type="_6" context="_1" location="f1:2" file="f1" line="2"/>
+  <Variable id="_4" name="var_int" type="_6" init="\(int\)123" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <Variable id="_5" name="var_int2" type="_6" init="static_cast<int>\(123\)" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
+  <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Variable-init-cast.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Variable-init-ns.xml.txt b/test/expect/castxml1.any.Variable-init-ns.xml.txt
new file mode 100644
index 0000000..ce8d44d
--- /dev/null
+++ b/test/expect/castxml1.any.Variable-init-ns.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+  <Variable id="_3" name="C" type="_5c" init="123" context="_1" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
+  <Variable id="_4" name="var_int" type="_5" init="start::C" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <CvQualifiedType id="_5c" type="_5" const="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/Variable-init-ns.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Variable-init.xml.txt b/test/expect/castxml1.any.Variable-init.xml.txt
new file mode 100644
index 0000000..263c572
--- /dev/null
+++ b/test/expect/castxml1.any.Variable-init.xml.txt
@@ -0,0 +1,12 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+  <Variable id="_3" name="var_int" type="_5" init="123" context="_1" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Variable id="_4" name="var_str" type="_6" init=""abc"" context="_1" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
+  <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
+  <PointerType id="_6" type="_7c"/>
+  <CvQualifiedType id="_7c" type="_7" const="1"/>
+  <Namespace id="_2" name="::"/>
+  <FundamentalType id="_7" name="char" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/Variable-init.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.Variable.xml.txt b/test/expect/castxml1.any.Variable.xml.txt
new file mode 100644
index 0000000..5ef5615
--- /dev/null
+++ b/test/expect/castxml1.any.Variable.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Variable id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Variable.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.implicit-decl-ms.xml.txt b/test/expect/castxml1.any.implicit-decl-ms.xml.txt
new file mode 100644
index 0000000..795a87f
--- /dev/null
+++ b/test/expect/castxml1.any.implicit-decl-ms.xml.txt
@@ -0,0 +1,11 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+">
+    <Argument type="_2" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <Typedef id="_2" name="size_t" type="_4" context="_3" location="f0:0" file="f0" line="0"/>
+  <FundamentalType id="_4" name="unsigned int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f0" name="<builtin>"/>
+  <File id="f1" name=".*/test/input/implicit-decl-ms.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.inline-asm-ms.xml.txt b/test/expect/castxml1.any.inline-asm-ms.xml.txt
new file mode 100644
index 0000000..f55473f
--- /dev/null
+++ b/test/expect/castxml1.any.inline-asm-ms.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]+"/>
+  <FundamentalType id="_2" name="void" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/inline-asm-ms.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.invalid-decl-for-type.xml.txt b/test/expect/castxml1.any.invalid-decl-for-type.xml.txt
similarity index 51%
copy from test/expect/gccxml.any.invalid-decl-for-type.xml.txt
copy to test/expect/castxml1.any.invalid-decl-for-type.xml.txt
index 4d3cbab..c7cdaf5 100644
--- a/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
+++ b/test/expect/castxml1.any.invalid-decl-for-type.xml.txt
@@ -1,32 +1,32 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Struct id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="b" type="_9" context="_1" access="public" location="f1:5" file="f1" line="5" offset="0"/>
-  <Typedef id="_4" name="type" type="_10" context="_1" access="public" location="f1:6" file="f1" line="6"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+<CastXML[^>]*>
+  <Struct id="_1" name="start" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Field id="_3" name="b" type="_9" context="_1" access="public" location="f1:14" file="f1" line="14" offset="0"/>
+  <Typedef id="_4" name="type" type="_10" context="_1" access="public" location="f1:15" file="f1" line="15"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?>
+    <Argument type="_11" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_12" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_7" name="=" returns="_12" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_11" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Struct id="_9" name="B<Incomplete>" context="_2" location="f1:2" file="f1" line="2" members="_13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
-  <Struct id="_10" name="A<Incomplete>" context="_2" location="f1:1" file="f1" line="1" size="[0-9]+" align="[0-9]+"/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Struct id="_9" name="B<Incomplete>" context="_2" location="f1:7" file="f1" line="7" members="_13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_10" name="A<Incomplete>" context="_2" location="f1:2" file="f1" line="2" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_12" type="_1"/>
-  <Constructor id="_13" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1"/>
-  <Constructor id="_14" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
-    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_13" name="B" context="_9" access="public" location="f1:9" file="f1" line="9" inline="1"/>
+  <Constructor id="_14" name="B" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
+    <Argument type="_17" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_15" name="=" returns="_18" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_15" name="=" returns="_18" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_17" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_16" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_16" name="B" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_17" type="_9c"/>
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <ReferenceType id="_18" type="_9"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/invalid-decl-for-type.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.nostart.xml.txt b/test/expect/castxml1.any.nostart.xml.txt
new file mode 100644
index 0000000..4d4ece0
--- /dev/null
+++ b/test/expect/castxml1.any.nostart.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="::" members="[^"]*"/>
+.*<Class id="_[0-9]+" name="A" context="_1" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <OperatorFunction id="_[0-9]+" name="\+" returns="_[0-9]+" context="_1" location="f1:2" file="f1" line="2" mangled="[^"]*">
+    <Argument type="_[0-9]+" location="f1:2" file="f1" line="2"/>
+    <Argument type="_[0-9]+" location="f1:2" file="f1" line="2"/>
+  </OperatorFunction>.*
+  <File id="f1" name=".*/test/input/nostart.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.qualified-type-name.xml.txt b/test/expect/castxml1.any.qualified-type-name.xml.txt
similarity index 81%
copy from test/expect/gccxml.any.qualified-type-name.xml.txt
copy to test/expect/castxml1.any.qualified-type-name.xml.txt
index fe1eefa..d1d4ea4 100644
--- a/test/expect/gccxml.any.qualified-type-name.xml.txt
+++ b/test/expect/castxml1.any.qualified-type-name.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
-  <Typedef id="_2" name="type" type="_4" context="_5" location="f1:1" file="f1" line="1"/>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:4" file="f1" line="4"/>
+  <Typedef id="_2" name="type" type="_4" context="_5" location="f1:2" file="f1" line="2"/>
   <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_3" name="::"/>
   <Namespace id="_5" name="ns" context="_3"/>
   <File id="f1" name=".*/test/input/qualified-type-name.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.any.using-declaration-class.xml.txt b/test/expect/castxml1.any.using-declaration-class.xml.txt
similarity index 72%
copy from test/expect/gccxml.any.using-declaration-class.xml.txt
copy to test/expect/castxml1.any.using-declaration-class.xml.txt
index 857d19f..bce3add 100644
--- a/test/expect/gccxml.any.using-declaration-class.xml.txt
+++ b/test/expect/castxml1.any.using-declaration-class.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6 _7 _8" bases="_9" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" bases="_9" size="[0-9]+" align="[0-9]+">
     <Base type="_9" access="public" virtual="0" offset="0"/>
   </Class>
-  <Method id="_3" name="f" returns="_10" context="_9" access="protected" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_10" location="f1:3" file="f1" line="3"/>
+  <Method id="_3" name="f" returns="_10" context="_9" access="protected" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_10" location="f1:4" file="f1" line="4"/>
   </Method>
-  <Method id="_4" name="f" returns="_10" context="_1" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_11" location="f1:7" file="f1" line="7"/>
+  <Method id="_4" name="f" returns="_10" context="_1" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:9" file="f1" line="9"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
-    <Argument type="_12" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_12" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_13" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_12" location="f1:5" file="f1" line="5"/>
+  <OperatorMethod id="_7" name="=" returns="_13" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_12" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <Class id="_9" name="base" context="_2" location="f1:1" file="f1" line="1" members="_3 _14 _15 _16 _17" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_10" name="int" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_11" name="char" size="[0-9]+" align="[0-9]+"/>
@@ -36,4 +36,4 @@
   <ReferenceType id="_19" type="_9"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/using-declaration-class.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.any.using-declaration-ns.xml.txt b/test/expect/castxml1.any.using-declaration-ns.xml.txt
new file mode 100644
index 0000000..ac2946a
--- /dev/null
+++ b/test/expect/castxml1.any.using-declaration-ns.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2" members="_3"/>
+  <Class id="_3" name="A" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Namespace id="_2" name="::"/>
+  <File id="f1" name=".*/test/input/using-declaration-ns.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.using-declaration-start.xml.txt b/test/expect/castxml1.any.using-declaration-start.xml.txt
new file mode 100644
index 0000000..321f706
--- /dev/null
+++ b/test/expect/castxml1.any.using-declaration-start.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
+  <Namespace id="_2" name="N" context="_3"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/using-declaration-start.cxx"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.using-directive-ns.xml.txt b/test/expect/castxml1.any.using-directive-ns.xml.txt
new file mode 100644
index 0000000..6502658
--- /dev/null
+++ b/test/expect/castxml1.any.using-directive-ns.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</CastXML>$
diff --git a/test/expect/castxml1.any.using-directive-start.xml.txt b/test/expect/castxml1.any.using-directive-start.xml.txt
new file mode 100644
index 0000000..5230e37
--- /dev/null
+++ b/test/expect/castxml1.any.using-directive-start.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
+  <Namespace id="_2" name="A" context="_3"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/using-directive-start.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt b/test/expect/castxml1.broken.any.ReferenceType-to-Class-template.xml.txt
similarity index 61%
copy from test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt
copy to test/expect/castxml1.broken.any.ReferenceType-to-Class-template.xml.txt
index e15cd3c..58379a5 100644
--- a/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt
+++ b/test/expect/castxml1.broken.any.ReferenceType-to-Class-template.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_4" context="_5" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_6" location="f1:2" file="f1" line="2"/>
-    <Argument type="_7" location="f1:2" file="f1" line="2"/>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_4" context="_5" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_6" location="f1:5" file="f1" line="5"/>
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </Function>
-  <Function id="_2" name="start" returns="_4" context="_5" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <Function id="_2" name="start" returns="_4" context="_5" location="f1:6" file="f1" line="6" mangled="[^"]+">
+    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Function>
-  <Function id="_3" name="start" returns="_4" context="_5" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Function id="_3" name="start" returns="_4" context="_5" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+    <Argument type="_11" location="f1:7" file="f1" line="7"/>
   </Function>
   <FundamentalType id="_4" name="void" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_6" type="_12"/>
@@ -20,6 +20,6 @@
   <ReferenceType id="_10" type="_12"/>(broken: duplicate ReferenceType)?
   <FundamentalType id="_11" name="long int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_5" name="::"/>
-  <Class id="_12" name="A<int>" context="_5" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Class id="_12" name="A<int>" context="_5" location="f1:2" file="f1" line="2" incomplete="1"/>
   <File id="f1" name=".*/test/input/ReferenceType-to-Class-template.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.c++14.Class-bases.xml.txt b/test/expect/castxml1.c++11.Class-bases.xml.txt
similarity index 63%
copy from test/expect/gccxml.c++14.Class-bases.xml.txt
copy to test/expect/castxml1.c++11.Class-bases.xml.txt
index 48b51e1..7b2c6cc 100644
--- a/test/expect/gccxml.c++14.Class-bases.xml.txt
+++ b/test/expect/castxml1.c++11.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,21 +27,21 @@
   <Constructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
     <Argument type="_25" location="f1:1" file="f1" line="1"/>
   </Constructor>
-  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <ReferenceType id="_24" type="_7"/>
   <ReferenceType id="_25" type="_7c"/>
@@ -54,4 +54,4 @@
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.c++14.Class-template-bases.xml.txt b/test/expect/castxml1.c++11.Class-template-bases.xml.txt
similarity index 70%
copy from test/expect/gccxml.c++14.Class-template-bases.xml.txt
copy to test/expect/castxml1.c++11.Class-template-bases.xml.txt
index 6f9b62a..2245a4e 100644
--- a/test/expect/gccxml.c++14.Class-template-bases.xml.txt
+++ b/test/expect/castxml1.c++11.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
@@ -41,4 +41,4 @@
   <ReferenceType id="_22" type="_8"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.c++14.Class-bases.xml.txt b/test/expect/castxml1.c++14.Class-bases.xml.txt
similarity index 63%
copy from test/expect/gccxml.c++14.Class-bases.xml.txt
copy to test/expect/castxml1.c++14.Class-bases.xml.txt
index 48b51e1..7b2c6cc 100644
--- a/test/expect/gccxml.c++14.Class-bases.xml.txt
+++ b/test/expect/castxml1.c++14.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,21 +27,21 @@
   <Constructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
     <Argument type="_25" location="f1:1" file="f1" line="1"/>
   </Constructor>
-  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <ReferenceType id="_24" type="_7"/>
   <ReferenceType id="_25" type="_7c"/>
@@ -54,4 +54,4 @@
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.c++14.Class-template-bases.xml.txt b/test/expect/castxml1.c++14.Class-template-bases.xml.txt
similarity index 70%
copy from test/expect/gccxml.c++14.Class-template-bases.xml.txt
copy to test/expect/castxml1.c++14.Class-template-bases.xml.txt
index 6f9b62a..2245a4e 100644
--- a/test/expect/gccxml.c++14.Class-template-bases.xml.txt
+++ b/test/expect/castxml1.c++14.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
@@ -41,4 +41,4 @@
   <ReferenceType id="_22" type="_8"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.c++98.CXXLiteral.result.txt b/test/expect/castxml1.c++98.CXXLiteral.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/castxml1.c++98.CXXLiteral.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/castxml1.c++98.CXXLiteral.stderr.txt b/test/expect/castxml1.c++98.CXXLiteral.stderr.txt
new file mode 100644
index 0000000..14fd5d6
--- /dev/null
+++ b/test/expect/castxml1.c++98.CXXLiteral.stderr.txt
@@ -0,0 +1 @@
+error: expected a type
diff --git a/test/expect/castxml1.c++98.CXXLiteral.xml.txt b/test/expect/castxml1.c++98.CXXLiteral.xml.txt
new file mode 100644
index 0000000..f276847
--- /dev/null
+++ b/test/expect/castxml1.c++98.CXXLiteral.xml.txt
@@ -0,0 +1 @@
+\(missing\)
diff --git a/test/expect/gccxml.c++98.Class-bases.xml.txt b/test/expect/castxml1.c++98.Class-bases.xml.txt
similarity index 64%
copy from test/expect/gccxml.c++98.Class-bases.xml.txt
copy to test/expect/castxml1.c++98.Class-bases.xml.txt
index 6e58110..c82141f 100644
--- a/test/expect/gccxml.c++98.Class-bases.xml.txt
+++ b/test/expect/castxml1.c++98.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw=""/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw=""/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw="">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,22 +27,22 @@
     <Argument type="_24" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw=""/>
-  <Constructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="">
-    <Argument type="_26" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_16" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw=""/>
+  <Constructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
+    <Argument type="_26" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_18" name="=" returns="_27" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_26" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_18" name="=" returns="_27" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_26" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_20" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw=""/>
-  <Constructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw="">
-    <Argument type="_28" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_20" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw=""/>
+  <Constructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw="">
+    <Argument type="_28" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_22" name="=" returns="_29" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_28" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_22" name="=" returns="_29" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_28" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_24" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_25" type="_7"/>
@@ -54,4 +54,4 @@
   <ReferenceType id="_29" type="_9"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/gccxml.c++98.Class-template-bases.xml.txt b/test/expect/castxml1.c++98.Class-template-bases.xml.txt
similarity index 70%
copy from test/expect/gccxml.c++98.Class-template-bases.xml.txt
copy to test/expect/castxml1.c++98.Class-template-bases.xml.txt
index 44c30e1..0883c53 100644
--- a/test/expect/gccxml.c++98.Class-template-bases.xml.txt
+++ b/test/expect/castxml1.c++98.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
-<GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+<CastXML[^>]*>
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" throw="">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" throw="">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
@@ -41,4 +41,4 @@
   <ReferenceType id="_22" type="_8"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Class-template-bases.cxx"/>
-</GCC_XML>$
+</CastXML>$
diff --git a/test/expect/castxml1.c++98.Function-rvalue-reference.stderr.txt b/test/expect/castxml1.c++98.Function-rvalue-reference.stderr.txt
new file mode 100644
index 0000000..6dbbb9d
--- /dev/null
+++ b/test/expect/castxml1.c++98.Function-rvalue-reference.stderr.txt
@@ -0,0 +1 @@
+warning: rvalue references are a C\+\+11 extension
diff --git a/test/expect/castxml1.c++98.Method-rvalue-reference.stderr.txt b/test/expect/castxml1.c++98.Method-rvalue-reference.stderr.txt
new file mode 100644
index 0000000..6dbbb9d
--- /dev/null
+++ b/test/expect/castxml1.c++98.Method-rvalue-reference.stderr.txt
@@ -0,0 +1 @@
+warning: rvalue references are a C\+\+11 extension
diff --git a/test/expect/castxml1.c++98.RValueReferenceType.stderr.txt b/test/expect/castxml1.c++98.RValueReferenceType.stderr.txt
new file mode 100644
index 0000000..6dbbb9d
--- /dev/null
+++ b/test/expect/castxml1.c++98.RValueReferenceType.stderr.txt
@@ -0,0 +1 @@
+warning: rvalue references are a C\+\+11 extension
diff --git a/test/expect/castxml1.c++98.TypeAlias.stderr.txt b/test/expect/castxml1.c++98.TypeAlias.stderr.txt
new file mode 100644
index 0000000..02b944f
--- /dev/null
+++ b/test/expect/castxml1.c++98.TypeAlias.stderr.txt
@@ -0,0 +1 @@
+warning: alias declarations are a C\+\+11 extension
diff --git a/test/expect/castxml1.c++98.TypeAliasTemplate.stderr.txt b/test/expect/castxml1.c++98.TypeAliasTemplate.stderr.txt
new file mode 100644
index 0000000..02b944f
--- /dev/null
+++ b/test/expect/castxml1.c++98.TypeAliasTemplate.stderr.txt
@@ -0,0 +1 @@
+warning: alias declarations are a C\+\+11 extension
diff --git a/test/expect/castxml1.c.FunctionNoProto.xml.txt b/test/expect/castxml1.c.FunctionNoProto.xml.txt
new file mode 100644
index 0000000..76a7626
--- /dev/null
+++ b/test/expect/castxml1.c.FunctionNoProto.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/FunctionNoProto.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.FundamentalType.xml.txt b/test/expect/castxml1.c.FundamentalType.xml.txt
new file mode 100644
index 0000000..fd0cff5
--- /dev/null
+++ b/test/expect/castxml1.c.FundamentalType.xml.txt
@@ -0,0 +1,7 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/FundamentalType.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.GNU-float128-nostart.xml.txt b/test/expect/castxml1.c.GNU-float128-nostart.xml.txt
new file mode 100644
index 0000000..e578256
--- /dev/null
+++ b/test/expect/castxml1.c.GNU-float128-nostart.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+.*<FundamentalType id="_[0-9]+" name="__float128" size="128" align="128"/>.*
+  <File id="f1" name=".*/test/input/GNU-float128-nostart.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.GNU-float128.xml.txt b/test/expect/castxml1.c.GNU-float128.xml.txt
new file mode 100644
index 0000000..5ee5ea2
--- /dev/null
+++ b/test/expect/castxml1.c.GNU-float128.xml.txt
@@ -0,0 +1,9 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" mangled="[^"]*start[^"]*">
+    <Argument type="_2" location="f1:1" file="f1" line="1"/>
+  </Function>
+  <FundamentalType id="_2" name="__float128" size="128" align="128"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-float128.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.GNU-va_arg_pack.xml.txt b/test/expect/castxml1.c.GNU-va_arg_pack.xml.txt
new file mode 100644
index 0000000..97caa08
--- /dev/null
+++ b/test/expect/castxml1.c.GNU-va_arg_pack.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Function id="_1" name="start" returns="_2" context="_3" location="f1:1" file="f1" line="1" inline="1" mangled="[^"]+">
+    <Argument name="n" type="_2" location="f1:1" file="f1" line="1"/>
+    <Ellipsis/>
+  </Function>
+  <FundamentalType id="_2" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/GNU-va_arg_pack.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.Typedef-called-class.xml.txt b/test/expect/castxml1.c.Typedef-called-class.xml.txt
new file mode 100644
index 0000000..032f46c
--- /dev/null
+++ b/test/expect/castxml1.c.Typedef-called-class.xml.txt
@@ -0,0 +1,8 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <Typedef id="_2" name="class" type="_4" context="_3" location="f1:1" file="f1" line="1"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <File id="f1" name=".*/test/input/Typedef-called-class.c"/>
+</CastXML>$
diff --git a/test/expect/castxml1.c.invalid.result.txt b/test/expect/castxml1.c.invalid.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/castxml1.c.invalid.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/castxml1.c.invalid.stderr.txt b/test/expect/castxml1.c.invalid.stderr.txt
new file mode 100644
index 0000000..73c9062
--- /dev/null
+++ b/test/expect/castxml1.c.invalid.stderr.txt
@@ -0,0 +1 @@
+error: unknown type name 'class'
diff --git a/test/expect/cmd.castxml-and-objc1.result.txt b/test/expect/cmd.castxml-and-objc1.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/cmd.castxml-and-objc1.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/cmd.castxml-and-objc1.stderr.txt b/test/expect/cmd.castxml-and-objc1.stderr.txt
new file mode 100644
index 0000000..72b3262
--- /dev/null
+++ b/test/expect/cmd.castxml-and-objc1.stderr.txt
@@ -0,0 +1 @@
+^error: '--castxml-output=<v>' does not work with Objective C$
diff --git a/test/expect/cmd.castxml-and-objc2.result.txt b/test/expect/cmd.castxml-and-objc2.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/cmd.castxml-and-objc2.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/cmd.castxml-and-objc2.stderr.txt b/test/expect/cmd.castxml-and-objc2.stderr.txt
new file mode 100644
index 0000000..72b3262
--- /dev/null
+++ b/test/expect/cmd.castxml-and-objc2.stderr.txt
@@ -0,0 +1 @@
+^error: '--castxml-output=<v>' does not work with Objective C$
diff --git a/test/expect/cmd.castxml-empty-c++98-E.stdout.txt b/test/expect/cmd.castxml-empty-c++98-E.stdout.txt
new file mode 100644
index 0000000..931220e
--- /dev/null
+++ b/test/expect/cmd.castxml-empty-c++98-E.stdout.txt
@@ -0,0 +1,2 @@
+^#[^
+]*/test/input/empty.cxx"
diff --git a/test/expect/cmd.castxml-mix1.result.txt b/test/expect/cmd.castxml-mix1.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/cmd.castxml-mix1.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/cmd.castxml-mix1.stderr.txt b/test/expect/cmd.castxml-mix1.stderr.txt
new file mode 100644
index 0000000..cfda432
--- /dev/null
+++ b/test/expect/cmd.castxml-mix1.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-gccxml' and '--castxml-output=<v>' may not be not be used together!
+
+Usage: castxml .*$
diff --git a/test/expect/cmd.castxml-mix2.result.txt b/test/expect/cmd.castxml-mix2.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/cmd.castxml-mix2.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/cmd.castxml-mix2.stderr.txt b/test/expect/cmd.castxml-mix2.stderr.txt
new file mode 100644
index 0000000..cfda432
--- /dev/null
+++ b/test/expect/cmd.castxml-mix2.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-gccxml' and '--castxml-output=<v>' may not be not be used together!
+
+Usage: castxml .*$
diff --git a/test/expect/cmd.castxml-twice.result.txt b/test/expect/cmd.castxml-twice.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/cmd.castxml-twice.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/cmd.castxml-twice.stderr.txt b/test/expect/cmd.castxml-twice.stderr.txt
new file mode 100644
index 0000000..e915077
--- /dev/null
+++ b/test/expect/cmd.castxml-twice.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-output=<v>' may be given at most once!
+
+Usage: castxml .*$
diff --git a/test/expect/cmd.castxml-wrong-epic-version.result.txt b/test/expect/cmd.castxml-wrong-epic-version.result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/test/expect/cmd.castxml-wrong-epic-version.result.txt
@@ -0,0 +1 @@
+0
diff --git a/test/expect/cmd.castxml-wrong-epic-version.stderr.txt b/test/expect/cmd.castxml-wrong-epic-version.stderr.txt
new file mode 100644
index 0000000..eadff54
--- /dev/null
+++ b/test/expect/cmd.castxml-wrong-epic-version.stderr.txt
@@ -0,0 +1,3 @@
+^error: '--castxml-output=<v>' accepts only '1' as '<v>'!
+
+Usage: castxml .*$
diff --git a/test/expect/gccxml.any.CXXLiteral.xml.txt b/test/expect/gccxml.any.CXXLiteral.xml.txt
new file mode 100644
index 0000000..763161e
--- /dev/null
+++ b/test/expect/gccxml.any.CXXLiteral.xml.txt
@@ -0,0 +1,5 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Namespace id="_1" name="start" context="_2"/>
+  <Namespace id="_2" name="::"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Class-abstract.xml.txt b/test/expect/gccxml.any.Class-abstract.xml.txt
index 935f473..0072787 100644
--- a/test/expect/gccxml.any.Class-abstract.xml.txt
+++ b/test/expect/gccxml.any.Class-abstract.xml.txt
@@ -1,11 +1,11 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" abstract="1" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:2" file="f1" line="2" virtual="1" pure_virtual="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" virtual="1" pure_virtual="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </Method>
-  <Converter id="_4" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" virtual="1" pure_virtual="1" mangled="[^"]+"/>
-  <Destructor id="_5" name="start" context="_1" access="private" location="f1:4" file="f1" line="4" virtual="1" pure_virtual="1"/>
+  <Converter id="_4" returns="_9" context="_1" access="private" location="f1:4" file="f1" line="4" virtual="1" pure_virtual="1" mangled="[^"]+"/>
+  <Destructor id="_5" name="start" context="_1" access="private" location="f1:5" file="f1" line="5" virtual="1" pure_virtual="1"/>
   <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
     <Argument type="_11" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
diff --git a/test/expect/gccxml.any.Class-base-offset.xml.txt b/test/expect/gccxml.any.Class-base-offset.xml.txt
index 14f49b6..a1a4f40 100644
--- a/test/expect/gccxml.any.Class-base-offset.xml.txt
+++ b/test/expect/gccxml.any.Class-base-offset.xml.txt
@@ -1,6 +1,6 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8 _9" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:13" file="f1" line="13" members="_3 _4 _5 _6" bases="_7 _8 _9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="0"/>
     <Base type="_8" access="public" virtual="0" offset="1"/>
     <Base type="_9" access="public" virtual="0" offset="2"/>
diff --git a/test/expect/gccxml.any.Class-base-typedef.xml.txt b/test/expect/gccxml.any.Class-base-typedef.xml.txt
index f82be8a..e4cad62 100644
--- a/test/expect/gccxml.any.Class-base-typedef.xml.txt
+++ b/test/expect/gccxml.any.Class-base-typedef.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:3" file="f1" line="3" members="_3 _4 _5 _6" bases="_7" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6" bases="_7" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="0"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_8" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_8" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <Class id="_7" name="base" context="_2" location="f1:1" file="f1" line="1" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_8" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
diff --git a/test/expect/gccxml.any.Class-forward.xml.txt b/test/expect/gccxml.any.Class-forward.xml.txt
index 59c4902..313e06b 100644
--- a/test/expect/gccxml.any.Class-forward.xml.txt
+++ b/test/expect/gccxml.any.Class-forward.xml.txt
@@ -1,14 +1,14 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5">
-    <Argument type="_7" location="f1:5" file="f1" line="5"/>
-  </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:6" file="f1" line="6" mangled="[^"]+">
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6">
     <Argument type="_7" location="f1:6" file="f1" line="6"/>
+  </Constructor>
+  <OperatorMethod id="_5" name="=" returns="_8" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_7" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:7" file="f1" line="7"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:8" file="f1" line="8"/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1"/>
diff --git a/test/expect/gccxml.any.Class-friends.xml.txt b/test/expect/gccxml.any.Class-friends.xml.txt
index 353afcd..bac3cc2 100644
--- a/test/expect/gccxml.any.Class-friends.xml.txt
+++ b/test/expect/gccxml.any.Class-friends.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:3" file="f1" line="3" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
-  <Function id="_7" name="f" returns="_11" context="_2" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Function id="_7" name="f" returns="_11" context="_2" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
   <Class id="_8" name="A" context="_2" location="f1:1" file="f1" line="1" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_11" name="void" size="[0-9]+" align="[0-9]+"/>
   <File id="f1" name=".*/test/input/Class-friends.cxx"/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt b/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
index 56dece8..bacc2fc 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-access-mutable.xml.txt
@@ -1,20 +1,20 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:12" file="f1" line="12" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
     <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
-  <Destructor id="_3" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
   <Class id="_5" name="base" context="_2" location="f1:1" file="f1" line="1" members="_6 _7 _8 _9 _10" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:3" file="f1" line="3"/>
-  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_8" name="base" context="_5" access="private" location="f1:6" file="f1" line="6">
-    <Argument type="_11" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_8" name="base" context="_5" access="private" location="f1:8" file="f1" line="8">
+    <Argument type="_11" location="f1:8" file="f1" line="8"/>
   </Constructor>
-  <OperatorMethod id="_9" name="=" returns="_12" context="_5" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_11" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_9" name="=" returns="_12" context="_5" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Field id="_10" name="data" type="_13" context="_5" access="private" location="f1:8" file="f1" line="8" offset="0" mutable="1"/>
+  <Field id="_10" name="data" type="_13" context="_5" access="private" location="f1:10" file="f1" line="10" offset="0" mutable="1"/>
   <ReferenceType id="_11" type="_5c"/>
   <CvQualifiedType id="_5c" type="_5" const="1"/>
   <ReferenceType id="_12" type="_5"/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt b/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
index 9cf2a14..035cb7d 100644
--- a/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-access.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:11" file="f1" line="11" members="_3 _4" bases="_5" size="[0-9]+" align="[0-9]+">
     <Base type="_5" access="public" virtual="0" offset="0"/>
   </Class>
-  <Destructor id="_3" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_3" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <Class id="_5" name="base" context="_2" location="f1:1" file="f1" line="1" members="_6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:3" file="f1" line="3"/>
-  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_8" name="base" context="_5" access="private" location="f1:6" file="f1" line="6">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_6" name="base" context="_5" access="protected" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_7" name="base" context="_5" access="protected" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_8" name="base" context="_5" access="private" location="f1:8" file="f1" line="8">
+    <Argument type="_10" location="f1:8" file="f1" line="8"/>
   </Constructor>
-  <OperatorMethod id="_9" name="=" returns="_11" context="_5" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_9" name="=" returns="_11" context="_5" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
   <ReferenceType id="_10" type="_5c"/>
   <CvQualifiedType id="_5c" type="_5" const="1"/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-array.xml.txt b/test/expect/gccxml.any.Class-implicit-member-array.xml.txt
index f7519c7..586011f 100644
--- a/test/expect/gccxml.any.Class-implicit-member-array.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-array.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
+  <Field id="_3" name="data" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt b/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
index 6c98ab9..5bf41e3 100644
--- a/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
@@ -8,15 +8,15 @@
     <Argument type="_7" location="f1:9" file="f1" line="9"/>
   </Constructor>
   <Destructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
-  <Class id="_6" name="base<const int>" context="_2" location="f1:1" file="f1" line="1" members="_8 _9 _10 _11" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_6" name="base<const int>" context="_2" location="f1:2" file="f1" line="2" members="_8 _9 _10 _11" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
-  <Field id="_8" name="data" type="_12c" context="_6" access="protected" location="f1:3" file="f1" line="3" offset="0"/>
-  <Constructor id="_9" name="base" context="_6" access="protected" location="f1:4" file="f1" line="4"/>
-  <Constructor id="_10" name="base" context="_6" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
-    <Argument type="_13" location="f1:1" file="f1" line="1"/>
+  <Field id="_8" name="data" type="_12c" context="_6" access="protected" location="f1:5" file="f1" line="5" offset="0"/>
+  <Constructor id="_9" name="base" context="_6" access="protected" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_10" name="base" context="_6" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
+    <Argument type="_13" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <Destructor id="_11" name="base" context="_6" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_11" name="base" context="_6" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_12" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_12c" type="_12" const="1"/>
   <ReferenceType id="_13" type="_6c"/>
diff --git a/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt b/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt
index a6761b4..0c678f9 100644
--- a/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-const-aggregate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Struct id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_6c" context="_1" access="public" location="f1:2" file="f1" line="2" offset="0"/>
+  <Field id="_3" name="data" type="_6c" context="_1" access="public" location="f1:3" file="f1" line="3" offset="0"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Class-implicit-member-const.xml.txt b/test/expect/gccxml.any.Class-implicit-member-const.xml.txt
index fedda86..38edff8 100644
--- a/test/expect/gccxml.any.Class-implicit-member-const.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-const.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="data" type="_7c" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Field id="_3" name="data" type="_7c" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6"/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_8" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt b/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt
index 619941d..d522d6c 100644
--- a/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-reference.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="ref" type="_7" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Field id="_3" name="ref" type="_7" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6"/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_8" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Class-implicit-members.xml.txt b/test/expect/gccxml.any.Class-implicit-members.xml.txt
index 8676dd6..bd2dc9f 100644
--- a/test/expect/gccxml.any.Class-implicit-members.xml.txt
+++ b/test/expect/gccxml.any.Class-implicit-members.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_1" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument name="x" type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_1" context="_1" access="private" location="f1:3" file="f1" line="3" inline="1" mangled="[^"]+">
+    <Argument name="x" type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Class-member-template-access.xml.txt b/test/expect/gccxml.any.Class-member-template-access.xml.txt
index 4c2a0fc..1dcefc5 100644
--- a/test/expect/gccxml.any.Class-member-template-access.xml.txt
+++ b/test/expect/gccxml.any.Class-member-template-access.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_3" name="member<char>" context="_1" access="private" location="f1:2" file="f1" line="2" incomplete="1"/>
-  <Class id="_4" name="member<int>" context="_1" access="private" location="f1:6" file="f1" line="6" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_5" name="member_char" type="_3" context="_1" access="public" location="f1:4" file="f1" line="4"/>
+  <Class id="_3" name="member<char>" context="_1" access="private" location="f1:4" file="f1" line="4" incomplete="1"/>
+  <Class id="_4" name="member<int>" context="_1" access="private" location="f1:11" file="f1" line="11" members="_10 _11 _12 _13" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_5" name="member_char" type="_3" context="_1" access="public" location="f1:9" file="f1" line="9"/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_14" location="f1:1" file="f1" line="1"/>
@@ -12,14 +12,14 @@
     <Argument type="_14" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_9" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_10" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_11" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_16" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_10" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_11" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_16" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_12" name="=" returns="_17" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_16" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_12" name="=" returns="_17" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_16" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_13" name="member" context="_4" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_13" name="member" context="_4" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_14" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_15" type="_1"/>
diff --git a/test/expect/gccxml.any.Class-member-template.xml.txt b/test/expect/gccxml.any.Class-member-template.xml.txt
index cc5ae33..ffdea37 100644
--- a/test/expect/gccxml.any.Class-member-template.xml.txt
+++ b/test/expect/gccxml.any.Class-member-template.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument name="v" type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" inline="1" mangled="[^"]+">
+    <Argument name="v" type="_8" location="f1:4" file="f1" line="4"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt b/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
index 56b2dd4..6ec6fe1 100644
--- a/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
+++ b/test/expect/gccxml.any.Class-partial-template-member-Typedef.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int &>" context="_2" location="f1:7" file="f1" line="7" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:3" file="f1" line="3"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:5" file="f1" line="5" mangled="[^"]+">
-    <Argument type="_3" location="f1:5" file="f1" line="5"/>
+  <Class id="_1" name="start<int &>" context="_2" location="f1:11" file="f1" line="11" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:6" file="f1" line="6"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_3" location="f1:9" file="f1" line="9"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
diff --git a/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt b/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt
index 35a9f71..8ecd5b2 100644
--- a/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt
+++ b/test/expect/gccxml.any.Class-template-Method-Argument-const.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_9" location="f1:4" file="f1" line="4"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="void" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_12c"/>
   <ReferenceType id="_10" type="_1c"/>
diff --git a/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt b/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt
index 5ebccfb..70cfe24 100644
--- a/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt
+++ b/test/expect/gccxml.any.Class-template-Method-Argument-default.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_8" location="f1:2" file="f1" line="2" default="123"/>
+  <Class id="_1" name="start<int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_8" location="f1:4" file="f1" line="4" default="123"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
diff --git a/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt b/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt
index aa75b74..b44a4a4 100644
--- a/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt
+++ b/test/expect/gccxml.any.Class-template-Method-return-const.xml.txt
@@ -1,15 +1,15 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8c" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8c" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_6" name="=" returns="_10" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_8c" type="_8" const="1"/>
   <ReferenceType id="_9" type="_1c"/>
diff --git a/test/expect/gccxml.any.Class-template-constructor-template.xml.txt b/test/expect/gccxml.any.Class-template-constructor-template.xml.txt
index 4bbdd52..1b32202 100644
--- a/test/expect/gccxml.any.Class-template-constructor-template.xml.txt
+++ b/test/expect/gccxml.any.Class-template-constructor-template.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:3" file="f1" line="3">
-    <Argument type="_7" location="f1:3" file="f1" line="3"/>
+  <Class id="_1" name="start<int>" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:5" file="f1" line="5">
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4">
-    <Argument type="_8" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:7" file="f1" line="7">
+    <Argument type="_8" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+  <OperatorMethod id="_5" name="=" returns="_9" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_7" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_7" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_8" type="_1c"/>
diff --git a/test/expect/gccxml.any.Class-template-friends.xml.txt b/test/expect/gccxml.any.Class-template-friends.xml.txt
index 53d0860..da38882 100644
--- a/test/expect/gccxml.any.Class-template-friends.xml.txt
+++ b/test/expect/gccxml.any.Class-template-friends.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:8" file="f1" line="8" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:8" file="f1" line="8" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:8" file="f1" line="8" inline="1" artificial="1"( throw="")?>
-    <Argument type="_9" location="f1:8" file="f1" line="8"/>
+  <Class id="_1" name="start<int>" context="_2" location="f1:13" file="f1" line="13" members="_3 _4 _5 _6" befriending="_7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?>
+    <Argument type="_9" location="f1:13" file="f1" line="13"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:8" file="f1" line="8" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_9" location="f1:8" file="f1" line="8"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_9" location="f1:13" file="f1" line="13"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:8" file="f1" line="8" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:13" file="f1" line="13" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
   <Namespace id="_2" name="::"/>
-  <Function id="_7" name="f" returns="_11" context="_2" location="f1:5" file="f1" line="5" mangled="[^"]+">
-    <Argument type="_11" location="f1:2" file="f1" line="2"/>
+  <Function id="_7" name="f" returns="_11" context="_2" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:4" file="f1" line="4"/>
   </Function>
-  <Class id="_8" name="A<int>" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Class id="_8" name="A<int>" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
   <FundamentalType id="_11" name="int" size="[0-9]+" align="[0-9]+"/>
   <File id="f1" name=".*/test/input/Class-template-friends.cxx"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt b/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt
index f918475..964c82c 100644
--- a/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt
+++ b/test/expect/gccxml.any.Class-template-member-Typedef-const.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<const int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="IntConst" type="_9c" context="_1" access="private" location="f1:2" file="f1" line="2"/>
-  <Method id="_4" name="method" returns="_9c" context="_1" access="public" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_3" location="f1:4" file="f1" line="4"/>
+  <Class id="_1" name="start<const int>" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="IntConst" type="_9c" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_4" name="method" returns="_9c" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:7" file="f1" line="7"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <ReferenceType id="_10" type="_1c"/>
diff --git a/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt b/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt
index 859c196..e767040 100644
--- a/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt
+++ b/test/expect/gccxml.any.Class-template-member-Typedef.xml.txt
@@ -1,18 +1,18 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:2" file="f1" line="2"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_3" location="f1:4" file="f1" line="4"/>
+  <Class id="_1" name="start<int>" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Typedef id="_3" name="Int" type="_9" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="public" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:7" file="f1" line="7"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_7" name="=" returns="_11" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:9" file="f1" line="9"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
diff --git a/test/expect/gccxml.any.Class-template-member-nontemplate-Typedef.xml.txt b/test/expect/gccxml.any.Class-template-member-nontemplate-Typedef.xml.txt
new file mode 100644
index 0000000..5c70a39
--- /dev/null
+++ b/test/expect/gccxml.any.Class-template-member-nontemplate-Typedef.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:10" file="f1" line="10"/>
+  <Typedef id="_2" name="type" type="_4" context="_5" access="public" location="f1:7" file="f1" line="7"/>
+  <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
+  <Namespace id="_3" name="::"/>
+  <Struct id="_5" name="B" context="_6" access="public" location="f1:4" file="f1" line="4" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_6" name="A<int>" context="_3" location="f1:2" file="f1" line="2" size="[0-9]+" align="[0-9]+"/>
+  <File id="f1" name=".*/test/input/Class-template-member-nontemplate-Typedef.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.any.Class-template-member-template.xml.txt b/test/expect/gccxml.any.Class-template-member-template.xml.txt
index 8e23b3f..00c7ac5 100644
--- a/test/expect/gccxml.any.Class-template-member-template.xml.txt
+++ b/test/expect/gccxml.any.Class-template-member-template.xml.txt
@@ -1,17 +1,17 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" inline="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Class id="_1" name="start<int>" context="_2" location="f1:2" file="f1" line="2" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:5" file="f1" line="5" inline="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:5" file="f1" line="5"/>
   </Method>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
-    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
+    <Argument type="_10" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_10" location="f1:1" file="f1" line="1"/>
+  <OperatorMethod id="_6" name="=" returns="_11" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_10" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
-  <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="start" context="_1" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <FundamentalType id="_8" name="int" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_9" name="char" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1c"/>
diff --git a/test/expect/gccxml.any.Class-template-recurse.xml.txt b/test/expect/gccxml.any.Class-template-recurse.xml.txt
index 40106de..627b844 100644
--- a/test/expect/gccxml.any.Class-template-recurse.xml.txt
+++ b/test/expect/gccxml.any.Class-template-recurse.xml.txt
@@ -1,15 +1,15 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Variable id="_1" name="start" type="_2" init="" context="_3" location="f1:11" file="f1" line="11" mangled="[^"]+"/>
-  <Struct id="_2" name="C<void>" context="_3" location="f1:6" file="f1" line="6" members="_4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_4" name="C" context="_2" access="public" location="f1:7" file="f1" line="7" inline="1"/>
-  <Constructor id="_5" name="C" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+  <Variable id="_1" name="start" type="_2" init="" context="_3" location="f1:20" file="f1" line="20" mangled="[^"]+"/>
+  <Struct id="_2" name="C<void>" context="_3" location="f1:11" file="f1" line="11" members="_4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_4" name="C" context="_2" access="public" location="f1:13" file="f1" line="13" inline="1"/>
+  <Constructor id="_5" name="C" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_8" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_6" name="=" returns="_9" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+  <OperatorMethod id="_6" name="=" returns="_9" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_8" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_7" name="C" context="_2" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_7" name="C" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_8" type="_2c"/>
   <CvQualifiedType id="_2c" type="_2" const="1"/>
   <ReferenceType id="_9" type="_2"/>
diff --git a/test/expect/gccxml.any.Class-template.xml.txt b/test/expect/gccxml.any.Class-template.xml.txt
index 829ceb0..fcc577a 100644
--- a/test/expect/gccxml.any.Class-template.xml.txt
+++ b/test/expect/gccxml.any.Class-template.xml.txt
@@ -1,24 +1,24 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<char>" context="_4" location="f1:3" file="f1" line="3" incomplete="1"/>
-  <Class id="_2" name="start<int>" context="_4" location="f1:4" file="f1" line="4" members="_5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Struct id="_3" name="start<int &>" context="_4" location="f1:5" file="f1" line="5" members="_9 _10 _11 _12" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_5" name="start" context="_2" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_2" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_13" location="f1:4" file="f1" line="4"/>
+  <Class id="_1" name="start<char>" context="_4" location="f1:10" file="f1" line="10" incomplete="1"/>
+  <Class id="_2" name="start<int>" context="_4" location="f1:11" file="f1" line="11" members="_5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_3" name="start<int &>" context="_4" location="f1:12" file="f1" line="12" members="_9 _10 _11 _12" size="[0-9]+" align="[0-9]+"/>
+  <Constructor id="_5" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?>
+    <Argument type="_13" location="f1:11" file="f1" line="11"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_14" context="_2" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_13" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_7" name="=" returns="_14" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_13" location="f1:11" file="f1" line="11"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_2" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_9" name="start" context="_3" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_10" name="start" context="_3" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
-    <Argument type="_15" location="f1:5" file="f1" line="5"/>
+  <Destructor id="_8" name="start" context="_2" access="public" location="f1:11" file="f1" line="11" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_9" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_10" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?>
+    <Argument type="_15" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_11" name="=" returns="_16" context="_3" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_15" location="f1:5" file="f1" line="5"/>
+  <OperatorMethod id="_11" name="=" returns="_16" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_15" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_12" name="start" context="_3" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_12" name="start" context="_3" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_13" type="_2c"/>
   <CvQualifiedType id="_2c" type="_2" const="1"/>
   <ReferenceType id="_14" type="_2"/>
diff --git a/test/expect/gccxml.any.Constructor-annotate.xml.txt b/test/expect/gccxml.any.Constructor-annotate.xml.txt
index 90c7f02..e9e250e 100644
--- a/test/expect/gccxml.any.Constructor-annotate.xml.txt
+++ b/test/expect/gccxml.any.Constructor-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Constructor.xml.txt b/test/expect/gccxml.any.Constructor.xml.txt
index 4aec461..f52ca65 100644
--- a/test/expect/gccxml.any.Constructor.xml.txt
+++ b/test/expect/gccxml.any.Constructor.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Converter-annotate.xml.txt b/test/expect/gccxml.any.Converter-annotate.xml.txt
index 0642674..b07160e 100644
--- a/test/expect/gccxml.any.Converter-annotate.xml.txt
+++ b/test/expect/gccxml.any.Converter-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Converter.xml.txt b/test/expect/gccxml.any.Converter.xml.txt
index 0c563a3..90218dd 100644
--- a/test/expect/gccxml.any.Converter.xml.txt
+++ b/test/expect/gccxml.any.Converter.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+"/>
+  <Converter id="_3" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Destructor-annotate.xml.txt b/test/expect/gccxml.any.Destructor-annotate.xml.txt
index 0660f79..c7898d2 100644
--- a/test/expect/gccxml.any.Destructor-annotate.xml.txt
+++ b/test/expect/gccxml.any.Destructor-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2" attributes="annotate\(an annotation\)"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Destructor.xml.txt b/test/expect/gccxml.any.Destructor.xml.txt
index 130b197..1e2be84 100644
--- a/test/expect/gccxml.any.Destructor.xml.txt
+++ b/test/expect/gccxml.any.Destructor.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Destructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_7" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Field-annotate.xml.txt b/test/expect/gccxml.any.Field-annotate.xml.txt
index d5d524e..3e52277 100644
--- a/test/expect/gccxml.any.Field-annotate.xml.txt
+++ b/test/expect/gccxml.any.Field-annotate.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="field" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0" attributes="annotate\(an annotation\)"/>
+  <Field id="_3" name="field" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0" attributes="annotate\(an annotation\)"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.Field.xml.txt b/test/expect/gccxml.any.Field.xml.txt
index a3389c1..8b695f0 100644
--- a/test/expect/gccxml.any.Field.xml.txt
+++ b/test/expect/gccxml.any.Field.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="field" type="_10" context="_1" access="private" location="f1:2" file="f1" line="2" offset="0"/>
-  <Field id="_4" name="bit_field" type="_11" bits="2" context="_1" access="private" location="f1:3" file="f1" line="3" offset="32"/>
-  <Field id="_5" name="mutable_field" type="_10" context="_1" access="private" location="f1:4" file="f1" line="4" offset="64" mutable="1"/>
+  <Field id="_3" name="field" type="_10" context="_1" access="private" location="f1:3" file="f1" line="3" offset="0"/>
+  <Field id="_4" name="bit_field" type="_11" bits="2" context="_1" access="private" location="f1:4" file="f1" line="4" offset="32"/>
+  <Field id="_5" name="mutable_field" type="_10" context="_1" access="private" location="f1:5" file="f1" line="5" offset="64" mutable="1"/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_12" location="f1:1" file="f1" line="1"/>
   </Constructor>
diff --git a/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt b/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt
index 577adb1..d4c40d4 100644
--- a/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt
+++ b/test/expect/gccxml.any.Function-Argument-default-cast.xml.txt
@@ -2,35 +2,35 @@
 <GCC_XML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5 _6 _7 _8"/>
   <Struct id="_3" name="Base" context="_1" location="f1:2" file="f1" line="2" members="_9 _10 _11 _12" size="[0-9]+" align="[0-9]+"/>
-  <Struct id="_4" name="Derived" context="_1" location="f1:3" file="f1" line="3" members="_13 _14 _15 _16" bases="_3" size="[0-9]+" align="[0-9]+">
+  <Struct id="_4" name="Derived" context="_1" location="f1:7" file="f1" line="7" members="_13 _14 _15 _16" bases="_3" size="[0-9]+" align="[0-9]+">
     <Base type="_3" access="public" virtual="0" offset="0"/>
   </Struct>
-  <Function id="_5" name="b" returns="_17" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+"/>
-  <Function id="_6" name="bc" returns="_18" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]+"/>
-  <Typedef id="_7" name="Int" type="_19" context="_1" location="f1:6" file="f1" line="6"/>
-  <Function id="_8" name="f" returns="_20" context="_1" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_7" location="f1:7" file="f1" line="7" default="\(int\)0"/>
-    <Argument type="_17" location="f1:8" file="f1" line="8" default="\(start::Base \*\)0"/>
-    <Argument type="_17" location="f1:9" file="f1" line="9" default="static_cast<start::Base \*>\(0\)"/>
-    <Argument type="_17" location="f1:10" file="f1" line="10" default="reinterpret_cast<start::Base \*>\(0\)"/>
-    <Argument type="_17" location="f1:11" file="f1" line="11" default="const_cast<start::Base \*>\(start::bc\(\)\)"/>
-    <Argument type="_21" location="f1:12" file="f1" line="12" default="dynamic_cast<start::Derived \*>\(start::b\(\)\)"/>
+  <Function id="_5" name="b" returns="_17" context="_1" location="f1:10" file="f1" line="10" mangled="[^"]+"/>
+  <Function id="_6" name="bc" returns="_18" context="_1" location="f1:11" file="f1" line="11" mangled="[^"]+"/>
+  <Typedef id="_7" name="Int" type="_19" context="_1" location="f1:12" file="f1" line="12"/>
+  <Function id="_8" name="f" returns="_20" context="_1" location="f1:13" file="f1" line="13" mangled="[^"]+">
+    <Argument type="_7" location="f1:13" file="f1" line="13" default="\(int\)0"/>
+    <Argument type="_17" location="f1:13" file="f1" line="13" default="\(start::Base \*\)0"/>
+    <Argument type="_17" location="f1:13" file="f1" line="13" default="static_cast<start::Base \*>\(0\)"/>
+    <Argument type="_17" location="f1:14" file="f1" line="14" default="reinterpret_cast<start::Base \*>\(0\)"/>
+    <Argument type="_17" location="f1:14" file="f1" line="14" default="const_cast<start::Base \*>\(start::bc\(\)\)"/>
+    <Argument type="_21" location="f1:15" file="f1" line="15" default="dynamic_cast<start::Derived \*>\(start::b\(\)\)"/>
   </Function>
-  <Constructor id="_9" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2"/>
-  <Destructor id="_10" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2" virtual="1"/>
+  <Constructor id="_9" name="Base" context="_3" access="public" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_10" name="Base" context="_3" access="public" location="f1:5" file="f1" line="5" virtual="1"/>
   <OperatorMethod id="_11" name="=" returns="_22" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
     <Argument type="_23" location="f1:2" file="f1" line="2"/>
   </OperatorMethod>
   <Constructor id="_12" name="Base" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
     <Argument type="_23" location="f1:2" file="f1" line="2"/>
   </Constructor>
-  <OperatorMethod id="_13" name="=" returns="_24" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_25" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_13" name="=" returns="_24" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_25" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_14" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" virtual="1" inline="1" artificial="1"( throw="")? overrides="_10"/>
-  <Constructor id="_15" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="Derived" context="_4" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?>
-    <Argument type="_25" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_14" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" virtual="1" inline="1" artificial="1"( throw="")? overrides="_10"/>
+  <Constructor id="_15" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_16" name="Derived" context="_4" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
+    <Argument type="_25" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <PointerType id="_17" type="_3"/>
   <PointerType id="_18" type="_3c"/>
diff --git a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt b/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
index c6a3282..7dc1cad 100644
--- a/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
+++ b/test/expect/gccxml.any.Function-Argument-default-ns.xml.txt
@@ -5,9 +5,9 @@
   <Enumeration id="_4" name="" context="_1" location="f1:3" file="f1" line="3">
     <EnumValue name="E" init="0"/>
   </Enumeration>
-  <Function id="_5" name="f" returns="_7" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_6" location="f1:4" file="f1" line="4" default="start::C"/>
-    <Argument type="_6" location="f1:4" file="f1" line="4" default="start::E"/>
+  <Function id="_5" name="f" returns="_7" context="_1" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_6" location="f1:7" file="f1" line="7" default="start::C"/>
+    <Argument type="_6" location="f1:7" file="f1" line="7" default="start::E"/>
   </Function>
   <FundamentalType id="_6" name="int" size="[0-9]+" align="[0-9]+"/>
   <CvQualifiedType id="_6c" type="_6" const="1"/>
diff --git a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt b/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
index ba7fb08..89668b5 100644
--- a/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
+++ b/test/expect/gccxml.any.Function-calling-convention-ms-annotate.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Function id="_1" name="start" returns="_5" context="_6" location="f1:1" file="f1" line="1" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_7" location="f1:1" file="f1" line="1"/>
+    <Argument type="_7" location="f1:2" file="f1" line="2"/>
   </Function>
-  <Function id="_2" name="start" returns="_5" context="_6" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Function id="_2" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__stdcall__ annotate\(an annotation\)">
+    <Argument type="_8" location="f1:4" file="f1" line="4"/>
   </Function>
-  <Function id="_3" name="start" returns="_5" context="_6" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <Function id="_3" name="start" returns="_5" context="_6" location="f1:5" file="f1" line="5" mangled="[^"]+" attributes="__fastcall__ annotate\(an annotation\)">
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Function>
-  <Function id="_4" name="start" returns="_5" context="_6" location="f1:4" file="f1" line="4" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
+  <Function id="_4" name="start" returns="_5" context="_6" location="f1:7" file="f1" line="7" mangled="[^"]+" attributes="__thiscall__ annotate\(an annotation\)">
+    <Argument type="_10" location="f1:8" file="f1" line="8"/>
   </Function>
   <FundamentalType id="_5" name="void" size="[0-9]+" align="[0-9]+"/>
   <PointerType id="_7" type="_11"/>
diff --git a/test/expect/gccxml.any.Function-template.xml.txt b/test/expect/gccxml.any.Function-template.xml.txt
index f74aaba..add7387 100644
--- a/test/expect/gccxml.any.Function-template.xml.txt
+++ b/test/expect/gccxml.any.Function-template.xml.txt
@@ -1,10 +1,10 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_3" context="_4" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_3" location="f1:1" file="f1" line="1"/>
+  <Function id="_1" name="start" returns="_3" context="_4" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_3" location="f1:2" file="f1" line="2"/>
   </Function>
-  <Function id="_2" name="start" returns="_5" context="_4" location="f1:1" file="f1" line="1" mangled="[^"]+">
-    <Argument type="_5" location="f1:1" file="f1" line="1"/>
+  <Function id="_2" name="start" returns="_5" context="_4" location="f1:2" file="f1" line="2" mangled="[^"]+">
+    <Argument type="_5" location="f1:2" file="f1" line="2"/>
   </Function>
   <FundamentalType id="_3" name="char" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_5" name="int" size="[0-9]+" align="[0-9]+"/>
diff --git a/test/expect/gccxml.any.GNU-float128.xml.txt b/test/expect/gccxml.any.GNU-float128.xml.txt
index 8ae15a6..24520eb 100644
--- a/test/expect/gccxml.any.GNU-float128.xml.txt
+++ b/test/expect/gccxml.any.GNU-float128.xml.txt
@@ -1,14 +1,14 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
-  <Function id="_3" name="f" returns="_6" context="_1" location="f1:3" file="f1" line="3" mangled="">
-    <Argument type="_6" location="f1:3" file="f1" line="3"/>
+  <Function id="_3" name="f" returns="_6" context="_1" location="f1:4" file="f1" line="4" mangled="">
+    <Argument type="_6" location="f1:4" file="f1" line="4"/>
   </Function>
-  <Variable id="_4" name="v" type="_6" init="" context="_1" location="f1:4" file="f1" line="4" mangled="[^"]*"/>
-  <Variable id="_5" name="pa" type="_7" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]*"/>
+  <Variable id="_4" name="v" type="_6" init="" context="_1" location="f1:5" file="f1" line="5" mangled="[^"]*"/>
+  <Variable id="_5" name="pa" type="_7" context="_1" location="f1:6" file="f1" line="6" mangled="[^"]*"/>
   <FundamentalType id="_6" name="__float128" size="128" align="128"/>
   <PointerType id="_7" type="_8"/>
   <Namespace id="_2" name="::"/>
-  <Struct id="_8" name="A<__float128>" context="_2" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Struct id="_8" name="A<__float128>" context="_2" location="f1:2" file="f1" line="2" incomplete="1"/>
   <File id="f1" name=".*/test/input/GNU-float128.cxx"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt b/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt
index e7f93f2..809b667 100644
--- a/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt
+++ b/test/expect/gccxml.any.Method-Argument-default-cast.xml.txt
@@ -1,13 +1,13 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8 _9" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_3" name="Class" context="_1" access="private" location="f1:2" file="f1" line="2" incomplete="1"/>
-  <Typedef id="_4" name="Int" type="_10" context="_1" access="private" location="f1:3" file="f1" line="3"/>
-  <Method id="_5" name="f" returns="_10" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_4" location="f1:4" file="f1" line="4" default="\(int\)0"/>
+  <Class id="_3" name="Class" context="_1" access="private" location="f1:3" file="f1" line="3" incomplete="1"/>
+  <Typedef id="_4" name="Int" type="_10" context="_1" access="private" location="f1:4" file="f1" line="4"/>
+  <Method id="_5" name="f" returns="_10" context="_1" access="private" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_4" location="f1:5" file="f1" line="5" default="\(int\)0"/>
     <Argument type="_11" location="f1:5" file="f1" line="5" default="\(start::Class \*\)0"/>
-    <Argument type="_11" location="f1:6" file="f1" line="6" default="static_cast<start::Class \*>\(0\)"/>
-    <Argument type="_11" location="f1:7" file="f1" line="7" default="reinterpret_cast<start::Class \*>\(0\)"/>
+    <Argument type="_11" location="f1:5" file="f1" line="5" default="static_cast<start::Class \*>\(0\)"/>
+    <Argument type="_11" location="f1:6" file="f1" line="6" default="reinterpret_cast<start::Class \*>\(0\)"/>
   </Method>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Method-Argument-default.xml.txt b/test/expect/gccxml.any.Method-Argument-default.xml.txt
index 0e10cbf..ee5a364 100644
--- a/test/expect/gccxml.any.Method-Argument-default.xml.txt
+++ b/test/expect/gccxml.any.Method-Argument-default.xml.txt
@@ -1,9 +1,9 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_3" name="C" type="_9c" init="0" context="_1" access="private" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
-  <Method id="_4" name="method" returns="_9" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_9" location="f1:3" file="f1" line="3" default="start::C"/>
+  <Variable id="_3" name="C" type="_9c" init="0" context="_1" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
+  <Method id="_4" name="method" returns="_9" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_9" location="f1:4" file="f1" line="4" default="start::C"/>
   </Method>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Method-annotate.xml.txt b/test/expect/gccxml.any.Method-annotate.xml.txt
index 3e4f2f3..4362819 100644
--- a/test/expect/gccxml.any.Method-annotate.xml.txt
+++ b/test/expect/gccxml.any.Method-annotate.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Method-overrides.xml.txt b/test/expect/gccxml.any.Method-overrides.xml.txt
index dc95285..5fd9f52 100644
--- a/test/expect/gccxml.any.Method-overrides.xml.txt
+++ b/test/expect/gccxml.any.Method-overrides.xml.txt
@@ -1,23 +1,23 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7" bases="_8" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6 _7" bases="_8" size="[0-9]+" align="[0-9]+">
     <Base type="_8" access="public" virtual="0" offset="0"/>
   </Class>
-  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:5" file="f1" line="5" virtual="1" overrides="_10" mangled="[^"]+">
-    <Argument type="_9" location="f1:5" file="f1" line="5"/>
+  <Method id="_3" name="method" returns="_9" context="_1" access="private" location="f1:7" file="f1" line="7" virtual="1" overrides="_10" mangled="[^"]+">
+    <Argument type="_9" location="f1:7" file="f1" line="7"/>
   </Method>
-  <OperatorMethod id="_4" name="=" returns="_11" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_4" name="=" returns="_11" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_12" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_7" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_12" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_5" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_7" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
+    <Argument type="_12" location="f1:5" file="f1" line="5"/>
   </Constructor>
   <Class id="_8" name="base" context="_2" location="f1:1" file="f1" line="1" members="_10 _13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_9" name="int" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_10" name="method" returns="_9" context="_8" access="private" location="f1:2" file="f1" line="2" virtual="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <Method id="_10" name="method" returns="_9" context="_8" access="private" location="f1:3" file="f1" line="3" virtual="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </Method>
   <ReferenceType id="_11" type="_1"/>
   <ReferenceType id="_12" type="_1c"/>
diff --git a/test/expect/gccxml.any.Method-rvalue-reference.xml.txt b/test/expect/gccxml.any.Method-rvalue-reference.xml.txt
index 1fd1126..bf9d6a9 100644
--- a/test/expect/gccxml.any.Method-rvalue-reference.xml.txt
+++ b/test/expect/gccxml.any.Method-rvalue-reference.xml.txt
@@ -1,14 +1,14 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6" size="[0-9]+" align="[0-9]+"/>
-  <Constructor id="_3" name="start" context="_1" access="private" location="f1:2" file="f1" line="2">
-    <Argument type="_7" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_3" name="start" context="_1" access="private" location="f1:3" file="f1" line="3">
+    <Argument type="_7" location="f1:3" file="f1" line="3"/>
   </Constructor>
-  <OperatorMethod id="_4" name="=" returns="_7" context="_1" access="private" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_7" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_4" name="=" returns="_7" context="_1" access="private" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Method id="_5" name="method" returns="_8" context="_1" access="private" location="f1:6" file="f1" line="6" mangled="[^"]+">
-    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+  <Method id="_5" name="method" returns="_8" context="_1" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_8" location="f1:7" file="f1" line="7"/>
   </Method>
   <Destructor id="_6" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_7" type="_1"/>
diff --git a/test/expect/gccxml.any.Method.xml.txt b/test/expect/gccxml.any.Method.xml.txt
index 953620a..d9ab112 100644
--- a/test/expect/gccxml.any.Method.xml.txt
+++ b/test/expect/gccxml.any.Method.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_8" location="f1:2" file="f1" line="2"/>
+  <Method id="_3" name="method" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
+    <Argument type="_8" location="f1:3" file="f1" line="3"/>
   </Method>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Namespace-Class-members.xml.txt b/test/expect/gccxml.any.Namespace-Class-members.xml.txt
index 9f434ae..4f9a34d 100644
--- a/test/expect/gccxml.any.Namespace-Class-members.xml.txt
+++ b/test/expect/gccxml.any.Namespace-Class-members.xml.txt
@@ -2,7 +2,7 @@
 <GCC_XML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3"/>
   <Class id="_3" name="A" context="_1" location="f1:2" file="f1" line="2" members="_4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_4" name="data" type="_9" context="_3" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
+  <Variable id="_4" name="data" type="_9" context="_3" access="private" location="f1:4" file="f1" line="4" static="1" mangled="[^"]+"/>
   <Constructor id="_5" name="A" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_6" name="A" context="_3" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
     <Argument type="_10" location="f1:2" file="f1" line="2"/>
diff --git a/test/expect/gccxml.any.Namespace-inline-template.xml.txt b/test/expect/gccxml.any.Namespace-inline-template.xml.txt
index fc966fb..8279588 100644
--- a/test/expect/gccxml.any.Namespace-inline-template.xml.txt
+++ b/test/expect/gccxml.any.Namespace-inline-template.xml.txt
@@ -2,8 +2,8 @@
 <GCC_XML[^>]*>
   <Namespace id="_1" name="start" context="_2" members="_3 _4 _5"/>
   <Struct id="_3" name="A" context="_1" location="f1:4" file="f1" line="4" incomplete="1"/>
-  <Struct id="_4" name="B<start::A>" context="_1" location="f1:6" file="f1" line="6" incomplete="1"/>
-  <Typedef id="_5" name="B_A" type="_4" context="_1" location="f1:7" file="f1" line="7"/>
+  <Struct id="_4" name="B<start::A>" context="_1" location="f1:7" file="f1" line="7" incomplete="1"/>
+  <Typedef id="_5" name="B_A" type="_4" context="_1" location="f1:8" file="f1" line="8"/>
   <Namespace id="_2" name="::"/>
   <File id="f1" name=".*/test/input/Namespace-inline-template.cxx"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt b/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
index 692cd5e..ad6fb5a 100644
--- a/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
+++ b/test/expect/gccxml.any.OperatorMethod-annotate.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+" attributes="annotate\(an annotation\)">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+" attributes="annotate\(an annotation\)">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </OperatorMethod>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.OperatorMethod.xml.txt b/test/expect/gccxml.any.OperatorMethod.xml.txt
index fad0f46..3dceaf5 100644
--- a/test/expect/gccxml.any.OperatorMethod.xml.txt
+++ b/test/expect/gccxml.any.OperatorMethod.xml.txt
@@ -1,8 +1,8 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_9" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_3" name="<<" returns="_8" context="_1" access="private" location="f1:3" file="f1" line="3" mangled="[^"]+">
+    <Argument type="_9" location="f1:3" file="f1" line="3"/>
   </OperatorMethod>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
diff --git a/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt b/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt
index 3e6f75d..8d53cb9 100644
--- a/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt
+++ b/test/expect/gccxml.any.Typedef-to-Class-template.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
-  <Class id="_2" name="A<int>" context="_3" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:3" file="f1" line="3"/>
+  <Class id="_2" name="A<int>" context="_3" location="f1:2" file="f1" line="2" incomplete="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Class-template.cxx"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt b/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt
index bb21d49..d3a5950 100644
--- a/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt
+++ b/test/expect/gccxml.any.Typedef-to-Enumeration-anonymous.xml.txt
@@ -1,6 +1,6 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/>
   <Enumeration id="_2" name="start" context="_3" location="f1:1" file="f1" line="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Enumeration-anonymous.cxx"/>
diff --git a/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt b/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt
index 1e8ec8f..0e452dc 100644
--- a/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt
+++ b/test/expect/gccxml.any.Typedef-to-Enumeration.xml.txt
@@ -1,6 +1,6 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:4" file="f1" line="4"/>
   <Enumeration id="_2" name="E" context="_3" location="f1:1" file="f1" line="1"/>
   <Namespace id="_3" name="::"/>
   <File id="f1" name=".*/test/input/Typedef-to-Enumeration.cxx"/>
diff --git a/test/expect/gccxml.any.Variable-in-Class.xml.txt b/test/expect/gccxml.any.Variable-in-Class.xml.txt
index 510e985..ea92a1e 100644
--- a/test/expect/gccxml.any.Variable-in-Class.xml.txt
+++ b/test/expect/gccxml.any.Variable-in-Class.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
   <Class id="_1" name="start" context="_2" location="f1:1" file="f1" line="1" members="_3 _4 _5 _6 _7" size="[0-9]+" align="[0-9]+"/>
-  <Variable id="_3" name="static_field" type="_8" context="_1" access="private" location="f1:2" file="f1" line="2" static="1" mangled="[^"]+"/>
+  <Variable id="_3" name="static_field" type="_8" context="_1" access="private" location="f1:3" file="f1" line="3" static="1" mangled="[^"]+"/>
   <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
   <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?>
     <Argument type="_9" location="f1:1" file="f1" line="1"/>
diff --git a/test/expect/gccxml.any.invalid-decl-for-type.xml.txt b/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
index 4d3cbab..f7905c3 100644
--- a/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
+++ b/test/expect/gccxml.any.invalid-decl-for-type.xml.txt
@@ -1,29 +1,29 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Struct id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
-  <Field id="_3" name="b" type="_9" context="_1" access="public" location="f1:5" file="f1" line="5" offset="0"/>
-  <Typedef id="_4" name="type" type="_10" context="_1" access="public" location="f1:6" file="f1" line="6"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?>
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Struct id="_1" name="start" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6 _7 _8" size="[0-9]+" align="[0-9]+"/>
+  <Field id="_3" name="b" type="_9" context="_1" access="public" location="f1:14" file="f1" line="14" offset="0"/>
+  <Typedef id="_4" name="type" type="_10" context="_1" access="public" location="f1:15" file="f1" line="15"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?>
+    <Argument type="_11" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_12" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_7" name="=" returns="_12" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_11" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Struct id="_9" name="B<Incomplete>" context="_2" location="f1:2" file="f1" line="2" members="_13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
-  <Struct id="_10" name="A<Incomplete>" context="_2" location="f1:1" file="f1" line="1" size="[0-9]+" align="[0-9]+"/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Struct id="_9" name="B<Incomplete>" context="_2" location="f1:7" file="f1" line="7" members="_13 _14 _15 _16" size="[0-9]+" align="[0-9]+"/>
+  <Struct id="_10" name="A<Incomplete>" context="_2" location="f1:2" file="f1" line="2" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_12" type="_1"/>
-  <Constructor id="_13" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1"/>
-  <Constructor id="_14" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?>
-    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_13" name="B" context="_9" access="public" location="f1:9" file="f1" line="9" inline="1"/>
+  <Constructor id="_14" name="B" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?>
+    <Argument type="_17" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_15" name="=" returns="_18" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_17" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_15" name="=" returns="_18" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_17" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_16" name="B" context="_9" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_16" name="B" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_17" type="_9c"/>
   <CvQualifiedType id="_9c" type="_9" const="1"/>
   <ReferenceType id="_18" type="_9"/>
diff --git a/test/expect/gccxml.any.qualified-type-name.xml.txt b/test/expect/gccxml.any.qualified-type-name.xml.txt
index fe1eefa..84bc907 100644
--- a/test/expect/gccxml.any.qualified-type-name.xml.txt
+++ b/test/expect/gccxml.any.qualified-type-name.xml.txt
@@ -1,7 +1,7 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:2" file="f1" line="2"/>
-  <Typedef id="_2" name="type" type="_4" context="_5" location="f1:1" file="f1" line="1"/>
+  <Typedef id="_1" name="start" type="_2" context="_3" location="f1:4" file="f1" line="4"/>
+  <Typedef id="_2" name="type" type="_4" context="_5" location="f1:2" file="f1" line="2"/>
   <FundamentalType id="_4" name="int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_3" name="::"/>
   <Namespace id="_5" name="ns" context="_3"/>
diff --git a/test/expect/gccxml.any.using-declaration-class.xml.txt b/test/expect/gccxml.any.using-declaration-class.xml.txt
index 857d19f..2cd4661 100644
--- a/test/expect/gccxml.any.using-declaration-class.xml.txt
+++ b/test/expect/gccxml.any.using-declaration-class.xml.txt
@@ -1,22 +1,22 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:5" file="f1" line="5" members="_3 _4 _5 _6 _7 _8" bases="_9" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:6" file="f1" line="6" members="_3 _4 _5 _6 _7 _8" bases="_9" size="[0-9]+" align="[0-9]+">
     <Base type="_9" access="public" virtual="0" offset="0"/>
   </Class>
-  <Method id="_3" name="f" returns="_10" context="_9" access="protected" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_10" location="f1:3" file="f1" line="3"/>
+  <Method id="_3" name="f" returns="_10" context="_9" access="protected" location="f1:4" file="f1" line="4" mangled="[^"]+">
+    <Argument type="_10" location="f1:4" file="f1" line="4"/>
   </Method>
-  <Method id="_4" name="f" returns="_10" context="_1" access="private" location="f1:7" file="f1" line="7" mangled="[^"]+">
-    <Argument type="_11" location="f1:7" file="f1" line="7"/>
+  <Method id="_4" name="f" returns="_10" context="_1" access="private" location="f1:9" file="f1" line="9" mangled="[^"]+">
+    <Argument type="_11" location="f1:9" file="f1" line="9"/>
   </Method>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?>
-    <Argument type="_12" location="f1:5" file="f1" line="5"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?>
+    <Argument type="_12" location="f1:6" file="f1" line="6"/>
   </Constructor>
-  <OperatorMethod id="_7" name="=" returns="_13" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")? mangled="[^"]+">
-    <Argument type="_12" location="f1:5" file="f1" line="5"/>
+  <OperatorMethod id="_7" name="=" returns="_13" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")? mangled="[^"]+">
+    <Argument type="_12" location="f1:6" file="f1" line="6"/>
   </OperatorMethod>
-  <Destructor id="_8" name="start" context="_1" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_8" name="start" context="_1" access="public" location="f1:6" file="f1" line="6" inline="1" artificial="1"( throw="")?/>
   <Class id="_9" name="base" context="_2" location="f1:1" file="f1" line="1" members="_3 _14 _15 _16 _17" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_10" name="int" size="[0-9]+" align="[0-9]+"/>
   <FundamentalType id="_11" name="char" size="[0-9]+" align="[0-9]+"/>
diff --git a/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt b/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt
index e15cd3c..9e64c22 100644
--- a/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt
+++ b/test/expect/gccxml.broken.any.ReferenceType-to-Class-template.xml.txt
@@ -1,16 +1,16 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Function id="_1" name="start" returns="_4" context="_5" location="f1:2" file="f1" line="2" mangled="[^"]+">
-    <Argument type="_6" location="f1:2" file="f1" line="2"/>
-    <Argument type="_7" location="f1:2" file="f1" line="2"/>
+  <Function id="_1" name="start" returns="_4" context="_5" location="f1:5" file="f1" line="5" mangled="[^"]+">
+    <Argument type="_6" location="f1:5" file="f1" line="5"/>
+    <Argument type="_7" location="f1:5" file="f1" line="5"/>
   </Function>
-  <Function id="_2" name="start" returns="_4" context="_5" location="f1:3" file="f1" line="3" mangled="[^"]+">
-    <Argument type="_8" location="f1:3" file="f1" line="3"/>
-    <Argument type="_9" location="f1:3" file="f1" line="3"/>
+  <Function id="_2" name="start" returns="_4" context="_5" location="f1:6" file="f1" line="6" mangled="[^"]+">
+    <Argument type="_8" location="f1:6" file="f1" line="6"/>
+    <Argument type="_9" location="f1:6" file="f1" line="6"/>
   </Function>
-  <Function id="_3" name="start" returns="_4" context="_5" location="f1:4" file="f1" line="4" mangled="[^"]+">
-    <Argument type="_10" location="f1:4" file="f1" line="4"/>
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Function id="_3" name="start" returns="_4" context="_5" location="f1:7" file="f1" line="7" mangled="[^"]+">
+    <Argument type="_10" location="f1:7" file="f1" line="7"/>
+    <Argument type="_11" location="f1:7" file="f1" line="7"/>
   </Function>
   <FundamentalType id="_4" name="void" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_6" type="_12"/>
@@ -20,6 +20,6 @@
   <ReferenceType id="_10" type="_12"/>(broken: duplicate ReferenceType)?
   <FundamentalType id="_11" name="long int" size="[0-9]+" align="[0-9]+"/>
   <Namespace id="_5" name="::"/>
-  <Class id="_12" name="A<int>" context="_5" location="f1:1" file="f1" line="1" incomplete="1"/>
+  <Class id="_12" name="A<int>" context="_5" location="f1:2" file="f1" line="2" incomplete="1"/>
   <File id="f1" name=".*/test/input/ReferenceType-to-Class-template.cxx"/>
 </GCC_XML>$
diff --git a/test/expect/gccxml.c++11.Class-bases.xml.txt b/test/expect/gccxml.c++11.Class-bases.xml.txt
index 48b51e1..189f65a 100644
--- a/test/expect/gccxml.c++11.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++11.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,21 +27,21 @@
   <Constructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
     <Argument type="_25" location="f1:1" file="f1" line="1"/>
   </Constructor>
-  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <ReferenceType id="_24" type="_7"/>
   <ReferenceType id="_25" type="_7c"/>
diff --git a/test/expect/gccxml.c++11.Class-template-bases.xml.txt b/test/expect/gccxml.c++11.Class-template-bases.xml.txt
index 6f9b62a..d213494 100644
--- a/test/expect/gccxml.c++11.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++11.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
diff --git a/test/expect/gccxml.c++14.Class-bases.xml.txt b/test/expect/gccxml.c++14.Class-bases.xml.txt
index 48b51e1..189f65a 100644
--- a/test/expect/gccxml.c++14.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++14.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,21 +27,21 @@
   <Constructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1">
     <Argument type="_25" location="f1:1" file="f1" line="1"/>
   </Constructor>
-  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_16" name="=" returns="_26" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_27" location="f1:2" file="f1" line="2"/>
+  <Destructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_18" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Constructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
+    <Argument type="_27" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_20" name="=" returns="_28" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"/>
-  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1">
-    <Argument type="_29" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_22" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"/>
+  <Constructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1">
+    <Argument type="_29" location="f1:7" file="f1" line="7"/>
   </Constructor>
   <ReferenceType id="_24" type="_7"/>
   <ReferenceType id="_25" type="_7c"/>
diff --git a/test/expect/gccxml.c++14.Class-template-bases.xml.txt b/test/expect/gccxml.c++14.Class-template-bases.xml.txt
index 6f9b62a..d213494 100644
--- a/test/expect/gccxml.c++14.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++14.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
diff --git a/test/expect/gccxml.c++98.CXXLiteral.result.txt b/test/expect/gccxml.c++98.CXXLiteral.result.txt
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/test/expect/gccxml.c++98.CXXLiteral.result.txt
@@ -0,0 +1 @@
+1
diff --git a/test/expect/gccxml.c++98.CXXLiteral.stderr.txt b/test/expect/gccxml.c++98.CXXLiteral.stderr.txt
new file mode 100644
index 0000000..14fd5d6
--- /dev/null
+++ b/test/expect/gccxml.c++98.CXXLiteral.stderr.txt
@@ -0,0 +1 @@
+error: expected a type
diff --git a/test/expect/gccxml.c++98.CXXLiteral.xml.txt b/test/expect/gccxml.c++98.CXXLiteral.xml.txt
new file mode 100644
index 0000000..f276847
--- /dev/null
+++ b/test/expect/gccxml.c++98.CXXLiteral.xml.txt
@@ -0,0 +1 @@
+\(missing\)
diff --git a/test/expect/gccxml.c++98.Class-bases.xml.txt b/test/expect/gccxml.c++98.Class-bases.xml.txt
index 6e58110..df98ded 100644
--- a/test/expect/gccxml.c++98.Class-bases.xml.txt
+++ b/test/expect/gccxml.c++98.Class-bases.xml.txt
@@ -1,21 +1,21 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start" context="_2" location="f1:10" file="f1" line="10" members="_3 _4 _5 _6" bases="_7 private:_8 protected:_9" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="private" virtual="0" offset="[0-9]+"/>
     <Base type="_9" access="protected" virtual="1"/>
   </Class>
-  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_3" name="=" returns="_10" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </OperatorMethod>
-  <Destructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_5" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw=""/>
-  <Constructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
-    <Argument type="_11" location="f1:4" file="f1" line="4"/>
+  <Destructor id="_4" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_5" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw=""/>
+  <Constructor id="_6" name="start" context="_1" access="public" location="f1:10" file="f1" line="10" inline="1" artificial="1" throw="">
+    <Argument type="_11" location="f1:10" file="f1" line="10"/>
   </Constructor>
   <Class id="_7" name="base_public" context="_2" location="f1:1" file="f1" line="1" members="_12 _13 _14 _15" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="base_private" context="_2" location="f1:2" file="f1" line="2" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_9" name="base_protected" context="_2" location="f1:3" file="f1" line="3" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="base_private" context="_2" location="f1:4" file="f1" line="4" members="_16 _17 _18 _19" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_9" name="base_protected" context="_2" location="f1:7" file="f1" line="7" members="_20 _21 _22 _23" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_10" type="_1"/>
   <ReferenceType id="_11" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
@@ -27,22 +27,22 @@
     <Argument type="_24" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_15" name="base_public" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw=""/>
-  <Constructor id="_17" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="">
-    <Argument type="_26" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_16" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw=""/>
+  <Constructor id="_17" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
+    <Argument type="_26" location="f1:4" file="f1" line="4"/>
   </Constructor>
-  <OperatorMethod id="_18" name="=" returns="_27" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_26" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_18" name="=" returns="_27" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_26" location="f1:4" file="f1" line="4"/>
   </OperatorMethod>
-  <Destructor id="_19" name="base_private" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_20" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw=""/>
-  <Constructor id="_21" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw="">
-    <Argument type="_28" location="f1:3" file="f1" line="3"/>
+  <Destructor id="_19" name="base_private" context="_8" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_20" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw=""/>
+  <Constructor id="_21" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw="">
+    <Argument type="_28" location="f1:7" file="f1" line="7"/>
   </Constructor>
-  <OperatorMethod id="_22" name="=" returns="_29" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_28" location="f1:3" file="f1" line="3"/>
+  <OperatorMethod id="_22" name="=" returns="_29" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_28" location="f1:7" file="f1" line="7"/>
   </OperatorMethod>
-  <Destructor id="_23" name="base_protected" context="_9" access="public" location="f1:3" file="f1" line="3" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_23" name="base_protected" context="_9" access="public" location="f1:7" file="f1" line="7" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_24" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_25" type="_7"/>
diff --git a/test/expect/gccxml.c++98.Class-template-bases.xml.txt b/test/expect/gccxml.c++98.Class-template-bases.xml.txt
index 44c30e1..d5f0339 100644
--- a/test/expect/gccxml.c++98.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++98.Class-template-bases.xml.txt
@@ -1,19 +1,19 @@
 ^<\?xml version="1.0"\?>
 <GCC_XML[^>]*>
-  <Class id="_1" name="start<int>" context="_2" location="f1:4" file="f1" line="4" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
+  <Class id="_1" name="start<int>" context="_2" location="f1:12" file="f1" line="12" members="_3 _4 _5 _6" bases="_7 _8" size="[0-9]+" align="[0-9]+">
     <Base type="_7" access="public" virtual="0" offset="[0-9]+"/>
     <Base type="_8" access="public" virtual="0" offset="[0-9]+"/>
   </Class>
-  <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <Constructor id="_3" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_4" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" throw="">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </Constructor>
-  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_9" location="f1:4" file="f1" line="4"/>
+  <OperatorMethod id="_5" name="=" returns="_10" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_9" location="f1:12" file="f1" line="12"/>
   </OperatorMethod>
-  <Destructor id="_6" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_6" name="start" context="_1" access="public" location="f1:12" file="f1" line="12" inline="1" artificial="1"( throw="")?/>
   <Class id="_7" name="non_dependent_base" context="_2" location="f1:1" file="f1" line="1" members="_11 _12 _13 _14" size="[0-9]+" align="[0-9]+"/>
-  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
+  <Class id="_8" name="dependent_base<int>" context="_2" location="f1:5" file="f1" line="5" members="_15 _16 _17 _18" size="[0-9]+" align="[0-9]+"/>
   <ReferenceType id="_9" type="_1c"/>
   <CvQualifiedType id="_1c" type="_1" const="1"/>
   <ReferenceType id="_10" type="_1"/>
@@ -25,14 +25,14 @@
     <Argument type="_19" location="f1:1" file="f1" line="1"/>
   </OperatorMethod>
   <Destructor id="_14" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
-  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
+  <Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" throw="">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </Constructor>
-  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throw="" mangled="[^"]+">
-    <Argument type="_21" location="f1:2" file="f1" line="2"/>
+  <OperatorMethod id="_17" name="=" returns="_22" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1" throw="" mangled="[^"]+">
+    <Argument type="_21" location="f1:5" file="f1" line="5"/>
   </OperatorMethod>
-  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throw="")?/>
+  <Destructor id="_18" name="dependent_base" context="_8" access="public" location="f1:5" file="f1" line="5" inline="1" artificial="1"( throw="")?/>
   <ReferenceType id="_19" type="_7c"/>
   <CvQualifiedType id="_7c" type="_7" const="1"/>
   <ReferenceType id="_20" type="_7"/>
diff --git a/test/input/CXXLiteral.cxx b/test/input/CXXLiteral.cxx
new file mode 100644
index 0000000..b409562
--- /dev/null
+++ b/test/input/CXXLiteral.cxx
@@ -0,0 +1,3 @@
+namespace start {
+unsigned long long operator"" _u(unsigned long long);
+}
diff --git a/test/input/Class-abstract.cxx b/test/input/Class-abstract.cxx
index 419c6ec..89f1f02 100644
--- a/test/input/Class-abstract.cxx
+++ b/test/input/Class-abstract.cxx
@@ -1,4 +1,5 @@
-class start {
+class start
+{
   virtual int method(int) = 0;
   virtual operator int() = 0;
   virtual ~start() = 0;
diff --git a/test/input/Class-annotate.cxx b/test/input/Class-annotate.cxx
index e0f4261..67d02c4 100644
--- a/test/input/Class-annotate.cxx
+++ b/test/input/Class-annotate.cxx
@@ -1 +1,3 @@
-class __attribute__ ((annotate ("an annotation"))) start {};
+class __attribute__((annotate("an annotation"))) start
+{
+};
diff --git a/test/input/Class-base-offset.cxx b/test/input/Class-base-offset.cxx
index 279584c..255130d 100644
--- a/test/input/Class-base-offset.cxx
+++ b/test/input/Class-base-offset.cxx
@@ -1,4 +1,15 @@
-class base_1 { char b1; };
-class base_2 { char b2; };
-class base_3 { char b3; };
-class start: public base_1, public base_2, public base_3 {};
+class base_1
+{
+  char b1;
+};
+class base_2
+{
+  char b2;
+};
+class base_3
+{
+  char b3;
+};
+class start : public base_1, public base_2, public base_3
+{
+};
diff --git a/test/input/Class-base-typedef.cxx b/test/input/Class-base-typedef.cxx
index 159d0da..4f325ea 100644
--- a/test/input/Class-base-typedef.cxx
+++ b/test/input/Class-base-typedef.cxx
@@ -1,3 +1,7 @@
-class base {};
+class base
+{
+};
 typedef base base_t;
-class start: public base_t {};
+class start : public base_t
+{
+};
diff --git a/test/input/Class-bases.cxx b/test/input/Class-bases.cxx
index 5e37d14..b38bd8a 100644
--- a/test/input/Class-bases.cxx
+++ b/test/input/Class-bases.cxx
@@ -1,9 +1,14 @@
-class base_public {};
-class base_private {};
-class base_protected {};
-class start:
-  public base_public,
-  private base_private,
-  virtual protected base_protected
+class base_public
+{
+};
+class base_private
+{
+};
+class base_protected
+{
+};
+class start : public base_public,
+              private base_private,
+              virtual protected base_protected
 {
 };
diff --git a/test/input/Class-forward.cxx b/test/input/Class-forward.cxx
index 38374b6..c2ba11d 100644
--- a/test/input/Class-forward.cxx
+++ b/test/input/Class-forward.cxx
@@ -1,5 +1,6 @@
 class start;
-class start {
+class start
+{
 public:
   start();
   start(start const&);
diff --git a/test/input/Class-friends.cxx b/test/input/Class-friends.cxx
index 6659db2..fe3aa56 100644
--- a/test/input/Class-friends.cxx
+++ b/test/input/Class-friends.cxx
@@ -1,6 +1,9 @@
-class A {};
+class A
+{
+};
 void f(void);
-class start {
+class start
+{
   friend class A;
   friend void f(void);
 };
diff --git a/test/input/Class-implicit-member-access-mutable.cxx b/test/input/Class-implicit-member-access-mutable.cxx
index 8d9aaec..2b619a1 100644
--- a/test/input/Class-implicit-member-access-mutable.cxx
+++ b/test/input/Class-implicit-member-access-mutable.cxx
@@ -1,10 +1,14 @@
-class base {
+class base
+{
 protected:
   base();
   ~base();
+
 private:
   base(base const&);
   base& operator=(base const&);
   mutable int data;
 };
-class start: public base {};
+class start : public base
+{
+};
diff --git a/test/input/Class-implicit-member-access.cxx b/test/input/Class-implicit-member-access.cxx
index d9992bc..9673bc5 100644
--- a/test/input/Class-implicit-member-access.cxx
+++ b/test/input/Class-implicit-member-access.cxx
@@ -1,9 +1,13 @@
-class base {
+class base
+{
 protected:
   base();
   ~base();
+
 private:
   base(base const&);
   base& operator=(base const&);
 };
-class start: public base {};
+class start : public base
+{
+};
diff --git a/test/input/Class-implicit-member-array.cxx b/test/input/Class-implicit-member-array.cxx
index 44002dc..6f3520b 100644
--- a/test/input/Class-implicit-member-array.cxx
+++ b/test/input/Class-implicit-member-array.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   int data[2];
 };
diff --git a/test/input/Class-implicit-member-bad-base.cxx b/test/input/Class-implicit-member-bad-base.cxx
index 0a69e73..40f18d6 100644
--- a/test/input/Class-implicit-member-bad-base.cxx
+++ b/test/input/Class-implicit-member-bad-base.cxx
@@ -1,9 +1,11 @@
-template <typename T> class base {
+template <typename T>
+class base
+{
 protected:
   T data;
   base();
-  void operator=(base const& a) {
-    this->data = a.data;
-  }
+  void operator=(base const& a) { this->data = a.data; }
+};
+class start : public base<int const>
+{
 };
-class start: public base<int const> {};
diff --git a/test/input/Class-implicit-member-const-aggregate.cxx b/test/input/Class-implicit-member-const-aggregate.cxx
index 76fc8a8..8c45ac2 100644
--- a/test/input/Class-implicit-member-const-aggregate.cxx
+++ b/test/input/Class-implicit-member-const-aggregate.cxx
@@ -1,3 +1,4 @@
-struct start {
+struct start
+{
   int const data;
 };
diff --git a/test/input/Class-implicit-member-const.cxx b/test/input/Class-implicit-member-const.cxx
index 59221af..7c5c73b 100644
--- a/test/input/Class-implicit-member-const.cxx
+++ b/test/input/Class-implicit-member-const.cxx
@@ -1,5 +1,7 @@
-class start {
+class start
+{
   int const data;
+
 public:
   start();
 };
diff --git a/test/input/Class-implicit-member-reference.cxx b/test/input/Class-implicit-member-reference.cxx
index 67da21d..b84bbda 100644
--- a/test/input/Class-implicit-member-reference.cxx
+++ b/test/input/Class-implicit-member-reference.cxx
@@ -1,5 +1,7 @@
-class start {
+class start
+{
   int& ref;
+
 public:
   start();
 };
diff --git a/test/input/Class-implicit-members.cxx b/test/input/Class-implicit-members.cxx
index 2d79ee5..2c977d1 100644
--- a/test/input/Class-implicit-members.cxx
+++ b/test/input/Class-implicit-members.cxx
@@ -1,5 +1,7 @@
-class start {
-  start method(start const& x) {
+class start
+{
+  start method(start const& x)
+  {
     start s;
     s = x;
     return s;
diff --git a/test/input/Class-incomplete-twice.cxx b/test/input/Class-incomplete-twice.cxx
index 700ef6a..fb3368c 100644
--- a/test/input/Class-incomplete-twice.cxx
+++ b/test/input/Class-incomplete-twice.cxx
@@ -1,4 +1,4 @@
 namespace start {
-  class A;
-  class A;
+class A;
+class A;
 }
diff --git a/test/input/Class-member-template-access.cxx b/test/input/Class-member-template-access.cxx
index 1bcead7..b098ebd 100644
--- a/test/input/Class-member-template-access.cxx
+++ b/test/input/Class-member-template-access.cxx
@@ -1,5 +1,10 @@
-class start {
-  template <typename> class member {};
+class start
+{
+  template <typename>
+  class member
+  {
+  };
+
 public:
   typedef member<char> member_char; // incomplete
 };
diff --git a/test/input/Class-member-template.cxx b/test/input/Class-member-template.cxx
index 8ffb3d6..a320d8b 100644
--- a/test/input/Class-member-template.cxx
+++ b/test/input/Class-member-template.cxx
@@ -1,4 +1,9 @@
-class start {
-  template <typename T> T method(T v) { return v; }
+class start
+{
+  template <typename T>
+  T method(T v)
+  {
+    return v;
+  }
 };
 template int start::method<int>(int); // instantiation
diff --git a/test/input/Class-partial-template-member-Typedef.cxx b/test/input/Class-partial-template-member-Typedef.cxx
index f4bbf0a..ab71f5c 100644
--- a/test/input/Class-partial-template-member-Typedef.cxx
+++ b/test/input/Class-partial-template-member-Typedef.cxx
@@ -1,6 +1,10 @@
-template <typename T> class start;
-template <typename T> class start<T&> {
+template <typename T>
+class start;
+template <typename T>
+class start<T&>
+{
   typedef T Int;
+
 public:
   T method(Int);
 };
diff --git a/test/input/Class-template-Method-Argument-const.cxx b/test/input/Class-template-Method-Argument-const.cxx
index 76c6c4b..424070c 100644
--- a/test/input/Class-template-Method-Argument-const.cxx
+++ b/test/input/Class-template-Method-Argument-const.cxx
@@ -1,4 +1,6 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
   void method(T const&);
 };
 template class start<int const>; // instantiation
diff --git a/test/input/Class-template-Method-Argument-default.cxx b/test/input/Class-template-Method-Argument-default.cxx
index cc928b5..aa6b6a5 100644
--- a/test/input/Class-template-Method-Argument-default.cxx
+++ b/test/input/Class-template-Method-Argument-default.cxx
@@ -1,4 +1,6 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
   int method(int = 123);
 };
 template class start<int>; // instantiation
diff --git a/test/input/Class-template-Method-return-const.cxx b/test/input/Class-template-Method-return-const.cxx
index 28063b4..ac52b15 100644
--- a/test/input/Class-template-Method-return-const.cxx
+++ b/test/input/Class-template-Method-return-const.cxx
@@ -1,4 +1,6 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
   T const method();
 };
 template class start<int const>; // instantiation
diff --git a/test/input/Class-template-bases.cxx b/test/input/Class-template-bases.cxx
index e4db66d..b446021 100644
--- a/test/input/Class-template-bases.cxx
+++ b/test/input/Class-template-bases.cxx
@@ -1,4 +1,12 @@
-class non_dependent_base {};
-template <typename T> class dependent_base {};
-template <typename T> class start: public non_dependent_base, public dependent_base<T> {};
+class non_dependent_base
+{
+};
+template <typename T>
+class dependent_base
+{
+};
+template <typename T>
+class start : public non_dependent_base, public dependent_base<T>
+{
+};
 template class start<int>; // instantiation
diff --git a/test/input/Class-template-constructor-template.cxx b/test/input/Class-template-constructor-template.cxx
index 1ca5d93..3051e6a 100644
--- a/test/input/Class-template-constructor-template.cxx
+++ b/test/input/Class-template-constructor-template.cxx
@@ -1,6 +1,12 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
 public:
   start(start const&);
-  template <typename U> start(start<U> const&);
+  template <typename U>
+  start(start<U> const&);
 };
-start<int> instantiate_and_copy(start<int> const& x) { return x; }
+start<int> instantiate_and_copy(start<int> const& x)
+{
+  return x;
+}
diff --git a/test/input/Class-template-friends.cxx b/test/input/Class-template-friends.cxx
index e1b3166..03057ae 100644
--- a/test/input/Class-template-friends.cxx
+++ b/test/input/Class-template-friends.cxx
@@ -1,8 +1,13 @@
-template <typename T> class A;
-template <typename T> int f(T);
-template <typename T> class start {
+template <typename T>
+class A;
+template <typename T>
+int f(T);
+template <typename T>
+class start
+{
   friend class A<T>;
   friend int f<T>(T);
-  template <typename U> friend int f(U);
+  template <typename U>
+  friend int f(U);
 };
 template class start<int>;
diff --git a/test/input/Class-template-member-Typedef-const.cxx b/test/input/Class-template-member-Typedef-const.cxx
index f2a21b7..cea165c 100644
--- a/test/input/Class-template-member-Typedef-const.cxx
+++ b/test/input/Class-template-member-Typedef-const.cxx
@@ -1,5 +1,8 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
   typedef T IntConst;
+
 public:
   T method(IntConst);
 };
diff --git a/test/input/Class-template-member-Typedef.cxx b/test/input/Class-template-member-Typedef.cxx
index 07b38c6..462e013 100644
--- a/test/input/Class-template-member-Typedef.cxx
+++ b/test/input/Class-template-member-Typedef.cxx
@@ -1,5 +1,8 @@
-template <typename T> class start {
+template <typename T>
+class start
+{
   typedef T Int;
+
 public:
   T method(Int);
 };
diff --git a/test/input/Class-template-member-nontemplate-Typedef.cxx b/test/input/Class-template-member-nontemplate-Typedef.cxx
new file mode 100644
index 0000000..44c3da1
--- /dev/null
+++ b/test/input/Class-template-member-nontemplate-Typedef.cxx
@@ -0,0 +1,10 @@
+template <typename>
+struct A
+{
+  struct B
+  {
+    typedef int intermediate_type;
+    typedef intermediate_type type;
+  };
+};
+typedef A<int>::B::type start;
diff --git a/test/input/Class-template-member-template.cxx b/test/input/Class-template-member-template.cxx
index 9dc6a54..03bd600 100644
--- a/test/input/Class-template-member-template.cxx
+++ b/test/input/Class-template-member-template.cxx
@@ -1,4 +1,10 @@
-template <typename T> class start {
-  template <typename U> T method(U) { return T(); }
+template <typename T>
+class start
+{
+  template <typename U>
+  T method(U)
+  {
+    return T();
+  }
 };
 template int start<int>::method<char>(char); // instantiation
diff --git a/test/input/Class-template-recurse.cxx b/test/input/Class-template-recurse.cxx
index fd702a8..0523a5d 100644
--- a/test/input/Class-template-recurse.cxx
+++ b/test/input/Class-template-recurse.cxx
@@ -1,11 +1,20 @@
-template <typename T> struct A;
-template <typename T> struct C;
-template <typename T> struct B {
+template <typename T>
+struct A;
+template <typename T>
+struct C;
+template <typename T>
+struct B
+{
   typedef C<T> type;
 };
-template <typename T> struct C {
-  C() {
+template <typename T>
+struct C
+{
+  C()
+  {
+    /* clang-format off */
     static_cast<void>(sizeof(typename B< A<T> >::type));
+    /* clang-format on */
   }
 };
 C<void> start;
diff --git a/test/input/Class-template.cxx b/test/input/Class-template.cxx
index 7bfa22f..724c612 100644
--- a/test/input/Class-template.cxx
+++ b/test/input/Class-template.cxx
@@ -1,5 +1,12 @@
-template <typename T> class start {};
-template <typename T> struct start<T&> {}; // partial specialization
-template <> class start<char>; // specialization
-template class start<int>; // instantiation
+template <typename T>
+class start
+{
+};
+template <typename T>
+struct start<T&>
+{
+}; // partial specialization
+template <>
+class start<char>;          // specialization
+template class start<int>;  // instantiation
 template class start<int&>; // instantiation of partial specialization
diff --git a/test/input/Class.cxx b/test/input/Class.cxx
index 92a7e59..957148d 100644
--- a/test/input/Class.cxx
+++ b/test/input/Class.cxx
@@ -1 +1,3 @@
-class start {};
+class start
+{
+};
diff --git a/test/input/Constructor-annotate.cxx b/test/input/Constructor-annotate.cxx
index 94cf13e..91b5692 100644
--- a/test/input/Constructor-annotate.cxx
+++ b/test/input/Constructor-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) start();
+class start
+{
+  __attribute__((annotate("an annotation"))) start();
 };
diff --git a/test/input/Constructor.cxx b/test/input/Constructor.cxx
index e6e7948..46cf26c 100644
--- a/test/input/Constructor.cxx
+++ b/test/input/Constructor.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   start();
 };
diff --git a/test/input/Converter-annotate.cxx b/test/input/Converter-annotate.cxx
index 2e4a915..836d08f 100644
--- a/test/input/Converter-annotate.cxx
+++ b/test/input/Converter-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) operator int();
+class start
+{
+  __attribute__((annotate("an annotation"))) operator int();
 };
diff --git a/test/input/Converter.cxx b/test/input/Converter.cxx
index 64bad53..b0224f4 100644
--- a/test/input/Converter.cxx
+++ b/test/input/Converter.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   operator int();
 };
diff --git a/test/input/Destructor-annotate.cxx b/test/input/Destructor-annotate.cxx
index f2c59f1..71481e5 100644
--- a/test/input/Destructor-annotate.cxx
+++ b/test/input/Destructor-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) ~start();
+class start
+{
+  __attribute__((annotate("an annotation"))) ~start();
 };
diff --git a/test/input/Destructor.cxx b/test/input/Destructor.cxx
index 6a42e1a..864b3dd 100644
--- a/test/input/Destructor.cxx
+++ b/test/input/Destructor.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   ~start();
 };
diff --git a/test/input/Enumeration-annotate.cxx b/test/input/Enumeration-annotate.cxx
index fd2c9a3..20559c7 100644
--- a/test/input/Enumeration-annotate.cxx
+++ b/test/input/Enumeration-annotate.cxx
@@ -1,3 +1,4 @@
-enum __attribute__ ((annotate ("an annotation"))) start {
-  ev0 __attribute__ ((annotate ("an annotation")))
+enum __attribute__((annotate("an annotation"))) start
+{
+  ev0 __attribute__((annotate("an annotation")))
 };
diff --git a/test/input/Enumeration-anonymous.cxx b/test/input/Enumeration-anonymous.cxx
index f1325d1..c813534 100644
--- a/test/input/Enumeration-anonymous.cxx
+++ b/test/input/Enumeration-anonymous.cxx
@@ -1,6 +1,7 @@
 namespace start {
-  enum {
-    ev0,
-    ev1
-  };
+enum
+{
+  ev0,
+  ev1
+};
 }
diff --git a/test/input/Enumeration.cxx b/test/input/Enumeration.cxx
index 1cdd25c..5bc2886 100644
--- a/test/input/Enumeration.cxx
+++ b/test/input/Enumeration.cxx
@@ -1,4 +1,5 @@
-enum start {
+enum start
+{
   ev0,
   ev2 = 2
 };
diff --git a/test/input/Field-annotate.cxx b/test/input/Field-annotate.cxx
index 917e96f..2ebe946 100644
--- a/test/input/Field-annotate.cxx
+++ b/test/input/Field-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) int field;
+class start
+{
+  __attribute__((annotate("an annotation"))) int field;
 };
diff --git a/test/input/Field.cxx b/test/input/Field.cxx
index d8efaf9..73cfe6d 100644
--- a/test/input/Field.cxx
+++ b/test/input/Field.cxx
@@ -1,5 +1,6 @@
-class start {
+class start
+{
   int field;
-  unsigned bit_field: 2;
+  unsigned bit_field : 2;
   mutable int mutable_field;
 };
diff --git a/test/input/Function-Argument-annotate.cxx b/test/input/Function-Argument-annotate.cxx
index 3ea09ad..a9176ba 100644
--- a/test/input/Function-Argument-annotate.cxx
+++ b/test/input/Function-Argument-annotate.cxx
@@ -1 +1 @@
-void start( __attribute__ ((annotate ("an annotation"))) int);
+void start(__attribute__((annotate("an annotation"))) int);
diff --git a/test/input/Function-Argument-default-cast.cxx b/test/input/Function-Argument-default-cast.cxx
index 09ff46b..003ab9c 100644
--- a/test/input/Function-Argument-default-cast.cxx
+++ b/test/input/Function-Argument-default-cast.cxx
@@ -1,13 +1,16 @@
 namespace start {
-  struct Base { Base(); virtual ~Base(); };
-  struct Derived: public Base {};
-  Base* b();
-  Base const* bc();
-  typedef int Int;
-  void f(Int = (Int)0,
-         Base* = (Base*)0,
-         Base* = static_cast<Base*>(0),
-         Base* = reinterpret_cast<Base*>(0),
-         Base* = const_cast<Base*>(bc()),
-         Derived* = dynamic_cast<Derived*>(b()));
+struct Base
+{
+  Base();
+  virtual ~Base();
+};
+struct Derived : public Base
+{
+};
+Base* b();
+Base const* bc();
+typedef int Int;
+void f(Int = (Int)0, Base* = (Base*)0, Base* = static_cast<Base*>(0),
+       Base* = reinterpret_cast<Base*>(0), Base* = const_cast<Base*>(bc()),
+       Derived* = dynamic_cast<Derived*>(b()));
 }
diff --git a/test/input/Function-Argument-default-ns.cxx b/test/input/Function-Argument-default-ns.cxx
index b2fc53e..74370b9 100644
--- a/test/input/Function-Argument-default-ns.cxx
+++ b/test/input/Function-Argument-default-ns.cxx
@@ -1,5 +1,8 @@
 namespace start {
-  static int const C = 0;
-  enum { E = 0 };
-  void f(int = C, int = E);
+static int const C = 0;
+enum
+{
+  E = 0
+};
+void f(int = C, int = E);
 }
diff --git a/test/input/Function-annotate.cxx b/test/input/Function-annotate.cxx
index d7aaf79..15583bf 100644
--- a/test/input/Function-annotate.cxx
+++ b/test/input/Function-annotate.cxx
@@ -1 +1 @@
-__attribute__ ((annotate ("an annotation"))) void start(int);
+__attribute__((annotate("an annotation"))) void start(int);
diff --git a/test/input/Function-calling-convention-ms-annotate.cxx b/test/input/Function-calling-convention-ms-annotate.cxx
index 4803dd8..668fcb0 100644
--- a/test/input/Function-calling-convention-ms-annotate.cxx
+++ b/test/input/Function-calling-convention-ms-annotate.cxx
@@ -1,4 +1,8 @@
-__attribute__ ((annotate ("an annotation"))) void __cdecl start(void (__cdecl *)());
-__attribute__ ((annotate ("an annotation"))) void __stdcall start(void (__stdcall *)());
-__attribute__ ((annotate ("an annotation"))) void __fastcall start(void (__fastcall *)());
-__attribute__ ((annotate ("an annotation"))) void __thiscall start(void (__thiscall *)());
+__attribute__((annotate("an annotation"))) void __cdecl start(
+  void(__cdecl*)());
+__attribute__((annotate("an annotation"))) void __stdcall start(
+  void(__stdcall*)());
+__attribute__((annotate("an annotation"))) void __fastcall start(
+  void(__fastcall*)());
+__attribute__((annotate("an annotation"))) void __thiscall start(
+  void(__thiscall*)());
diff --git a/test/input/Function-calling-convention-ms.cxx b/test/input/Function-calling-convention-ms.cxx
index fac3c42..667453d 100644
--- a/test/input/Function-calling-convention-ms.cxx
+++ b/test/input/Function-calling-convention-ms.cxx
@@ -1,4 +1,4 @@
-void __cdecl start(void (__cdecl *)());
-void __stdcall start(void (__stdcall *)());
-void __fastcall start(void (__fastcall *)());
-void __thiscall start(void (__thiscall *)());
+void __cdecl start(void(__cdecl*)());
+void __stdcall start(void(__stdcall*)());
+void __fastcall start(void(__fastcall*)());
+void __thiscall start(void(__thiscall*)());
diff --git a/test/input/Function-template.cxx b/test/input/Function-template.cxx
index cd4b913..4d16f5f 100644
--- a/test/input/Function-template.cxx
+++ b/test/input/Function-template.cxx
@@ -1,3 +1,8 @@
-template <typename T> T start(T) { return T(); }
-template <> char start<char>(char); // specialization
+template <typename T>
+T start(T)
+{
+  return T();
+}
+template <>
+char start<char>(char);       // specialization
 template int start<int>(int); // instantiation
diff --git a/test/input/Function-variadic.cxx b/test/input/Function-variadic.cxx
index 2a2510b..2cafe90 100644
--- a/test/input/Function-variadic.cxx
+++ b/test/input/Function-variadic.cxx
@@ -1 +1 @@
-void start(int,...);
+void start(int, ...);
diff --git a/test/input/FunctionType-variadic.cxx b/test/input/FunctionType-variadic.cxx
index 90b9294..713703d 100644
--- a/test/input/FunctionType-variadic.cxx
+++ b/test/input/FunctionType-variadic.cxx
@@ -1 +1 @@
-typedef void start(int,...);
+typedef void start(int, ...);
diff --git a/test/input/FundamentalTypes.cxx b/test/input/FundamentalTypes.cxx
index 7ec7c53..93f3c3a 100644
--- a/test/input/FundamentalTypes.cxx
+++ b/test/input/FundamentalTypes.cxx
@@ -1,15 +1,15 @@
 namespace start {
-  typedef char t_Char;
-  typedef signed char t_SChar;
-  typedef unsigned char t_UChar;
-  typedef short t_Short;
-  typedef unsigned short t_UShort;
-  typedef int t_Int;
-  typedef unsigned int t_UInt;
-  typedef long t_Long;
-  typedef unsigned long t_ULong;
-  typedef long long t_LongLong;
-  typedef unsigned long long t_ULongLong;
-  typedef float t_Float;
-  typedef double t_Double;
+typedef char t_Char;
+typedef signed char t_SChar;
+typedef unsigned char t_UChar;
+typedef short t_Short;
+typedef unsigned short t_UShort;
+typedef int t_Int;
+typedef unsigned int t_UInt;
+typedef long t_Long;
+typedef unsigned long t_ULong;
+typedef long long t_LongLong;
+typedef unsigned long long t_ULongLong;
+typedef float t_Float;
+typedef double t_Double;
 }
diff --git a/test/input/GNU-float128.cxx b/test/input/GNU-float128.cxx
index 183ada9..e976f4b 100644
--- a/test/input/GNU-float128.cxx
+++ b/test/input/GNU-float128.cxx
@@ -1,6 +1,7 @@
-template <typename T> struct A;
+template <typename T>
+struct A;
 namespace start {
-  __float128 f(__float128);
-  __float128 v;
-  A<__float128>* pa;
+__float128 f(__float128);
+__float128 v;
+A<__float128>* pa;
 }
diff --git a/test/input/GNU-va_arg_pack.cxx b/test/input/GNU-va_arg_pack.cxx
index 7a437cf..ed93e53 100644
--- a/test/input/GNU-va_arg_pack.cxx
+++ b/test/input/GNU-va_arg_pack.cxx
@@ -1,3 +1,4 @@
-__inline int start(int n, ...) {
+__inline int start(int n, ...)
+{
   return start(n + __builtin_va_arg_pack_len(), __builtin_va_arg_pack());
 }
diff --git a/test/input/Method-Argument-default-cast.cxx b/test/input/Method-Argument-default-cast.cxx
index 903b622..b7c0d8c 100644
--- a/test/input/Method-Argument-default-cast.cxx
+++ b/test/input/Method-Argument-default-cast.cxx
@@ -1,8 +1,7 @@
-class start {
+class start
+{
   class Class;
   typedef int Int;
-  int f(Int = (Int)0,
-        Class* = (Class*)0,
-        Class* = static_cast<Class*>(0),
+  int f(Int = (Int)0, Class* = (Class*)0, Class* = static_cast<Class*>(0),
         Class* = reinterpret_cast<Class*>(0));
 };
diff --git a/test/input/Method-Argument-default.cxx b/test/input/Method-Argument-default.cxx
index dfd86ae..b0ee68b 100644
--- a/test/input/Method-Argument-default.cxx
+++ b/test/input/Method-Argument-default.cxx
@@ -1,4 +1,5 @@
-class start {
+class start
+{
   static int const C = 0;
   int method(int = C);
 };
diff --git a/test/input/Method-annotate.cxx b/test/input/Method-annotate.cxx
index cbd02cf..13b58b3 100644
--- a/test/input/Method-annotate.cxx
+++ b/test/input/Method-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) int method(int);
+class start
+{
+  __attribute__((annotate("an annotation"))) int method(int);
 };
diff --git a/test/input/Method-overrides.cxx b/test/input/Method-overrides.cxx
index d7e79af..f8dc982 100644
--- a/test/input/Method-overrides.cxx
+++ b/test/input/Method-overrides.cxx
@@ -1,6 +1,8 @@
-class base {
+class base
+{
   virtual int method(int);
 };
-class start: public base {
+class start : public base
+{
   virtual int method(int);
 };
diff --git a/test/input/Method-rvalue-reference.cxx b/test/input/Method-rvalue-reference.cxx
index 30c12ee..f3a7a31 100644
--- a/test/input/Method-rvalue-reference.cxx
+++ b/test/input/Method-rvalue-reference.cxx
@@ -1,4 +1,5 @@
-class start {
+class start
+{
   start(start&);
   start(start&&);
   start& operator=(start&);
diff --git a/test/input/Method.cxx b/test/input/Method.cxx
index eba4254..5fa3b2c 100644
--- a/test/input/Method.cxx
+++ b/test/input/Method.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   int method(int);
 };
diff --git a/test/input/MethodType-cv.cxx b/test/input/MethodType-cv.cxx
index 1ab435d..e8f44c9 100644
--- a/test/input/MethodType-cv.cxx
+++ b/test/input/MethodType-cv.cxx
@@ -1,2 +1,2 @@
 class A;
-typedef int (A::* const volatile start)(int) const volatile;
+typedef int (A::*const volatile start)(int) const volatile;
diff --git a/test/input/MethodType.cxx b/test/input/MethodType.cxx
index 2f9e67c..85a5d16 100644
--- a/test/input/MethodType.cxx
+++ b/test/input/MethodType.cxx
@@ -1,2 +1,2 @@
 class A;
-typedef int (A::* start)(int);
+typedef int (A::*start)(int);
diff --git a/test/input/Namespace-Class-members.cxx b/test/input/Namespace-Class-members.cxx
index 0b196ea..55f6f34 100644
--- a/test/input/Namespace-Class-members.cxx
+++ b/test/input/Namespace-Class-members.cxx
@@ -1,6 +1,7 @@
 namespace start {
-  class A {
-    static int data;
-  };
-  int A::data;
+class A
+{
+  static int data;
+};
+int A::data;
 }
diff --git a/test/input/Namespace-Class-partial-template-members.cxx b/test/input/Namespace-Class-partial-template-members.cxx
index 0c220c9..b87f1da 100644
--- a/test/input/Namespace-Class-partial-template-members.cxx
+++ b/test/input/Namespace-Class-partial-template-members.cxx
@@ -1,7 +1,11 @@
 namespace start {
-  template <typename T> class A;
-  template <typename T> class A<T&> {
-    static int data;
-  };
-  template <typename T> int A<T&>::data;
+template <typename T>
+class A;
+template <typename T>
+class A<T&>
+{
+  static int data;
+};
+template <typename T>
+int A<T&>::data;
 }
diff --git a/test/input/Namespace-Class-template-members.cxx b/test/input/Namespace-Class-template-members.cxx
index 5367a14..23131d7 100644
--- a/test/input/Namespace-Class-template-members.cxx
+++ b/test/input/Namespace-Class-template-members.cxx
@@ -1,6 +1,9 @@
 namespace start {
-  template <typename T> class A {
-    static int data;
-  };
-  template <typename T> int A<T>::data;
+template <typename T>
+class A
+{
+  static int data;
+};
+template <typename T>
+int A<T>::data;
 }
diff --git a/test/input/Namespace-Function-template-members.cxx b/test/input/Namespace-Function-template-members.cxx
index 925281f..d149de3 100644
--- a/test/input/Namespace-Function-template-members.cxx
+++ b/test/input/Namespace-Function-template-members.cxx
@@ -1,3 +1,4 @@
 namespace start {
-  template <typename T> T function(T);
+template <typename T>
+T function(T);
 }
diff --git a/test/input/Namespace-anonymous.cxx b/test/input/Namespace-anonymous.cxx
index f35a1ab..61cbe65 100644
--- a/test/input/Namespace-anonymous.cxx
+++ b/test/input/Namespace-anonymous.cxx
@@ -1,5 +1,5 @@
 namespace start {
-  namespace {
-    struct A;
-  }
+namespace {
+struct A;
+}
 }
diff --git a/test/input/Namespace-empty.cxx b/test/input/Namespace-empty.cxx
index 7aada05..90cb9ff 100644
--- a/test/input/Namespace-empty.cxx
+++ b/test/input/Namespace-empty.cxx
@@ -1,3 +1,3 @@
 namespace start {
-  ;
+;
 }
diff --git a/test/input/Namespace-extern-C-members.cxx b/test/input/Namespace-extern-C-members.cxx
index debf987..68fb48a 100644
--- a/test/input/Namespace-extern-C-members.cxx
+++ b/test/input/Namespace-extern-C-members.cxx
@@ -1,6 +1,6 @@
 namespace start {
-  extern "C" {
-    typedef int Int;
-    Int function(Int);
-  }
+extern "C" {
+typedef int Int;
+Int function(Int);
+}
 }
diff --git a/test/input/Namespace-inline-start.cxx b/test/input/Namespace-inline-start.cxx
index 35f05bc..a8e71da 100644
--- a/test/input/Namespace-inline-start.cxx
+++ b/test/input/Namespace-inline-start.cxx
@@ -1,2 +1,3 @@
 #pragma clang diagnostic ignored "-Wc++11-extensions"
-inline namespace start {}
+inline namespace start {
+}
diff --git a/test/input/Namespace-inline-template.cxx b/test/input/Namespace-inline-template.cxx
index fc38a46..f0e66d0 100644
--- a/test/input/Namespace-inline-template.cxx
+++ b/test/input/Namespace-inline-template.cxx
@@ -1,8 +1,9 @@
 #pragma clang diagnostic ignored "-Wc++11-extensions"
 namespace start {
-  inline namespace level1 {
-    struct A;
-  }
-  template <typename T> struct B;
-  typedef B<A> B_A;
+inline namespace level1 {
+struct A;
+}
+template <typename T>
+struct B;
+typedef B<A> B_A;
 }
diff --git a/test/input/Namespace-inline.cxx b/test/input/Namespace-inline.cxx
index 9569ad3..3df5602 100644
--- a/test/input/Namespace-inline.cxx
+++ b/test/input/Namespace-inline.cxx
@@ -1,9 +1,9 @@
 #pragma clang diagnostic ignored "-Wc++11-extensions"
 namespace start {
-  inline namespace level1 {
-    struct A;
-    inline namespace level2 {
-      struct B;
-    }
-  }
+inline namespace level1 {
+struct A;
+inline namespace level2 {
+struct B;
+}
+}
 }
diff --git a/test/input/Namespace-nested.cxx b/test/input/Namespace-nested.cxx
index 495208f..5e3afa5 100644
--- a/test/input/Namespace-nested.cxx
+++ b/test/input/Namespace-nested.cxx
@@ -1,11 +1,11 @@
 namespace start {
-  namespace ns1 {
-    void f1();
-  }
-  namespace ns2 {
-    void f2();
-  }
-  namespace ns3 {
-    void f3();
-  }
+namespace ns1 {
+void f1();
+}
+namespace ns2 {
+void f2();
+}
+namespace ns3 {
+void f3();
+}
 }
diff --git a/test/input/Namespace-repeat-start.cxx b/test/input/Namespace-repeat-start.cxx
index feb9d5c..0ce6793 100644
--- a/test/input/Namespace-repeat-start.cxx
+++ b/test/input/Namespace-repeat-start.cxx
@@ -1,6 +1,6 @@
 namespace start {
-  void f1();
+void f1();
 }
 namespace start {
-  void f2();
+void f2();
 }
diff --git a/test/input/Namespace-repeat.cxx b/test/input/Namespace-repeat.cxx
index 00f3d38..bc5221c 100644
--- a/test/input/Namespace-repeat.cxx
+++ b/test/input/Namespace-repeat.cxx
@@ -1,8 +1,8 @@
 namespace start {
-  namespace ns {
-    void f1();
-  }
-  namespace ns {
-    void f2();
-  }
+namespace ns {
+void f1();
+}
+namespace ns {
+void f2();
+}
 }
diff --git a/test/input/Namespace.cxx b/test/input/Namespace.cxx
index a3102e6..9071a9f 100644
--- a/test/input/Namespace.cxx
+++ b/test/input/Namespace.cxx
@@ -1 +1,2 @@
-namespace start {}
+namespace start {
+}
diff --git a/test/input/OffsetType-cv.cxx b/test/input/OffsetType-cv.cxx
index efbc605..c555de4 100644
--- a/test/input/OffsetType-cv.cxx
+++ b/test/input/OffsetType-cv.cxx
@@ -1,2 +1,2 @@
 class A;
-typedef int const volatile A::* const volatile start;
+typedef int const volatile A::*const volatile start;
diff --git a/test/input/OffsetType.cxx b/test/input/OffsetType.cxx
index 5a030d5..6326230 100644
--- a/test/input/OffsetType.cxx
+++ b/test/input/OffsetType.cxx
@@ -1,2 +1,2 @@
 class A;
-typedef int A::* start;
+typedef int A::*start;
diff --git a/test/input/OperatorFunction-annotate.cxx b/test/input/OperatorFunction-annotate.cxx
index bbb3bf9..e255b58 100644
--- a/test/input/OperatorFunction-annotate.cxx
+++ b/test/input/OperatorFunction-annotate.cxx
@@ -1,4 +1,4 @@
 class A;
 namespace start {
-  __attribute__ ((annotate ("an annotation"))) A& operator<<(A&, int);
+__attribute__((annotate("an annotation"))) A& operator<<(A&, int);
 }
diff --git a/test/input/OperatorFunction.cxx b/test/input/OperatorFunction.cxx
index 75125a2..0c0d222 100644
--- a/test/input/OperatorFunction.cxx
+++ b/test/input/OperatorFunction.cxx
@@ -1,4 +1,4 @@
 class A;
 namespace start {
-  A& operator<<(A&, int);
+A& operator<<(A&, int);
 }
diff --git a/test/input/OperatorMethod-annotate.cxx b/test/input/OperatorMethod-annotate.cxx
index 3384ece..543af88 100644
--- a/test/input/OperatorMethod-annotate.cxx
+++ b/test/input/OperatorMethod-annotate.cxx
@@ -1,3 +1,4 @@
-class start {
-  __attribute__ ((annotate ("an annotation"))) start& operator<<(int);
+class start
+{
+  __attribute__((annotate("an annotation"))) start& operator<<(int);
 };
diff --git a/test/input/OperatorMethod.cxx b/test/input/OperatorMethod.cxx
index 36a76c2..c05c431 100644
--- a/test/input/OperatorMethod.cxx
+++ b/test/input/OperatorMethod.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   start& operator<<(int);
 };
diff --git a/test/input/PointerType.cxx b/test/input/PointerType.cxx
index 46d5fee..936ea49 100644
--- a/test/input/PointerType.cxx
+++ b/test/input/PointerType.cxx
@@ -1 +1 @@
-typedef int *start;
+typedef int* start;
diff --git a/test/input/RValueReferenceType.cxx b/test/input/RValueReferenceType.cxx
index 35f2861..1dc1d14 100644
--- a/test/input/RValueReferenceType.cxx
+++ b/test/input/RValueReferenceType.cxx
@@ -1,3 +1,3 @@
 namespace start {
-  typedef int&& type;
+typedef int&& type;
 }
diff --git a/test/input/ReferenceType-to-Class-template.cxx b/test/input/ReferenceType-to-Class-template.cxx
index 2bf8bbb..74ed2a3 100644
--- a/test/input/ReferenceType-to-Class-template.cxx
+++ b/test/input/ReferenceType-to-Class-template.cxx
@@ -1,4 +1,7 @@
-template <typename T> class A {};
+template <typename T>
+class A
+{
+};
 void start(A<int>&, short);
 void start(A<int>&, int);
 void start(A<int>&, long);
diff --git a/test/input/ReferenceType.cxx b/test/input/ReferenceType.cxx
index 6cfa692..80646f6 100644
--- a/test/input/ReferenceType.cxx
+++ b/test/input/ReferenceType.cxx
@@ -1 +1 @@
-typedef int &start;
+typedef int& start;
diff --git a/test/input/TypeAlias.cxx b/test/input/TypeAlias.cxx
index 8e5470c..d86a77c 100644
--- a/test/input/TypeAlias.cxx
+++ b/test/input/TypeAlias.cxx
@@ -1,3 +1,3 @@
 namespace start {
-  using type = int;
+using type = int;
 }
diff --git a/test/input/TypeAliasTemplate.cxx b/test/input/TypeAliasTemplate.cxx
index ec54f80..57a7838 100644
--- a/test/input/TypeAliasTemplate.cxx
+++ b/test/input/TypeAliasTemplate.cxx
@@ -1,4 +1,9 @@
-template <typename T> struct A { typedef T type; };
+template <typename T>
+struct A
+{
+  typedef T type;
+};
 namespace start {
-  template <typename T> using type = typename A<T>::type;
+template <typename T>
+using type = typename A<T>::type;
 }
diff --git a/test/input/Typedef-annotate.cxx b/test/input/Typedef-annotate.cxx
index 33dd09c..731f1e6 100644
--- a/test/input/Typedef-annotate.cxx
+++ b/test/input/Typedef-annotate.cxx
@@ -1 +1 @@
-typedef int (start) __attribute__ ((annotate ("an annotation")));
+typedef int(start) __attribute__((annotate("an annotation")));
diff --git a/test/input/Typedef-paren.cxx b/test/input/Typedef-paren.cxx
index 8b8b301..24bc9bf 100644
--- a/test/input/Typedef-paren.cxx
+++ b/test/input/Typedef-paren.cxx
@@ -1 +1 @@
-typedef int (start);
+typedef int(start);
diff --git a/test/input/Typedef-to-Class-template.cxx b/test/input/Typedef-to-Class-template.cxx
index f04a56e..c91b972 100644
--- a/test/input/Typedef-to-Class-template.cxx
+++ b/test/input/Typedef-to-Class-template.cxx
@@ -1,2 +1,3 @@
-template <typename T> class A;
+template <typename T>
+class A;
 typedef A<int> start;
diff --git a/test/input/Typedef-to-Enumeration-anonymous.cxx b/test/input/Typedef-to-Enumeration-anonymous.cxx
index cf5f26f..efcbc45 100644
--- a/test/input/Typedef-to-Enumeration-anonymous.cxx
+++ b/test/input/Typedef-to-Enumeration-anonymous.cxx
@@ -1,2 +1 @@
-typedef enum {
-} start;
+typedef enum {} start;
diff --git a/test/input/Typedef-to-Enumeration.cxx b/test/input/Typedef-to-Enumeration.cxx
index 9a1db81..38743f4 100644
--- a/test/input/Typedef-to-Enumeration.cxx
+++ b/test/input/Typedef-to-Enumeration.cxx
@@ -1,2 +1,4 @@
-enum E {};
+enum E
+{
+};
 typedef E start;
diff --git a/test/input/Typedef-to-FundamentalType-mode.cxx b/test/input/Typedef-to-FundamentalType-mode.cxx
index 03869e9..6b76163 100644
--- a/test/input/Typedef-to-FundamentalType-mode.cxx
+++ b/test/input/Typedef-to-FundamentalType-mode.cxx
@@ -1 +1 @@
-typedef int start __attribute__ ((__mode__ (__HI__)));
+typedef int start __attribute__((__mode__(__HI__)));
diff --git a/test/input/Typedef-to-extern-C-FundamentalType-mode.cxx b/test/input/Typedef-to-extern-C-FundamentalType-mode.cxx
index 3e966f0..371bcaf 100644
--- a/test/input/Typedef-to-extern-C-FundamentalType-mode.cxx
+++ b/test/input/Typedef-to-extern-C-FundamentalType-mode.cxx
@@ -1,3 +1,3 @@
 extern "C" {
-  typedef int start __attribute__ ((__mode__ (__HI__)));
+typedef int start __attribute__((__mode__(__HI__)));
 }
diff --git a/test/input/Variable-annotate.cxx b/test/input/Variable-annotate.cxx
index 0f044ec..bbe7f63 100644
--- a/test/input/Variable-annotate.cxx
+++ b/test/input/Variable-annotate.cxx
@@ -1 +1 @@
-__attribute__ ((annotate ("an annotation"))) int start;
+__attribute__((annotate("an annotation"))) int start;
diff --git a/test/input/Variable-in-Class.cxx b/test/input/Variable-in-Class.cxx
index 2aa9004..e10d058 100644
--- a/test/input/Variable-in-Class.cxx
+++ b/test/input/Variable-in-Class.cxx
@@ -1,3 +1,4 @@
-class start {
+class start
+{
   static int static_field;
 };
diff --git a/test/input/Variable-init-cast.cxx b/test/input/Variable-init-cast.cxx
index 80dbb0f..c5d664c 100644
--- a/test/input/Variable-init-cast.cxx
+++ b/test/input/Variable-init-cast.cxx
@@ -1,5 +1,5 @@
 namespace start {
-  typedef int Int;
-  int var_int = (Int)123;
-  int var_int2 = static_cast<Int>(123);
+typedef int Int;
+int var_int = (Int)123;
+int var_int2 = static_cast<Int>(123);
 }
diff --git a/test/input/Variable-init-ns.cxx b/test/input/Variable-init-ns.cxx
index 0f5311c..72bdc2f 100644
--- a/test/input/Variable-init-ns.cxx
+++ b/test/input/Variable-init-ns.cxx
@@ -1,4 +1,4 @@
 namespace start {
-  static int const C = 123;
-  int var_int = C;
+static int const C = 123;
+int var_int = C;
 }
diff --git a/test/input/Variable-init.cxx b/test/input/Variable-init.cxx
index 79b05cf..c2ef751 100644
--- a/test/input/Variable-init.cxx
+++ b/test/input/Variable-init.cxx
@@ -1,4 +1,4 @@
 namespace start {
-  int var_int = 123;
-  const char* var_str = "abc";
+int var_int = 123;
+const char* var_str = "abc";
 }
diff --git a/test/input/inline-asm-ms.cxx b/test/input/inline-asm-ms.cxx
index 1454d85..d9a83a4 100644
--- a/test/input/inline-asm-ms.cxx
+++ b/test/input/inline-asm-ms.cxx
@@ -1 +1,4 @@
-void start() { __asm { int 1 } }
+void start()
+{
+  __asm { int 1 }
+}
diff --git a/test/input/invalid-decl-for-type.cxx b/test/input/invalid-decl-for-type.cxx
index 5c2225f..2eb8a3e 100644
--- a/test/input/invalid-decl-for-type.cxx
+++ b/test/input/invalid-decl-for-type.cxx
@@ -1,7 +1,16 @@
-template<typename T> struct A { T x; };
-template<typename T> struct B { B() { A<T> a; } };
+template <typename T>
+struct A
+{
+  T x;
+};
+template <typename T>
+struct B
+{
+  B() { A<T> a; }
+};
 struct Incomplete;
-struct start {
+struct start
+{
   B<Incomplete> b;
   typedef A<Incomplete> type;
 };
diff --git a/test/input/make_integer_seq.cxx b/test/input/make_integer_seq.cxx
index 44a89a8..ec5c408 100644
--- a/test/input/make_integer_seq.cxx
+++ b/test/input/make_integer_seq.cxx
@@ -1,6 +1,11 @@
-template <typename _T, _T...> struct seq;
+template <typename _T, _T...>
+struct seq;
 typedef __make_integer_seq<seq, int, 3> seq_A;
-typedef seq<int,0,1,2> seq_B;
-template <typename A, typename B> struct assert_same;
-template <typename A> struct assert_same<A,A> {};
-assert_same<seq_A,seq_B> enforce;
+typedef seq<int, 0, 1, 2> seq_B;
+template <typename A, typename B>
+struct assert_same;
+template <typename A>
+struct assert_same<A, A>
+{
+};
+assert_same<seq_A, seq_B> enforce;
diff --git a/test/input/nostart.cxx b/test/input/nostart.cxx
index 37374bc..ad9b995 100644
--- a/test/input/nostart.cxx
+++ b/test/input/nostart.cxx
@@ -1,2 +1,2 @@
 class A;
-A operator+(A,A);
+A operator+(A, A);
diff --git a/test/input/qualified-type-name.cxx b/test/input/qualified-type-name.cxx
index ea0f4b2..ebba546 100644
--- a/test/input/qualified-type-name.cxx
+++ b/test/input/qualified-type-name.cxx
@@ -1,2 +1,4 @@
-namespace ns { typedef int type; }
+namespace ns {
+typedef int type;
+}
 typedef ns::type start;
diff --git a/test/input/using-declaration-class.cxx b/test/input/using-declaration-class.cxx
index 7b5ad6b..b63a8c1 100644
--- a/test/input/using-declaration-class.cxx
+++ b/test/input/using-declaration-class.cxx
@@ -1,8 +1,10 @@
-class base {
+class base
+{
 protected:
   int f(int);
 };
-class start: public base {
+class start : public base
+{
   using base::f;
   int f(char);
 };
diff --git a/test/input/using-declaration-ns.cxx b/test/input/using-declaration-ns.cxx
index 1629a8b..04e8637 100644
--- a/test/input/using-declaration-ns.cxx
+++ b/test/input/using-declaration-ns.cxx
@@ -1,4 +1,4 @@
 class A;
 namespace start {
-  using ::A;
+using ::A;
 }
diff --git a/test/input/using-declaration-start.cxx b/test/input/using-declaration-start.cxx
index 9d732d0..efb8912 100644
--- a/test/input/using-declaration-start.cxx
+++ b/test/input/using-declaration-start.cxx
@@ -1,4 +1,4 @@
 namespace N {
-  class start;
+class start;
 }
 using N::start;
diff --git a/test/input/using-directive-ns.cxx b/test/input/using-directive-ns.cxx
index 937b851..b3519ea 100644
--- a/test/input/using-directive-ns.cxx
+++ b/test/input/using-directive-ns.cxx
@@ -1,6 +1,6 @@
 namespace N {
-  class A;
+class A;
 }
 namespace start {
-  using namespace N;
+using namespace N;
 }
diff --git a/test/input/using-directive-start.cxx b/test/input/using-directive-start.cxx
index 1e69a1b..5a4c0cb 100644
--- a/test/input/using-directive-start.cxx
+++ b/test/input/using-directive-start.cxx
@@ -1,4 +1,4 @@
 namespace A {
-  class start;
+class start;
 }
 using namespace A;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/castxml.git



More information about the debian-med-commit mailing list