Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Unified Diff: lib/Parse/ParseStmtAsm.cpp

Issue 1430233002: Cherry-pick upstream r237073 (Closed) Base URL: https://chromium.googlesource.com/a/native_client/pnacl-clang.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/Parse/Parser.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Parse/ParseStmtAsm.cpp
diff --git a/lib/Parse/ParseStmtAsm.cpp b/lib/Parse/ParseStmtAsm.cpp
index 85eff1712d26966fc2a5c99cc329a6f0d12df589..8ba9f15f0a40dde6aca0c1ba151db044a9b66f15 100644
--- a/lib/Parse/ParseStmtAsm.cpp
+++ b/lib/Parse/ParseStmtAsm.cpp
@@ -616,10 +616,6 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
return ParseMicrosoftAsmStatement(AsmLoc);
}
- // Check if GNU-style inline Asm is disabled.
- if (!getLangOpts().GNUAsm)
- Diag(AsmLoc, diag::err_gnu_inline_asm_disabled);
-
DeclSpec DS(AttrFactory);
SourceLocation Loc = Tok.getLocation();
ParseTypeQualifierListOpt(DS, AR_VendorAttributesParsed);
@@ -644,6 +640,15 @@ StmtResult Parser::ParseAsmStatement(bool &msAsm) {
T.consumeOpen();
ExprResult AsmString(ParseAsmStringLiteral());
+
+ // Check if GNU-style InlineAsm is disabled.
+ // Error on anything other than empty string.
+ if (!(getLangOpts().GNUAsm || AsmString.isInvalid())) {
+ const auto *SL = cast<StringLiteral>(AsmString.get());
+ if (!SL->getString().trim().empty())
+ Diag(Loc, diag::err_gnu_inline_asm_disabled);
+ }
+
if (AsmString.isInvalid()) {
// Consume up to and including the closing paren.
T.skipToEnd();
« no previous file with comments | « no previous file | lib/Parse/Parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698