================
@@ -0,0 +1,136 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "UseIfConstevalCheck.h"
+
+#include "../utils/BracesAroundStatement.h"
+#include "clang/ASTMatchers/ASTMatchFinder.h"
+#include "clang/Lex/Lexer.h"
+
+using namespace clang::ast_matchers;
+
+namespace clang::tidy::modernize {
+
+namespace {
+
+struct BraceFix {
+  bool NeedsBraces = false;
+  utils::BraceInsertionHints Hints;
+};
+
+} // namespace
+
+static const Stmt *ignoreAttributedStmt(const Stmt *S) {
+  while (const auto *AS = dyn_cast_or_null<AttributedStmt>(S))
+    S = AS->getSubStmt();
+  return S;
+}
+
+static std::optional<CharSourceRange>
+getHeaderRange(const IfStmt *If, const SourceManager &SM,
+               const LangOptions &LangOpts) {
+  if (If->getIfLoc().isMacroID() || If->getRParenLoc().isMacroID())
----------------
unterumarmung wrote:

Initially I used to replace whole `if (std::is_constant_evaluated())`. But I 
agree that replacing only `(std::is_constant_evaluated())` is better. So I did 
that and added 2 additional tests: `if` as a macro and no whitespace before `(`

https://github.com/llvm/llvm-project/pull/189743
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to