summaryrefslogtreecommitdiffstats
path: root/clang/test/Analysis/inline.cpp
diff options
context:
space:
mode:
authorJordan Rose <jordan_rose@apple.com>2012-09-11 00:31:02 +0000
committerJordan Rose <jordan_rose@apple.com>2012-09-11 00:31:02 +0000
commit12f669e3cd42b20eb3abd1e1a43b2fd9c7d8a923 (patch)
tree3ea6c2149342009fe4733ff3f81d128feddcd2c5 /clang/test/Analysis/inline.cpp
parenta39ad077c9c637a2b43c21deae41a0c7f6d86032 (diff)
downloadbcm5719-llvm-12f669e3cd42b20eb3abd1e1a43b2fd9c7d8a923.tar.gz
bcm5719-llvm-12f669e3cd42b20eb3abd1e1a43b2fd9c7d8a923.zip
[analyzer] Member function calls that use qualified names are non-virtual.
C++11 [expr.call]p1: ...If the selected function is non-virtual, or if the id-expression in the class member access expression is a qualified-id, that function is called. Otherwise, its final overrider in the dynamic type of the object expression is called. <rdar://problem/12255556> llvm-svn: 163577
Diffstat (limited to 'clang/test/Analysis/inline.cpp')
-rw-r--r--clang/test/Analysis/inline.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Analysis/inline.cpp b/clang/test/Analysis/inline.cpp
index 6c7cfc14e89..b39b87101a5 100644
--- a/clang/test/Analysis/inline.cpp
+++ b/clang/test/Analysis/inline.cpp
@@ -325,3 +325,18 @@ namespace VirtualWithSisterCasts {
clang_analyzer_eval(g->x == 42); // expected-warning{{TRUE}}
}
}
+
+
+namespace QualifiedCalls {
+ void test(One *object) {
+ // This uses the One class from the top of the file.
+ clang_analyzer_eval(object->getNum() == 1); // expected-warning{{UNKNOWN}}
+ clang_analyzer_eval(object->One::getNum() == 1); // expected-warning{{TRUE}}
+ clang_analyzer_eval(object->A::getNum() == 0); // expected-warning{{TRUE}}
+
+ // getZero is non-virtual.
+ clang_analyzer_eval(object->getZero() == 0); // expected-warning{{TRUE}}
+ clang_analyzer_eval(object->One::getZero() == 0); // expected-warning{{TRUE}}
+ clang_analyzer_eval(object->A::getZero() == 0); // expected-warning{{TRUE}}
+}
+}
OpenPOWER on IntegriCloud