[Frontend] Convert NLOptions to an enum class#89992
Open
filip-sakel wants to merge 2 commits into
Open
Conversation
xedin
reviewed
Jun 16, 2026
|
|
||
| /// Constants used to customize name lookup. | ||
| enum NLOptions : unsigned { | ||
| enum class NLOptions : unsigned { |
Contributor
There was a problem hiding this comment.
Have you considered making this into a NLFlag instead and declaring NLOptions to be an OptionSet? This is a very common pattern in the code-base and helps us avoid declaring plural names as well.
Contributor
Author
There was a problem hiding this comment.
Sure, I can do that. Just one question, does OptionSet depend on the C++ standard library? Because according to BasicBridging.h:
// Do not add other std/llvm header files here!
// Function implementations should be placed into BasicBridging.cpp and
// required header files should be added there.
//
// Pure bridging mode does not permit including any std/llvm headers.
// See also the comments for `BRIDGING_MODE` in the top-level CMakeLists.txt
// file.
Contributor
There was a problem hiding this comment.
OptionSet is a defined in swift it’S effectively just a wrapper over a bit field.
Contributor
Author
There was a problem hiding this comment.
Sounds good! I'll change it to an OptionSet.
Contributor
There was a problem hiding this comment.
Please re-request the review once you are ready to make sure that I don't lose track of this.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Converts the
NLOptionsenum to an enum class. From my understanding, the codebase wants to use more namespaced enums in general. More particularly, this change allows us to exposeNLOptionstoASTGen(by including it inASTBridging.h), which I need to validate the upcoming qualified-lookup API in swift-syntax.Changes at the call site:
NL_[...]constants becomeNLOptions::[...]NLOptions::Noneto indicate the absence of name-lookup optionsNLOptionsdoesn't implicitly convert tobool. So if you want to test if the given options include a specific options, you convert: