diff options
author | Chad Rosier <mcrosier@apple.com> | 2013-01-24 20:24:34 +0000 |
---|---|---|
committer | Chad Rosier <mcrosier@apple.com> | 2013-01-24 20:24:34 +0000 |
commit | 282d675b28783254b06f2fbb2f96d3b41e273c6a (patch) | |
tree | cd0c27ca7863b8195c0c142334013107c5a71108 /clang/lib/Sema/SemaStmtAsm.cpp | |
parent | b8f80ee67fee5601378049fd4b56bd8c94d93edb (diff) | |
download | bcm5719-llvm-282d675b28783254b06f2fbb2f96d3b41e273c6a.tar.gz bcm5719-llvm-282d675b28783254b06f2fbb2f96d3b41e273c6a.zip |
[ms-inline asm] Add an error when trying to compile MS-style inline assembly
for an unsupported architecture.
rdar://13063988
llvm-svn: 173364
Diffstat (limited to 'clang/lib/Sema/SemaStmtAsm.cpp')
-rw-r--r-- | clang/lib/Sema/SemaStmtAsm.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaStmtAsm.cpp b/clang/lib/Sema/SemaStmtAsm.cpp index 4646ef7b389..5624a54089b 100644 --- a/clang/lib/Sema/SemaStmtAsm.cpp +++ b/clang/lib/Sema/SemaStmtAsm.cpp @@ -580,8 +580,15 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, SmallVector<Expr*, 4> Exprs; SmallVector<StringRef, 4> ClobberRefs; + llvm::Triple TheTriple = Context.getTargetInfo().getTriple(); + llvm::Triple::ArchType ArchTy = TheTriple.getArch(); + bool UnsupportedArch = ArchTy != llvm::Triple::x86 && + ArchTy != llvm::Triple::x86_64; + if (UnsupportedArch) + Diag(AsmLoc, diag::err_msasm_unsupported_arch) << TheTriple.getArchName(); + // Empty asm statements don't need to instantiate the AsmParser, etc. - if (AsmToks.empty()) { + if (UnsupportedArch || AsmToks.empty()) { StringRef EmptyAsmStr; MSAsmStmt *NS = new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true, @@ -598,7 +605,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc, SourceLocation LBraceLoc, // Get the target specific parser. std::string Error; - const std::string &TT = Context.getTargetInfo().getTriple().getTriple(); + const std::string &TT = TheTriple.getTriple(); const llvm::Target *TheTarget(llvm::TargetRegistry::lookupTarget(TT, Error)); OwningPtr<llvm::MCAsmInfo> MAI(TheTarget->createMCAsmInfo(TT)); |