llvm_unreachable("unknown statement kind");
}
-CompoundStmt::CompoundStmt(const ASTContext &C, ArrayRef<Stmt*> Stmts,
+CompoundStmt::CompoundStmt(ASTContext &C, ArrayRef<Stmt*> Stmts,
SourceLocation LB, SourceLocation RB)
: Stmt(CompoundStmtClass), LBracLoc(LB), RBracLoc(RB) {
CompoundStmtBits.NumStmts = Stmts.size();
std::copy(Stmts.begin(), Stmts.end(), Body);
}
-void CompoundStmt::setStmts(const ASTContext &C, Stmt **Stmts,
- unsigned NumStmts) {
+void CompoundStmt::setStmts(ASTContext &C, Stmt **Stmts, unsigned NumStmts) {
if (this->Body)
C.Deallocate(Body);
this->CompoundStmtBits.NumStmts = NumStmts;
return getDecl()->getIdentifier()->getNameStart();
}
-AttributedStmt *AttributedStmt::Create(const ASTContext &C, SourceLocation Loc,
+AttributedStmt *AttributedStmt::Create(ASTContext &C, SourceLocation Loc,
ArrayRef<const Attr*> Attrs,
Stmt *SubStmt) {
void *Mem = C.Allocate(sizeof(AttributedStmt) +
return new (Mem) AttributedStmt(Loc, Attrs, SubStmt);
}
-AttributedStmt *AttributedStmt::CreateEmpty(const ASTContext &C,
- unsigned NumAttrs) {
+AttributedStmt *AttributedStmt::CreateEmpty(ASTContext &C, unsigned NumAttrs) {
assert(NumAttrs > 0 && "NumAttrs should be greater than zero");
void *Mem = C.Allocate(sizeof(AttributedStmt) +
sizeof(Attr*) * (NumAttrs - 1),
return new (Mem) AttributedStmt(EmptyShell(), NumAttrs);
}
-std::string AsmStmt::generateAsmString(const ASTContext &C) const {
+std::string AsmStmt::generateAsmString(ASTContext &C) const {
if (const GCCAsmStmt *gccAsmStmt = dyn_cast<GCCAsmStmt>(this))
return gccAsmStmt->generateAsmString(C);
if (const MSAsmStmt *msAsmStmt = dyn_cast<MSAsmStmt>(this))
return getInputConstraintLiteral(i)->getString();
}
-void GCCAsmStmt::setOutputsAndInputsAndClobbers(const ASTContext &C,
- IdentifierInfo **Names,
- StringLiteral **Constraints,
- Stmt **Exprs,
- unsigned NumOutputs,
- unsigned NumInputs,
- StringLiteral **Clobbers,
- unsigned NumClobbers) {
+void GCCAsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
+ IdentifierInfo **Names,
+ StringLiteral **Constraints,
+ Stmt **Exprs,
+ unsigned NumOutputs,
+ unsigned NumInputs,
+ StringLiteral **Clobbers,
+ unsigned NumClobbers) {
this->NumOutputs = NumOutputs;
this->NumInputs = NumInputs;
this->NumClobbers = NumClobbers;
/// it into pieces. If the asm string is erroneous, emit errors and return
/// true, otherwise return false.
unsigned GCCAsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces,
- const ASTContext &C, unsigned &DiagOffs) const {
+ ASTContext &C, unsigned &DiagOffs) const {
StringRef Str = getAsmString()->getString();
const char *StrStart = Str.begin();
const char *StrEnd = Str.end();
}
/// Assemble final IR asm string (GCC-style).
-std::string GCCAsmStmt::generateAsmString(const ASTContext &C) const {
+std::string GCCAsmStmt::generateAsmString(ASTContext &C) const {
// Analyze the asm string to decompose it into its pieces. We know that Sema
// has already done this, so it is guaranteed to be successful.
SmallVector<GCCAsmStmt::AsmStringPiece, 4> Pieces;
}
/// Assemble final IR asm string (MS-style).
-std::string MSAsmStmt::generateAsmString(const ASTContext &C) const {
+std::string MSAsmStmt::generateAsmString(ASTContext &C) const {
// FIXME: This needs to be translated into the IR string representation.
return AsmStr;
}
// Constructors
//===----------------------------------------------------------------------===//
-GCCAsmStmt::GCCAsmStmt(const ASTContext &C, SourceLocation asmloc,
- bool issimple, bool isvolatile, unsigned numoutputs,
- unsigned numinputs, IdentifierInfo **names,
- StringLiteral **constraints, Expr **exprs,
- StringLiteral *asmstr, unsigned numclobbers,
- StringLiteral **clobbers,
+GCCAsmStmt::GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
+ bool isvolatile, unsigned numoutputs, unsigned numinputs,
+ IdentifierInfo **names, StringLiteral **constraints,
+ Expr **exprs, StringLiteral *asmstr,
+ unsigned numclobbers, StringLiteral **clobbers,
SourceLocation rparenloc)
: AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
std::copy(clobbers, clobbers + NumClobbers, Clobbers);
}
-MSAsmStmt::MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
+MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
SourceLocation lbraceloc, bool issimple, bool isvolatile,
ArrayRef<Token> asmtoks, unsigned numoutputs,
unsigned numinputs,
initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
}
-static StringRef copyIntoContext(const ASTContext &C, StringRef str) {
+static StringRef copyIntoContext(ASTContext &C, StringRef str) {
size_t size = str.size();
char *buffer = new (C) char[size];
memcpy(buffer, str.data(), size);
return StringRef(buffer, size);
}
-void MSAsmStmt::initialize(const ASTContext &C,
+void MSAsmStmt::initialize(ASTContext &C,
StringRef asmstr,
ArrayRef<Token> asmtoks,
ArrayRef<StringRef> constraints,
Stmts[NumCatchStmts + 1] = atFinallyStmt;
}
-ObjCAtTryStmt *ObjCAtTryStmt::Create(const ASTContext &Context,
+ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
SourceLocation atTryLoc,
Stmt *atTryStmt,
Stmt **CatchStmts,
atFinallyStmt);
}
-ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(const ASTContext &Context,
- unsigned NumCatchStmts,
- bool HasFinally) {
+ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
+ unsigned NumCatchStmts,
+ bool HasFinally) {
unsigned Size = sizeof(ObjCAtTryStmt) +
(1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
return getTryBody()->getLocEnd();
}
-CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc,
+CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
Stmt *tryBlock, ArrayRef<Stmt*> handlers) {
std::size_t Size = sizeof(CXXTryStmt);
Size += ((handlers.size() + 1) * sizeof(Stmt));
return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers);
}
-CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty,
+CXXTryStmt *CXXTryStmt::Create(ASTContext &C, EmptyShell Empty,
unsigned numHandlers) {
std::size_t Size = sizeof(CXXTryStmt);
Size += ((numHandlers + 1) * sizeof(Stmt));
return const_cast<CXXForRangeStmt*>(this)->getLoopVariable();
}
-IfStmt::IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
+IfStmt::IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
Stmt *then, SourceLocation EL, Stmt *elsev)
: Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL)
{
return cast<VarDecl>(DS->getSingleDecl());
}
-void IfStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
+void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
if (!V) {
SubExprs[VAR] = 0;
return;
VarRange.getEnd());
}
-ForStmt::ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
+ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
SourceLocation RP)
: Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
return cast<VarDecl>(DS->getSingleDecl());
}
-void ForStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
+void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
if (!V) {
SubExprs[CONDVAR] = 0;
return;
VarRange.getEnd());
}
-SwitchStmt::SwitchStmt(const ASTContext &C, VarDecl *Var, Expr *cond)
+SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond)
: Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
{
setConditionVariable(C, Var);
return cast<VarDecl>(DS->getSingleDecl());
}
-void SwitchStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
+void SwitchStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
if (!V) {
SubExprs[VAR] = 0;
return;
return cast<DefaultStmt>(this)->getSubStmt();
}
-WhileStmt::WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
+WhileStmt::WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
SourceLocation WL)
: Stmt(WhileStmtClass) {
setConditionVariable(C, Var);
return cast<VarDecl>(DS->getSingleDecl());
}
-void WhileStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
+void WhileStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
if (!V) {
SubExprs[VAR] = 0;
return;
Children[HANDLER] = Handler;
}
-SEHTryStmt* SEHTryStmt::Create(const ASTContext &C, bool IsCXXTry,
- SourceLocation TryLoc, Stmt *TryBlock,
+SEHTryStmt* SEHTryStmt::Create(ASTContext &C,
+ bool IsCXXTry,
+ SourceLocation TryLoc,
+ Stmt *TryBlock,
Stmt *Handler) {
return new(C) SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
}
Children[BLOCK] = Block;
}
-SEHExceptStmt* SEHExceptStmt::Create(const ASTContext &C, SourceLocation Loc,
- Expr *FilterExpr, Stmt *Block) {
+SEHExceptStmt* SEHExceptStmt::Create(ASTContext &C,
+ SourceLocation Loc,
+ Expr *FilterExpr,
+ Stmt *Block) {
return new(C) SEHExceptStmt(Loc,FilterExpr,Block);
}
Block(Block)
{}
-SEHFinallyStmt* SEHFinallyStmt::Create(const ASTContext &C, SourceLocation Loc,
+SEHFinallyStmt* SEHFinallyStmt::Create(ASTContext &C,
+ SourceLocation Loc,
Stmt *Block) {
return new(C)SEHFinallyStmt(Loc,Block);
}
getStoredStmts()[NumCaptures] = 0;
}
-CapturedStmt *CapturedStmt::Create(const ASTContext &Context, Stmt *S,
+CapturedStmt *CapturedStmt::Create(ASTContext &Context, Stmt *S,
CapturedRegionKind Kind,
ArrayRef<Capture> Captures,
ArrayRef<Expr *> CaptureInits,
return new (Mem) CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
}
-CapturedStmt *CapturedStmt::CreateDeserialized(const ASTContext &Context,
+CapturedStmt *CapturedStmt::CreateDeserialized(ASTContext &Context,
unsigned NumCaptures) {
unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1);
if (NumCaptures > 0) {
return false;
}
-OMPPrivateClause *OMPPrivateClause::Create(const ASTContext &C,
+OMPPrivateClause *OMPPrivateClause::Create(ASTContext &C,
SourceLocation StartLoc,
SourceLocation LParenLoc,
SourceLocation EndLoc,
return Clause;
}
-OMPPrivateClause *OMPPrivateClause::CreateEmpty(const ASTContext &C,
+OMPPrivateClause *OMPPrivateClause::CreateEmpty(ASTContext &C,
unsigned N) {
void *Mem = C.Allocate(sizeof(OMPPrivateClause) + sizeof(Expr *) * N,
llvm::alignOf<OMPPrivateClause>());
std::copy(Clauses.begin(), Clauses.end(), this->Clauses.begin());
}
-OMPParallelDirective *OMPParallelDirective::Create(const ASTContext &C,
- SourceLocation StartLoc,
- SourceLocation EndLoc,
- ArrayRef<OMPClause *> Clauses,
- Stmt *AssociatedStmt) {
+OMPParallelDirective *OMPParallelDirective::Create(
+ ASTContext &C,
+ SourceLocation StartLoc,
+ SourceLocation EndLoc,
+ ArrayRef<OMPClause *> Clauses,
+ Stmt *AssociatedStmt) {
void *Mem = C.Allocate(sizeof(OMPParallelDirective) +
sizeof(OMPClause *) * Clauses.size() + sizeof(Stmt *),
llvm::alignOf<OMPParallelDirective>());
return Dir;
}
-OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
+OMPParallelDirective *OMPParallelDirective::CreateEmpty(ASTContext &C,
unsigned N,
EmptyShell) {
void *Mem = C.Allocate(sizeof(OMPParallelDirective) +