[lint] Update local variable names in fml (#36136)#36147
[lint] Update local variable names in fml (#36136)#36147cbracken merged 1 commit intoflutter:mainfrom cbracken:fix-locals-fml
Conversation
| static std::atomic_size_t gLastItem; | ||
| return ++gLastItem; | ||
| static std::atomic_size_t last_item; | ||
| return ++last_item; |
There was a problem hiding this comment.
We don't seem to be consistent with scoped statics -- i.e. whether we name them the same as globals within global scope and add a g prefix, or name them the same as locals. There are semantic differences to both. Personally I think it's pretty clear that it's static, at least in this case. My guess is that most cases of function-local statics are similarly concise.
clang-tidy does support specifying static local/field formatting/prefixes if we want to give these special treatment. Opinions?
There was a problem hiding this comment.
For static const we consistently tend to prefix as kFooBar.
For static fields it looks like typically we don't prefix:
- common/graphics/persistent_cache.h:145: static std::atomic cache_sksl_;
- common/graphics/persistent_cache.h:149: static std::atomic strategy_set_;
- display_list/display_list_complexity_metal.h:95: static DisplayListMetalComplexityCalculator* instance_;
For static locals I see a mix:
- display_list/display_list_unittests.cc:684: static DisplayListBuilder builder;
- flow/flow_test_utils.cc:9:static std::string gGoldenDir;
- flow/flow_test_utils.cc:10:static std::string gFontFile;
- impeller/aiks/aiks_unittests.cc:121: static float alpha = 1.0;
- impeller/aiks/aiks_unittests.cc:133: static Matrix matrix = {
- impeller/display_list/display_list_unittests.cc:344: static bool draw_circle = true;
- impeller/display_list/display_list_unittests.cc:345: static bool add_clip = true;
Looks like most code doesn't prefix with g when I grep with git grep 'static '|grep -v 'static const' | grep -v '('
This updates local variable names to use clang `lower_case` style in the fml directory. This is one of several patches to update our variable names to a consistent style before enabling enforcement in our clang-tidy rules. This is a formatting-only change with no intended semantic change.
This updates local variable names to use clang
lower_casestyle in the fml directory. This is one of several patches to update our variable names to a consistent style before enabling enforcement in our clang-tidy rules.This is a formatting-only change with no intended semantic change.
Pre-launch Checklist
writing and running engine tests.
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.