summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-12-08 14:45:45 (GMT)
committerBrad King <brad.king@kitware.com>2014-12-08 14:55:31 (GMT)
commit01f991852c288a061e121e0c6017da32b34bb3da (patch)
tree464ec2a615c09ad439cf947b6ac2b3c82be6e87a /test
parent825cca7df68c0282339e3d0ec64e75f40fd57ed9 (diff)
downloadCastXML-01f991852c288a061e121e0c6017da32b34bb3da.zip
CastXML-01f991852c288a061e121e0c6017da32b34bb3da.tar.gz
CastXML-01f991852c288a061e121e0c6017da32b34bb3da.tar.bz2
RunClang: Refactor definition of implicit members
Use clang::Sema::PerformPendingInstantiations before we attempt to add implicit member definitions so any real errors show up first. Then set SuppressAllDiagnostics to suppress errors caused by the following. Iterate over all members of one class at a time in order of completion of class definition (bases before derived classes). Force definition of each member using clang::Sema::MarkFunctionReferenced followed by another call to clang::Sema::PerformPendingInstantiations to ensure that members formed by implicitly instantiated templates are completed. Clang will mark any failed declaration as invalid, allowing us to exclude it from the output. This works both for implicit and explicit members. Update the test suite to mark test cases that are no longer 'broken'. According to discussion on the Clang cfe-commits mailing list: [PATCH] Add DiagnosticSuppressionScope RAII class http://thread.gmane.org/gmane.comp.compilers.clang.scm/110832/focus=111112 this approach may depend on non-guaranteed behavior. By iterating over members in order of class definition, we mark any bad special members invalid in base classes so that when Clang processes those in derived classes the invalid members are only one "step" away. Hopefully this behavior will be easier to preserve if Clang changes in the future.
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt2
-rw-r--r--test/expect/gccxml.any.Class-implicit-member-bad-base.stdout.txt (renamed from test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stdout.txt)0
-rw-r--r--test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt26
-rw-r--r--test/expect/gccxml.broken.any.Class-implicit-member-bad-base.result.txt1
-rw-r--r--test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stderr.txt2
-rw-r--r--test/expect/gccxml.c++98.Class-template-bases.xml.txt6
6 files changed, 30 insertions, 7 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 4675d12..5978260 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -146,6 +146,7 @@ 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-reference)
castxml_test_gccxml(Class-implicit-members)
@@ -222,6 +223,5 @@ castxml_test_gccxml_c(Typedef-called-class)
castxml_test_gccxml_c(invalid)
-castxml_test_gccxml_broken(Class-implicit-member-bad-base)
castxml_test_gccxml_broken(Class-template-constructor-template)
castxml_test_gccxml_broken(ReferenceType-to-Class-template)
diff --git a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stdout.txt b/test/expect/gccxml.any.Class-implicit-member-bad-base.stdout.txt
index 10f3293..10f3293 100644
--- a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stdout.txt
+++ b/test/expect/gccxml.any.Class-implicit-member-bad-base.stdout.txt
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
new file mode 100644
index 0000000..3f73cac
--- /dev/null
+++ b/test/expect/gccxml.any.Class-implicit-member-bad-base.xml.txt
@@ -0,0 +1,26 @@
+^<\?xml version="1.0"\?>
+<GCC_XML[^>]*>
+ <Class id="_1" name="start" context="_2" location="f1:9" file="f1" line="9" members="_3 _4 _5" bases="_6">
+ <Base type="_6" access="public" virtual="0"/>
+ </Class>
+ <Constructor id="_3" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throws="")?/>
+ <Constructor id="_4" name="start" context="_1" access="public" location="f1:9" file="f1" line="9" inline="1" artificial="1"( throws="")?>
+ <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"( throws="")?/>
+ <Class id="_6" name="base&lt;const int&gt;" context="_2" location="f1:1" file="f1" line="1" members="_8 _9 _10 _11"/>
+ <ReferenceType id="_7" type="_1c"/>
+ <Field id="_8" name="data" type="_13" context="_6" access="protected" location="f1:3" file="f1" line="3"/>
+ <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"( throws="")?>
+ <Argument type="_14" location="f1:1" file="f1" line="1"/>
+ </Constructor>
+ <Destructor id="_11" name="base" context="_6" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throws="")?/>
+ <CvQualifiedType id="_15c" type="_15" const="1"/>
+ <ReferenceType id="_14" type="_6c"/>
+ <FundamentalType id="_15" name="int"/>
+ <Namespace id="_2" name="::"/>
+ <CvQualifiedType id="_1c" type="_1" const="1"/>
+ <CvQualifiedType id="_6c" type="_6" const="1"/>
+ <File id="f1" name=".*/test/input/Class-implicit-member-bad-base.cxx"/>
+</GCC_XML>$
diff --git a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.result.txt b/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.result.txt
deleted file mode 100644
index d00491f..0000000
--- a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.result.txt
+++ /dev/null
@@ -1 +0,0 @@
-1
diff --git a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stderr.txt b/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stderr.txt
deleted file mode 100644
index 7f45214..0000000
--- a/test/expect/gccxml.broken.any.Class-implicit-member-bad-base.stderr.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-.*/test/input/Class-implicit-member-bad-base.cxx:6:16: error: read-only variable is not assignable
-.*/test/input/Class-implicit-member-bad-base.cxx:9:7: note: in instantiation of member function 'base<const int>::operator=' requested here
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 327ac3d..448de83 100644
--- a/test/expect/gccxml.c++98.Class-template-bases.xml.txt
+++ b/test/expect/gccxml.c++98.Class-template-bases.xml.txt
@@ -4,7 +4,7 @@
<Base type="_7" access="public" virtual="0"/>
<Base type="_8" access="public" virtual="0"/>
</Class>
- <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throws=""/>
+ <Constructor id="_3" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1"( throws="")?/>
<Constructor id="_4" name="start" context="_1" access="public" location="f1:4" file="f1" line="4" inline="1" artificial="1" throws="">
<Argument type="_9" location="f1:4" file="f1" line="4"/>
</Constructor>
@@ -16,7 +16,7 @@
<Class id="_8" name="dependent_base&lt;int&gt;" context="_2" location="f1:2" file="f1" line="2" members="_15 _16 _17 _18"/>
<ReferenceType id="_9" type="_1c"/>
<ReferenceType id="_10" type="_1"/>
- <Constructor id="_11" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1" throws=""/>
+ <Constructor id="_11" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1"( throws="")?/>
<Constructor id="_12" name="non_dependent_base" context="_7" access="public" location="f1:1" file="f1" line="1" inline="1" artificial="1" throws="">
<Argument type="_20" location="f1:1" file="f1" line="1"/>
</Constructor>
@@ -24,7 +24,7 @@
<Argument type="_20" 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" throws=""/>
- <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throws=""/>
+ <Constructor id="_15" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1"( throws="")?/>
<Constructor id="_16" name="dependent_base" context="_8" access="public" location="f1:2" file="f1" line="2" inline="1" artificial="1" throws="">
<Argument type="_22" location="f1:2" file="f1" line="2"/>
</Constructor>