From d2e0a8dd949ab874c6d66f97106bd5c270e2fa7d Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 14 Jan 2017 15:38:35 +0000 Subject: Vendor import of clang release_40 branch r292009: https://llvm.org/svn/llvm-project/cfe/branches/release_40@292009 --- lib/StaticAnalyzer/Core/SValBuilder.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/StaticAnalyzer/Core/SValBuilder.cpp') diff --git a/lib/StaticAnalyzer/Core/SValBuilder.cpp b/lib/StaticAnalyzer/Core/SValBuilder.cpp index 10b0858b8488..ffaa0eda918a 100644 --- a/lib/StaticAnalyzer/Core/SValBuilder.cpp +++ b/lib/StaticAnalyzer/Core/SValBuilder.cpp @@ -218,6 +218,18 @@ SValBuilder::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol, } DefinedSVal SValBuilder::getMemberPointer(const DeclaratorDecl* DD) { + assert(!DD || isa(DD) || isa(DD)); + + if (auto *MD = dyn_cast_or_null(DD)) { + // Sema treats pointers to static member functions as have function pointer + // type, so return a function pointer for the method. + // We don't need to play a similar trick for static member fields + // because these are represented as plain VarDecls and not FieldDecls + // in the AST. + if (MD->isStatic()) + return getFunctionPointer(MD); + } + return nonloc::PointerToMember(DD); } -- cgit v1.2.3