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

Unified Diff: lib/Parse/Parser.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 | « lib/Parse/ParseStmtAsm.cpp ('k') | test/Parser/no-gnu-inline-asm.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Parse/Parser.cpp
diff --git a/lib/Parse/Parser.cpp b/lib/Parse/Parser.cpp
index 3b56102dcfad045b36288dc0ac5a35692460aa42..697fda9215df3f423c74b9e4b4e208e37e0413a2 100644
--- a/lib/Parse/Parser.cpp
+++ b/lib/Parse/Parser.cpp
@@ -669,8 +669,18 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
SourceLocation StartLoc = Tok.getLocation();
SourceLocation EndLoc;
+
ExprResult Result(ParseSimpleAsm(&EndLoc));
+ // Check if GNU-style InlineAsm is disabled.
+ // Empty asm string is allowed because it will not introduce
+ // any assembly code.
+ if (!(getLangOpts().GNUAsm || Result.isInvalid())) {
+ const auto *SL = cast<StringLiteral>(Result.get());
+ if (!SL->getString().trim().empty())
+ Diag(StartLoc, diag::err_gnu_inline_asm_disabled);
+ }
+
ExpectAndConsume(tok::semi, diag::err_expected_after,
"top-level asm block");
« no previous file with comments | « lib/Parse/ParseStmtAsm.cpp ('k') | test/Parser/no-gnu-inline-asm.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698