forked from OSchip/llvm-project
parent
fbf45dc2bd
commit
42032fafe4
|
@ -361,7 +361,7 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
|
|||
StringLiteral **Constraints,
|
||||
Stmt **Exprs,
|
||||
unsigned NumOutputs,
|
||||
unsigned NumInputs,
|
||||
unsigned NumInputs,
|
||||
StringLiteral **Clobbers,
|
||||
unsigned NumClobbers) {
|
||||
this->NumOutputs = NumOutputs;
|
||||
|
@ -369,19 +369,19 @@ void AsmStmt::setOutputsAndInputsAndClobbers(ASTContext &C,
|
|||
this->NumClobbers = NumClobbers;
|
||||
|
||||
unsigned NumExprs = NumOutputs + NumInputs;
|
||||
|
||||
|
||||
C.Deallocate(this->Names);
|
||||
this->Names = new (C) IdentifierInfo*[NumExprs];
|
||||
std::copy(Names, Names + NumExprs, this->Names);
|
||||
|
||||
|
||||
C.Deallocate(this->Exprs);
|
||||
this->Exprs = new (C) Stmt*[NumExprs];
|
||||
std::copy(Exprs, Exprs + NumExprs, this->Exprs);
|
||||
|
||||
|
||||
C.Deallocate(this->Constraints);
|
||||
this->Constraints = new (C) StringLiteral*[NumExprs];
|
||||
std::copy(Constraints, Constraints + NumExprs, this->Constraints);
|
||||
|
||||
|
||||
C.Deallocate(this->Clobbers);
|
||||
this->Clobbers = new (C) StringLiteral*[NumClobbers];
|
||||
std::copy(Clobbers, Clobbers + NumClobbers, this->Clobbers);
|
||||
|
@ -440,7 +440,7 @@ unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces,
|
|||
std::string CurStringPiece;
|
||||
|
||||
bool HasVariants = !C.getTargetInfo().hasNoAsmVariants();
|
||||
|
||||
|
||||
while (1) {
|
||||
// Done with the string?
|
||||
if (CurPtr == StrEnd) {
|
||||
|
@ -461,7 +461,7 @@ unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces,
|
|||
CurStringPiece += CurChar;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// Escaped "%" character in asm string.
|
||||
if (CurPtr == StrEnd) {
|
||||
// % at end of string is invalid (no escape).
|
||||
|
@ -558,8 +558,8 @@ QualType CXXCatchStmt::getCaughtType() const {
|
|||
// Constructors
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||
bool isvolatile, bool msasm,
|
||||
AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
||||
bool isvolatile, bool msasm,
|
||||
unsigned numoutputs, unsigned numinputs,
|
||||
IdentifierInfo **names, StringLiteral **constraints,
|
||||
Expr **exprs, StringLiteral *asmstr, unsigned numclobbers,
|
||||
|
@ -568,8 +568,8 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
|||
, IsSimple(issimple), IsVolatile(isvolatile), MSAsm(msasm)
|
||||
, NumOutputs(numoutputs), NumInputs(numinputs), NumClobbers(numclobbers) {
|
||||
|
||||
unsigned NumExprs = NumOutputs +NumInputs;
|
||||
|
||||
unsigned NumExprs = NumOutputs + NumInputs;
|
||||
|
||||
Names = new (C) IdentifierInfo*[NumExprs];
|
||||
std::copy(names, names + NumExprs, Names);
|
||||
|
||||
|
@ -615,31 +615,31 @@ ObjCAtTryStmt::ObjCAtTryStmt(SourceLocation atTryLoc, Stmt *atTryStmt,
|
|||
Stmts[0] = atTryStmt;
|
||||
for (unsigned I = 0; I != NumCatchStmts; ++I)
|
||||
Stmts[I + 1] = CatchStmts[I];
|
||||
|
||||
|
||||
if (HasFinally)
|
||||
Stmts[NumCatchStmts + 1] = atFinallyStmt;
|
||||
}
|
||||
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
||||
SourceLocation atTryLoc,
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::Create(ASTContext &Context,
|
||||
SourceLocation atTryLoc,
|
||||
Stmt *atTryStmt,
|
||||
Stmt **CatchStmts,
|
||||
Stmt **CatchStmts,
|
||||
unsigned NumCatchStmts,
|
||||
Stmt *atFinallyStmt) {
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
(1 + NumCatchStmts + (atFinallyStmt != 0)) * sizeof(Stmt *);
|
||||
void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
|
||||
return new (Mem) ObjCAtTryStmt(atTryLoc, atTryStmt, CatchStmts, NumCatchStmts,
|
||||
atFinallyStmt);
|
||||
}
|
||||
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
|
||||
ObjCAtTryStmt *ObjCAtTryStmt::CreateEmpty(ASTContext &Context,
|
||||
unsigned NumCatchStmts,
|
||||
bool HasFinally) {
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
unsigned Size = sizeof(ObjCAtTryStmt) +
|
||||
(1 + NumCatchStmts + HasFinally) * sizeof(Stmt *);
|
||||
void *Mem = Context.Allocate(Size, llvm::alignOf<ObjCAtTryStmt>());
|
||||
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
|
||||
return new (Mem) ObjCAtTryStmt(EmptyShell(), NumCatchStmts, HasFinally);
|
||||
}
|
||||
|
||||
SourceRange ObjCAtTryStmt::getSourceRange() const {
|
||||
|
@ -650,12 +650,12 @@ SourceRange ObjCAtTryStmt::getSourceRange() const {
|
|||
EndLoc = getCatchStmt(NumCatchStmts - 1)->getLocEnd();
|
||||
else
|
||||
EndLoc = getTryBody()->getLocEnd();
|
||||
|
||||
|
||||
return SourceRange(AtTryLoc, EndLoc);
|
||||
}
|
||||
|
||||
CXXTryStmt *CXXTryStmt::Create(ASTContext &C, SourceLocation tryLoc,
|
||||
Stmt *tryBlock, Stmt **handlers,
|
||||
Stmt *tryBlock, Stmt **handlers,
|
||||
unsigned numHandlers) {
|
||||
std::size_t Size = sizeof(CXXTryStmt);
|
||||
Size += ((numHandlers + 1) * sizeof(Stmt));
|
||||
|
@ -715,20 +715,20 @@ const VarDecl *CXXForRangeStmt::getLoopVariable() const {
|
|||
return const_cast<CXXForRangeStmt*>(this)->getLoopVariable();
|
||||
}
|
||||
|
||||
IfStmt::IfStmt(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)
|
||||
{
|
||||
setConditionVariable(C, var);
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
SubExprs[THEN] = then;
|
||||
SubExprs[ELSE] = elsev;
|
||||
SubExprs[ELSE] = elsev;
|
||||
}
|
||||
|
||||
VarDecl *IfStmt::getConditionVariable() const {
|
||||
if (!SubExprs[VAR])
|
||||
return 0;
|
||||
|
||||
|
||||
DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
|
||||
return cast<VarDecl>(DS->getSingleDecl());
|
||||
}
|
||||
|
@ -738,16 +738,16 @@ void IfStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
|||
SubExprs[VAR] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SourceRange VarRange = V->getSourceRange();
|
||||
SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(),
|
||||
VarRange.getEnd());
|
||||
}
|
||||
|
||||
ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
||||
Expr *Inc, Stmt *Body, SourceLocation FL, SourceLocation LP,
|
||||
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)
|
||||
: Stmt(ForStmtClass), ForLoc(FL), LParenLoc(LP), RParenLoc(RP)
|
||||
{
|
||||
SubExprs[INIT] = Init;
|
||||
setConditionVariable(C, condVar);
|
||||
|
@ -759,7 +759,7 @@ ForStmt::ForStmt(ASTContext &C, Stmt *Init, Expr *Cond, VarDecl *condVar,
|
|||
VarDecl *ForStmt::getConditionVariable() const {
|
||||
if (!SubExprs[CONDVAR])
|
||||
return 0;
|
||||
|
||||
|
||||
DeclStmt *DS = cast<DeclStmt>(SubExprs[CONDVAR]);
|
||||
return cast<VarDecl>(DS->getSingleDecl());
|
||||
}
|
||||
|
@ -769,14 +769,14 @@ void ForStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
|||
SubExprs[CONDVAR] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SourceRange VarRange = V->getSourceRange();
|
||||
SubExprs[CONDVAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(),
|
||||
VarRange.getEnd());
|
||||
}
|
||||
|
||||
SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond)
|
||||
: Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
|
||||
SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond)
|
||||
: Stmt(SwitchStmtClass), FirstCase(0), AllEnumCasesCovered(0)
|
||||
{
|
||||
setConditionVariable(C, Var);
|
||||
SubExprs[COND] = reinterpret_cast<Stmt*>(cond);
|
||||
|
@ -786,7 +786,7 @@ SwitchStmt::SwitchStmt(ASTContext &C, VarDecl *Var, Expr *cond)
|
|||
VarDecl *SwitchStmt::getConditionVariable() const {
|
||||
if (!SubExprs[VAR])
|
||||
return 0;
|
||||
|
||||
|
||||
DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
|
||||
return cast<VarDecl>(DS->getSingleDecl());
|
||||
}
|
||||
|
@ -796,7 +796,7 @@ void SwitchStmt::setConditionVariable(ASTContext &C, VarDecl *V) {
|
|||
SubExprs[VAR] = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SourceRange VarRange = V->getSourceRange();
|
||||
SubExprs[VAR] = new (C) DeclStmt(DeclGroupRef(V), VarRange.getBegin(),
|
||||
VarRange.getEnd());
|
||||
|
@ -808,7 +808,7 @@ Stmt *SwitchCase::getSubStmt() {
|
|||
return cast<DefaultStmt>(this)->getSubStmt();
|
||||
}
|
||||
|
||||
WhileStmt::WhileStmt(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);
|
||||
|
@ -820,7 +820,7 @@ WhileStmt::WhileStmt(ASTContext &C, VarDecl *Var, Expr *cond, Stmt *body,
|
|||
VarDecl *WhileStmt::getConditionVariable() const {
|
||||
if (!SubExprs[VAR])
|
||||
return 0;
|
||||
|
||||
|
||||
DeclStmt *DS = cast<DeclStmt>(SubExprs[VAR]);
|
||||
return cast<VarDecl>(DS->getSingleDecl());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue