Page MenuHomePhabricator

[ClangExpressionParser] Add ClangDeclVendor

Authored by xiaobai on Aug 19 2019, 4:09 PM.



This introduces a layer between DeclVendor and the currently implemented
DeclVendors (ClangModulesDeclVendor and AppleObjCDeclVendor). This
allows the removal of DeclVendor::GetImporterSource which is extremely
clang-specific, freeing up the interface to be more general.

A good follow up to this would be to remove the remaining instances of
clang in DeclVendor, either by moving things to ClangDeclVendor or by
using wrappers (e.g. CompilerDecl instead of clang::NamedDecl).

Diff Detail


Event Timeline

xiaobai created this revision.Aug 19 2019, 4:09 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 19 2019, 4:09 PM
JDevlieghere added inline comments.Aug 19 2019, 4:30 PM
27 ↗(On Diff #216015)

What's eLastClangDeclVendor and where is it used?

33 ↗(On Diff #216015)

I think a switch would be more readable?

xiaobai marked an inline comment as done.Aug 19 2019, 4:36 PM
xiaobai added inline comments.
27 ↗(On Diff #216015)

Following the advice here:

I added a Last one to indicate that any new ClangDeclVendor subclasses should go before this one. It also makes the classof pattern of checking bounds easier. (kind >= eFoo && kind < eLastFoo).

JDevlieghere added inline comments.Aug 19 2019, 5:27 PM
27 ↗(On Diff #216015)

Fair enough, I totally forgot about that pattern.

teemperor accepted this revision.Aug 20 2019, 12:24 AM
teemperor added a subscriber: teemperor.


This revision is now accepted and ready to land.Aug 20 2019, 12:24 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptAug 20 2019, 11:46 AM