================
@@ -0,0 +1,103 @@
+//===--- MLIROpBuilderCheck.cpp - clang-tidy 
------------------------------===//
+//
+// 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 "MLIROpBuilderCheck.h"
+#include "clang/ASTMatchers/ASTMatchers.h"
+#include "clang/Basic/LLVM.h"
+#include "clang/Lex/Lexer.h"
+#include "clang/Tooling/Transformer/RangeSelector.h"
+#include "clang/Tooling/Transformer/RewriteRule.h"
+#include "clang/Tooling/Transformer/SourceCode.h"
+#include "clang/Tooling/Transformer/Stencil.h"
+#include "llvm/Support/Error.h"
+
+namespace clang::tidy::llvm_check {
+namespace {
+
+using namespace ::clang::ast_matchers; // NOLINT: Too many names.
+using namespace ::clang::transformer;  // NOLINT: Too many names.
+
+class TypeAsWrittenStencil : public StencilInterface {
+public:
+  explicit TypeAsWrittenStencil(std::string S) : id(std::move(S)) {}
+  std::string toString() const override {
+    return (llvm::Twine("TypeAsWritten(\"") + id + "\")").str();
+  }
+
+  llvm::Error eval(const MatchFinder::MatchResult &match,
+                   std::string *result) const override {
+    llvm::Expected<CharSourceRange> n = node(id)(match);
+    if (!n)
+      return n.takeError();
+    SourceRange srcRange = n->getAsRange();
----------------
EugeneZelenko wrote:

```suggestion
    const SourceRange srcRange = n->getAsRange();
```

Please also run Clang-Tidy on your files: looks like variables naming is not 
confirmed to LLVM coding style.

https://github.com/llvm/llvm-project/pull/149148
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to