summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-04-08 15:43:13 (GMT)
committerBrad King <brad.king@kitware.com>2019-04-09 13:31:27 (GMT)
commit3ae91acdf018cb8f6e69a825fd165180d673e7b1 (patch)
tree682269361e076562bf40cdf53e0a87c7ac18664d /test
parenta32b2d7470e93d1a537a32056d325239df9856c1 (diff)
downloadCastXML-3ae91acdf018cb8f6e69a825fd165180d673e7b1.zip
CastXML-3ae91acdf018cb8f6e69a825fd165180d673e7b1.tar.gz
CastXML-3ae91acdf018cb8f6e69a825fd165180d673e7b1.tar.bz2
Output: Add the type of nullptr as a FundamentalType
Extend the `--castxml-output=1` format to support the nullptr type. The name of the type is `decltype(nullptr)`. Recognize types named exactly this way (as a literal) and treat them as a FundamentalType. This gives the `std::nullptr_t` typedef a meaningful representation even without full decltype support. Leave deeper nullptr-typed expressions like `decltype((nullptr))` unchanged.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt1
-rw-r--r--test/expect/castxml1.any.FundamentalType-nullptr.xml.txt10
-rw-r--r--test/expect/gccxml.any.FundamentalType-nullptr.xml.txt10
-rw-r--r--test/input/FundamentalType-nullptr.cxx4
4 files changed, 25 insertions, 0 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index cc72d78..4b84309 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -481,6 +481,7 @@ castxml_test_output(FunctionType)
castxml_test_output(FunctionType-variadic)
castxml_test_output(FundamentalType)
castxml_test_output(FundamentalTypes)
+castxml_test_output_11(FundamentalType-nullptr)
castxml_test_output(Method)
castxml_test_output(Method-annotate)
castxml_test_output(Method-deprecated)
diff --git a/test/expect/castxml1.any.FundamentalType-nullptr.xml.txt b/test/expect/castxml1.any.FundamentalType-nullptr.xml.txt
new file mode 100644
index 0000000..3c7750a
--- /dev/null
+++ b/test/expect/castxml1.any.FundamentalType-nullptr.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<CastXML[^>]*>
+ <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+ <Typedef id="_3" name="t_NullPtr" type="_5" context="_1" location="f1:2" file="f1" line="2"/>
+ <Typedef id="_4" name="t_ParenNullPtr" type="_6" context="_1" location="f1:3" file="f1" line="3"/>
+ <FundamentalType id="_5" name="decltype\(nullptr\)" size="[0-9]+" align="[0-9]+"/>
+ <Unimplemented id="_6" type_class="Decltype"/>
+ <Namespace id="_2" name="::"/>
+ <File id="f1" name=".*/test/input/FundamentalType-nullptr.cxx"/>
+</CastXML>$
diff --git a/test/expect/gccxml.any.FundamentalType-nullptr.xml.txt b/test/expect/gccxml.any.FundamentalType-nullptr.xml.txt
new file mode 100644
index 0000000..1936ab7
--- /dev/null
+++ b/test/expect/gccxml.any.FundamentalType-nullptr.xml.txt
@@ -0,0 +1,10 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Namespace id="_1" name="start" context="_2" members="_3 _4"/>
+ <Typedef id="_3" name="t_NullPtr" type="_5" context="_1" location="f1:2" file="f1" line="2"/>
+ <Typedef id="_4" name="t_ParenNullPtr" type="_6" context="_1" location="f1:3" file="f1" line="3"/>
+ <Unimplemented id="_5" type_class="Decltype"/>
+ <Unimplemented id="_6" type_class="Decltype"/>
+ <Namespace id="_2" name="::"/>
+ <File id="f1" name=".*/test/input/FundamentalType-nullptr.cxx"/>
+</GCC_XML>$
diff --git a/test/input/FundamentalType-nullptr.cxx b/test/input/FundamentalType-nullptr.cxx
new file mode 100644
index 0000000..867402e
--- /dev/null
+++ b/test/input/FundamentalType-nullptr.cxx
@@ -0,0 +1,4 @@
+namespace start {
+typedef decltype(nullptr) t_NullPtr;
+typedef decltype((nullptr)) t_ParenNullPtr;
+}