This is an archive of the discontinued LLVM Phabricator instance.

[clang][flang] Improve the consistency of the code-base
ClosedPublic

Authored by achieveartificialintelligence on Feb 21 2021, 12:10 AM.

Details

Summary

In clang:

  • Replace argc_ with Argc
  • Replace argv_ with Argv
  • Replace argv with Args

In flang:

  • Replace argc_ with argc
  • Replace argv_ with argv
  • Replace argv with args

Diff Detail

Event Timeline

achieveartificialintelligence requested review of this revision.Feb 21 2021, 12:10 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 21 2021, 12:10 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jhenderson resigned from this revision.Feb 22 2021, 1:59 AM

In general, I don't work on the clang side. As such, I don't know the norms surrounding this sort of change in this area, and don't feel comfortable reviewing. You should look at getting reviewers who do work in that part of the repository.

awarzynski requested changes to this revision.Feb 22 2021, 3:13 AM

Thank you for submitting this @achieveartificialintelligence !

The aim of these changes is to improve the consistency of the code-base with respect to the coding standards documented separately for Clang and Flang. I think that this is a very positive suggestion, but would like to request a few refinements before this is ready:

  • Please note that in LLVM/Clang, variables names start with upper case (so it should be int main(int Argc, const char **Argv) instead of main(int argc, const char **argv) ). link
  • In Flang the rules are slightly different, and the variable names start with a lower case (so it should be int main(int Argc, const char **Argv) instead of main(int argc, const char **argv) ). link
  • Your commit message refers to _a driver_, but in fact you are updating 2 specific drivers: Clang compiler driver and Flang compiler driver - could you clarify?
  • Your commit message refers to argc_ specifically, but you are updating argc_, argv_ and Argv/argv too.

Personally I'd prefer ArgC/argC and ArgV/argV for input parameters and ArgValues/argValues for the local variable. This way it would be more self-explanatory. But that's a matter of style. As long as this is consistent with the coding standards, I think that this should be accepted.

This revision now requires changes to proceed.Feb 22 2021, 3:13 AM
achieveartificialintelligence retitled this revision from [Driver] replace argc_ with argc to [clang][flang] Improve the consistency of the code-base.
achieveartificialintelligence edited the summary of this revision. (Show Details)

Thank you for submitting this @achieveartificialintelligence !

The aim of these changes is to improve the consistency of the code-base with respect to the coding standards documented separately for Clang and Flang. I think that this is a very positive suggestion, but would like to request a few refinements before this is ready:

  • Please note that in LLVM/Clang, variables names start with upper case (so it should be int main(int Argc, const char **Argv) instead of main(int argc, const char **argv) ). link
  • In Flang the rules are slightly different, and the variable names start with a lower case (so it should be int main(int Argc, const char **Argv) instead of main(int argc, const char **argv) ). link
  • Your commit message refers to _a driver_, but in fact you are updating 2 specific drivers: Clang compiler driver and Flang compiler driver - could you clarify?
  • Your commit message refers to argc_ specifically, but you are updating argc_, argv_ and Argv/argv too.

Personally I'd prefer ArgC/argC and ArgV/argV for input parameters and ArgValues/argValues for the local variable. This way it would be more self-explanatory. But that's a matter of style. As long as this is consistent with the coding standards, I think that this should be accepted.

Thank you very much for your comment.

MaskRay resigned from this revision.Feb 22 2021, 4:55 PM
aganea added inline comments.Feb 24 2021, 2:01 PM
clang/tools/driver/driver.cpp
349

What about just Args? "Values" sounds a bit too broad.

achieveartificialintelligence marked an inline comment as done.Feb 25 2021, 12:41 AM

Thanks @aganea. And I have a question that, should I use argc & argv or argC & argV in the flang part now ?

aganea accepted this revision.Feb 25 2021, 5:12 AM

Thanks @aganea. And I have a question that, should I use argc & argv or argC & argV in the flang part now ?

Looks good as it is now, thanks!

awarzynski accepted this revision.Feb 25 2021, 5:18 AM

Thank you, this is a much appreciated improvement!

This revision is now accepted and ready to land.Feb 25 2021, 5:18 AM
This revision was landed with ongoing or failed builds.Feb 25 2021, 5:26 AM
This revision was automatically updated to reflect the committed changes.