aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-28 23:35:09 +0000
committerChris Lattner <sabre@nondot.org>2010-09-28 23:35:09 +0000
commit6229c8e7ecccbc6b661df0b4399eb205587c61b4 (patch)
treef3085267462bf6a9af159e3d0d6acfc35b7abe68
parent2138664dd2cff39de52ff11ca35f653c20b2e4b0 (diff)
enhance tentative parsing to handle ms extensions, patch by Martin Vejnar!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115004 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Parse/ParseTentative.cpp7
-rw-r--r--test/Parser/MicrosoftExtensions.c4
2 files changed, 10 insertions, 1 deletions
diff --git a/lib/Parse/ParseTentative.cpp b/lib/Parse/ParseTentative.cpp
index 085edb1281..43d856d85f 100644
--- a/lib/Parse/ParseTentative.cpp
+++ b/lib/Parse/ParseTentative.cpp
@@ -532,7 +532,12 @@ Parser::TPResult Parser::TryParseDeclarator(bool mayBeAbstract,
// '(' declarator ')'
// '(' attributes declarator ')'
// '(' abstract-declarator ')'
- if (Tok.is(tok::kw___attribute))
+ if (Tok.is(tok::kw___attribute) ||
+ Tok.is(tok::kw___declspec) ||
+ Tok.is(tok::kw___cdecl) ||
+ Tok.is(tok::kw___stdcall) ||
+ Tok.is(tok::kw___fastcall) ||
+ Tok.is(tok::kw___thiscall))
return TPResult::True(); // attributes indicate declaration
TPResult TPR = TryParseDeclarator(mayBeAbstract, mayHaveIdentifier);
if (TPR != TPResult::Ambiguous())
diff --git a/test/Parser/MicrosoftExtensions.c b/test/Parser/MicrosoftExtensions.c
index 105bb7f3a4..3dfa241fa1 100644
--- a/test/Parser/MicrosoftExtensions.c
+++ b/test/Parser/MicrosoftExtensions.c
@@ -30,6 +30,10 @@ void foo() {
typedef bool (__stdcall __stdcall *blarg)(int);
+void local_callconv()
+{
+ bool (__stdcall *p)(int);
+}
// Charify extension.
#define FOO(x) #@x