|
@@ -340,13 +340,6 @@ bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D,
|
|
if (!shouldInlineCXX(getAnalysisManager()))
|
|
if (!shouldInlineCXX(getAnalysisManager()))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
- // Only inline constructors and destructors if we built the CFGs for them
|
|
|
|
- // properly.
|
|
|
|
- const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext();
|
|
|
|
- if (!ADC->getCFGBuildOptions().AddImplicitDtors ||
|
|
|
|
- !ADC->getCFGBuildOptions().AddInitializers)
|
|
|
|
- return false;
|
|
|
|
-
|
|
|
|
const CXXConstructorCall &Ctor = cast<CXXConstructorCall>(Call);
|
|
const CXXConstructorCall &Ctor = cast<CXXConstructorCall>(Call);
|
|
|
|
|
|
// FIXME: We don't handle constructors or destructors for arrays properly.
|
|
// FIXME: We don't handle constructors or destructors for arrays properly.
|
|
@@ -354,6 +347,17 @@ bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D,
|
|
if (Target && isa<ElementRegion>(Target))
|
|
if (Target && isa<ElementRegion>(Target))
|
|
return false;
|
|
return false;
|
|
|
|
|
|
|
|
+ // If the destructor is trivial, it's always safe to inline the constructor.
|
|
|
|
+ if (Ctor.getDecl()->getParent()->hasTrivialDestructor())
|
|
|
|
+ break;
|
|
|
|
+
|
|
|
|
+ // For other types, only inline constructors if we built the CFGs for the
|
|
|
|
+ // destructor properly.
|
|
|
|
+ const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext();
|
|
|
|
+ assert(ADC->getCFGBuildOptions().AddInitializers && "No CFG initializers");
|
|
|
|
+ if (!ADC->getCFGBuildOptions().AddImplicitDtors)
|
|
|
|
+ return false;
|
|
|
|
+
|
|
// FIXME: This is a hack. We don't handle temporary destructors
|
|
// FIXME: This is a hack. We don't handle temporary destructors
|
|
// right now, so we shouldn't inline their constructors.
|
|
// right now, so we shouldn't inline their constructors.
|
|
const CXXConstructExpr *CtorExpr = Ctor.getOriginExpr();
|
|
const CXXConstructExpr *CtorExpr = Ctor.getOriginExpr();
|
|
@@ -370,8 +374,7 @@ bool ExprEngine::inlineCall(const CallEvent &Call, const Decl *D,
|
|
// Only inline constructors and destructors if we built the CFGs for them
|
|
// Only inline constructors and destructors if we built the CFGs for them
|
|
// properly.
|
|
// properly.
|
|
const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext();
|
|
const AnalysisDeclContext *ADC = CallerSFC->getAnalysisDeclContext();
|
|
- if (!ADC->getCFGBuildOptions().AddImplicitDtors ||
|
|
|
|
- !ADC->getCFGBuildOptions().AddInitializers)
|
|
|
|
|
|
+ if (!ADC->getCFGBuildOptions().AddImplicitDtors)
|
|
return false;
|
|
return false;
|
|
|
|
|
|
const CXXDestructorCall &Dtor = cast<CXXDestructorCall>(Call);
|
|
const CXXDestructorCall &Dtor = cast<CXXDestructorCall>(Call);
|