]> granicus.if.org Git - clang/commitdiff
Fixit to remove 'volatile' in file-scope 'asm volatile'.
authorJohn McCall <rjmccall@apple.com>
Mon, 25 Jan 2010 23:12:50 +0000 (23:12 +0000)
committerJohn McCall <rjmccall@apple.com>
Mon, 25 Jan 2010 23:12:50 +0000 (23:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94466 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/Parser.cpp

index 8ae85e3c26a6d3b14ebae51943599b0b318a7fe2..63b0a27c08cc65b81b8f2f842eecf0a702ed942d 100644 (file)
@@ -836,7 +836,12 @@ Parser::OwningExprResult Parser::ParseSimpleAsm(SourceLocation *EndLoc) {
   SourceLocation Loc = ConsumeToken();
 
   if (Tok.is(tok::kw_volatile)) {
-    Diag(Tok, diag::warn_file_asm_volatile);
+    // Remove from the end of 'asm' to the end of 'volatile'.
+    SourceRange RemovalRange(PP.getLocForEndOfToken(Loc),
+                             PP.getLocForEndOfToken(Tok.getLocation()));
+
+    Diag(Tok, diag::warn_file_asm_volatile)
+      << CodeModificationHint::CreateRemoval(RemovalRange);
     ConsumeToken();
   }