aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
diff options
context:
space:
mode:
authorSirui Mu <msrlancern@gmail.com>2023-12-26 22:49:41 +0800
committerGitHub <noreply@github.com>2023-12-26 15:49:41 +0100
commitaca3727e97bced3e98f8e0719de95c93034a97d2 (patch)
tree19aa8cd77d369defc180e54e5ee10f930b7049ea /llvm/lib/Bitcode/Reader/BitcodeReader.cpp
parent898320d4e52c9110422a31a8afc896b9d211ed9d (diff)
downloadllvm-aca3727e97bced3e98f8e0719de95c93034a97d2.zip
llvm-aca3727e97bced3e98f8e0719de95c93034a97d2.tar.gz
llvm-aca3727e97bced3e98f8e0719de95c93034a97d2.tar.bz2
[clang-tidy] Treat fields in anonymous records as names in enclosing scope when checking name styles (#75701)
Currently, fields in anonymous records are treated as normal record members during naming style check. This can be undesirable in certain situations since these fields are used just like names in their enclosing scopes: ```c++ class Foo { union { int iv_; // warning: invalid case style for public member 'iv_' float fv_; // warning: invalid case style for public member 'fv_' }; }; ``` `iv_` and `fv_` are used in the code like private members of `Foo` but their naming style comes from rules for public members. This PR changes this behavior. It adds a new option `CheckAnonFieldInParent` to `readability-identifier-naming`. When set to `true`, fields in anonymous records will be treated as names in their enclosing scopes when checking name styles. Specifically: - If the anonymous record is defined within the file scope or in a namespace scope, treat its fields as global variables when checking name styles; - If the anonymous record is defined within a function, treat its fields as local variables when checking name styles; - If the anonymous record is defined within a non-anonymous record, treat its fields as non-static record members when checking name styles.
Diffstat (limited to 'llvm/lib/Bitcode/Reader/BitcodeReader.cpp')
0 files changed, 0 insertions, 0 deletions