Skip to content

Commit

Permalink
Merged master:8ba8ab8c95f into amd-gfx:5e49f586b6a
Browse files Browse the repository at this point in the history
Local branch amd-gfx 5e49f58 Fix up tests after manual merge
Remote branch master 8ba8ab8 [mlir] support reductions in loop to std conversion
  • Loading branch information
Sw authored and Sw committed Mar 3, 2020
2 parents 5e49f58 + 8ba8ab8 commit 53ca563
Show file tree
Hide file tree
Showing 334 changed files with 2,066 additions and 2,554 deletions.
3 changes: 0 additions & 3 deletions clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ namespace abseil {
using namespace clang::ast_matchers;

void DurationDivisionCheck::registerMatchers(MatchFinder *finder) {
if (!getLangOpts().CPlusPlus)
return;

const auto DurationExpr =
expr(hasType(cxxRecordDecl(hasName("::absl::Duration"))));
finder->addMatcher(
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/abseil/DurationDivisionCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ namespace abseil {
class DurationDivisionCheck : public ClangTidyCheck {
public:
using ClangTidyCheck::ClangTidyCheck;
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ llvm::Optional<std::string> makeCharacterLiteral(const StringLiteral *Literal,
} // anonymous namespace

void FasterStrsplitDelimiterCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

// Binds to one character string literals.
const auto SingleChar =
expr(ignoringParenCasts(stringLiteral(lengthIsOne()).bind("Literal")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class FasterStrsplitDelimiterCheck : public ClangTidyCheck {
public:
FasterStrsplitDelimiterCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ namespace tidy {
namespace abseil {

void NoInternalDependenciesCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

// TODO: refactor matcher to be configurable or just match on any internal
// access from outside the enclosing namespace.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class NoInternalDependenciesCheck : public ClangTidyCheck {
public:
NoInternalDependenciesCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
3 changes: 0 additions & 3 deletions clang-tools-extra/clang-tidy/abseil/NoNamespaceCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ namespace tidy {
namespace abseil {

void NoNamespaceCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

Finder->addMatcher(
namespaceDecl(hasName("::absl"), unless(isInAbseilFile()))
.bind("abslNamespace"),
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/abseil/NoNamespaceCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class NoNamespaceCheck : public ClangTidyCheck {
public:
NoNamespaceCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ namespace abseil {
// argument.

void RedundantStrcatCallsCheck::registerMatchers(MatchFinder* Finder) {
if (!getLangOpts().CPlusPlus)
return;
const auto CallToStrcat =
callExpr(callee(functionDecl(hasName("::absl::StrCat"))));
const auto CallToStrappend =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class RedundantStrcatCallsCheck : public ClangTidyCheck {
public:
RedundantStrcatCallsCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
2 changes: 0 additions & 2 deletions clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,6 @@ AST_MATCHER_P(Stmt, IgnoringTemporaries, ast_matchers::internal::Matcher<Stmt>,
// str.append(StrCat(...))

void StrCatAppendCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
const auto StrCat = functionDecl(hasName("::absl::StrCat"));
// The arguments of absl::StrCat are implicitly converted to AlphaNum. This
// matches to the arguments because of that behavior.
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/abseil/StrCatAppendCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class StrCatAppendCheck : public ClangTidyCheck {
public:
StrCatAppendCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ namespace tidy {
namespace abseil {

void UpgradeDurationConversionsCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

// For the arithmetic calls, we match only the uses of the templated operators
// where the template parameter is not a built-in type. This means the
// instantiation makes use of an available user defined conversion to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class UpgradeDurationConversionsCheck : public ClangTidyCheck {
public:
UpgradeDurationConversionsCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;

Expand Down
3 changes: 0 additions & 3 deletions clang-tools-extra/clang-tidy/boost/UseToStringCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ AST_MATCHER(Type, isStrictlyInteger) {
} // namespace

void UseToStringCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

Finder->addMatcher(
callExpr(
hasDeclaration(functionDecl(
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/boost/UseToStringCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class UseToStringCheck : public ClangTidyCheck {
public:
UseToStringCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ namespace tidy {
namespace bugprone {

void CopyConstructorInitCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

// In the future this might be extended to move constructors?
Finder->addMatcher(
cxxConstructorDecl(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class CopyConstructorInitCheck : public ClangTidyCheck {
public:
CopyConstructorInitCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ void DynamicStaticInitializersCheck::storeOptions(
}

void DynamicStaticInitializersCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus || getLangOpts().ThreadsafeStatics)
return;
Finder->addMatcher(
varDecl(hasGlobalStorage(), unless(hasConstantDeclaration())).bind("var"),
this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ namespace bugprone {
class DynamicStaticInitializersCheck : public ClangTidyCheck {
public:
DynamicStaticInitializersCheck(StringRef Name, ClangTidyContext *Context);
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus && !LangOpts.ThreadsafeStatics;
}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ void ExceptionEscapeCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}

void ExceptionEscapeCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus || !getLangOpts().CXXExceptions)
return;

Finder->addMatcher(
functionDecl(anyOf(isNoThrow(), cxxDestructorDecl(),
cxxConstructorDecl(isMoveConstructor()),
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ namespace bugprone {
class ExceptionEscapeCheck : public ClangTidyCheck {
public:
ExceptionEscapeCheck(StringRef Name, ClangTidyContext *Context);
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus && LangOpts.CXXExceptions;
}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ AST_MATCHER_P(TemplateTypeParmDecl, hasDefaultArgument,
} // namespace

void ForwardingReferenceOverloadCheck::registerMatchers(MatchFinder *Finder) {
// Forwarding references require C++11 or later.
if (!getLangOpts().CPlusPlus11)
return;

auto ForwardingRefParm =
parmVarDecl(
hasType(qualType(rValueReferenceType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ class ForwardingReferenceOverloadCheck : public ClangTidyCheck {
public:
ForwardingReferenceOverloadCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ namespace tidy {
namespace bugprone {

void InaccurateEraseCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
return;

const auto EndCall =
callExpr(
callee(functionDecl(hasAnyName("remove", "remove_if", "unique"))),
Expand Down
3 changes: 3 additions & 0 deletions clang-tools-extra/clang-tidy/bugprone/InaccurateEraseCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ class InaccurateEraseCheck : public ClangTidyCheck {
public:
InaccurateEraseCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ static void replaceMoveWithForward(const UnresolvedLookupExpr *Callee,
}

void MoveForwardingReferenceCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus11)
return;

// Matches a ParmVarDecl for a forwarding reference, i.e. a non-const rvalue
// reference of a function template parameter type.
auto ForwardingReferenceParmMatcher =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class MoveForwardingReferenceCheck : public ClangTidyCheck {
public:
MoveForwardingReferenceCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ void StringConstructorCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
}

void StringConstructorCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

const auto ZeroExpr = expr(ignoringParenImpCasts(integerLiteral(equals(0))));
const auto CharExpr = expr(ignoringParenImpCasts(characterLiteral()));
const auto NegativeExpr = expr(ignoringParenImpCasts(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ namespace bugprone {
class StringConstructorCheck : public ClangTidyCheck {
public:
StringConstructorCheck(StringRef Name, ClangTidyContext *Context);
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ namespace tidy {
namespace bugprone {

void StringIntegerAssignmentCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;
Finder->addMatcher(
cxxOperatorCallExpr(
anyOf(hasOverloadedOperatorName("="),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ class StringIntegerAssignmentCheck : public ClangTidyCheck {
public:
StringIntegerAssignmentCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ namespace tidy {
namespace bugprone {

void ThrowKeywordMissingCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

auto CtorInitializerList =
cxxConstructorDecl(hasAnyConstructorInitializer(anything()));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class ThrowKeywordMissingCheck : public ClangTidyCheck {
public:
ThrowKeywordMissingCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ void UndelegatedConstructorCheck::registerMatchers(MatchFinder *Finder) {
// depending on the type's destructor and the number of arguments on the
// constructor call, this is handled by ignoringTemporaryExpr. Ignore template
// instantiations to reduce the number of duplicated warnings.
//
// Only register the matchers for C++11; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus11)
return;

Finder->addMatcher(
compoundStmt(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ class UndelegatedConstructorCheck : public ClangTidyCheck {
public:
UndelegatedConstructorCheck(StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context) {}
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus11;
}
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ void UnhandledSelfAssignmentCheck::storeOptions(
}

void UnhandledSelfAssignmentCheck::registerMatchers(MatchFinder *Finder) {
if (!getLangOpts().CPlusPlus)
return;

// We don't care about deleted, default or implicit operator implementations.
const auto IsUserDefined = cxxMethodDecl(
isDefinition(), unless(anyOf(isDeleted(), isImplicit(), isDefaulted())));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class UnhandledSelfAssignmentCheck : public ClangTidyCheck {
public:
UnhandledSelfAssignmentCheck(StringRef Name, ClangTidyContext *Context);

bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
return LangOpts.CPlusPlus;
}
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
Expand Down
5 changes: 0 additions & 5 deletions clang-tools-extra/clang-tidy/bugprone/UnusedRaiiCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ AST_MATCHER(CXXRecordDecl, hasNonTrivialDestructor) {
} // namespace

void UnusedRaiiCheck::registerMatchers(MatchFinder *Finder) {
// Only register the matchers for C++; the functionality currently does not
// provide any benefit to other languages, despite being benign.
if (!getLangOpts().CPlusPlus)
return;

// Look for temporaries that are constructed in-place and immediately
// destroyed. Look for temporaries created by a functional cast but not for
// those returned from a call.
Expand Down
Loading

0 comments on commit 53ca563

Please sign in to comment.