summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorReid Kleckner <rnk@google.com>2018-03-07 23:26:02 +0000
committerReid Kleckner <rnk@google.com>2018-03-07 23:26:02 +0000
commitc6663b7c45056e5bcd1894b11556d82c752114b4 (patch)
tree06926f27a3844384b204e9f202681661b00c3077
parentabdb3224386475aec79bbd3345c62d988e622ca7 (diff)
downloadbcm5719-llvm-c6663b7c45056e5bcd1894b11556d82c752114b4.tar.gz
bcm5719-llvm-c6663b7c45056e5bcd1894b11556d82c752114b4.zip
[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. llvm-svn: 326962
-rw-r--r--clang/lib/Parse/ParseTentative.cpp3
-rw-r--r--clang/test/Parser/MicrosoftExtensions.cpp7
2 files changed, 9 insertions, 1 deletions
diff --git a/clang/lib/Parse/ParseTentative.cpp b/clang/lib/Parse/ParseTentative.cpp
index 88c0e176b02..ebd6f0f5b8e 100644
--- a/clang/lib/Parse/ParseTentative.cpp
+++ b/clang/lib/Parse/ParseTentative.cpp
@@ -1894,7 +1894,8 @@ Parser::TPResult Parser::TryParseFunctionDeclarator() {
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]
diff --git a/clang/test/Parser/MicrosoftExtensions.cpp b/clang/test/Parser/MicrosoftExtensions.cpp
index 21635f0ee12..8799f49df6c 100644
--- a/clang/test/Parser/MicrosoftExtensions.cpp
+++ b/clang/test/Parser/MicrosoftExtensions.cpp
@@ -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;
+}
OpenPOWER on IntegriCloud