[CIR][CIRGen] Change buildX functions to emitX #1093
Merged
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.
The buildX naming convention originated when the CIRGen implementation
was planned to be substantially different from original CodeGen. CIRGen
is now a much closer adaption of CodeGen, and the emitX to buildX
renaming just makes things more confusing, since CodeGen also has some
helper functions whose names start with build or Build, so it's not
immediately clear which CodeGen function corresponds to a CIRGen buildX
function. Rename the buildX functions back to emitX to fix this.
This diff was generated mostly mechanically. I searched for all buildX
functions in CIRGen and all emitX or buildX functions in CodeGen:
I used a simple Python script to find corresponding functions:
https://gist.github.com/smeenai/02be7ced8564cef5518df72606ec7b19.
https://gist.github.com/smeenai/6ffd67be4249c8cebdd7fa99cfa4f13c is the
resulting list of correspondences. This isn't 100% accurate because it's
not accounting for the files that the functions are present in, but
that's pretty unlikely to matter here, so I kept it simple.
The buildX functions in CIRGen which correspond to an emitX function in
CodeGen should be changed, and the ones which correspond to a BuildX
function in CodeGen should not be changed. That leaves some functions
without any correspondences, which required a judgement call. I scanned
through all those functions, and buildVirtualMethodAttr was the only one
that seemed like it shouldn't be changed to emit. I performed the
replacement as follows:
The mechanical changes are in the first commit of this PR. There was a
manual fixup required for a token pasting macro in CIRGenExprScalar.cpp,
which is the second commit. I then ran
git clang-format
, which is thethird commit. (They'll be squashed together when the PR is committed.)