diff options
author | Brad King <brad.king@kitware.com> | 2014-04-10 13:00:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-04-10 13:11:05 (GMT) |
commit | 80d1be2da7aea241318130e4c49aebfe54377e29 (patch) | |
tree | 19bf27d537f9b909a824f8717eb013ac95309f31 /test | |
parent | 721e248bcad717e306133990bf9ac1b64861dbe7 (diff) | |
download | CastXML-80d1be2da7aea241318130e4c49aebfe54377e29.zip CastXML-80d1be2da7aea241318130e4c49aebfe54377e29.tar.gz CastXML-80d1be2da7aea241318130e4c49aebfe54377e29.tar.bz2 |
castxml: Support -std=c++11 with --castxml-gccxml
Parsing standard library headers in Visual Studio 11 and above requires
Clang to use -std=c++11 because the headers use C++11 constructs. While
gccxml output format does not support these constructs, it is still
useful to be able to output interfaces from C++98 project code while
tolerating C++11 constructs in system headers.
Drop the rejection of -std=c++11 and --castxml-gccxml together. Teach
our ASTVisitor::AddDumpNode method to skip deleted member functions,
implicit move constructors, and implicit move assignment operators.
This should avoid encountering any C++11 constructs that are not written
explicitly in the translation unit.
Extend the test suite to run all gccxml output format tests in both
-std=c++98 and -std=c++11 mode to verify the behavior of the two modes
is as close as possible. Tweak the Class-implicit-members expected
output to tolerate the empty throw specification missing in C++11 mode.
Add a RValueReferenceType test to verify that the gccxml-format output
contains an Unimplemented element for the rvalue-reference type.
Diffstat (limited to 'test')
-rw-r--r-- | test/CMakeLists.txt | 11 | ||||
-rw-r--r-- | test/expect/cmd.gccxml-and-c++11.result.txt | 1 | ||||
-rw-r--r-- | test/expect/cmd.gccxml-and-c++11.stderr.txt | 2 | ||||
-rw-r--r-- | test/expect/cmd.gccxml-and-c++11.stdout.txt | 1 | ||||
-rw-r--r-- | test/expect/gccxml.any.Class-implicit-members.xml.txt | 4 | ||||
-rw-r--r-- | test/expect/gccxml.any.RValueReferenceType.stdout.txt | 1 | ||||
-rw-r--r-- | test/expect/gccxml.any.RValueReferenceType.xml.txt | 7 | ||||
-rw-r--r-- | test/expect/gccxml.c++11.RValueReferenceType.stderr.txt | 1 | ||||
-rw-r--r-- | test/expect/gccxml.c++98.RValueReferenceType.stderr.txt | 1 | ||||
-rw-r--r-- | test/input/RValueReferenceType.cxx | 1 |
10 files changed, 26 insertions, 4 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 448e801..05ffc70 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -53,20 +53,30 @@ macro(castxml_test_gccxml_cxx98 test) castxml_test_gccxml_common(gccxml cxx c++98 ${test}) endmacro() +macro(castxml_test_gccxml_cxx11 test) + castxml_test_gccxml_common(gccxml cxx c++11 ${test}) +endmacro() + macro(castxml_test_gccxml_broken_cxx98 test) castxml_test_gccxml_common(gccxml.broken cxx c++98 ${test}) endmacro() +macro(castxml_test_gccxml_broken_cxx11 test) + castxml_test_gccxml_common(gccxml.broken cxx c++11 ${test}) +endmacro() + macro(castxml_test_gccxml_c test) castxml_test_gccxml_c89(${test}) endmacro() macro(castxml_test_gccxml test) castxml_test_gccxml_cxx98(${test}) + castxml_test_gccxml_cxx11(${test}) endmacro() macro(castxml_test_gccxml_broken test) castxml_test_gccxml_broken_cxx98(${test}) + castxml_test_gccxml_broken_cxx11(${test}) endmacro() set(input ${CMAKE_CURRENT_LIST_DIR}/input) @@ -153,6 +163,7 @@ castxml_test_gccxml(OperatorFunction) castxml_test_gccxml(OperatorMethod) castxml_test_gccxml(PointerType) castxml_test_gccxml(ReferenceType) +castxml_test_gccxml(RValueReferenceType) castxml_test_gccxml(Typedef-paren) castxml_test_gccxml(Typedef-to-Class-template) castxml_test_gccxml(Typedef-to-Enumeration) diff --git a/test/expect/cmd.gccxml-and-c++11.result.txt b/test/expect/cmd.gccxml-and-c++11.result.txt deleted file mode 100644 index d00491f..0000000 --- a/test/expect/cmd.gccxml-and-c++11.result.txt +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/expect/cmd.gccxml-and-c++11.stderr.txt b/test/expect/cmd.gccxml-and-c++11.stderr.txt index c19941a..10f3293 100644 --- a/test/expect/cmd.gccxml-and-c++11.stderr.txt +++ b/test/expect/cmd.gccxml-and-c++11.stderr.txt @@ -1 +1 @@ -^error: '--castxml-gccxml' does not work with c\+\+11$ +^$ diff --git a/test/expect/cmd.gccxml-and-c++11.stdout.txt b/test/expect/cmd.gccxml-and-c++11.stdout.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/test/expect/cmd.gccxml-and-c++11.stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/test/expect/gccxml.any.Class-implicit-members.xml.txt b/test/expect/gccxml.any.Class-implicit-members.xml.txt index 58aed61..99728db 100644 --- a/test/expect/gccxml.any.Class-implicit-members.xml.txt +++ b/test/expect/gccxml.any.Class-implicit-members.xml.txt @@ -5,10 +5,10 @@ <Argument name="x" type="_8" location="f1:2" file="f1" line="2"/> </Method> <Constructor id="_4" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/> - <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1" throws=""> + <Constructor id="_5" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throws="")?> <Argument type="_8" location="f1:1" file="f1" line="1"/> </Constructor> - <OperatorMethod id="_6" name="=" returns="_9" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1" throws=""> + <OperatorMethod id="_6" name="=" returns="_9" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throws="")?> <Argument type="_8" location="f1:1" file="f1" line="1"/> </OperatorMethod> <Destructor id="_7" name="start" context="_1" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"/> diff --git a/test/expect/gccxml.any.RValueReferenceType.stdout.txt b/test/expect/gccxml.any.RValueReferenceType.stdout.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/test/expect/gccxml.any.RValueReferenceType.stdout.txt @@ -0,0 +1 @@ +^$ diff --git a/test/expect/gccxml.any.RValueReferenceType.xml.txt b/test/expect/gccxml.any.RValueReferenceType.xml.txt new file mode 100644 index 0000000..6899e98 --- /dev/null +++ b/test/expect/gccxml.any.RValueReferenceType.xml.txt @@ -0,0 +1,7 @@ +^<\?xml version="1.0"\?> +<GCC_XML[^>]*> + <Typedef id="_1" name="start" type="_2" context="_3" location="f1:1" file="f1" line="1"/> + <Unimplemented id="_2" type_class="RValueReference"/> + <Namespace id="_3" name="::"/> + <File id="f1" name=".*/test/input/RValueReferenceType.cxx"/> +</GCC_XML>$ diff --git a/test/expect/gccxml.c++11.RValueReferenceType.stderr.txt b/test/expect/gccxml.c++11.RValueReferenceType.stderr.txt new file mode 100644 index 0000000..10f3293 --- /dev/null +++ b/test/expect/gccxml.c++11.RValueReferenceType.stderr.txt @@ -0,0 +1 @@ +^$ diff --git a/test/expect/gccxml.c++98.RValueReferenceType.stderr.txt b/test/expect/gccxml.c++98.RValueReferenceType.stderr.txt new file mode 100644 index 0000000..6dbbb9d --- /dev/null +++ b/test/expect/gccxml.c++98.RValueReferenceType.stderr.txt @@ -0,0 +1 @@ +warning: rvalue references are a C\+\+11 extension diff --git a/test/input/RValueReferenceType.cxx b/test/input/RValueReferenceType.cxx new file mode 100644 index 0000000..44f0232 --- /dev/null +++ b/test/input/RValueReferenceType.cxx @@ -0,0 +1 @@ +typedef int&& start; |