Removing the setLBracLoc and setRBracLoc functions from CompoundStmt -- their only use was with the AST reader, and friendship can be used to handle that. Drive-by rename of "Brac" to "Brace" for the private data members. NFC.

llvm-svn: 220428
This commit is contained in:
Aaron Ballman 2014-10-22 21:06:18 +00:00
parent 73a51a1a68
commit ce6c67e040
3 changed files with 12 additions and 11 deletions

View File

@ -552,14 +552,17 @@ public:
/// ///
class CompoundStmt : public Stmt { class CompoundStmt : public Stmt {
Stmt** Body; Stmt** Body;
SourceLocation LBracLoc, RBracLoc; SourceLocation LBraceLoc, RBraceLoc;
friend class ASTStmtReader;
public: public:
CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts, CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts,
SourceLocation LB, SourceLocation RB); SourceLocation LB, SourceLocation RB);
// \brief Build an empty compound statement with a location. // \brief Build an empty compound statement with a location.
explicit CompoundStmt(SourceLocation Loc) explicit CompoundStmt(SourceLocation Loc)
: Stmt(CompoundStmtClass), Body(nullptr), LBracLoc(Loc), RBracLoc(Loc) { : Stmt(CompoundStmtClass), Body(nullptr), LBraceLoc(Loc), RBraceLoc(Loc) {
CompoundStmtBits.NumStmts = 0; CompoundStmtBits.NumStmts = 0;
} }
@ -618,13 +621,11 @@ public:
return const_reverse_body_iterator(body_begin()); return const_reverse_body_iterator(body_begin());
} }
SourceLocation getLocStart() const LLVM_READONLY { return LBracLoc; } SourceLocation getLocStart() const LLVM_READONLY { return LBraceLoc; }
SourceLocation getLocEnd() const LLVM_READONLY { return RBracLoc; } SourceLocation getLocEnd() const LLVM_READONLY { return RBraceLoc; }
SourceLocation getLBracLoc() const { return LBracLoc; } SourceLocation getLBracLoc() const { return LBraceLoc; }
void setLBracLoc(SourceLocation L) { LBracLoc = L; } SourceLocation getRBracLoc() const { return RBraceLoc; }
SourceLocation getRBracLoc() const { return RBracLoc; }
void setRBracLoc(SourceLocation L) { RBracLoc = L; }
static bool classof(const Stmt *T) { static bool classof(const Stmt *T) {
return T->getStmtClass() == CompoundStmtClass; return T->getStmtClass() == CompoundStmtClass;

View File

@ -274,7 +274,7 @@ SourceLocation Stmt::getLocEnd() const {
CompoundStmt::CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts, CompoundStmt::CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts,
SourceLocation LB, SourceLocation RB) SourceLocation LB, SourceLocation RB)
: Stmt(CompoundStmtClass), LBracLoc(LB), RBracLoc(RB) { : Stmt(CompoundStmtClass), LBraceLoc(LB), RBraceLoc(RB) {
CompoundStmtBits.NumStmts = Stmts.size(); CompoundStmtBits.NumStmts = Stmts.size();
assert(CompoundStmtBits.NumStmts == Stmts.size() && assert(CompoundStmtBits.NumStmts == Stmts.size() &&
"NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!"); "NumStmts doesn't fit in bits of CompoundStmtBits.NumStmts!");

View File

@ -135,8 +135,8 @@ void ASTStmtReader::VisitCompoundStmt(CompoundStmt *S) {
while (NumStmts--) while (NumStmts--)
Stmts.push_back(Reader.ReadSubStmt()); Stmts.push_back(Reader.ReadSubStmt());
S->setStmts(Reader.getContext(), Stmts.data(), Stmts.size()); S->setStmts(Reader.getContext(), Stmts.data(), Stmts.size());
S->setLBracLoc(ReadSourceLocation(Record, Idx)); S->LBraceLoc = ReadSourceLocation(Record, Idx);
S->setRBracLoc(ReadSourceLocation(Record, Idx)); S->RBraceLoc = ReadSourceLocation(Record, Idx);
} }
void ASTStmtReader::VisitSwitchCase(SwitchCase *S) { void ASTStmtReader::VisitSwitchCase(SwitchCase *S) {