diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-07 11:31:27 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2010-07-07 11:31:27 +0000 |
commit | 6fbc8fa53e5e1d8eeb226e1aa103c40576748ea6 (patch) | |
tree | cfb41a228c5e17ca38f7fb024a94a7bfb462788c /clang/lib/AST/DeclBase.cpp | |
parent | 46f556d4e5742213212c6d22ab1fc5b2cc8a8c99 (diff) | |
download | bcm5719-llvm-6fbc8fa53e5e1d8eeb226e1aa103c40576748ea6.tar.gz bcm5719-llvm-6fbc8fa53e5e1d8eeb226e1aa103c40576748ea6.zip |
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
llvm-svn: 107770
Diffstat (limited to 'clang/lib/AST/DeclBase.cpp')
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 0821da3b87d..96c88c9b346 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/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 |