From: Jordan Rose Date: Tue, 31 Jul 2012 18:22:40 +0000 (+0000) Subject: [analyzer] Control C++ inlining with a macro in ExprEngineCallAndReturn.cpp. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2f9c40a915593849f6b0f5c4de516e2f597d0d66;p=clang [analyzer] Control C++ inlining with a macro in ExprEngineCallAndReturn.cpp. For now this will stay on, but this way it's easy to switch off if we need to pull back our support for a while. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@161064 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp index 00ea6daf4f..c1e010073c 100644 --- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp +++ b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp @@ -19,6 +19,8 @@ #include "llvm/ADT/SmallSet.h" #include "llvm/Support/SaveAndRestore.h" +#define CXX_INLINING_ENABLED 1 + using namespace clang; using namespace ento; @@ -287,11 +289,16 @@ bool ExprEngine::inlineCall(const CallEvent &Call, // FIXME: Refactor this check into a hypothetical CallEvent::canInline. switch (Call.getKind()) { case CE_Function: + break; case CE_CXXMember: case CE_CXXMemberOperator: - // These are always at least possible to inline. + if (!CXX_INLINING_ENABLED) + return false; break; case CE_CXXConstructor: { + if (!CXX_INLINING_ENABLED) + return false; + // Only inline constructors and destructors if we built the CFGs for them // properly. const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext(); @@ -316,6 +323,9 @@ bool ExprEngine::inlineCall(const CallEvent &Call, break; } case CE_CXXDestructor: { + if (!CXX_INLINING_ENABLED) + return false; + // Only inline constructors and destructors if we built the CFGs for them // properly. const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext(); @@ -333,6 +343,9 @@ bool ExprEngine::inlineCall(const CallEvent &Call, break; } case CE_CXXAllocator: + if (!CXX_INLINING_ENABLED) + return false; + // Do not inline allocators until we model deallocators. // This is unfortunate, but basically necessary for smart pointers and such. return false;