From 6717ef4e695cb37b69dead5fae486c73f8a44a28 Mon Sep 17 00:00:00 2001 From: Argyrios Kyrtzidis Date: Wed, 7 Jul 2010 11:31:27 +0000 Subject: [PATCH] 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 --- lib/AST/DeclBase.cpp | 12 ++++-------- 1 file 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(Body)) - return CS->getRBracLoc(); - assert(isa(Body) && - "Body can only be CompoundStmt or CXXTryStmt"); - return cast(Body)->getSourceRange().getEnd(); + if (Stmt *Body = getBody()) + return Body->getSourceRange().getEnd(); + + return SourceLocation(); } #ifndef NDEBUG -- 2.40.0