aboutsummaryrefslogtreecommitdiff
path: root/lib/AST/DeclBase.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 11:31:27 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2010-07-07 11:31:27 +0000
commit6717ef4e695cb37b69dead5fae486c73f8a44a28 (patch)
tree3fec38475c24b84f6400ea6048ed412d8f6d12c0 /lib/AST/DeclBase.cpp
parent9d96f9239e9250864435b25ed93bf6d08c4e5feb (diff)
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107770 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AST/DeclBase.cpp')
-rw-r--r--lib/AST/DeclBase.cpp12
1 files changed, 4 insertions, 8 deletions
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index 0821da3b87..96c88c9b34 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -461,14 +461,10 @@ SourceLocation Decl::getBodyRBrace() const {
return SourceLocation();
}
- Stmt *Body = getBody();
- if (!Body)
- return SourceLocation();
- if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Body))
- return CS->getRBracLoc();
- assert(isa<CXXTryStmt>(Body) &&
- "Body can only be CompoundStmt or CXXTryStmt");
- return cast<CXXTryStmt>(Body)->getSourceRange().getEnd();
+ if (Stmt *Body = getBody())
+ return Body->getSourceRange().getEnd();
+
+ return SourceLocation();
}
#ifndef NDEBUG