[clang-tidy][NFC] run clang-format over clang-tidy checks and tool code. (#143324)
This commit is contained in:
@@ -419,8 +419,8 @@ ClangTidyASTConsumerFactory::createASTConsumer(
|
||||
|
||||
std::unique_ptr<ClangTidyProfiling> Profiling;
|
||||
if (Context.getEnableProfiling()) {
|
||||
Profiling = std::make_unique<ClangTidyProfiling>(
|
||||
Context.getProfileStorageParams());
|
||||
Profiling =
|
||||
std::make_unique<ClangTidyProfiling>(Context.getProfileStorageParams());
|
||||
FinderOptions.CheckProfiling.emplace(Profiling->Records);
|
||||
}
|
||||
|
||||
@@ -432,8 +432,8 @@ ClangTidyASTConsumerFactory::createASTConsumer(
|
||||
|
||||
if (Context.canEnableModuleHeadersParsing() &&
|
||||
Context.getLangOpts().Modules && OverlayFS != nullptr) {
|
||||
auto ModuleExpander = std::make_unique<ExpandModularHeadersPPCallbacks>(
|
||||
&Compiler, OverlayFS);
|
||||
auto ModuleExpander =
|
||||
std::make_unique<ExpandModularHeadersPPCallbacks>(&Compiler, OverlayFS);
|
||||
ModuleExpanderPP = ModuleExpander->getPreprocessor();
|
||||
PP->addPPCallbacks(std::move(ModuleExpander));
|
||||
}
|
||||
@@ -497,7 +497,7 @@ getCheckNames(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers) {
|
||||
clang::tidy::ClangTidyContext Context(
|
||||
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
Options),
|
||||
Options),
|
||||
AllowEnablingAnalyzerAlphaCheckers);
|
||||
ClangTidyASTConsumerFactory Factory(Context);
|
||||
return Factory.getCheckNames();
|
||||
@@ -508,7 +508,7 @@ getCheckOptions(const ClangTidyOptions &Options,
|
||||
bool AllowEnablingAnalyzerAlphaCheckers) {
|
||||
clang::tidy::ClangTidyContext Context(
|
||||
std::make_unique<DefaultOptionsProvider>(ClangTidyGlobalOptions(),
|
||||
Options),
|
||||
Options),
|
||||
AllowEnablingAnalyzerAlphaCheckers);
|
||||
ClangTidyDiagnosticConsumer DiagConsumer(Context);
|
||||
auto DiagOpts = std::make_unique<DiagnosticOptions>();
|
||||
|
||||
@@ -530,7 +530,6 @@ void ClangTidyCheck::OptionsView::store<bool>(
|
||||
ClangTidyOptions::OptionMap &Options, StringRef LocalName,
|
||||
bool Value) const;
|
||||
|
||||
|
||||
} // namespace tidy
|
||||
} // namespace clang
|
||||
|
||||
|
||||
@@ -217,11 +217,10 @@ public:
|
||||
using DiagLevelAndFormatString = std::pair<DiagnosticIDs::Level, std::string>;
|
||||
DiagLevelAndFormatString getDiagLevelAndFormatString(unsigned DiagnosticID,
|
||||
SourceLocation Loc) {
|
||||
return {
|
||||
static_cast<DiagnosticIDs::Level>(
|
||||
DiagEngine->getDiagnosticLevel(DiagnosticID, Loc)),
|
||||
std::string(
|
||||
DiagEngine->getDiagnosticIDs()->getDescription(DiagnosticID))};
|
||||
return {static_cast<DiagnosticIDs::Level>(
|
||||
DiagEngine->getDiagnosticLevel(DiagnosticID, Loc)),
|
||||
std::string(
|
||||
DiagEngine->getDiagnosticIDs()->getDescription(DiagnosticID))};
|
||||
}
|
||||
|
||||
void setOptionsCollector(llvm::StringSet<> *Collector) {
|
||||
|
||||
@@ -70,7 +70,8 @@ struct NOptionMap {
|
||||
NOptionMap(IO &, const ClangTidyOptions::OptionMap &OptionMap) {
|
||||
Options.reserve(OptionMap.size());
|
||||
for (const auto &KeyValue : OptionMap)
|
||||
Options.emplace_back(std::string(KeyValue.getKey()), KeyValue.getValue().Value);
|
||||
Options.emplace_back(std::string(KeyValue.getKey()),
|
||||
KeyValue.getValue().Value);
|
||||
}
|
||||
ClangTidyOptions::OptionMap denormalize(IO &) {
|
||||
ClangTidyOptions::OptionMap Map;
|
||||
|
||||
@@ -204,7 +204,9 @@ class FileOptionsBaseProvider : public DefaultOptionsProvider {
|
||||
protected:
|
||||
// A pair of configuration file base name and a function parsing
|
||||
// configuration from text in the corresponding format.
|
||||
using ConfigFileHandler = std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions> (llvm::MemoryBufferRef)>>;
|
||||
using ConfigFileHandler =
|
||||
std::pair<std::string, std::function<llvm::ErrorOr<ClangTidyOptions>(
|
||||
llvm::MemoryBufferRef)>>;
|
||||
|
||||
/// Configuration file handlers listed in the order of priority.
|
||||
///
|
||||
|
||||
@@ -49,8 +49,8 @@ public:
|
||||
FilesToRecord.erase(File);
|
||||
}
|
||||
|
||||
/// Makes sure we have contents for all the files we were interested in. Ideally
|
||||
/// `FilesToRecord` should be empty.
|
||||
/// Makes sure we have contents for all the files we were interested in.
|
||||
/// Ideally `FilesToRecord` should be empty.
|
||||
void checkAllFilesRecorded() {
|
||||
LLVM_DEBUG({
|
||||
for (auto FileEntry : FilesToRecord)
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace tooling {
|
||||
/// including the contents of the modular headers and all their transitive
|
||||
/// includes.
|
||||
///
|
||||
/// This allows existing tools based on PPCallbacks to retain their functionality
|
||||
/// when running with C++ modules enabled. This only works in the backwards
|
||||
/// compatible modules mode, i.e. when code can still be parsed in non-modular
|
||||
/// way.
|
||||
/// This allows existing tools based on PPCallbacks to retain their
|
||||
/// functionality when running with C++ modules enabled. This only works in the
|
||||
/// backwards compatible modules mode, i.e. when code can still be parsed in
|
||||
/// non-modular way.
|
||||
class ExpandModularHeadersPPCallbacks : public PPCallbacks {
|
||||
public:
|
||||
ExpandModularHeadersPPCallbacks(
|
||||
|
||||
@@ -27,7 +27,8 @@ public:
|
||||
|
||||
} // namespace concurrency
|
||||
|
||||
// Register the ConcurrencyTidyModule using this statically initialized variable.
|
||||
// Register the ConcurrencyTidyModule using this statically initialized
|
||||
// variable.
|
||||
static ClangTidyModuleRegistry::Add<concurrency::ConcurrencyModule>
|
||||
X("concurrency-module", "Adds concurrency checks.");
|
||||
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
|
||||
namespace clang::tidy::hicpp {
|
||||
|
||||
/// Check for thrown exceptions and enforce they are all derived from std::exception.
|
||||
/// Check for thrown exceptions and enforce they are all derived from
|
||||
/// std::exception.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/hicpp/exception-baseclass.html
|
||||
|
||||
@@ -113,7 +113,7 @@ void MultiwayPathsCoveredCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
}
|
||||
// Warns for degenerated 'switch' statements that neither define a case nor
|
||||
// a default label.
|
||||
// FIXME: Evaluate, if emitting a fix-it to simplify that statement is
|
||||
// FIXME: Evaluate, if emitting a fix-it to simplify that statement is
|
||||
// reasonable.
|
||||
if (!SwitchHasDefault && SwitchCaseCount == 0) {
|
||||
diag(Switch->getBeginLoc(),
|
||||
|
||||
@@ -19,8 +19,7 @@ void MustCheckErrsCheck::registerMatchers(MatchFinder *Finder) {
|
||||
"ERR_CAST", "PTR_ERR_OR_ZERO"));
|
||||
auto NonCheckingStmts = stmt(anyOf(compoundStmt(), labelStmt()));
|
||||
Finder->addMatcher(
|
||||
callExpr(callee(ErrFn), hasParent(NonCheckingStmts)).bind("call"),
|
||||
this);
|
||||
callExpr(callee(ErrFn), hasParent(NonCheckingStmts)).bind("call"), this);
|
||||
|
||||
auto ReturnToCheck = returnStmt(hasReturnValue(callExpr(callee(ErrFn))));
|
||||
auto ReturnsErrFn = functionDecl(hasDescendant(ReturnToCheck));
|
||||
|
||||
@@ -15,8 +15,9 @@ namespace clang::tidy::llvm_check {
|
||||
|
||||
/// Looks at conditionals and finds and replaces cases of ``cast<>``, which will
|
||||
/// assert rather than return a null pointer, and ``dyn_cast<>`` where
|
||||
/// the return value is not captured. Additionally, finds and replaces cases that match the
|
||||
/// pattern ``var && isa<X>(var)``, where ``var`` is evaluated twice.
|
||||
/// the return value is not captured. Additionally, finds and replaces cases
|
||||
/// that match the pattern ``var && isa<X>(var)``, where ``var`` is evaluated
|
||||
/// twice.
|
||||
///
|
||||
/// Finds cases like these:
|
||||
/// \code
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
namespace clang::tidy::misc {
|
||||
|
||||
///checks for locations that do not throw by value
|
||||
/// Checks for locations that do not throw by value
|
||||
// or catch by reference.
|
||||
// The check is C++ only. It checks that all throw locations
|
||||
// throw by value and not by pointer. Additionally it
|
||||
|
||||
@@ -13,8 +13,8 @@
|
||||
|
||||
namespace clang::tidy::modernize {
|
||||
|
||||
/// This check warns the uses of the deprecated member types of ``std::ios_base``
|
||||
/// and replaces those that have a non-deprecated equivalent.
|
||||
/// This check warns the uses of the deprecated member types of
|
||||
/// ``std::ios_base`` and replaces those that have a non-deprecated equivalent.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/modernize/deprecated-ios-base-aliases.html
|
||||
|
||||
@@ -688,9 +688,8 @@ bool ForLoopIndexUseVisitor::TraverseArraySubscriptExpr(ArraySubscriptExpr *E) {
|
||||
if (!isIndexInSubscriptExpr(E->getIdx(), IndexVar))
|
||||
return VisitorBase::TraverseArraySubscriptExpr(E);
|
||||
|
||||
if ((ContainerExpr &&
|
||||
!areSameExpr(Context, Arr->IgnoreParenImpCasts(),
|
||||
ContainerExpr->IgnoreParenImpCasts())) ||
|
||||
if ((ContainerExpr && !areSameExpr(Context, Arr->IgnoreParenImpCasts(),
|
||||
ContainerExpr->IgnoreParenImpCasts())) ||
|
||||
!arrayMatchesBoundExpr(Context, Arr->IgnoreImpCasts()->getType(),
|
||||
ArrayBoundExpr)) {
|
||||
// If we have already discovered the array being indexed and this isn't it
|
||||
|
||||
@@ -161,7 +161,7 @@ public:
|
||||
checkName(MacroNameTok);
|
||||
}
|
||||
void Elifdef(SourceLocation Loc, SourceRange ConditionRange,
|
||||
SourceLocation IfLoc) override {
|
||||
SourceLocation IfLoc) override {
|
||||
PPCallbacks::Elifdef(Loc, ConditionRange, IfLoc);
|
||||
}
|
||||
void Elifndef(SourceLocation Loc, const Token &MacroNameTok,
|
||||
@@ -169,7 +169,7 @@ public:
|
||||
checkName(MacroNameTok);
|
||||
}
|
||||
void Elifndef(SourceLocation Loc, SourceRange ConditionRange,
|
||||
SourceLocation IfLoc) override {
|
||||
SourceLocation IfLoc) override {
|
||||
PPCallbacks::Elifndef(Loc, ConditionRange, IfLoc);
|
||||
}
|
||||
void Endif(SourceLocation Loc, SourceLocation IfLoc) override;
|
||||
@@ -316,8 +316,7 @@ void MacroToEnumCallbacks::FileChanged(SourceLocation Loc,
|
||||
CurrentFile = &Files.back();
|
||||
}
|
||||
|
||||
bool MacroToEnumCallbacks::isInitializer(ArrayRef<Token> MacroTokens)
|
||||
{
|
||||
bool MacroToEnumCallbacks::isInitializer(ArrayRef<Token> MacroTokens) {
|
||||
IntegralLiteralExpressionMatcher Matcher(MacroTokens, LangOpts.C99 == 0);
|
||||
bool Matched = Matcher.match();
|
||||
bool IsC = !LangOpts.CPlusPlus;
|
||||
@@ -328,7 +327,6 @@ bool MacroToEnumCallbacks::isInitializer(ArrayRef<Token> MacroTokens)
|
||||
return Matched;
|
||||
}
|
||||
|
||||
|
||||
// Any defined but rejected macro is scanned for identifiers that
|
||||
// are to be excluded as enums.
|
||||
void MacroToEnumCallbacks::MacroDefined(const Token &MacroNameTok,
|
||||
@@ -444,8 +442,8 @@ void MacroToEnumCallbacks::invalidateExpressionNames() {
|
||||
}
|
||||
|
||||
void MacroToEnumCallbacks::EndOfMainFile() {
|
||||
invalidateExpressionNames();
|
||||
issueDiagnostics();
|
||||
invalidateExpressionNames();
|
||||
issueDiagnostics();
|
||||
}
|
||||
|
||||
void MacroToEnumCallbacks::invalidateRange(SourceRange Range) {
|
||||
@@ -517,7 +515,8 @@ void MacroToEnumCallbacks::fixEnumMacro(const MacroList &MacroList) const {
|
||||
void MacroToEnumCheck::registerPPCallbacks(const SourceManager &SM,
|
||||
Preprocessor *PP,
|
||||
Preprocessor *ModuleExpanderPP) {
|
||||
auto Callback = std::make_unique<MacroToEnumCallbacks>(this, getLangOpts(), SM);
|
||||
auto Callback =
|
||||
std::make_unique<MacroToEnumCallbacks>(this, getLangOpts(), SM);
|
||||
PPCallback = Callback.get();
|
||||
PP->addPPCallbacks(std::move(Callback));
|
||||
}
|
||||
@@ -540,7 +539,7 @@ void MacroToEnumCheck::check(
|
||||
const ast_matchers::MatchFinder::MatchResult &Result) {
|
||||
auto *TLDecl = Result.Nodes.getNodeAs<Decl>("top");
|
||||
if (TLDecl == nullptr)
|
||||
return;
|
||||
return;
|
||||
|
||||
SourceRange Range = TLDecl->getSourceRange();
|
||||
if (auto *TemplateFn = Result.Nodes.getNodeAs<FunctionTemplateDecl>("top")) {
|
||||
|
||||
@@ -361,8 +361,7 @@ bool MakeSmartPtrCheck::replaceNew(DiagnosticBuilder &Diag,
|
||||
Diag << FixItHint::CreateRemoval(
|
||||
SourceRange(NewStart, InitRange.getBegin()));
|
||||
Diag << FixItHint::CreateRemoval(SourceRange(InitRange.getEnd(), NewEnd));
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
// New array expression with default/value initialization:
|
||||
// smart_ptr<Foo[]>(new int[5]());
|
||||
// smart_ptr<Foo[]>(new Foo[5]());
|
||||
|
||||
@@ -110,11 +110,11 @@ public:
|
||||
CheckFactories.registerCheck<UseDefaultMemberInitCheck>(
|
||||
"modernize-use-default-member-init");
|
||||
CheckFactories.registerCheck<UseEmplaceCheck>("modernize-use-emplace");
|
||||
CheckFactories.registerCheck<UseEqualsDefaultCheck>("modernize-use-equals-default");
|
||||
CheckFactories.registerCheck<UseEqualsDefaultCheck>(
|
||||
"modernize-use-equals-default");
|
||||
CheckFactories.registerCheck<UseEqualsDeleteCheck>(
|
||||
"modernize-use-equals-delete");
|
||||
CheckFactories.registerCheck<UseNodiscardCheck>(
|
||||
"modernize-use-nodiscard");
|
||||
CheckFactories.registerCheck<UseNodiscardCheck>("modernize-use-nodiscard");
|
||||
CheckFactories.registerCheck<UseNoexceptCheck>("modernize-use-noexcept");
|
||||
CheckFactories.registerCheck<UseNullptrCheck>("modernize-use-nullptr");
|
||||
CheckFactories.registerCheck<UseOverrideCheck>("modernize-use-override");
|
||||
|
||||
@@ -141,8 +141,7 @@ void ReplaceAutoPtrCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
"auto_ptr")
|
||||
return;
|
||||
|
||||
SourceLocation EndLoc =
|
||||
AutoPtrLoc.getLocWithOffset(strlen("auto_ptr") - 1);
|
||||
SourceLocation EndLoc = AutoPtrLoc.getLocWithOffset(strlen("auto_ptr") - 1);
|
||||
diag(AutoPtrLoc, "auto_ptr is deprecated, use unique_ptr instead")
|
||||
<< FixItHint::CreateReplacement(SourceRange(AutoPtrLoc, EndLoc),
|
||||
"unique_ptr");
|
||||
|
||||
@@ -38,12 +38,11 @@ size_t getTypeNameLength(bool RemoveStars, StringRef Text) {
|
||||
else if (C == '>')
|
||||
--TemplateTypenameCntr;
|
||||
const CharType NextChar =
|
||||
isAlphanumeric(C)
|
||||
? Alpha
|
||||
: (isWhitespace(C) ||
|
||||
(!RemoveStars && TemplateTypenameCntr == 0 && C == '*'))
|
||||
? Space
|
||||
: Punctuation;
|
||||
isAlphanumeric(C) ? Alpha
|
||||
: (isWhitespace(C) ||
|
||||
(!RemoveStars && TemplateTypenameCntr == 0 && C == '*'))
|
||||
? Space
|
||||
: Punctuation;
|
||||
if (NextChar != Space) {
|
||||
++NumChars; // Count the non-space character.
|
||||
if (LastChar == Space && NextChar == Alpha && BeforeSpace == Alpha)
|
||||
@@ -444,10 +443,10 @@ void UseAutoCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
replaceIterators(Decl, Result.Context);
|
||||
} else if (const auto *Decl =
|
||||
Result.Nodes.getNodeAs<DeclStmt>(DeclWithNewId)) {
|
||||
replaceExpr(Decl, Result.Context,
|
||||
[](const Expr *Expr) { return Expr->getType(); },
|
||||
"use auto when initializing with new to avoid "
|
||||
"duplicating the type name");
|
||||
replaceExpr(
|
||||
Decl, Result.Context, [](const Expr *Expr) { return Expr->getType(); },
|
||||
"use auto when initializing with new to avoid "
|
||||
"duplicating the type name");
|
||||
} else if (const auto *Decl =
|
||||
Result.Nodes.getNodeAs<DeclStmt>(DeclWithCastId)) {
|
||||
replaceExpr(
|
||||
|
||||
@@ -98,8 +98,8 @@ auto hasWantedType(llvm::ArrayRef<StringRef> TypeNames) {
|
||||
|
||||
// Matches member call expressions of the named method on the listed container
|
||||
// types.
|
||||
auto cxxMemberCallExprOnContainer(
|
||||
StringRef MethodName, llvm::ArrayRef<StringRef> ContainerNames) {
|
||||
auto cxxMemberCallExprOnContainer(StringRef MethodName,
|
||||
llvm::ArrayRef<StringRef> ContainerNames) {
|
||||
return cxxMemberCallExpr(
|
||||
hasDeclaration(functionDecl(hasName(MethodName))),
|
||||
on(hasTypeOrPointeeType(hasWantedType(ContainerNames))));
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//===--- UseEqualsDefaultCheck.h - clang-tidy--------------------------*- C++ -*-===//
|
||||
//===--- UseEqualsDefaultCheck.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.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//===--- UseEqualsDeleteCheck.h - clang-tidy---------------------------*- C++ -*-===//
|
||||
//===--- UseEqualsDeleteCheck.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.
|
||||
|
||||
@@ -229,7 +229,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
auto* CastSubExpr = C->getSubExpr()->IgnoreParens();
|
||||
auto *CastSubExpr = C->getSubExpr()->IgnoreParens();
|
||||
// Ignore cast expressions which cast nullptr literal.
|
||||
if (isa<CXXNullPtrLiteralExpr>(CastSubExpr)) {
|
||||
return true;
|
||||
|
||||
@@ -316,7 +316,6 @@ findReturnTypeAndCVSourceRange(const FunctionDecl &F, const TypeLoc &ReturnLoc,
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
// If the return type has no local qualifiers, it's source range is accurate.
|
||||
if (!hasAnyNestedLocalQualifiers(F.getReturnType()))
|
||||
return ReturnTypeRange;
|
||||
|
||||
@@ -26,6 +26,7 @@ public:
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
private:
|
||||
const bool SafeMode;
|
||||
};
|
||||
|
||||
@@ -39,10 +39,10 @@ void UseUncaughtExceptionsCheck::registerMatchers(MatchFinder *Finder) {
|
||||
this);
|
||||
// CallExpr in initialisation list: warning, fix-it with avoiding narrowing
|
||||
// conversions.
|
||||
Finder->addMatcher(callExpr(DirectCallToUncaughtException,
|
||||
hasAncestor(initListExpr()))
|
||||
.bind("init_call_expr"),
|
||||
this);
|
||||
Finder->addMatcher(
|
||||
callExpr(DirectCallToUncaughtException, hasAncestor(initListExpr()))
|
||||
.bind("init_call_expr"),
|
||||
this);
|
||||
}
|
||||
|
||||
void UseUncaughtExceptionsCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
|
||||
@@ -13,9 +13,10 @@
|
||||
|
||||
namespace clang::tidy::modernize {
|
||||
|
||||
/// This check will warn on calls to std::uncaught_exception and replace them with calls to
|
||||
/// std::uncaught_exceptions, since std::uncaught_exception was deprecated in C++17. In case of
|
||||
/// macro ID there will be only a warning without fixits.
|
||||
/// This check will warn on calls to std::uncaught_exception and replace them
|
||||
/// with calls to std::uncaught_exceptions, since std::uncaught_exception was
|
||||
/// deprecated in C++17. In case of macro ID there will be only a warning
|
||||
/// without fixits.
|
||||
///
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/modernize/use-uncaught-exceptions.html
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace clang::tidy::objc {
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/objc/avoid-nserror-init.html
|
||||
class AvoidNSErrorInitCheck : public ClangTidyCheck {
|
||||
public:
|
||||
public:
|
||||
AvoidNSErrorInitCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context) {}
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
@@ -31,4 +31,4 @@ class AvoidNSErrorInitCheck : public ClangTidyCheck {
|
||||
|
||||
} // namespace clang::tidy::objc
|
||||
|
||||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
|
||||
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_OBJC_AVOIDNSERRORINITCHECK_H
|
||||
|
||||
@@ -35,14 +35,11 @@ constexpr char DefaultForbiddenSuperClassNames[] =
|
||||
|
||||
} // namespace
|
||||
|
||||
ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(
|
||||
StringRef Name,
|
||||
ClangTidyContext *Context)
|
||||
ForbiddenSubclassingCheck::ForbiddenSubclassingCheck(StringRef Name,
|
||||
ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context),
|
||||
ForbiddenSuperClassNames(
|
||||
utils::options::parseStringList(
|
||||
Options.get("ClassNames", DefaultForbiddenSuperClassNames))) {
|
||||
}
|
||||
ForbiddenSuperClassNames(utils::options::parseStringList(
|
||||
Options.get("ClassNames", DefaultForbiddenSuperClassNames))) {}
|
||||
|
||||
void ForbiddenSubclassingCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(
|
||||
@@ -53,27 +50,22 @@ void ForbiddenSubclassingCheck::registerMatchers(MatchFinder *Finder) {
|
||||
this);
|
||||
}
|
||||
|
||||
void ForbiddenSubclassingCheck::check(
|
||||
const MatchFinder::MatchResult &Result) {
|
||||
const auto *SubClass = Result.Nodes.getNodeAs<ObjCInterfaceDecl>(
|
||||
"subclass");
|
||||
void ForbiddenSubclassingCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
const auto *SubClass = Result.Nodes.getNodeAs<ObjCInterfaceDecl>("subclass");
|
||||
assert(SubClass != nullptr);
|
||||
const auto *SuperClass = Result.Nodes.getNodeAs<ObjCInterfaceDecl>(
|
||||
"superclass");
|
||||
const auto *SuperClass =
|
||||
Result.Nodes.getNodeAs<ObjCInterfaceDecl>("superclass");
|
||||
assert(SuperClass != nullptr);
|
||||
diag(SubClass->getLocation(),
|
||||
"Objective-C interface %0 subclasses %1, which is not "
|
||||
"intended to be subclassed")
|
||||
<< SubClass
|
||||
<< SuperClass;
|
||||
<< SubClass << SuperClass;
|
||||
}
|
||||
|
||||
void ForbiddenSubclassingCheck::storeOptions(
|
||||
ClangTidyOptions::OptionMap &Opts) {
|
||||
Options.store(
|
||||
Opts,
|
||||
"ForbiddenSuperClassNames",
|
||||
utils::options::serializeStringList(ForbiddenSuperClassNames));
|
||||
Options.store(Opts, "ForbiddenSuperClassNames",
|
||||
utils::options::serializeStringList(ForbiddenSuperClassNames));
|
||||
}
|
||||
|
||||
} // namespace clang::tidy::objc
|
||||
|
||||
@@ -35,22 +35,19 @@ public:
|
||||
"objc-dealloc-in-category");
|
||||
CheckFactories.registerCheck<ForbiddenSubclassingCheck>(
|
||||
"objc-forbidden-subclassing");
|
||||
CheckFactories.registerCheck<MissingHashCheck>(
|
||||
"objc-missing-hash");
|
||||
CheckFactories.registerCheck<MissingHashCheck>("objc-missing-hash");
|
||||
CheckFactories.registerCheck<NSDateFormatterCheck>("objc-nsdate-formatter");
|
||||
CheckFactories.registerCheck<NSInvocationArgumentLifetimeCheck>(
|
||||
"objc-nsinvocation-argument-lifetime");
|
||||
CheckFactories.registerCheck<PropertyDeclarationCheck>(
|
||||
"objc-property-declaration");
|
||||
CheckFactories.registerCheck<SuperSelfCheck>(
|
||||
"objc-super-self");
|
||||
CheckFactories.registerCheck<SuperSelfCheck>("objc-super-self");
|
||||
}
|
||||
};
|
||||
|
||||
// Register the ObjCTidyModule using this statically initialized variable.
|
||||
static ClangTidyModuleRegistry::Add<ObjCModule> X(
|
||||
"objc-module",
|
||||
"Adds Objective-C lint checks.");
|
||||
static ClangTidyModuleRegistry::Add<ObjCModule>
|
||||
X("objc-module", "Adds Objective-C lint checks.");
|
||||
|
||||
} // namespace objc
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ bool prefixedPropertyNameValid(llvm::StringRef PropertyName) {
|
||||
auto RegexExp = llvm::Regex(llvm::StringRef(validPropertyNameRegex(false)));
|
||||
return RegexExp.match(PropertyName.substr(Start + 1));
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
void PropertyDeclarationCheck::registerMatchers(MatchFinder *Finder) {
|
||||
Finder->addMatcher(objcPropertyDecl(
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace clang::tidy::performance {
|
||||
class FasterStringFindCheck : public ClangTidyCheck {
|
||||
public:
|
||||
FasterStringFindCheck(StringRef Name, ClangTidyContext *Context);
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
return LangOpts.CPlusPlus;
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace clang::tidy::performance {
|
||||
class ForRangeCopyCheck : public ClangTidyCheck {
|
||||
public:
|
||||
ForRangeCopyCheck(StringRef Name, ClangTidyContext *Context);
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
return LangOpts.CPlusPlus11;
|
||||
}
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
|
||||
@@ -65,8 +65,7 @@ void ImplicitConversionInLoopCheck::check(
|
||||
const MatchFinder::MatchResult &Result) {
|
||||
const auto *VD = Result.Nodes.getNodeAs<VarDecl>("faulty-var");
|
||||
const auto *Init = Result.Nodes.getNodeAs<Expr>("init");
|
||||
const auto *OperatorCall =
|
||||
Result.Nodes.getNodeAs<Expr>("operator-call");
|
||||
const auto *OperatorCall = Result.Nodes.getNodeAs<Expr>("operator-call");
|
||||
|
||||
if (const auto *Cleanup = dyn_cast<ExprWithCleanups>(Init))
|
||||
Init = Cleanup->getSubExpr();
|
||||
|
||||
@@ -20,9 +20,9 @@ class ImplicitConversionInLoopCheck : public ClangTidyCheck {
|
||||
public:
|
||||
ImplicitConversionInLoopCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context) {}
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
|
||||
return LangOpts.CPlusPlus11;
|
||||
}
|
||||
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;
|
||||
|
||||
|
||||
@@ -126,15 +126,14 @@ void InefficientVectorOperationCheck::addMatcher(
|
||||
//
|
||||
// FIXME: Support more types of counter-based loops like decrement loops.
|
||||
Finder->addMatcher(
|
||||
forStmt(
|
||||
hasLoopInit(LoopVarInit),
|
||||
hasCondition(binaryOperator(
|
||||
hasOperatorName("<"), hasLHS(RefersToLoopVar),
|
||||
hasRHS(expr(unless(hasDescendant(expr(RefersToLoopVar))))
|
||||
.bind(LoopEndExprName)))),
|
||||
hasIncrement(unaryOperator(hasOperatorName("++"),
|
||||
hasUnaryOperand(RefersToLoopVar))),
|
||||
HasInterestingLoopBody, InInterestingCompoundStmt)
|
||||
forStmt(hasLoopInit(LoopVarInit),
|
||||
hasCondition(binaryOperator(
|
||||
hasOperatorName("<"), hasLHS(RefersToLoopVar),
|
||||
hasRHS(expr(unless(hasDescendant(expr(RefersToLoopVar))))
|
||||
.bind(LoopEndExprName)))),
|
||||
hasIncrement(unaryOperator(hasOperatorName("++"),
|
||||
hasUnaryOperand(RefersToLoopVar))),
|
||||
HasInterestingLoopBody, InInterestingCompoundStmt)
|
||||
.bind(LoopCounterName),
|
||||
this);
|
||||
|
||||
@@ -179,7 +178,7 @@ void InefficientVectorOperationCheck::registerMatchers(MatchFinder *Finder) {
|
||||
|
||||
void InefficientVectorOperationCheck::check(
|
||||
const MatchFinder::MatchResult &Result) {
|
||||
auto* Context = Result.Context;
|
||||
auto *Context = Result.Context;
|
||||
if (Context->getDiagnostics().hasUncompilableErrorOccurred())
|
||||
return;
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ namespace clang::tidy::performance {
|
||||
class InefficientVectorOperationCheck : public ClangTidyCheck {
|
||||
public:
|
||||
InefficientVectorOperationCheck(StringRef Name, ClangTidyContext *Context);
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
return LangOpts.CPlusPlus;
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
|
||||
@@ -111,10 +111,11 @@ AST_MATCHER_FUNCTION(StatementMatcher, isConstRefReturningFunctionCall) {
|
||||
// an alias to one of its arguments and the arguments need to be checked
|
||||
// for const use as well.
|
||||
return callExpr(argumentCountIs(0),
|
||||
callee(functionDecl(returns(hasCanonicalType(matchers::isReferenceToConst())),
|
||||
callee(functionDecl(returns(hasCanonicalType(
|
||||
matchers::isReferenceToConst())),
|
||||
unless(cxxMethodDecl(unless(isStatic()))))
|
||||
.bind(FunctionDeclId)))
|
||||
.bind(InitFunctionCallId);
|
||||
.bind(FunctionDeclId)))
|
||||
.bind(InitFunctionCallId);
|
||||
}
|
||||
|
||||
AST_MATCHER_FUNCTION_P(StatementMatcher, initializerReturnsReferenceToConst,
|
||||
@@ -234,12 +235,14 @@ UnnecessaryCopyInitialization::UnnecessaryCopyInitialization(
|
||||
Options.get("ExcludedContainerTypes", ""))) {}
|
||||
|
||||
void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
|
||||
auto LocalVarCopiedFrom = [this](const ast_matchers::internal::Matcher<Expr> &CopyCtorArg) {
|
||||
return compoundStmt(
|
||||
forEachDescendant(
|
||||
declStmt(
|
||||
unless(has(decompositionDecl())),
|
||||
has(varDecl(hasLocalStorage(),
|
||||
auto LocalVarCopiedFrom =
|
||||
[this](const ast_matchers::internal::Matcher<Expr> &CopyCtorArg) {
|
||||
return compoundStmt(
|
||||
forEachDescendant(
|
||||
declStmt(
|
||||
unless(has(decompositionDecl())),
|
||||
has(varDecl(
|
||||
hasLocalStorage(),
|
||||
hasType(qualType(
|
||||
hasCanonicalType(allOf(
|
||||
matchers::isExpensiveToCopy(),
|
||||
@@ -256,10 +259,10 @@ void UnnecessaryCopyInitialization::registerMatchers(MatchFinder *Finder) {
|
||||
isCopyConstructor())),
|
||||
hasArgument(0, CopyCtorArg))
|
||||
.bind("ctorCall"))))
|
||||
.bind("newVarDecl")))
|
||||
.bind("declStmt")))
|
||||
.bind("blockStmt");
|
||||
};
|
||||
.bind("newVarDecl")))
|
||||
.bind("declStmt")))
|
||||
.bind("blockStmt");
|
||||
};
|
||||
|
||||
Finder->addMatcher(
|
||||
LocalVarCopiedFrom(anyOf(
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace clang::tidy::performance {
|
||||
class UnnecessaryCopyInitialization : public ClangTidyCheck {
|
||||
public:
|
||||
UnnecessaryCopyInitialization(StringRef Name, ClangTidyContext *Context);
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override{
|
||||
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
|
||||
return LangOpts.CPlusPlus;
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
llvm::SmallString<32> Std;
|
||||
const bool Suggest;
|
||||
};
|
||||
|
||||
@@ -19,16 +19,16 @@ namespace clang::tidy::readability {
|
||||
/// For the user-facing documentation see:
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/readability/const-return-type.html
|
||||
class ConstReturnTypeCheck : public ClangTidyCheck {
|
||||
public:
|
||||
ConstReturnTypeCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context),
|
||||
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
public:
|
||||
ConstReturnTypeCheck(StringRef Name, ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context),
|
||||
IgnoreMacros(Options.getLocalOrGlobal("IgnoreMacros", true)) {}
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
private:
|
||||
const bool IgnoreMacros;
|
||||
private:
|
||||
const bool IgnoreMacros;
|
||||
};
|
||||
|
||||
} // namespace clang::tidy::readability
|
||||
|
||||
@@ -131,8 +131,8 @@ findDifferingParamsInDeclaration(const FunctionDecl *ParameterSourceDeclaration,
|
||||
|
||||
InconsistentDeclarationsContainer
|
||||
findInconsistentDeclarations(const FunctionDecl *OriginalDeclaration,
|
||||
const FunctionDecl *ParameterSourceDeclaration,
|
||||
SourceManager &SM, bool Strict) {
|
||||
const FunctionDecl *ParameterSourceDeclaration,
|
||||
SourceManager &SM, bool Strict) {
|
||||
InconsistentDeclarationsContainer InconsistentDeclarations;
|
||||
SourceLocation ParameterSourceLocation =
|
||||
ParameterSourceDeclaration->getLocation();
|
||||
|
||||
@@ -43,11 +43,12 @@ private:
|
||||
|
||||
bool isBitFieldWidth(const clang::ast_matchers::MatchFinder::MatchResult &,
|
||||
const FloatingLiteral &) const {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isBitFieldWidth(const clang::ast_matchers::MatchFinder::MatchResult &Result,
|
||||
const IntegerLiteral &Literal) const;
|
||||
bool
|
||||
isBitFieldWidth(const clang::ast_matchers::MatchFinder::MatchResult &Result,
|
||||
const IntegerLiteral &Literal) const;
|
||||
|
||||
bool isUserDefinedLiteral(
|
||||
const clang::ast_matchers::MatchFinder::MatchResult &Result,
|
||||
|
||||
@@ -50,10 +50,9 @@ std::optional<Token> findQualToken(const VarDecl *Decl, Qualifier Qual,
|
||||
if (FileRange.isInvalid())
|
||||
return std::nullopt;
|
||||
|
||||
tok::TokenKind Tok =
|
||||
Qual == Qualifier::Const
|
||||
? tok::kw_const
|
||||
: Qual == Qualifier::Volatile ? tok::kw_volatile : tok::kw_restrict;
|
||||
tok::TokenKind Tok = Qual == Qualifier::Const ? tok::kw_const
|
||||
: Qual == Qualifier::Volatile ? tok::kw_volatile
|
||||
: tok::kw_restrict;
|
||||
|
||||
return utils::lexer::getQualifyingToken(Tok, FileRange, *Result.Context,
|
||||
*Result.SourceManager);
|
||||
|
||||
@@ -13,7 +13,8 @@ using namespace clang::ast_matchers;
|
||||
|
||||
namespace clang::tidy::readability {
|
||||
|
||||
void RedundantFunctionPtrDereferenceCheck::registerMatchers(MatchFinder *Finder) {
|
||||
void RedundantFunctionPtrDereferenceCheck::registerMatchers(
|
||||
MatchFinder *Finder) {
|
||||
Finder->addMatcher(
|
||||
traverse(TK_AsIs, unaryOperator(hasOperatorName("*"),
|
||||
has(implicitCastExpr(hasCastKind(
|
||||
@@ -22,7 +23,8 @@ void RedundantFunctionPtrDereferenceCheck::registerMatchers(MatchFinder *Finder)
|
||||
this);
|
||||
}
|
||||
|
||||
void RedundantFunctionPtrDereferenceCheck::check(const MatchFinder::MatchResult &Result) {
|
||||
void RedundantFunctionPtrDereferenceCheck::check(
|
||||
const MatchFinder::MatchResult &Result) {
|
||||
const auto *Operator = Result.Nodes.getNodeAs<UnaryOperator>("op");
|
||||
diag(Operator->getOperatorLoc(),
|
||||
"redundant repeated dereference of function pointer")
|
||||
|
||||
@@ -19,7 +19,8 @@ namespace clang::tidy::readability {
|
||||
/// http://clang.llvm.org/extra/clang-tidy/checks/readability/redundant-function-ptr-dereference.html
|
||||
class RedundantFunctionPtrDereferenceCheck : public ClangTidyCheck {
|
||||
public:
|
||||
RedundantFunctionPtrDereferenceCheck(StringRef Name, ClangTidyContext *Context)
|
||||
RedundantFunctionPtrDereferenceCheck(StringRef Name,
|
||||
ClangTidyContext *Context)
|
||||
: ClangTidyCheck(Name, Context) {}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
|
||||
@@ -52,12 +52,11 @@ void RedundantStringCStrCheck::registerMatchers(
|
||||
const auto StringConstructorExpr = expr(anyOf(
|
||||
cxxConstructExpr(argumentCountIs(1),
|
||||
hasDeclaration(cxxMethodDecl(hasName("basic_string")))),
|
||||
cxxConstructExpr(
|
||||
argumentCountIs(2),
|
||||
hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
|
||||
// If present, the second argument is the alloc object which must not
|
||||
// be present explicitly.
|
||||
hasArgument(1, cxxDefaultArgExpr()))));
|
||||
cxxConstructExpr(argumentCountIs(2),
|
||||
hasDeclaration(cxxMethodDecl(hasName("basic_string"))),
|
||||
// If present, the second argument is the alloc object
|
||||
// which must not be present explicitly.
|
||||
hasArgument(1, cxxDefaultArgExpr()))));
|
||||
|
||||
// Match string constructor.
|
||||
const auto StringViewConstructorExpr = cxxConstructExpr(
|
||||
@@ -105,8 +104,9 @@ void RedundantStringCStrCheck::registerMatchers(
|
||||
|
||||
// Detect: 'dst.append(str.c_str())' -> 'dst.append(str)'
|
||||
Finder->addMatcher(
|
||||
cxxMemberCallExpr(on(StringExpr), callee(decl(cxxMethodDecl(hasAnyName(
|
||||
"append", "assign", "compare")))),
|
||||
cxxMemberCallExpr(on(StringExpr),
|
||||
callee(decl(cxxMethodDecl(
|
||||
hasAnyName("append", "assign", "compare")))),
|
||||
argumentCountIs(1), hasArgument(0, StringCStrCallExpr)),
|
||||
this);
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
}
|
||||
void registerMatchers(ast_matchers::MatchFinder *Finder) override;
|
||||
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap& Opts) override;
|
||||
void storeOptions(ClangTidyOptions::OptionMap &Opts) override;
|
||||
std::optional<TraversalKind> getCheckTraversalKind() const override {
|
||||
return TK_IgnoreUnlessSpelledInSource;
|
||||
}
|
||||
|
||||
@@ -337,8 +337,7 @@ Allow empty enabled checks. This suppresses
|
||||
the "no checks enabled" error when disabling
|
||||
all of the checks.
|
||||
)"),
|
||||
cl::init(false),
|
||||
cl::cat(ClangTidyCategory));
|
||||
cl::init(false), cl::cat(ClangTidyCategory));
|
||||
|
||||
namespace clang::tidy {
|
||||
|
||||
@@ -370,8 +369,8 @@ static void printStats(const ClangTidyStats &Stats) {
|
||||
}
|
||||
}
|
||||
|
||||
static std::unique_ptr<ClangTidyOptionsProvider> createOptionsProvider(
|
||||
llvm::IntrusiveRefCntPtr<vfs::FileSystem> FS) {
|
||||
static std::unique_ptr<ClangTidyOptionsProvider>
|
||||
createOptionsProvider(llvm::IntrusiveRefCntPtr<vfs::FileSystem> FS) {
|
||||
ClangTidyGlobalOptions GlobalOptions;
|
||||
if (std::error_code Err = parseLineFilter(LineFilter, GlobalOptions)) {
|
||||
llvm::errs() << "Invalid LineFilter: " << Err.message() << "\n\nUsage:\n";
|
||||
|
||||
@@ -48,8 +48,7 @@ StringRef makeCanonicalName(StringRef Str, IncludeSorter::IncludeStyle Style) {
|
||||
if (StartIndex == StringRef::npos) {
|
||||
StartIndex = 0;
|
||||
}
|
||||
return Canonical.substr(
|
||||
0, Canonical.find_first_of('+', StartIndex));
|
||||
return Canonical.substr(0, Canonical.find_first_of('+', StartIndex));
|
||||
}
|
||||
return removeFirstSuffix(
|
||||
removeFirstSuffix(Str, {".cc", ".cpp", ".c", ".h", ".hpp"}),
|
||||
|
||||
@@ -41,8 +41,7 @@ std::optional<bool> isExpensiveToCopy(QualType Type,
|
||||
return std::nullopt;
|
||||
return !Type.isTriviallyCopyableType(Context) &&
|
||||
!classHasTrivialCopyAndDestroy(Type) &&
|
||||
!hasDeletedCopyConstructor(Type) &&
|
||||
!Type->isObjCLifetimeType();
|
||||
!hasDeletedCopyConstructor(Type) && !Type->isObjCLifetimeType();
|
||||
}
|
||||
|
||||
bool recordIsTriviallyDefaultConstructible(const RecordDecl &RecordDecl,
|
||||
|
||||
Reference in New Issue
Block a user