Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.

llvm-svn: 107770
This commit is contained in:
Argyrios Kyrtzidis 2010-07-07 11:31:27 +00:00
parent 46f556d4e5
commit 6fbc8fa53e
1 changed files with 4 additions and 8 deletions

View File

@ -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