github-actions[bot] wrote:
<!--LLVM CODE LINT COMMENT: clang-tidy-->
:warning: C/C++ code linter, clang-tidy found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
```bash
git diff -U0 origin/main...HEAD --
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.h
clang-tools-extra/clang-tidy/bugprone/BugproneTidyModule.cpp |
python3 clang-tools-extra/clang-tidy/tool/clang-tidy-diff.py -path build -p1
-quiet
```
</details>
<details>
<summary>
View the output from clang-tidy here.
</summary>
```
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.h:14:1: warning:
nested namespaces can be concatenated [modernize-concat-nested-namespaces]
14 | namespace clang {
| ^~~~~~~~~~~~~~~~~
15 | namespace tidy {
| ~~~~~~~~~~~~~~~~
16 | namespace bugprone {
| ~~~~~~~~~~~~~~~~~~
| namespace clang::tidy::bugprone
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:26:18: warning:
place static function 'getTokenName' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
26 | static StringRef getTokenName(const Token &Tok) {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:103:46: warning:
place definition of method 'referencesInCondition' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
103 | ConditionReferences MacroConditionCallbacks::referencesInCondition(
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:106:3: warning:
variable 'BeginLoc' of type 'SourceLocation' can be declared 'const'
[misc-const-correctness]
106 | SourceLocation BeginLoc =
SM.getExpansionLoc(ConditionRange.getBegin());
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:110:3: warning:
variable 'Decomposed' of type 'std::pair<FileID, unsigned int>' can be declared
'const' [misc-const-correctness]
110 | std::pair<FileID, unsigned> Decomposed =
SM.getDecomposedLoc(BeginLoc);
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:123:5: warning:
variable 'Newline' of type 'size_t' (aka 'unsigned long') can be declared
'const' [misc-const-correctness]
123 | size_t Newline = End;
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:139:8: warning:
variable 'AtEnd' is not initialized [cppcoreguidelines-init-variables]
139 | bool AtEnd;
| ^
| = false
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:158:5: warning:
variable 'DefinedLoc' of type 'SourceLocation' can be declared 'const'
[misc-const-correctness]
158 | SourceLocation DefinedLoc = Current.getLocation();
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:170:26: warning:
place definition of method 'referenceFromRange' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
170 | MacroConditionCallbacks::referenceFromRange(SourceRange Range,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:180:31: warning:
place definition of method 'isIgnoredIdentifier' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
180 | bool MacroConditionCallbacks::isIgnoredIdentifier(StringRef Name) const
{
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:186:31: warning:
place definition of method 'startCondition' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
186 | void MacroConditionCallbacks::startCondition(ConditionReferences
References) {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:186:66: warning:
the parameter 'References' of type 'ConditionReferences' is copied for each
invocation but only used as a const reference; consider making it a const
reference [performance-unnecessary-value-param]
86 | void MacroConditionCallbacks::startCondition(ConditionReferences
References) {
| ^
| const &
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:191:31: warning:
place definition of method 'startDefinitionCondition' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
191 | void MacroConditionCallbacks::startDefinitionCondition(StringRef Name,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:199:31: warning:
place definition of method 'nextBranch' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
199 | void MacroConditionCallbacks::nextBranch(ConditionReferences
References) {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:199:62: warning:
the parameter 'References' of type 'ConditionReferences' is copied for each
invocation but only used as a const reference; consider making it a const
reference [performance-unnecessary-value-param]
88 | void MacroConditionCallbacks::nextBranch(ConditionReferences
References) {
| ^
| const &
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:208:31: warning:
place definition of method 'processReferences' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
208 | void MacroConditionCallbacks::processReferences(
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:220:31: warning:
place definition of method 'checkDefinitionReference' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
220 | void MacroConditionCallbacks::checkDefinitionReference(
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:224:3: warning:
pointee of variable 'Info' of type 'IdentifierInfo *' can be declared 'const'
[misc-const-correctness]
224 | IdentifierInfo *Info = PP.getIdentifierInfo(Reference.Name);
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:225:3: warning:
variable 'Definition' of type 'MacroDefinition' can be declared 'const'
[misc-const-correctness]
225 | MacroDefinition Definition = PP.getMacroDefinition(Info);
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:231:3: warning:
variable 'DefinitionLoc' of type 'SourceLocation' can be declared 'const'
[misc-const-correctness]
231 | SourceLocation DefinitionLoc = Macro->getDefinitionLoc();
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:239:31: warning:
place definition of method 'checkValueReference' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
239 | void MacroConditionCallbacks::checkValueReference(
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:241:3: warning:
pointee of variable 'Info' of type 'IdentifierInfo *' can be declared 'const'
[misc-const-correctness]
241 | IdentifierInfo *Info = PP.getIdentifierInfo(Reference.Name);
| ^
| const
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:252:31: warning:
place definition of method 'isDefinitionTestActive' outside of an anonymous
namespace [llvm-prefer-static-over-anonymous-namespace]
252 | bool MacroConditionCallbacks::isDefinitionTestActive(StringRef Name)
const {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:258:31: warning:
place definition of method 'finishBranch' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
258 | void MacroConditionCallbacks::finishBranch(ConditionalBranch &Branch) {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:276:31: warning:
place definition of method 'If' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
276 | void MacroConditionCallbacks::If(SourceLocation Loc, SourceRange
ConditionRange,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:281:31: warning:
place definition of method 'Ifdef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
281 | void MacroConditionCallbacks::Ifdef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:287:31: warning:
place definition of method 'Ifndef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
287 | void MacroConditionCallbacks::Ifndef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:293:31: warning:
place definition of method 'Elif' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
293 | void MacroConditionCallbacks::Elif(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:300:31: warning:
place definition of method 'Elifdef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
300 | void MacroConditionCallbacks::Elifdef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:308:31: warning:
place definition of method 'Elifdef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
308 | void MacroConditionCallbacks::Elifdef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:318:31: warning:
place definition of method 'Elifndef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
318 | void MacroConditionCallbacks::Elifndef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:326:31: warning:
place definition of method 'Elifndef' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
326 | void MacroConditionCallbacks::Elifndef(SourceLocation Loc,
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:336:31: warning:
place definition of method 'Else' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
336 | void MacroConditionCallbacks::Else(SourceLocation Loc, SourceLocation
IfLoc) {
| ^
clang-tools-extra/clang-tidy/bugprone/MacroConditionCheck.cpp:340:31: warning:
place definition of method 'Endif' outside of an anonymous namespace
[llvm-prefer-static-over-anonymous-namespace]
340 | void MacroConditionCallbacks::Endif(SourceLocation Loc, SourceLocation
IfLoc) {
| ^
```
</details>
https://github.com/llvm/llvm-project/pull/210768
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits