]> granicus.if.org Git - clang/commitdiff
Loop hint pragmas sometimes do not contain an identifier option (such as #pragma...
authorAaron Ballman <aaron@aaronballman.com>
Thu, 31 Jul 2014 21:24:32 +0000 (21:24 +0000)
committerAaron Ballman <aaron@aaronballman.com>
Thu, 31 Jul 2014 21:24:32 +0000 (21:24 +0000)
Amends r214432

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@214446 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Parse/ParsePragma.cpp

index 106c02b362fb0eed18b1a6c12dcadfd38eef73eb..e0b8f8b4eae8d904a85b14eb312182a0e0a425b6 100644 (file)
@@ -733,7 +733,11 @@ bool Parser::HandlePragmaLoopHint(LoopHint &Hint) {
   Hint.PragmaNameLoc = IdentifierLoc::create(
       Actions.Context, Info->PragmaName.getLocation(), PragmaNameInfo);
 
-  IdentifierInfo *OptionInfo = Info->Option.getIdentifierInfo();
+  // It is possible that the loop hint has no option identifier, such as
+  // #pragma unroll(4).
+  IdentifierInfo *OptionInfo = Info->Option.is(tok::identifier)
+                                   ? Info->Option.getIdentifierInfo()
+                                   : nullptr;
   Hint.OptionLoc = IdentifierLoc::create(
       Actions.Context, Info->Option.getLocation(), OptionInfo);