[cfe-commits] r164363 - in /cfe/trunk: include/clang/Analysis/AnalysisContext.h include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h lib/StaticAnalyzer/Core/CallEvent.cpp lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
Ted Kremenek
kremenek at apple.com
Thu Sep 20 23:13:13 PDT 2012
Author: kremenek
Date: Fri Sep 21 01:13:13 2012
New Revision: 164363
URL: http://llvm.org/viewvc/llvm-project?rev=164363&view=rev
Log:
Simplify getRuntimeDefinition() back to taking no arguments.
Modified:
cfe/trunk/include/clang/Analysis/AnalysisContext.h
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
Modified: cfe/trunk/include/clang/Analysis/AnalysisContext.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/AnalysisContext.h?rev=164363&r1=164362&r2=164363&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/AnalysisContext.h (original)
+++ cfe/trunk/include/clang/Analysis/AnalysisContext.h Fri Sep 21 01:13:13 2012
@@ -104,6 +104,12 @@
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;
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h?rev=164363&r1=164362&r2=164363&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h Fri Sep 21 01:13:13 2012
@@ -192,8 +192,7 @@
/// \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.
@@ -366,13 +365,14 @@
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());
}
@@ -476,8 +476,7 @@
return BR->getDecl();
}
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+ virtual RuntimeDefinition getRuntimeDefinition() const {
return RuntimeDefinition(getBlockDecl());
}
@@ -519,8 +518,7 @@
virtual const FunctionDecl *getDecl() const;
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const;
@@ -562,8 +560,7 @@
virtual const Expr *getCXXThisExpr() const;
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual Kind getKind() const { return CE_CXXMember; }
@@ -643,8 +640,7 @@
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;
@@ -850,8 +846,7 @@
llvm_unreachable("Unknown message kind");
}
- virtual RuntimeDefinition
- getRuntimeDefinition(AnalysisDeclContextManager &M) const;
+ virtual RuntimeDefinition getRuntimeDefinition() const;
virtual void getInitialStackFrameContents(const StackFrameContext *CalleeCtx,
BindingsTy &Bindings) const;
Modified: cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp?rev=164363&r1=164362&r2=164363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/CallEvent.cpp Fri Sep 21 01:13:13 2012
@@ -414,7 +414,7 @@
}
-RuntimeDefinition CXXInstanceCall::getRuntimeDefinition(AnalysisDeclContextManager &M) const {
+RuntimeDefinition CXXInstanceCall::getRuntimeDefinition() const {
// Do we have a decl at all?
const Decl *D = getDecl();
if (!D)
@@ -423,7 +423,7 @@
// 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();
@@ -513,16 +513,16 @@
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();
}
@@ -600,13 +600,13 @@
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();
}
@@ -790,7 +790,7 @@
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();
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp?rev=164363&r1=164362&r2=164363&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp Fri Sep 21 01:13:13 2012
@@ -640,7 +640,7 @@
// 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()) {
More information about the cfe-commits
mailing list