summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Stmt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r--clang/lib/AST/Stmt.cpp27
1 files changed, 10 insertions, 17 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index 84622658d5e..ac432e85a7c 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -630,14 +630,6 @@ Expr *MSAsmStmt::getOutputExpr(unsigned i) {
return cast<Expr>(Exprs[i]);
}
-/// getOutputConstraint - Return the constraint string for the specified
-/// output operand. All output constraints are known to be non-empty (either
-/// '=' or '+').
-StringRef MSAsmStmt::getOutputConstraint(unsigned i) const {
- // FIXME: Compute constraints.
- return StringRef();
-}
-
Expr *MSAsmStmt::getInputExpr(unsigned i) {
return cast<Expr>(Exprs[i + NumOutputs]);
}
@@ -645,13 +637,6 @@ void MSAsmStmt::setInputExpr(unsigned i, Expr *E) {
Exprs[i + NumOutputs] = E;
}
-/// getInputConstraint - Return the specified input constraint. Unlike output
-/// constraints, these can be empty.
-StringRef MSAsmStmt::getInputConstraint(unsigned i) const {
- // FIXME: Compute constraints.
- return StringRef();
-}
-
QualType CXXCatchStmt::getCaughtType() const {
if (ExceptionDecl)
return ExceptionDecl->getType();
@@ -691,8 +676,8 @@ MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
ArrayRef<Token> asmtoks, ArrayRef<IdentifierInfo*> inputs,
ArrayRef<IdentifierInfo*> outputs,
ArrayRef<Expr*> inputexprs, ArrayRef<Expr*> outputexprs,
- StringRef asmstr, ArrayRef<StringRef> clobbers,
- SourceLocation endloc)
+ StringRef asmstr, ArrayRef<StringRef> constraints,
+ ArrayRef<StringRef> clobbers, SourceLocation endloc)
: AsmStmt(MSAsmStmtClass, asmloc, issimple, isvolatile, outputs.size(), inputs.size(),
clobbers.size()), LBraceLoc(lbraceloc), EndLoc(endloc),
AsmStr(asmstr.str()), NumAsmToks(asmtoks.size()) {
@@ -717,6 +702,14 @@ MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
for (unsigned i = 0, e = NumAsmToks; i != e; ++i)
AsmToks[i] = asmtoks[i];
+ Constraints = new (C) StringRef[NumExprs];
+ for (unsigned i = 0, e = NumExprs; i != e; ++i) {
+ size_t size = constraints[i].size();
+ char *dest = new (C) char[size];
+ std::strncpy(dest, constraints[i].data(), size);
+ Constraints[i] = StringRef(dest, size);
+ }
+
Clobbers = new (C) StringRef[NumClobbers];
for (unsigned i = 0, e = NumClobbers; i != e; ++i) {
// FIXME: Avoid the allocation/copy if at all possible.
OpenPOWER on IntegriCloud