Skip to content

Fix function declarations with ms_call_modifier being incorrect. #321

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,7 @@ module.exports = grammar(C, {
seq(
// C uses _declaration_declarator here for some nice macro parsing in function declarators,
// but this causes a world of pain for C++ so we'll just stick to the normal _declarator here.
optional($.ms_call_modifier),
$._declarator,
optional($.gnu_asm_expression),
),
Expand Down
9 changes: 8 additions & 1 deletion test/corpus/microsoft.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ union __declspec(noinline) u2 {
class __declspec(uuid) u2 {
};

int __cdecl f2();
---

(translation_unit
Expand All @@ -29,4 +30,10 @@ class __declspec(uuid) u2 {
(ms_declspec_modifier
(identifier))
name: (type_identifier)
body: (field_declaration_list)))
body: (field_declaration_list))
(declaration
type: (primitive_type)
declarator: (ms_call_modifier)
declarator: (function_declarator
declarator: (identifier)
parameters: (parameter_list))))