]> granicus.if.org Git - clang/commitdiff
Simplify code. CompoundStmt's RBraceLoc can be found using its SourceRange too.
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 7 Jul 2010 11:31:27 +0000 (11:31 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Wed, 7 Jul 2010 11:31:27 +0000 (11:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107770 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/DeclBase.cpp

index 0821da3b87d16fb076e76182afd8b83a504866cb..96c88c9b346186b51c173c357f78b058b7de790e 100644 (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