[Macros/Parser] Attributes on MacroExpansionDecl

* Parse `#<identifier>` attribute list as a `MacroExpansionDecl`
  regardless of the position
* Diagnose whitespaces between `#` and the macro name.
* Correctly attach attributes to `MacroExpansionDecl`
* Fix `OrigDeclAttributes` to handle modifiers (use `getLocation()`
  instead of `AtLoc`.)

Type checking is a TODO

rdar://107386648
This commit is contained in:
Rintaro Ishizaki
2023-05-09 18:58:27 -07:00
parent 4d8dab00f8
commit 9fc1521aeb
11 changed files with 112 additions and 35 deletions

View File

@@ -12,7 +12,7 @@ let _ = #"\##("invalid")"#
let _ = ###"""invalid"######
// expected-error@-1{{too many '#' characters in closing delimiter}}{{26-29=}}
// expected-error@-2{{consecutive statements on a line must be separated by ';'}}
// expected-error@-3 3 {{expected a macro identifier}}
// expected-error@-3{{expected a macro identifier}}
let _ = ####"invalid"###
// expected-error@-1{{unterminated string literal}}
@@ -20,7 +20,7 @@ let _ = ####"invalid"###
let _ = ###"invalid"######
// expected-error@-1{{too many '#' characters in closing delimiter}}{{24-27=}}
// expected-error@-2{{consecutive statements on a line must be separated by ';'}}
// expected-error@-3 3 {{expected a macro identifier}}
// expected-error@-3{{expected a macro identifier}}
let _ = ##"""aa
foobar