[PATCH] D48873: [AST] Use llvm::TrailingObjects in CXXTryStmt
Bruno Ricci via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 14 12:03:24 PDT 2018
bricci updated this revision to Diff 155563.
bricci retitled this revision from "[AST] Use llvm::TrailingObjects in clang::CXXTryStmt" to "[AST] Use llvm::TrailingObjects in CXXTryStmt".
bricci edited the summary of this revision.
bricci added reviewers: arphaman, bkramer.
bricci added a comment.
1. Remove unnecessary use of getTrailingObjects and use getStmts instead.
2. Move friend class ASTStmtReader; to the top with the other friend declaration.
3. Reword message.
Repository:
rC Clang
https://reviews.llvm.org/D48873
Files:
include/clang/AST/StmtCXX.h
lib/AST/StmtCXX.cpp
Index: lib/AST/StmtCXX.cpp
===================================================================
--- lib/AST/StmtCXX.cpp
+++ lib/AST/StmtCXX.cpp
@@ -40,7 +40,7 @@
CXXTryStmt::CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
ArrayRef<Stmt *> handlers)
: Stmt(CXXTryStmtClass), TryLoc(tryLoc), NumHandlers(handlers.size()) {
- Stmt **Stmts = getTrailingObjects<Stmt *>();
+ Stmt **Stmts = getStmts();
Stmts[0] = tryBlock;
std::copy(handlers.begin(), handlers.end(), Stmts + 1);
}
Index: include/clang/AST/StmtCXX.h
===================================================================
--- include/clang/AST/StmtCXX.h
+++ include/clang/AST/StmtCXX.h
@@ -66,6 +66,7 @@
private llvm::TrailingObjects<CXXTryStmt, Stmt *> {
friend TrailingObjects;
+ friend class ASTStmtReader;
SourceLocation TryLoc;
unsigned NumHandlers;
@@ -90,34 +91,31 @@
SourceLocation getTryLoc() const { return TryLoc; }
SourceLocation getEndLoc() const {
- return getTrailingObjects<Stmt *>()[NumHandlers]->getLocEnd();
+ return getStmts()[NumHandlers]->getLocEnd();
}
CompoundStmt *getTryBlock() {
- return cast<CompoundStmt>(getTrailingObjects<Stmt *>()[0]);
+ return cast<CompoundStmt>(getStmts()[0]);
}
const CompoundStmt *getTryBlock() const {
- return cast<CompoundStmt>(getTrailingObjects<Stmt *>()[0]);
+ return cast<CompoundStmt>(getStmts()[0]);
}
unsigned getNumHandlers() const { return NumHandlers; }
CXXCatchStmt *getHandler(unsigned i) {
- return cast<CXXCatchStmt>(getTrailingObjects<Stmt *>()[i + 1]);
+ return cast<CXXCatchStmt>(getStmts()[i + 1]);
}
const CXXCatchStmt *getHandler(unsigned i) const {
- return cast<CXXCatchStmt>(getTrailingObjects<Stmt *>()[i + 1]);
+ return cast<CXXCatchStmt>(getStmts()[i + 1]);
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXTryStmtClass;
}
child_range children() {
- return child_range(getTrailingObjects<Stmt *>(),
- getTrailingObjects<Stmt *>() + getNumHandlers() + 1);
+ return child_range(getStmts(), getStmts() + getNumHandlers() + 1);
}
-
- friend class ASTStmtReader;
};
/// CXXForRangeStmt - This represents C++0x [stmt.ranged]'s ranged for
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D48873.155563.patch
Type: text/x-patch
Size: 2281 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180714/4efca47e/attachment.bin>
More information about the cfe-commits
mailing list