This repository has been archived by the owner on Apr 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 307
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[clang-tidy] Add loop-convert check to clang-tidy.
Move LoopConvert from clang-modernize to modernize module in clang-tidy. http://reviews.llvm.org/D12076 Patch by Angel Garcia! git-svn-id: https://llvm.org/svn/llvm-project/clang-tools-extra/trunk@245427 91177308-0d34-0410-b5e6-96231b3b80d8
- Loading branch information
Showing
10 changed files
with
3,756 additions
and
0 deletions.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,52 @@ | ||
//===--- LoopConvertCheck.h - clang-tidy-------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H | ||
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H | ||
|
||
#include "../ClangTidy.h" | ||
#include "LoopConvertUtils.h" | ||
|
||
namespace clang { | ||
namespace tidy { | ||
namespace modernize { | ||
|
||
class LoopConvertCheck : public ClangTidyCheck { | ||
public: | ||
LoopConvertCheck(StringRef Name, ClangTidyContext *Context); | ||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override; | ||
void registerMatchers(ast_matchers::MatchFinder *Finder) override; | ||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override; | ||
|
||
private: | ||
void doConversion(ASTContext *Context, const VarDecl *IndexVar, | ||
const VarDecl *MaybeContainer, StringRef ContainerString, | ||
const UsageResult &Usages, const DeclStmt *AliasDecl, | ||
bool AliasUseRequired, bool AliasFromForInit, | ||
const ForStmt *TheLoop, bool ContainerNeedsDereference, | ||
bool DerefByValue, bool DerefByConstRef); | ||
|
||
StringRef checkRejections(ASTContext *Context, const Expr *ContainerExpr, | ||
const ForStmt *TheLoop); | ||
|
||
void findAndVerifyUsages(ASTContext *Context, const VarDecl *LoopVar, | ||
const VarDecl *EndVar, const Expr *ContainerExpr, | ||
const Expr *BoundExpr, | ||
bool ContainerNeedsDereference, bool DerefByValue, | ||
bool DerefByConstRef, const ForStmt *TheLoop, | ||
LoopFixerKind FixerKind); | ||
std::unique_ptr<TUTrackingInfo> TUInfo; | ||
Confidence::Level MinConfidence; | ||
}; | ||
|
||
} // namespace modernize | ||
} // namespace tidy | ||
} // namespace clang | ||
|
||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_MODERNIZE_LOOP_CONVERT_H |
Oops, something went wrong.