================
@@ -58,21 +58,25 @@ void ConditionalToIfCheck::check(const
MatchFinder::MatchResult &Result) {
const SourceManager &SM = *Result.SourceManager;
- auto Diag = diag(Ternary->getBeginLoc(),
- "replace ternary operator with if/else statement for
readability");
+ auto Diag =
+ diag(Ternary->getBeginLoc(),
+ "replace ternary operator with if/else statement for readability");
// Extract source text for condition, true and false expressions
- std::string CondStr = Lexer::getSourceText(
- CharSourceRange::getTokenRange(Cond->getSourceRange()), SM,
- Result.Context->getLangOpts()).str();
+ std::string CondStr = Lexer::getSourceText(CharSourceRange::getTokenRange(
----------------
EugeneZelenko wrote:
```suggestion
const std::string CondStr =
Lexer::getSourceText(CharSourceRange::getTokenRange(
```
Same below. See
https://clang.llvm.org/extra/clang-tidy/checks/misc/const-correctness.html.
https://github.com/llvm/llvm-project/pull/166822
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits