summaryrefslogtreecommitdiffstats
path: root/clang/lib/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Analysis')
-rw-r--r--clang/lib/Analysis/BugReporter.cpp6
-rw-r--r--clang/lib/Analysis/CFRefCount.cpp8
-rw-r--r--clang/lib/Analysis/PathDiagnostic.cpp9
3 files changed, 15 insertions, 8 deletions
diff --git a/clang/lib/Analysis/BugReporter.cpp b/clang/lib/Analysis/BugReporter.cpp
index 348ab3d09a7..397d28b6e2e 100644
--- a/clang/lib/Analysis/BugReporter.cpp
+++ b/clang/lib/Analysis/BugReporter.cpp
@@ -189,7 +189,7 @@ PathDiagnosticBuilder::ExecutionContinues(const ExplodedNode<GRState>* N) {
if (Stmt *S = GetNextStmt(N))
return PathDiagnosticLocation(S, SMgr);
- return FullSourceLoc(CodeDecl.getBody(getContext())->getRBracLoc(), SMgr);
+ return FullSourceLoc(CodeDecl.getBodyRBrace(getContext()), SMgr);
}
PathDiagnosticLocation
@@ -825,7 +825,9 @@ public:
// Finally, add an initial edge from the start location of the first
// statement (if it doesn't already exist).
- if (const CompoundStmt *CS = PDB.getCodeDecl().getBody(PDB.getContext()))
+ // FIXME: Should handle CXXTryStmt if analyser starts supporting C++.
+ if (const CompoundStmt *CS =
+ PDB.getCodeDecl().getCompoundBody(PDB.getContext()))
if (!CS->body_empty()) {
SourceLocation Loc = (*CS->body_begin())->getLocStart();
rawAddEdge(PathDiagnosticLocation(Loc, PDB.getSourceManager()));
diff --git a/clang/lib/Analysis/CFRefCount.cpp b/clang/lib/Analysis/CFRefCount.cpp
index bb957b89f55..c2369abb2cf 100644
--- a/clang/lib/Analysis/CFRefCount.cpp
+++ b/clang/lib/Analysis/CFRefCount.cpp
@@ -3047,11 +3047,11 @@ CFRefLeakReport::getEndPath(BugReporter& br, const ExplodedNode<GRState>* EndN){
LeakN = LeakN->succ_empty() ? 0 : *(LeakN->succ_begin());
}
-
+
if (!L.isValid()) {
- CompoundStmt *CS
- = BR.getStateManager().getCodeDecl().getBody(BR.getContext());
- L = PathDiagnosticLocation(CS->getRBracLoc(), SMgr);
+ L = PathDiagnosticLocation(
+ BR.getStateManager().getCodeDecl().getBodyRBrace(BR.getContext()),
+ SMgr);
}
std::string sbuf;
diff --git a/clang/lib/Analysis/PathDiagnostic.cpp b/clang/lib/Analysis/PathDiagnostic.cpp
index 946548e02cc..1a4af471f5c 100644
--- a/clang/lib/Analysis/PathDiagnostic.cpp
+++ b/clang/lib/Analysis/PathDiagnostic.cpp
@@ -15,6 +15,7 @@
#include "clang/AST/Expr.h"
#include "clang/AST/Decl.h"
#include "clang/AST/DeclObjC.h"
+#include "clang/AST/StmtCXX.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Casting.h"
#include <sstream>
@@ -197,8 +198,12 @@ PathDiagnosticRange PathDiagnosticLocation::asRange() const {
// FIXME: We would like to always get the function body, even
// when it needs to be de-serialized, but getting the
// ASTContext here requires significant changes.
- if (CompoundStmt *Body = FD->getBodyIfAvailable())
- return Body->getSourceRange();
+ if (Stmt *Body = FD->getBodyIfAvailable()) {
+ if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Body))
+ return CS->getSourceRange();
+ else
+ return cast<CXXTryStmt>(Body)->getSourceRange();
+ }
}
else {
SourceLocation L = D->getLocation();
OpenPOWER on IntegriCloud