r326962 - [MS] Accept __unaligned as a qualifier on member function pointers

Reid Kleckner via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 7 15:26:03 PST 2018


Author: rnk
Date: Wed Mar  7 15:26:02 2018
New Revision: 326962

URL: http://llvm.org/viewvc/llvm-project?rev=326962&view=rev
Log:
[MS] Accept __unaligned as a qualifier on member function pointers

We need to treat __unaligned like the other 'cvr' qualifiers when it
appears at the end of a function prototype. We weren't doing that in
some tentative parsing.

Fixes PR36638.

Modified:
    cfe/trunk/lib/Parse/ParseTentative.cpp
    cfe/trunk/test/Parser/MicrosoftExtensions.cpp

Modified: cfe/trunk/lib/Parse/ParseTentative.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseTentative.cpp?rev=326962&r1=326961&r2=326962&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseTentative.cpp (original)
+++ cfe/trunk/lib/Parse/ParseTentative.cpp Wed Mar  7 15:26:02 2018
@@ -1894,7 +1894,8 @@ Parser::TPResult Parser::TryParseFunctio
     return TPResult::Error;
 
   // cv-qualifier-seq
-  while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw_restrict))
+  while (Tok.isOneOf(tok::kw_const, tok::kw_volatile, tok::kw___unaligned,
+                     tok::kw_restrict))
     ConsumeToken();
 
   // ref-qualifier[opt]

Modified: cfe/trunk/test/Parser/MicrosoftExtensions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/MicrosoftExtensions.cpp?rev=326962&r1=326961&r2=326962&view=diff
==============================================================================
--- cfe/trunk/test/Parser/MicrosoftExtensions.cpp (original)
+++ cfe/trunk/test/Parser/MicrosoftExtensions.cpp Wed Mar  7 15:26:02 2018
@@ -424,3 +424,10 @@ struct S {
   S(T);
 } f([] {});
 }
+
+namespace pr36638 {
+// Make sure we accept __unaligned method qualifiers on member function
+// pointers.
+struct A;
+void (A::*mp1)(int) __unaligned;
+}




More information about the cfe-commits mailing list