================
@@ -172,13 +172,52 @@ void UseStdMinMaxCheck::check(const
MatchFinder::MatchResult &Result) {
auto ReplaceAndDiagnose = [&](const llvm::StringRef FunctionName) {
const SourceManager &Source = *Result.SourceManager;
+ llvm::SmallString<64> Comment;
+
+ const auto AppendNormalized = [&](llvm::StringRef Text) {
+ Text = Text.ltrim();
+ if (!Text.empty()) {
+ if (!Comment.empty())
+ Comment += " ";
+ Comment += Text;
+ }
+ };
+
+ AppendNormalized(Lexer::getSourceText(
----------------
zeyi2 wrote:
This part captures:
- `if (cond) // Comment A`
- `if (cond) /* Comment A */ { ... }`
- `if (cond) /* Comment A */ x = y;`
https://github.com/llvm/llvm-project/pull/169908
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits