summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseStmt.cpp
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-08-24 21:42:51 +0000
committerChad Rosier <mcrosier@apple.com>2012-08-24 21:42:51 +0000
commit175ea24e383d6277fb94434043e8d1059a89c22b (patch)
treea245e7b543d2f35dbdf40c64f446fd83c31f65a4 /clang/lib/Parse/ParseStmt.cpp
parentbfd96e11edfc80662967401f62f5955e3deca17d (diff)
downloadbcm5719-llvm-175ea24e383d6277fb94434043e8d1059a89c22b.tar.gz
bcm5719-llvm-175ea24e383d6277fb94434043e8d1059a89c22b.zip
[ms-inline asm] Change the -fenable-experimental-ms-inline-asm option from a
CodeGen option to a LangOpt option. In turn, hoist the guard into the parser so that we avoid the new (and fairly unstable) Sema/AST/CodeGen logic. This should restore the behavior of clang to that prior to r158325. <rdar://problem/12163681> llvm-svn: 162602
Diffstat (limited to 'clang/lib/Parse/ParseStmt.cpp')
-rw-r--r--clang/lib/Parse/ParseStmt.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/clang/lib/Parse/ParseStmt.cpp b/clang/lib/Parse/ParseStmt.cpp
index 72536fa6821..37f5bc51ca6 100644
--- a/clang/lib/Parse/ParseStmt.cpp
+++ b/clang/lib/Parse/ParseStmt.cpp
@@ -1596,6 +1596,9 @@ StmtResult Parser::ParseReturnStatement() {
/// ms-asm-line '\n' ms-asm-instruction-block
///
StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
+ // MS-style inline assembly is not fully supported, so emit a warning.
+ Diag(AsmLoc, diag::warn_unsupported_msasm);
+
SourceManager &SrcMgr = PP.getSourceManager();
SourceLocation EndLoc = AsmLoc;
SmallVector<Token, 4> AsmToks;
@@ -1688,6 +1691,21 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
return StmtError();
}
+ // If MS-style inline assembly is disabled, then build an empty asm.
+ if (!getLangOpts().EmitMicrosoftInlineAsm) {
+ Token t;
+ t.setKind(tok::string_literal);
+ t.setLiteralData("\"/*FIXME: not done*/\"");
+ t.clearFlag(Token::NeedsCleaning);
+ t.setLength(21);
+ ExprResult AsmString(Actions.ActOnStringLiteral(&t, 1));
+ ExprVector Constraints;
+ ExprVector Exprs;
+ ExprVector Clobbers;
+ return Actions.ActOnAsmStmt(AsmLoc, true, true, 0, 0, 0, Constraints, Exprs,
+ AsmString.take(), Clobbers, EndLoc);
+ }
+
// FIXME: We should be passing source locations for better diagnostics.
return Actions.ActOnMSAsmStmt(AsmLoc, LBraceLoc,
llvm::makeArrayRef(AsmToks), EndLoc);
OpenPOWER on IntegriCloud