forked from OSchip/llvm-project
Constify the ASTContext& passed to Stmt creation functions. Also constify the context in couple other functions that are called from creation functions.
llvm-svn: 188986
This commit is contained in:
parent
ce7167c84a
commit
e6960e2db5
|
@ -544,7 +544,7 @@ class CompoundStmt : public Stmt {
|
||||||
Stmt** Body;
|
Stmt** Body;
|
||||||
SourceLocation LBracLoc, RBracLoc;
|
SourceLocation LBracLoc, RBracLoc;
|
||||||
public:
|
public:
|
||||||
CompoundStmt(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 statment with a location.
|
// \brief Build an empty compound statment with a location.
|
||||||
|
@ -818,10 +818,10 @@ class AttributedStmt : public Stmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static AttributedStmt *Create(ASTContext &C, SourceLocation Loc,
|
static AttributedStmt *Create(const ASTContext &C, SourceLocation Loc,
|
||||||
ArrayRef<const Attr*> Attrs, Stmt *SubStmt);
|
ArrayRef<const Attr*> Attrs, Stmt *SubStmt);
|
||||||
// \brief Build an empty attributed statement.
|
// \brief Build an empty attributed statement.
|
||||||
static AttributedStmt *CreateEmpty(ASTContext &C, unsigned NumAttrs);
|
static AttributedStmt *CreateEmpty(const ASTContext &C, unsigned NumAttrs);
|
||||||
|
|
||||||
SourceLocation getAttrLoc() const { return AttrLoc; }
|
SourceLocation getAttrLoc() const { return AttrLoc; }
|
||||||
ArrayRef<const Attr*> getAttrs() const {
|
ArrayRef<const Attr*> getAttrs() const {
|
||||||
|
@ -851,7 +851,7 @@ class IfStmt : public Stmt {
|
||||||
SourceLocation ElseLoc;
|
SourceLocation ElseLoc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
|
IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
|
||||||
Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
|
Stmt *then, SourceLocation EL = SourceLocation(), Stmt *elsev = 0);
|
||||||
|
|
||||||
/// \brief Build an empty if/then/else statement
|
/// \brief Build an empty if/then/else statement
|
||||||
|
@ -866,7 +866,7 @@ public:
|
||||||
/// }
|
/// }
|
||||||
/// \endcode
|
/// \endcode
|
||||||
VarDecl *getConditionVariable() const;
|
VarDecl *getConditionVariable() const;
|
||||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
void setConditionVariable(const ASTContext &C, VarDecl *V);
|
||||||
|
|
||||||
/// If this IfStmt has a condition variable, return the faux DeclStmt
|
/// If this IfStmt has a condition variable, return the faux DeclStmt
|
||||||
/// associated with the creation of that condition variable.
|
/// associated with the creation of that condition variable.
|
||||||
|
@ -924,7 +924,7 @@ class SwitchStmt : public Stmt {
|
||||||
unsigned AllEnumCasesCovered : 1;
|
unsigned AllEnumCasesCovered : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond);
|
SwitchStmt(const ASTContext &C, VarDecl *Var, Expr *cond);
|
||||||
|
|
||||||
/// \brief Build a empty switch statement.
|
/// \brief Build a empty switch statement.
|
||||||
explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { }
|
explicit SwitchStmt(EmptyShell Empty) : Stmt(SwitchStmtClass, Empty) { }
|
||||||
|
@ -939,7 +939,7 @@ public:
|
||||||
/// }
|
/// }
|
||||||
/// \endcode
|
/// \endcode
|
||||||
VarDecl *getConditionVariable() const;
|
VarDecl *getConditionVariable() const;
|
||||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
void setConditionVariable(const ASTContext &C, VarDecl *V);
|
||||||
|
|
||||||
/// If this SwitchStmt has a condition variable, return the faux DeclStmt
|
/// If this SwitchStmt has a condition variable, return the faux DeclStmt
|
||||||
/// associated with the creation of that condition variable.
|
/// associated with the creation of that condition variable.
|
||||||
|
@ -1009,7 +1009,7 @@ class WhileStmt : public Stmt {
|
||||||
Stmt* SubExprs[END_EXPR];
|
Stmt* SubExprs[END_EXPR];
|
||||||
SourceLocation WhileLoc;
|
SourceLocation WhileLoc;
|
||||||
public:
|
public:
|
||||||
WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
||||||
SourceLocation WL);
|
SourceLocation WL);
|
||||||
|
|
||||||
/// \brief Build an empty while statement.
|
/// \brief Build an empty while statement.
|
||||||
|
@ -1024,7 +1024,7 @@ public:
|
||||||
/// }
|
/// }
|
||||||
/// \endcode
|
/// \endcode
|
||||||
VarDecl *getConditionVariable() const;
|
VarDecl *getConditionVariable() const;
|
||||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
void setConditionVariable(const ASTContext &C, VarDecl *V);
|
||||||
|
|
||||||
/// If this WhileStmt has a condition variable, return the faux DeclStmt
|
/// If this WhileStmt has a condition variable, return the faux DeclStmt
|
||||||
/// associated with the creation of that condition variable.
|
/// associated with the creation of that condition variable.
|
||||||
|
@ -1117,8 +1117,9 @@ class ForStmt : public Stmt {
|
||||||
SourceLocation LParenLoc, RParenLoc;
|
SourceLocation LParenLoc, RParenLoc;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar, Expr *Inc,
|
ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
||||||
Stmt *Body, SourceLocation FL, SourceLocation LP, SourceLocation RP);
|
Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
|
||||||
|
SourceLocation RP);
|
||||||
|
|
||||||
/// \brief Build an empty for statement.
|
/// \brief Build an empty for statement.
|
||||||
explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
|
explicit ForStmt(EmptyShell Empty) : Stmt(ForStmtClass, Empty) { }
|
||||||
|
@ -1134,7 +1135,7 @@ public:
|
||||||
/// }
|
/// }
|
||||||
/// \endcode
|
/// \endcode
|
||||||
VarDecl *getConditionVariable() const;
|
VarDecl *getConditionVariable() const;
|
||||||
void setConditionVariable(ASTContext &C, VarDecl *V);
|
void setConditionVariable(const ASTContext &C, VarDecl *V);
|
||||||
|
|
||||||
/// If this ForStmt has a condition variable, return the faux DeclStmt
|
/// If this ForStmt has a condition variable, return the faux DeclStmt
|
||||||
/// associated with the creation of that condition variable.
|
/// associated with the creation of that condition variable.
|
||||||
|
@ -1508,7 +1509,7 @@ class GCCAsmStmt : public AsmStmt {
|
||||||
friend class ASTStmtReader;
|
friend class ASTStmtReader;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
GCCAsmStmt(const ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||||
bool isvolatile, unsigned numoutputs, unsigned numinputs,
|
bool isvolatile, unsigned numoutputs, unsigned numinputs,
|
||||||
IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
|
IdentifierInfo **names, StringLiteral **constraints, Expr **exprs,
|
||||||
StringLiteral *asmstr, unsigned numclobbers,
|
StringLiteral *asmstr, unsigned numclobbers,
|
||||||
|
@ -1683,9 +1684,9 @@ class MSAsmStmt : public AsmStmt {
|
||||||
friend class ASTStmtReader;
|
friend class ASTStmtReader;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MSAsmStmt(ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc,
|
MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
|
||||||
bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
|
SourceLocation lbraceloc, bool issimple, bool isvolatile,
|
||||||
unsigned numoutputs, unsigned numinputs,
|
ArrayRef<Token> asmtoks, unsigned numoutputs, unsigned numinputs,
|
||||||
ArrayRef<StringRef> constraints,
|
ArrayRef<StringRef> constraints,
|
||||||
ArrayRef<Expr*> exprs, StringRef asmstr,
|
ArrayRef<Expr*> exprs, StringRef asmstr,
|
||||||
ArrayRef<StringRef> clobbers, SourceLocation endloc);
|
ArrayRef<StringRef> clobbers, SourceLocation endloc);
|
||||||
|
@ -1753,12 +1754,9 @@ public:
|
||||||
StringRef getClobber(unsigned i) const { return getClobbers()[i]; }
|
StringRef getClobber(unsigned i) const { return getClobbers()[i]; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void initialize(ASTContext &C,
|
void initialize(const ASTContext &C, StringRef AsmString,
|
||||||
StringRef AsmString,
|
ArrayRef<Token> AsmToks, ArrayRef<StringRef> Constraints,
|
||||||
ArrayRef<Token> AsmToks,
|
ArrayRef<Expr*> Exprs, ArrayRef<StringRef> Clobbers);
|
||||||
ArrayRef<StringRef> Constraints,
|
|
||||||
ArrayRef<Expr*> Exprs,
|
|
||||||
ArrayRef<StringRef> Clobbers);
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
|
SourceLocation getLocStart() const LLVM_READONLY { return AsmLoc; }
|
||||||
|
@ -1788,7 +1786,7 @@ class SEHExceptStmt : public Stmt {
|
||||||
explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) { }
|
explicit SEHExceptStmt(EmptyShell E) : Stmt(SEHExceptStmtClass, E) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SEHExceptStmt* Create(ASTContext &C,
|
static SEHExceptStmt* Create(const ASTContext &C,
|
||||||
SourceLocation ExceptLoc,
|
SourceLocation ExceptLoc,
|
||||||
Expr *FilterExpr,
|
Expr *FilterExpr,
|
||||||
Stmt *Block);
|
Stmt *Block);
|
||||||
|
@ -1829,7 +1827,7 @@ class SEHFinallyStmt : public Stmt {
|
||||||
explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) { }
|
explicit SEHFinallyStmt(EmptyShell E) : Stmt(SEHFinallyStmtClass, E) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SEHFinallyStmt* Create(ASTContext &C,
|
static SEHFinallyStmt* Create(const ASTContext &C,
|
||||||
SourceLocation FinallyLoc,
|
SourceLocation FinallyLoc,
|
||||||
Stmt *Block);
|
Stmt *Block);
|
||||||
|
|
||||||
|
@ -1868,10 +1866,8 @@ class SEHTryStmt : public Stmt {
|
||||||
explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) { }
|
explicit SEHTryStmt(EmptyShell E) : Stmt(SEHTryStmtClass, E) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static SEHTryStmt* Create(ASTContext &C,
|
static SEHTryStmt* Create(const ASTContext &C, bool isCXXTry,
|
||||||
bool isCXXTry,
|
SourceLocation TryLoc, Stmt *TryBlock,
|
||||||
SourceLocation TryLoc,
|
|
||||||
Stmt *TryBlock,
|
|
||||||
Stmt *Handler);
|
Stmt *Handler);
|
||||||
|
|
||||||
SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
|
SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
|
||||||
|
@ -1994,13 +1990,13 @@ private:
|
||||||
void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
|
void setCapturedStmt(Stmt *S) { getStoredStmts()[NumCaptures] = S; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CapturedStmt *Create(ASTContext &Context, Stmt *S,
|
static CapturedStmt *Create(const ASTContext &Context, Stmt *S,
|
||||||
CapturedRegionKind Kind,
|
CapturedRegionKind Kind,
|
||||||
ArrayRef<Capture> Captures,
|
ArrayRef<Capture> Captures,
|
||||||
ArrayRef<Expr *> CaptureInits,
|
ArrayRef<Expr *> CaptureInits,
|
||||||
CapturedDecl *CD, RecordDecl *RD);
|
CapturedDecl *CD, RecordDecl *RD);
|
||||||
|
|
||||||
static CapturedStmt *CreateDeserialized(ASTContext &Context,
|
static CapturedStmt *CreateDeserialized(const ASTContext &Context,
|
||||||
unsigned NumCaptures);
|
unsigned NumCaptures);
|
||||||
|
|
||||||
/// \brief Retrieve the statement being captured.
|
/// \brief Retrieve the statement being captured.
|
||||||
|
|
|
@ -79,10 +79,10 @@ class CXXTryStmt : public Stmt {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static CXXTryStmt *Create(ASTContext &C, SourceLocation tryLoc,
|
static CXXTryStmt *Create(const ASTContext &C, SourceLocation tryLoc,
|
||||||
Stmt *tryBlock, ArrayRef<Stmt*> handlers);
|
Stmt *tryBlock, ArrayRef<Stmt*> handlers);
|
||||||
|
|
||||||
static CXXTryStmt *Create(ASTContext &C, EmptyShell Empty,
|
static CXXTryStmt *Create(const ASTContext &C, EmptyShell Empty,
|
||||||
unsigned numHandlers);
|
unsigned numHandlers);
|
||||||
|
|
||||||
SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
|
SourceLocation getLocStart() const LLVM_READONLY { return getTryLoc(); }
|
||||||
|
|
|
@ -181,13 +181,12 @@ private:
|
||||||
HasFinally(HasFinally) { }
|
HasFinally(HasFinally) { }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ObjCAtTryStmt *Create(ASTContext &Context, SourceLocation atTryLoc,
|
static ObjCAtTryStmt *Create(const ASTContext &Context,
|
||||||
Stmt *atTryStmt,
|
SourceLocation atTryLoc, Stmt *atTryStmt,
|
||||||
Stmt **CatchStmts, unsigned NumCatchStmts,
|
Stmt **CatchStmts, unsigned NumCatchStmts,
|
||||||
Stmt *atFinallyStmt);
|
Stmt *atFinallyStmt);
|
||||||
static ObjCAtTryStmt *CreateEmpty(ASTContext &Context,
|
static ObjCAtTryStmt *CreateEmpty(const ASTContext &Context,
|
||||||
unsigned NumCatchStmts,
|
unsigned NumCatchStmts, bool HasFinally);
|
||||||
bool HasFinally);
|
|
||||||
|
|
||||||
/// \brief Retrieve the location of the @ in the \@try.
|
/// \brief Retrieve the location of the @ in the \@try.
|
||||||
SourceLocation getAtTryLoc() const { return AtTryLoc; }
|
SourceLocation getAtTryLoc() const { return AtTryLoc; }
|
||||||
|
|
|
@ -228,7 +228,7 @@ public:
|
||||||
/// \param EndLoc Ending location of the clause.
|
/// \param EndLoc Ending location of the clause.
|
||||||
/// \param VL List of references to the variables.
|
/// \param VL List of references to the variables.
|
||||||
///
|
///
|
||||||
static OMPPrivateClause *Create(ASTContext &C, SourceLocation StartLoc,
|
static OMPPrivateClause *Create(const ASTContext &C, SourceLocation StartLoc,
|
||||||
SourceLocation LParenLoc,
|
SourceLocation LParenLoc,
|
||||||
SourceLocation EndLoc,
|
SourceLocation EndLoc,
|
||||||
ArrayRef<Expr *> VL);
|
ArrayRef<Expr *> VL);
|
||||||
|
@ -237,7 +237,7 @@ public:
|
||||||
/// \param C AST context.
|
/// \param C AST context.
|
||||||
/// \param N The number of variables.
|
/// \param N The number of variables.
|
||||||
///
|
///
|
||||||
static OMPPrivateClause *CreateEmpty(ASTContext &C, unsigned N);
|
static OMPPrivateClause *CreateEmpty(const ASTContext &C, unsigned N);
|
||||||
|
|
||||||
StmtRange children() {
|
StmtRange children() {
|
||||||
return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
|
return StmtRange(reinterpret_cast<Stmt **>(varlist_begin()),
|
||||||
|
@ -386,7 +386,8 @@ public:
|
||||||
/// \param Clauses List of clauses.
|
/// \param Clauses List of clauses.
|
||||||
/// \param AssociatedStmt Statement associated with the directive.
|
/// \param AssociatedStmt Statement associated with the directive.
|
||||||
///
|
///
|
||||||
static OMPParallelDirective *Create(ASTContext &C, SourceLocation StartLoc,
|
static OMPParallelDirective *Create(const ASTContext &C,
|
||||||
|
SourceLocation StartLoc,
|
||||||
SourceLocation EndLoc,
|
SourceLocation EndLoc,
|
||||||
ArrayRef<OMPClause *> Clauses,
|
ArrayRef<OMPClause *> Clauses,
|
||||||
Stmt *AssociatedStmt);
|
Stmt *AssociatedStmt);
|
||||||
|
@ -396,7 +397,7 @@ public:
|
||||||
/// \param C AST context.
|
/// \param C AST context.
|
||||||
/// \param N The number of clauses.
|
/// \param N The number of clauses.
|
||||||
///
|
///
|
||||||
static OMPParallelDirective *CreateEmpty(ASTContext &C, unsigned N,
|
static OMPParallelDirective *CreateEmpty(const ASTContext &C, unsigned N,
|
||||||
EmptyShell);
|
EmptyShell);
|
||||||
|
|
||||||
static bool classof(const Stmt *T) {
|
static bool classof(const Stmt *T) {
|
||||||
|
|
|
@ -248,7 +248,7 @@ SourceLocation Stmt::getLocEnd() const {
|
||||||
llvm_unreachable("unknown statement kind");
|
llvm_unreachable("unknown statement kind");
|
||||||
}
|
}
|
||||||
|
|
||||||
CompoundStmt::CompoundStmt(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), LBracLoc(LB), RBracLoc(RB) {
|
||||||
CompoundStmtBits.NumStmts = Stmts.size();
|
CompoundStmtBits.NumStmts = Stmts.size();
|
||||||
|
@ -277,7 +277,7 @@ const char *LabelStmt::getName() const {
|
||||||
return getDecl()->getIdentifier()->getNameStart();
|
return getDecl()->getIdentifier()->getNameStart();
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributedStmt *AttributedStmt::Create(ASTContext &C, SourceLocation Loc,
|
AttributedStmt *AttributedStmt::Create(const ASTContext &C, SourceLocation Loc,
|
||||||
ArrayRef<const Attr*> Attrs,
|
ArrayRef<const Attr*> Attrs,
|
||||||
Stmt *SubStmt) {
|
Stmt *SubStmt) {
|
||||||
void *Mem = C.Allocate(sizeof(AttributedStmt) +
|
void *Mem = C.Allocate(sizeof(AttributedStmt) +
|
||||||
|
@ -286,7 +286,8 @@ AttributedStmt *AttributedStmt::Create(ASTContext &C, SourceLocation Loc,
|
||||||
return new (Mem) AttributedStmt(Loc, Attrs, SubStmt);
|
return new (Mem) AttributedStmt(Loc, Attrs, SubStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
AttributedStmt *AttributedStmt::CreateEmpty(ASTContext &C, unsigned NumAttrs) {
|
AttributedStmt *AttributedStmt::CreateEmpty(const ASTContext &C,
|
||||||
|
unsigned NumAttrs) {
|
||||||
assert(NumAttrs > 0 && "NumAttrs should be greater than zero");
|
assert(NumAttrs > 0 && "NumAttrs should be greater than zero");
|
||||||
void *Mem = C.Allocate(sizeof(AttributedStmt) +
|
void *Mem = C.Allocate(sizeof(AttributedStmt) +
|
||||||
sizeof(Attr*) * (NumAttrs - 1),
|
sizeof(Attr*) * (NumAttrs - 1),
|
||||||
|
@ -620,12 +621,12 @@ QualType CXXCatchStmt::getCaughtType() const {
|
||||||
// Constructors
|
// Constructors
|
||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
GCCAsmStmt::GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
GCCAsmStmt::GCCAsmStmt(const ASTContext &C, SourceLocation asmloc,
|
||||||
bool isvolatile, unsigned numoutputs, unsigned numinputs,
|
bool issimple, bool isvolatile, unsigned numoutputs,
|
||||||
IdentifierInfo **names, StringLiteral **constraints,
|
unsigned numinputs, IdentifierInfo **names,
|
||||||
Expr **exprs, StringLiteral *asmstr,
|
StringLiteral **constraints, Expr **exprs,
|
||||||
unsigned numclobbers, StringLiteral **clobbers,
|
StringLiteral *asmstr, unsigned numclobbers,
|
||||||
SourceLocation rparenloc)
|
StringLiteral **clobbers, SourceLocation rparenloc)
|
||||||
: AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
|
: AsmStmt(GCCAsmStmtClass, asmloc, issimple, isvolatile, numoutputs,
|
||||||
numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
|
numinputs, numclobbers), RParenLoc(rparenloc), AsmStr(asmstr) {
|
||||||
|
|
||||||
|
@ -644,7 +645,7 @@ GCCAsmStmt::GCCAsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||||
std::copy(clobbers, clobbers + NumClobbers, Clobbers);
|
std::copy(clobbers, clobbers + NumClobbers, Clobbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
|
MSAsmStmt::MSAsmStmt(const ASTContext &C, SourceLocation asmloc,
|
||||||
SourceLocation lbraceloc, bool issimple, bool isvolatile,
|
SourceLocation lbraceloc, bool issimple, bool isvolatile,
|
||||||
ArrayRef<Token> asmtoks, unsigned numoutputs,
|
ArrayRef<Token> asmtoks, unsigned numoutputs,
|
||||||
unsigned numinputs,
|
unsigned numinputs,
|
||||||
|
@ -658,15 +659,14 @@ MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
|
||||||
initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
|
initialize(C, asmstr, asmtoks, constraints, exprs, clobbers);
|
||||||
}
|
}
|
||||||
|
|
||||||
static StringRef copyIntoContext(ASTContext &C, StringRef str) {
|
static StringRef copyIntoContext(const ASTContext &C, StringRef str) {
|
||||||
size_t size = str.size();
|
size_t size = str.size();
|
||||||
char *buffer = new (C) char[size];
|
char *buffer = new (C) char[size];
|
||||||
memcpy(buffer, str.data(), size);
|
memcpy(buffer, str.data(), size);
|
||||||
return StringRef(buffer, size);
|
return StringRef(buffer, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MSAsmStmt::initialize(ASTContext &C,
|
void MSAsmStmt::initialize(const ASTContext &C, StringRef asmstr,
|
||||||
StringRef asmstr,
|
|
||||||
ArrayRef<Token> asmtoks,
|
ArrayRef<Token> asmtoks,
|
||||||
ArrayRef<StringRef> constraints,
|
ArrayRef<StringRef> constraints,
|
||||||
ArrayRef<Expr*> exprs,
|
ArrayRef<Expr*> exprs,
|
||||||
|
@ -726,7 +726,7 @@ ObjCAtTryStmt::ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
||||||
Stmts[NumCatchStmts + 1] = atFinallyStmt;
|
Stmts[NumCatchStmts + 1] = atFinallyStmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
ObjCAtTryStmt *ObjCAtTryStmt::Create(const ASTContext &Context,
|
||||||
SourceLocation atTryLoc,
|
SourceLocation atTryLoc,
|
||||||
Stmt *atTryStmt,
|
Stmt *atTryStmt,
|
||||||
Stmt **CatchStmts,
|
Stmt **CatchStmts,
|
||||||
|
@ -739,9 +739,9 @@ ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
||||||
atFinallyStmt);
|
atFinallyStmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
|
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(const ASTContext &Context,
|
||||||
unsigned NumCatchStmts,
|
unsigned NumCatchStmts,
|
||||||
bool HasFinally) {
|
bool HasFinally) {
|
||||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||||
(1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
|
(1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
|
||||||
void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
|
void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
|
||||||
|
@ -756,7 +756,7 @@ SourceLocation ObjCAtTryStmt::getLocEnd() const {
|
||||||
return getTryBody()->getLocEnd();
|
return getTryBody()->getLocEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
|
CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, SourceLocation tryLoc,
|
||||||
Stmt *tryBlock, ArrayRef<Stmt*> handlers) {
|
Stmt *tryBlock, ArrayRef<Stmt*> handlers) {
|
||||||
std::size_t Size = sizeof(CXXTryStmt);
|
std::size_t Size = sizeof(CXXTryStmt);
|
||||||
Size += ((handlers.size() + 1) * sizeof(Stmt));
|
Size += ((handlers.size() + 1) * sizeof(Stmt));
|
||||||
|
@ -765,7 +765,7 @@ CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
|
||||||
return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers);
|
return new (Mem) CXXTryStmt(tryLoc, tryBlock, handlers);
|
||||||
}
|
}
|
||||||
|
|
||||||
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, EmptyShell Empty,
|
CXXTryStmt *CXXTryStmt::Create(const ASTContext &C, EmptyShell Empty,
|
||||||
unsigned numHandlers) {
|
unsigned numHandlers) {
|
||||||
std::size_t Size = sizeof(CXXTryStmt);
|
std::size_t Size = sizeof(CXXTryStmt);
|
||||||
Size += ((numHandlers + 1) * sizeof(Stmt));
|
Size += ((numHandlers + 1) * sizeof(Stmt));
|
||||||
|
@ -816,7 +816,7 @@ const VarDecl *CXXForRangeStmt::getLoopVariable() const {
|
||||||
return const_cast<CXXForRangeStmt*>(this)->getLoopVariable();
|
return const_cast<CXXForRangeStmt*>(this)->getLoopVariable();
|
||||||
}
|
}
|
||||||
|
|
||||||
IfStmt::IfStmt(ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
|
IfStmt::IfStmt(const ASTContext &C, SourceLocation IL, VarDecl *var, Expr *cond,
|
||||||
Stmt *then, SourceLocation EL, Stmt *elsev)
|
Stmt *then, SourceLocation EL, Stmt *elsev)
|
||||||
: Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL)
|
: Stmt(IfStmtClass), IfLoc(IL), ElseLoc(EL)
|
||||||
{
|
{
|
||||||
|
@ -834,7 +834,7 @@ VarDecl *IfStmt::getConditionVariable() const {
|
||||||
return cast<VarDecl>(DS->getSingleDecl());
|
return cast<VarDecl>(DS->getSingleDecl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
void IfStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
|
||||||
if (!V) {
|
if (!V) {
|
||||||
SubExprs[VAR] = 0;
|
SubExprs[VAR] = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -845,7 +845,7 @@ void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
||||||
VarRange.getEnd());
|
VarRange.getEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
ForStmt::ForStmt(const ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
||||||
Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
|
Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
|
||||||
SourceLocation RP)
|
SourceLocation RP)
|
||||||
: Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
|
: Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
|
||||||
|
@ -865,7 +865,7 @@ VarDecl *ForStmt::getConditionVariable() const {
|
||||||
return cast<VarDecl>(DS->getSingleDecl());
|
return cast<VarDecl>(DS->getSingleDecl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
void ForStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
|
||||||
if (!V) {
|
if (!V) {
|
||||||
SubExprs[CONDVAR] = 0;
|
SubExprs[CONDVAR] = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -876,7 +876,7 @@ void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
||||||
VarRange.getEnd());
|
VarRange.getEnd());
|
||||||
}
|
}
|
||||||
|
|
||||||
SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond)
|
SwitchStmt::SwitchStmt(const ASTContext &C, VarDecl *Var, Expr *cond)
|
||||||
: Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
|
: Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
|
||||||
{
|
{
|
||||||
setConditionVariable(C, Var);
|
setConditionVariable(C, Var);
|
||||||
|
@ -892,7 +892,7 @@ VarDecl *SwitchStmt::getConditionVariable() const {
|
||||||
return cast<VarDecl>(DS->getSingleDecl());
|
return cast<VarDecl>(DS->getSingleDecl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void SwitchStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
void SwitchStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
|
||||||
if (!V) {
|
if (!V) {
|
||||||
SubExprs[VAR] = 0;
|
SubExprs[VAR] = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -909,7 +909,7 @@ Stmt *SwitchCase::getSubStmt() {
|
||||||
return cast<DefaultStmt>(this)->getSubStmt();
|
return cast<DefaultStmt>(this)->getSubStmt();
|
||||||
}
|
}
|
||||||
|
|
||||||
WhileStmt::WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
WhileStmt::WhileStmt(const ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
||||||
SourceLocation WL)
|
SourceLocation WL)
|
||||||
: Stmt(WhileStmtClass) {
|
: Stmt(WhileStmtClass) {
|
||||||
setConditionVariable(C, Var);
|
setConditionVariable(C, Var);
|
||||||
|
@ -926,7 +926,7 @@ VarDecl *WhileStmt::getConditionVariable() const {
|
||||||
return cast<VarDecl>(DS->getSingleDecl());
|
return cast<VarDecl>(DS->getSingleDecl());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WhileStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
void WhileStmt::setConditionVariable(const ASTContext &C, VarDecl *V) {
|
||||||
if (!V) {
|
if (!V) {
|
||||||
SubExprs[VAR] = 0;
|
SubExprs[VAR] = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -965,10 +965,8 @@ SEHTryStmt::SEHTryStmt(bool IsCXXTry,
|
||||||
Children[HANDLER] = Handler;
|
Children[HANDLER] = Handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEHTryStmt* SEHTryStmt::Create(ASTContext &C,
|
SEHTryStmt* SEHTryStmt::Create(const ASTContext &C, bool IsCXXTry,
|
||||||
bool IsCXXTry,
|
SourceLocation TryLoc, Stmt *TryBlock,
|
||||||
SourceLocation TryLoc,
|
|
||||||
Stmt *TryBlock,
|
|
||||||
Stmt *Handler) {
|
Stmt *Handler) {
|
||||||
return new(C) SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
|
return new(C) SEHTryStmt(IsCXXTry,TryLoc,TryBlock,Handler);
|
||||||
}
|
}
|
||||||
|
@ -991,10 +989,8 @@ SEHExceptStmt::SEHExceptStmt(SourceLocation Loc,
|
||||||
Children[BLOCK] = Block;
|
Children[BLOCK] = Block;
|
||||||
}
|
}
|
||||||
|
|
||||||
SEHExceptStmt* SEHExceptStmt::Create(ASTContext &C,
|
SEHExceptStmt* SEHExceptStmt::Create(const ASTContext &C, SourceLocation Loc,
|
||||||
SourceLocation Loc,
|
Expr *FilterExpr, Stmt *Block) {
|
||||||
Expr *FilterExpr,
|
|
||||||
Stmt *Block) {
|
|
||||||
return new(C) SEHExceptStmt(Loc,FilterExpr,Block);
|
return new(C) SEHExceptStmt(Loc,FilterExpr,Block);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1005,8 +1001,7 @@ SEHFinallyStmt::SEHFinallyStmt(SourceLocation Loc,
|
||||||
Block(Block)
|
Block(Block)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
SEHFinallyStmt* SEHFinallyStmt::Create(ASTContext &C,
|
SEHFinallyStmt* SEHFinallyStmt::Create(const ASTContext &C, SourceLocation Loc,
|
||||||
SourceLocation Loc,
|
|
||||||
Stmt *Block) {
|
Stmt *Block) {
|
||||||
return new(C)SEHFinallyStmt(Loc,Block);
|
return new(C)SEHFinallyStmt(Loc,Block);
|
||||||
}
|
}
|
||||||
|
@ -1053,7 +1048,7 @@ CapturedStmt::CapturedStmt(EmptyShell Empty, unsigned NumCaptures)
|
||||||
getStoredStmts()[NumCaptures] = 0;
|
getStoredStmts()[NumCaptures] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
CapturedStmt *CapturedStmt::Create(ASTContext &Context, Stmt *S,
|
CapturedStmt *CapturedStmt::Create(const ASTContext &Context, Stmt *S,
|
||||||
CapturedRegionKind Kind,
|
CapturedRegionKind Kind,
|
||||||
ArrayRef<Capture> Captures,
|
ArrayRef<Capture> Captures,
|
||||||
ArrayRef<Expr *> CaptureInits,
|
ArrayRef<Expr *> CaptureInits,
|
||||||
|
@ -1081,7 +1076,7 @@ CapturedStmt *CapturedStmt::Create(ASTContext &Context, Stmt *S,
|
||||||
return new (Mem) CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
|
return new (Mem) CapturedStmt(S, Kind, Captures, CaptureInits, CD, RD);
|
||||||
}
|
}
|
||||||
|
|
||||||
CapturedStmt *CapturedStmt::CreateDeserialized(ASTContext &Context,
|
CapturedStmt *CapturedStmt::CreateDeserialized(const ASTContext &Context,
|
||||||
unsigned NumCaptures) {
|
unsigned NumCaptures) {
|
||||||
unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1);
|
unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1);
|
||||||
if (NumCaptures > 0) {
|
if (NumCaptures > 0) {
|
||||||
|
@ -1115,7 +1110,7 @@ bool CapturedStmt::capturesVariable(const VarDecl *Var) const {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPPrivateClause *OMPPrivateClause::Create(ASTContext &C,
|
OMPPrivateClause *OMPPrivateClause::Create(const ASTContext &C,
|
||||||
SourceLocation StartLoc,
|
SourceLocation StartLoc,
|
||||||
SourceLocation LParenLoc,
|
SourceLocation LParenLoc,
|
||||||
SourceLocation EndLoc,
|
SourceLocation EndLoc,
|
||||||
|
@ -1128,7 +1123,7 @@ OMPPrivateClause *OMPPrivateClause::Create(ASTContext &C,
|
||||||
return Clause;
|
return Clause;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPPrivateClause *OMPPrivateClause::CreateEmpty(ASTContext &C,
|
OMPPrivateClause *OMPPrivateClause::CreateEmpty(const ASTContext &C,
|
||||||
unsigned N) {
|
unsigned N) {
|
||||||
void *Mem = C.Allocate(sizeof(OMPPrivateClause) + sizeof(Expr *) * N,
|
void *Mem = C.Allocate(sizeof(OMPPrivateClause) + sizeof(Expr *) * N,
|
||||||
llvm::alignOf<OMPPrivateClause>());
|
llvm::alignOf<OMPPrivateClause>());
|
||||||
|
@ -1142,7 +1137,7 @@ void OMPExecutableDirective::setClauses(ArrayRef<OMPClause *> Clauses) {
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPParallelDirective *OMPParallelDirective::Create(
|
OMPParallelDirective *OMPParallelDirective::Create(
|
||||||
ASTContext &C,
|
const ASTContext &C,
|
||||||
SourceLocation StartLoc,
|
SourceLocation StartLoc,
|
||||||
SourceLocation EndLoc,
|
SourceLocation EndLoc,
|
||||||
ArrayRef<OMPClause *> Clauses,
|
ArrayRef<OMPClause *> Clauses,
|
||||||
|
@ -1157,7 +1152,7 @@ OMPParallelDirective *OMPParallelDirective::Create(
|
||||||
return Dir;
|
return Dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
OMPParallelDirective *OMPParallelDirective::CreateEmpty(ASTContext &C,
|
OMPParallelDirective *OMPParallelDirective::CreateEmpty(const ASTContext &C,
|
||||||
unsigned N,
|
unsigned N,
|
||||||
EmptyShell) {
|
EmptyShell) {
|
||||||
void *Mem = C.Allocate(sizeof(OMPParallelDirective) +
|
void *Mem = C.Allocate(sizeof(OMPParallelDirective) +
|
||||||
|
|
Loading…
Reference in New Issue