aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Parse/Parser.cpp
diff options
context:
space:
mode:
authorSteven Wu <stevenwu@apple.com>2015-05-11 21:14:09 +0000
committerSteven Wu <stevenwu@apple.com>2015-05-11 21:14:09 +0000
commit6b72a6753be823440035d1a4645add9c6048e136 (patch)
tree5e7422c5bb354f21448639fa58920b0bbc23fd70 /clang/lib/Parse/Parser.cpp
parente76e7e9369ca1b8309d15e26b31a2bf24b311ed7 (diff)
downloadllvm-6b72a6753be823440035d1a4645add9c6048e136.zip
llvm-6b72a6753be823440035d1a4645add9c6048e136.tar.gz
llvm-6b72a6753be823440035d1a4645add9c6048e136.tar.bz2
Allow AsmLabel with -fno-gnu-inline-asm
Summary: AsmLabel is heavily used in system level and firmware to redirect function and access platform specific labels. They are also extensively used in system headers which makes this option unusable for many users. Since AsmLabel doesn't introduce any assembly code into the output binary, it shouldn't be considered as inline-asm. Reviewers: bob.wilson, rnk Reviewed By: rnk Subscribers: cfe-commits Differential Revision: http://reviews.llvm.org/D9679 llvm-svn: 237048
Diffstat (limited to 'clang/lib/Parse/Parser.cpp')
-rw-r--r--clang/lib/Parse/Parser.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/Parse/Parser.cpp b/clang/lib/Parse/Parser.cpp
index 6211322..ed27a9e 100644
--- a/clang/lib/Parse/Parser.cpp
+++ b/clang/lib/Parse/Parser.cpp
@@ -669,6 +669,11 @@ Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
SourceLocation StartLoc = Tok.getLocation();
SourceLocation EndLoc;
+
+ // Check if GNU-style InlineAsm is disabled.
+ if (!getLangOpts().GNUAsm)
+ Diag(StartLoc, diag::err_gnu_inline_asm_disabled);
+
ExprResult Result(ParseSimpleAsm(&EndLoc));
ExpectAndConsume(tok::semi, diag::err_expected_after,
@@ -1253,10 +1258,6 @@ ExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
assert(Tok.is(tok::kw_asm) && "Not an asm!");
SourceLocation Loc = ConsumeToken();
- // Check if GNU-style InlineAsm is disabled.
- if (!getLangOpts().GNUAsm)
- Diag(Loc, diag::err_gnu_inline_asm_disabled);
-
if (Tok.is(tok::kw_volatile)) {
// Remove from the end of 'asm' to the end of 'volatile'.
SourceRange RemovalRange(PP.getLocForEndOfToken(Loc),