-
Notifications
You must be signed in to change notification settings - Fork 745
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LLVM and SPIRV-LLVM-Translator pulldown (WW46-47)
LLVM: llvm/llvm-project@0f652d8f527f SPIRV-LLVM-Translator: KhronosGroup/SPIRV-LLVM-Translator@05e183d
- Loading branch information
Showing
5,688 changed files
with
226,266 additions
and
93,865 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
//===--- CleanupCtadCheck.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 "CleanupCtadCheck.h" | ||
#include "../utils/TransformerClangTidyCheck.h" | ||
#include "clang/AST/ASTContext.h" | ||
#include "clang/ASTMatchers/ASTMatchFinder.h" | ||
#include "clang/ASTMatchers/ASTMatchers.h" | ||
#include "clang/Tooling/Transformer/RangeSelector.h" | ||
#include "clang/Tooling/Transformer/RewriteRule.h" | ||
#include "clang/Tooling/Transformer/Stencil.h" | ||
#include "llvm/ADT/StringRef.h" | ||
|
||
using namespace ::clang::ast_matchers; | ||
using namespace ::clang::transformer; | ||
|
||
namespace clang { | ||
namespace tidy { | ||
namespace abseil { | ||
|
||
RewriteRule CleanupCtadCheckImpl() { | ||
auto warning_message = cat("prefer absl::Cleanup's class template argument " | ||
"deduction pattern in C++17 and higher"); | ||
|
||
return makeRule( | ||
declStmt(has(varDecl( | ||
hasType(autoType()), hasTypeLoc(typeLoc().bind("auto_type_loc")), | ||
hasInitializer(traverse( | ||
clang::TK_IgnoreUnlessSpelledInSource, | ||
callExpr(callee(functionDecl(hasName("absl::MakeCleanup"))), | ||
argumentCountIs(1), | ||
hasArgument(0, expr().bind("make_cleanup_argument"))) | ||
.bind("make_cleanup_call")))))), | ||
{changeTo(node("auto_type_loc"), cat("absl::Cleanup")), | ||
changeTo(node("make_cleanup_call"), cat(node("make_cleanup_argument")))}, | ||
warning_message); | ||
} | ||
|
||
CleanupCtadCheck::CleanupCtadCheck(StringRef Name, ClangTidyContext *Context) | ||
: utils::TransformerClangTidyCheck(CleanupCtadCheckImpl(), Name, Context) {} | ||
|
||
} // namespace abseil | ||
} // namespace tidy | ||
} // namespace clang |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
//===--- CleanupCtadCheck.h - clang-tidy ------------------------*- C++ -*-===// | ||
// | ||
// 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 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H | ||
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H | ||
|
||
#include "../utils/TransformerClangTidyCheck.h" | ||
|
||
namespace clang { | ||
namespace tidy { | ||
namespace abseil { | ||
|
||
/// Suggests switching the initialization pattern of `absl::Cleanup` | ||
/// instances from the factory function to class template argument | ||
/// deduction (CTAD), in C++17 and higher. | ||
/// | ||
/// For the user-facing documentation see: | ||
/// http://clang.llvm.org/extra/clang-tidy/checks/abseil-cleanup-ctad.html | ||
class CleanupCtadCheck : public utils::TransformerClangTidyCheck { | ||
public: | ||
CleanupCtadCheck(StringRef Name, ClangTidyContext *Context); | ||
|
||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override { | ||
return LangOpts.CPlusPlus17; | ||
} | ||
}; | ||
|
||
} // namespace abseil | ||
} // namespace tidy | ||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_CLEANUPCTADCHECK_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.