[ms-inline asm] Add the basic APIs for Exprs to the MSAsmStmt AST. Next we need
generate the Input/Output expressions using Sema::ActOnIdExpression().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@162509 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaStmtAsm.cpp b/lib/Sema/SemaStmtAsm.cpp
index 38bc254..039aa1e 100644
--- a/lib/Sema/SemaStmtAsm.cpp
+++ b/lib/Sema/SemaStmtAsm.cpp
@@ -458,7 +458,8 @@
MSAsmStmt *NS = \
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true, \
/*IsVolatile*/ true, AsmToks, Inputs, Outputs, \
- AsmString, Clobbers, EndLoc);
+ InputExprs, OutputExprs, AsmString, Clobbers, \
+ EndLoc);
StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
SourceLocation LBraceLoc,
@@ -470,6 +471,8 @@
std::set<std::string> ClobberRegs;
SmallVector<IdentifierInfo*, 4> Inputs;
SmallVector<IdentifierInfo*, 4> Outputs;
+ SmallVector<Expr*, 4> InputExprs;
+ SmallVector<Expr*, 4> OutputExprs;
// Empty asm statements don't need to instantiate the AsmParser, etc.
if (AsmToks.empty()) {
@@ -593,8 +596,16 @@
IdentifierInfo *II = getIdentifierInfo(Name, AsmToks,
AsmTokRanges[StrIdx].first,
AsmTokRanges[StrIdx].second);
- if (II)
- isDef ? Outputs.push_back(II) : Inputs.push_back(II);
+ if (II) {
+ // FIXME: Compute the InputExpr/OutputExpr using ActOnIdExpression().
+ if (isDef) {
+ Outputs.push_back(II);
+ OutputExprs.push_back(0);
+ } else {
+ Inputs.push_back(II);
+ InputExprs.push_back(0);
+ }
+ }
}
}
}
@@ -606,6 +617,7 @@
MSAsmStmt *NS =
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
/*IsVolatile*/ true, AsmToks, Inputs, Outputs,
- AsmString, Clobbers, EndLoc);
+ InputExprs, OutputExprs, AsmString, Clobbers,
+ EndLoc);
return Owned(NS);
}