[cfe-commits] r114065 - in /cfe/trunk: include/clang/Checker/BugReporter/BugReporter.h lib/Checker/BugReporter.cpp lib/Checker/CFRefCount.cpp lib/Checker/GRExprEngine.cpp
Tom Care
tcare at apple.com
Wed Sep 15 20:50:39 PDT 2010
Author: tcare
Date: Wed Sep 15 22:50:38 2010
New Revision: 114065
URL: http://llvm.org/viewvc/llvm-project?rev=114065&view=rev
Log:
Refactored BugReporter to refer to EndNode as ErrorNode. We currently make the assumption that EndNode == ErrorNode, but upcoming changes will break this.
Modified:
cfe/trunk/include/clang/Checker/BugReporter/BugReporter.h
cfe/trunk/lib/Checker/BugReporter.cpp
cfe/trunk/lib/Checker/CFRefCount.cpp
cfe/trunk/lib/Checker/GRExprEngine.cpp
Modified: cfe/trunk/include/clang/Checker/BugReporter/BugReporter.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Checker/BugReporter/BugReporter.h?rev=114065&r1=114064&r2=114065&view=diff
==============================================================================
--- cfe/trunk/include/clang/Checker/BugReporter/BugReporter.h (original)
+++ cfe/trunk/include/clang/Checker/BugReporter/BugReporter.h Wed Sep 15 22:50:38 2010
@@ -61,7 +61,7 @@
BugType& BT;
std::string ShortDescription;
std::string Description;
- const ExplodedNode *EndNode;
+ const ExplodedNode *ErrorNode;
SourceRange R;
protected:
@@ -81,12 +81,13 @@
getOriginalNode(const ExplodedNode* N) = 0;
};
- BugReport(BugType& bt, llvm::StringRef desc, const ExplodedNode *n)
- : BT(bt), Description(desc), EndNode(n) {}
+ BugReport(BugType& bt, llvm::StringRef desc, const ExplodedNode *errornode)
+ : BT(bt), Description(desc), ErrorNode(errornode) {}
BugReport(BugType& bt, llvm::StringRef shortDesc, llvm::StringRef desc,
- const ExplodedNode *n)
- : BT(bt), ShortDescription(shortDesc), Description(desc), EndNode(n) {}
+ const ExplodedNode *errornode)
+ : BT(bt), ShortDescription(shortDesc), Description(desc),
+ ErrorNode(errornode) {}
virtual ~BugReport();
@@ -96,7 +97,7 @@
BugType& getBugType() { return BT; }
// FIXME: Perhaps this should be moved into a subclass?
- const ExplodedNode* getEndNode() const { return EndNode; }
+ const ExplodedNode* getErrorNode() const { return ErrorNode; }
// FIXME: Do we need this? Maybe getLocation() should return a ProgramPoint
// object.
@@ -193,12 +194,13 @@
class RangedBugReport : public BugReport {
std::vector<SourceRange> Ranges;
public:
- RangedBugReport(BugType& D, llvm::StringRef description, ExplodedNode *n)
- : BugReport(D, description, n) {}
+ RangedBugReport(BugType& D, llvm::StringRef description,
+ ExplodedNode *errornode)
+ : BugReport(D, description, errornode) {}
RangedBugReport(BugType& D, llvm::StringRef shortDescription,
- llvm::StringRef description, ExplodedNode *n)
- : BugReport(D, shortDescription, description, n) {}
+ llvm::StringRef description, ExplodedNode *errornode)
+ : BugReport(D, shortDescription, description, errornode) {}
~RangedBugReport();
@@ -232,12 +234,13 @@
Creators creators;
public:
- EnhancedBugReport(BugType& D, llvm::StringRef description, ExplodedNode *n)
- : RangedBugReport(D, description, n) {}
+ EnhancedBugReport(BugType& D, llvm::StringRef description,
+ ExplodedNode *errornode)
+ : RangedBugReport(D, description, errornode) {}
EnhancedBugReport(BugType& D, llvm::StringRef shortDescription,
- llvm::StringRef description, ExplodedNode *n)
- : RangedBugReport(D, shortDescription, description, n) {}
+ llvm::StringRef description, ExplodedNode *errornode)
+ : RangedBugReport(D, shortDescription, description, errornode) {}
~EnhancedBugReport() {}
@@ -279,10 +282,12 @@
void FlushReport(BugReportEquivClass& EQ);
protected:
- BugReporter(BugReporterData& d, Kind k) : BugTypes(F.GetEmptySet()), kind(k), D(d) {}
+ BugReporter(BugReporterData& d, Kind k) : BugTypes(F.GetEmptySet()), kind(k),
+ D(d) {}
public:
- BugReporter(BugReporterData& d) : BugTypes(F.GetEmptySet()), kind(BaseBRKind), D(d) {}
+ BugReporter(BugReporterData& d) : BugTypes(F.GetEmptySet()), kind(BaseBRKind),
+ D(d) {}
virtual ~BugReporter();
void FlushReports();
Modified: cfe/trunk/lib/Checker/BugReporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/BugReporter.cpp?rev=114065&r1=114064&r2=114065&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/BugReporter.cpp (original)
+++ cfe/trunk/lib/Checker/BugReporter.cpp Wed Sep 15 22:50:38 2010
@@ -168,9 +168,9 @@
PathDiagnosticLocation ExecutionContinues(llvm::raw_string_ostream& os,
const ExplodedNode* N);
- Decl const &getCodeDecl() { return R->getEndNode()->getCodeDecl(); }
+ Decl const &getCodeDecl() { return R->getErrorNode()->getCodeDecl(); }
- ParentMap& getParentMap() { return R->getEndNode()->getParentMap(); }
+ ParentMap& getParentMap() { return R->getErrorNode()->getParentMap(); }
const Stmt *getParent(const Stmt *S) {
return getParentMap().getParent(S);
@@ -1216,13 +1216,13 @@
RangedBugReport::~RangedBugReport() {}
const Stmt* BugReport::getStmt() const {
- ProgramPoint ProgP = EndNode->getLocation();
+ ProgramPoint ProgP = ErrorNode->getLocation();
const Stmt *S = NULL;
if (BlockEntrance* BE = dyn_cast<BlockEntrance>(&ProgP)) {
CFGBlock &Exit = ProgP.getLocationContext()->getCFG()->getExit();
if (BE->getBlock() == &Exit)
- S = GetPreviousStmt(EndNode);
+ S = GetPreviousStmt(ErrorNode);
}
if (!S)
S = GetStmt(ProgP);
@@ -1266,8 +1266,8 @@
}
SourceLocation BugReport::getLocation() const {
- if (EndNode)
- if (const Stmt* S = GetCurrentOrPreviousStmt(EndNode)) {
+ if (ErrorNode)
+ if (const Stmt* S = GetCurrentOrPreviousStmt(ErrorNode)) {
// For member expressions, return the location of the '.' or '->'.
if (const MemberExpr *ME = dyn_cast<MemberExpr>(S))
return ME->getMemberLoc();
@@ -1665,7 +1665,7 @@
// by a sink, simply add all the nodes in the equivalence class to 'Nodes'.
if (!BT.isSuppressOnSink()) {
for (BugReportEquivClass::iterator I=EQ.begin(), E=EQ.end(); I!=E; ++I) {
- const ExplodedNode* N = I->getEndNode();
+ const ExplodedNode* N = I->getErrorNode();
if (N) {
R = *I;
Nodes.push_back(N);
@@ -1684,7 +1684,7 @@
for (; I != E; ++I) {
R = *I;
- const ExplodedNode *N = R->getEndNode();
+ const ExplodedNode *N = R->getErrorNode();
if (!N)
continue;
Modified: cfe/trunk/lib/Checker/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/CFRefCount.cpp?rev=114065&r1=114064&r2=114065&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Checker/CFRefCount.cpp Wed Sep 15 22:50:38 2010
@@ -2442,7 +2442,7 @@
const ExplodedNode* AllocNode = 0;
llvm::tie(AllocNode, AllocBinding) = // Set AllocBinding.
- GetAllocationSite(Eng.getStateManager(), getEndNode(), getSymbol());
+ GetAllocationSite(Eng.getStateManager(), getErrorNode(), getSymbol());
// Get the SourceLocation for the allocation site.
ProgramPoint P = AllocNode->getLocation();
Modified: cfe/trunk/lib/Checker/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Checker/GRExprEngine.cpp?rev=114065&r1=114064&r2=114065&view=diff
==============================================================================
--- cfe/trunk/lib/Checker/GRExprEngine.cpp (original)
+++ cfe/trunk/lib/Checker/GRExprEngine.cpp Wed Sep 15 22:50:38 2010
@@ -3726,7 +3726,7 @@
I2!=E2; ++I2) {
const BugReportEquivClass& EQ = *I2;
const BugReport &R = **EQ.begin();
- ExplodedNode *N = const_cast<ExplodedNode*>(R.getEndNode());
+ ExplodedNode *N = const_cast<ExplodedNode*>(R.getErrorNode());
if (N) Src.push_back(N);
}
}
More information about the cfe-commits
mailing list