Page MenuHomePhabricator

Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints
ClosedPublic

Authored by ehsan on Jan 15 2015, 10:03 PM.

Diff Detail

Repository
rL LLVM

Event Timeline

ehsan updated this revision to Diff 18291.Jan 15 2015, 10:03 PM
ehsan retitled this revision from to Diagnose ref-qualifiers occuring after virt-specifier-seq and generate fixit hints.
ehsan edited the test plan for this revision. (Show Details)
ehsan added a reviewer: rsmith.
ehsan updated this object.
ehsan added a subscriber: Unknown Object (MLST).
rsmith edited edge metadata.Jan 16 2015, 6:14 PM

Looks good, thanks!

lib/Parse/ParseDecl.cpp
5319–5321 ↗(On Diff #18291)

Remove braces here, please.

lib/Parse/ParseDeclCXX.cpp
2100–2139 ↗(On Diff #18291)

Maybe only produce a single diagnostic no matter how many specifiers were provided? You can then also use FixItHint::CreateInsertionFromRange to produce a fixit that copies the complete range of specifiers from after the virt-specifier to before (this will preserve things like macro names and whitespace between the tokens).

ehsan added inline comments.Jan 26 2015, 7:38 AM
lib/Parse/ParseDeclCXX.cpp
2100–2139 ↗(On Diff #18291)

Can you please tell me how that would work? My fixit hints are careful so that if you have something like: void foo() override final &; you would get void foo() final & override; whereas if you have void foo() final override final &; you would get void foo() final & override; (IOW you won't get two final keywords.)

I don't know how to do the same with a range based insertion fixit hint...

This revision was automatically updated to reflect the committed changes.