diff options
author | Chad Rosier <mcrosier@apple.com> | 2012-08-24 00:07:09 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2012-08-24 00:07:09 +0000 |
commit | fe31e626ca8068b69f99fe64c6beda0ac6ac37a2 (patch) | |
tree | a1d94f63e3e5d385acff96d5d8796fcf1012a9f5 /clang/lib/AST/Stmt.cpp | |
parent | 3d5d3d3e2cba3762cc919f661a22189797d076cc (diff) | |
download | bcm5719-llvm-fe31e626ca8068b69f99fe64c6beda0ac6ac37a2.tar.gz bcm5719-llvm-fe31e626ca8068b69f99fe64c6beda0ac6ac37a2.zip |
[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST. Next we need
generate the Input/Output expressions using Sema::ActOnIdExpression().
llvm-svn: 162509
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 963a20c3389..6b14ae5fd2f 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -548,6 +548,17 @@ unsigned AsmStmt::AnalyzeAsmString(SmallVectorImpl<AsmStringPiece>&Pieces, } } +Expr *MSAsmStmt::getOutputExpr(unsigned i) { + return cast<Expr>(Exprs[i]); +} + +Expr *MSAsmStmt::getInputExpr(unsigned i) { + return cast<Expr>(Exprs[i + NumOutputs]); +} +void MSAsmStmt::setInputExpr(unsigned i, Expr *E) { + Exprs[i + NumOutputs] = E; +} + QualType CXXCatchStmt::getCaughtType() const { if (ExceptionDecl) return ExceptionDecl->getType(); @@ -585,12 +596,16 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple, MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc, bool issimple, bool isvolatile, ArrayRef<Token> asmtoks, ArrayRef<IdentifierInfo*> inputs, - ArrayRef<IdentifierInfo*> outputs, StringRef asmstr, - ArrayRef<StringRef> clobbers, SourceLocation endloc) + ArrayRef<IdentifierInfo*> outputs, + ArrayRef<Expr*> inputexprs, ArrayRef<Expr*> outputexprs, + StringRef asmstr, ArrayRef<StringRef> clobbers, + SourceLocation endloc) : Stmt(MSAsmStmtClass), AsmLoc(asmloc), LBraceLoc(lbraceloc), EndLoc(endloc), AsmStr(asmstr.str()), IsSimple(issimple), IsVolatile(isvolatile), NumAsmToks(asmtoks.size()), NumInputs(inputs.size()), NumOutputs(outputs.size()), NumClobbers(clobbers.size()) { + assert (inputs.size() == inputexprs.size() && "Input expr size mismatch!"); + assert (outputs.size() == outputexprs.size() && "Input expr size mismatch!"); unsigned NumExprs = NumOutputs + NumInputs; @@ -600,6 +615,12 @@ MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc, for (unsigned i = NumOutputs, e = NumExprs; i != e; ++i) Names[i] = inputs[i]; + Exprs = new (C) Stmt*[NumExprs]; + for (unsigned i = 0, e = NumOutputs; i != e; ++i) + Exprs[i] = outputexprs[i]; + for (unsigned i = NumOutputs, e = NumExprs; i != e; ++i) + Exprs[i] = inputexprs[i]; + AsmToks = new (C) Token[NumAsmToks]; for (unsigned i = 0, e = NumAsmToks; i != e; ++i) AsmToks[i] = asmtoks[i]; |