ASTContext &getASTContext() const { return D->getASTContext(); }
const Decl *getDecl() const { return D; }
+ /// Return the AnalysisDeclContextManager (if any) that created
+ /// this AnalysisDeclContext.
+ AnalysisDeclContextManager *getManager() const {
+ return Manager;
+ }
+
/// Return the build options used to construct the CFG.
CFG::BuildOptions &getCFGBuildOptions() {
return cfgBuildOptions;
/// \brief Returns the definition of the function or method that will be
/// called.
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const = 0;
+ virtual RuntimeDefinition getRuntimeDefinition() const = 0;
/// \brief Returns the expression whose value will be the result of this call.
/// May be null.
return cast<FunctionDecl>(CallEvent::getDecl());
}
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+ virtual RuntimeDefinition getRuntimeDefinition() const {
const FunctionDecl *FD = getDecl();
// Note that the AnalysisDeclContext will have the FunctionDecl with
// the definition (if one exists).
if (FD) {
- AnalysisDeclContext *AD = M.getContext(FD);
+ AnalysisDeclContext *AD =
+ getLocationContext()->getAnalysisDeclContext()->
+ getManager()->getContext(FD);
if (AD->getBody())
return RuntimeDefinition(AD->getDecl());
}
return BR->getDecl();
}
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+ virtual RuntimeDefinition getRuntimeDefinition() const {
return RuntimeDefinition(getBlockDecl());
}
virtual const FunctionDecl *getDecl() const;
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const;
virtual const Expr *getCXXThisExpr() const;
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual Kind getKind() const { return CE_CXXMember; }
virtual SourceRange getSourceRange() const { return Location; }
virtual unsigned getNumArgs() const { return 0; }
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
/// \brief Returns the value of the implicit 'this' object.
virtual SVal getCXXThisVal() const;
llvm_unreachable("Unknown message kind");
}
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const;
}
-RuntimeDefinition CXXInstanceCall::getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const {
// Do we have a decl at all?
const Decl *D = getDecl();
if (!D)
// If the method is non-virtual, we know we can inline it.
const CXXMethodDecl *MD = cast<CXXMethodDecl>(D);
if (!MD->isVirtual())
- return AnyFunctionCall::getRuntimeDefinition(M);
+ return AnyFunctionCall::getRuntimeDefinition();
// Do we know the implicit 'this' object being called?
const MemRegion *R = getCXXThisVal().getAsRegion();
return getOriginExpr()->getImplicitObjectArgument();
}
-RuntimeDefinition CXXMemberCall::getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+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(M);
+ return AnyFunctionCall::getRuntimeDefinition();
- return CXXInstanceCall::getRuntimeDefinition(M);
+ return CXXInstanceCall::getRuntimeDefinition();
}
return UnknownVal();
}
-RuntimeDefinition CXXDestructorCall::getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+RuntimeDefinition CXXDestructorCall::getRuntimeDefinition() const {
// Base destructors are always called non-virtually.
// Skip CXXInstanceCall's devirtualization logic in this case.
if (isBaseDestructor())
- return AnyFunctionCall::getRuntimeDefinition(M);
+ return AnyFunctionCall::getRuntimeDefinition();
- return CXXInstanceCall::getRuntimeDefinition(M);
+ return CXXInstanceCall::getRuntimeDefinition();
}
llvm_unreachable("The while loop should always terminate.");
}
-RuntimeDefinition ObjCMethodCall::getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+RuntimeDefinition ObjCMethodCall::getRuntimeDefinition() const {
const ObjCMessageExpr *E = getOriginExpr();
assert(E);
Selector Sel = E->getSelector();
// If we already tried once and failed, make sure we don't retry later.
State = InlinedFailedState;
} else {
- RuntimeDefinition RD = Call->getRuntimeDefinition(AnalysisDeclContexts);
+ RuntimeDefinition RD = Call->getRuntimeDefinition();
const Decl *D = RD.getDecl();
if (D) {
if (RD.mayHaveOtherDefinitions()) {