-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add enumerator support for CxxToThrift.
Summary: The codegen from Thrift to C++ is quite straight forward, where the enumerators are always named consistently: ``` enum CountOnlyMode { Disabled = 0, HitCount = 1, FileCount = 2, } ``` generates ``` /** Glean {"file": "test.thrift", "name": "CountOnlyMode", "kind": "enum" } */ enum class CountOnlyMode { Disabled = 0, HitCount = 1, FileCount = 2, }; ``` To produce the `Fbthrift::EnumValue` fact, we need the `Fbthrift::NamedType` of the `enum` declaration the enumerator belongs to and the name of the enumerator. Since the enumerator name is the same between Thrift and C++, we simply use the C++ identifier without needing to rely on reading a comment. The `Fbthrift::NamedType` instance is stashed in the `EnumDecl` object as a special case, since it will be needed upon visiting the enumerators. Reviewed By: phlalx Differential Revision: D60707938 fbshipit-source-id: eb7d778b9b94548390d4f7c7a2793ea2f49e964b
- Loading branch information
1 parent
7812409
commit ccc2fff
Showing
6 changed files
with
341 additions
and
68 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
glean/lang/codemarkup/tests/clang/xlang/thrift/entityreferences.perf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
{ "@generated": null, "cxx1.TargetUses.5": 7, "cxx1.ThriftToCxx.5": 7 } | ||
{ "@generated": null, "cxx1.TargetUses.5": 7, "cxx1.ThriftToCxx.5": 10 } |
Oops, something went wrong.