diff options
author | Jordan Rose <jordan_rose@apple.com> | 2012-09-11 00:31:02 +0000 |
---|---|---|
committer | Jordan Rose <jordan_rose@apple.com> | 2012-09-11 00:31:02 +0000 |
commit | 12f669e3cd42b20eb3abd1e1a43b2fd9c7d8a923 (patch) | |
tree | 3ea6c2149342009fe4733ff3f81d128feddcd2c5 /clang/lib/StaticAnalyzer/Core/CallEvent.cpp | |
parent | a39ad077c9c637a2b43c21deae41a0c7f6d86032 (diff) | |
download | bcm5719-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/lib/StaticAnalyzer/Core/CallEvent.cpp')
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/CallEvent.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp index 50d16f97283..09ba21173ba 100644 --- a/clang/lib/StaticAnalyzer/Core/CallEvent.cpp +++ b/clang/lib/StaticAnalyzer/Core/CallEvent.cpp @@ -496,6 +496,18 @@ const Expr *CXXMemberCall::getCXXThisExpr() const { return getOriginExpr()->getImplicitObjectArgument(); } +RuntimeDefinition CXXMemberCall::getRuntimeDefinition() const { + // 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. + if (const MemberExpr *ME = dyn_cast<MemberExpr>(getOriginExpr()->getCallee())) + if (ME->hasQualifier()) + return AnyFunctionCall::getRuntimeDefinition(); + + return CXXInstanceCall::getRuntimeDefinition(); +} + const Expr *CXXMemberOperatorCall::getCXXThisExpr() const { return getOriginExpr()->getArg(0); |