Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ ComparisonInTempFailureRetryCheck::ComparisonInTempFailureRetryCheck(
StringRef Name, ClangTidyContext *Context)
: ClangTidyCheck(Name, Context),
RawRetryList(Options.get("RetryMacros", "TEMP_FAILURE_RETRY")) {
StringRef(RawRetryList).split(RetryMacros, ",", -1, false);
RawRetryList.split(RetryMacros, ",", -1, false);
}

void ComparisonInTempFailureRetryCheck::storeOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ AssertSideEffectCheck::AssertSideEffectCheck(StringRef Name,
RawAssertList(Options.get("AssertMacros", "assert,NSAssert,NSCAssert")),
IgnoredFunctions(utils::options::parseListPair(
"__builtin_expect;", Options.get("IgnoredFunctions", ""))) {
StringRef(RawAssertList).split(AssertMacros, ",", -1, false);
RawAssertList.split(AssertMacros, ",", -1, false);
}

// The options are explained in AssertSideEffectCheck.h.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
RawIgnoredExceptions(Options.get("IgnoredExceptions", "")) {
llvm::SmallVector<StringRef, 8> FunctionsThatShouldNotThrowVec,
IgnoredExceptionsVec;
StringRef(RawFunctionsThatShouldNotThrow)
.split(FunctionsThatShouldNotThrowVec, ",", -1, false);
RawFunctionsThatShouldNotThrow.split(FunctionsThatShouldNotThrowVec, ",", -1,
false);
FunctionsThatShouldNotThrow.insert_range(FunctionsThatShouldNotThrowVec);

llvm::StringSet<> IgnoredExceptions;
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
RawIgnoredExceptions.split(IgnoredExceptionsVec, ",", -1, false);
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
Tracer.ignoreExceptions(std::move(IgnoredExceptions));
Tracer.ignoreBadAlloc(true);
Expand Down
4 changes: 2 additions & 2 deletions clang-tools-extra/clang-tidy/bugprone/ExceptionEscapeCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class ExceptionEscapeCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;

private:
std::string RawFunctionsThatShouldNotThrow;
std::string RawIgnoredExceptions;
StringRef RawFunctionsThatShouldNotThrow;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a bit of mixed feelings about this since it can lead to lifetime issues. But I see the change you mentioned in the commit message and has been applied in many other checks so I guess it's fine!

StringRef RawIgnoredExceptions;

llvm::StringSet<> FunctionsThatShouldNotThrow;
utils::ExceptionAnalyzer Tracer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ ProperlySeededRandomGeneratorCheck::ProperlySeededRandomGeneratorCheck(
: ClangTidyCheck(Name, Context),
RawDisallowedSeedTypes(
Options.get("DisallowedSeedTypes", "time_t,std::time_t")) {
StringRef(RawDisallowedSeedTypes).split(DisallowedSeedTypes, ',');
RawDisallowedSeedTypes.split(DisallowedSeedTypes, ',');
}

void ProperlySeededRandomGeneratorCheck::storeOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ProperlySeededRandomGeneratorCheck : public ClangTidyCheck {
void checkSeed(const ast_matchers::MatchFinder::MatchResult &Result,
const T *Func);

std::string RawDisallowedSeedTypes;
StringRef RawDisallowedSeedTypes;
SmallVector<StringRef, 5> DisallowedSeedTypes;
};

Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ UseNullptrCheck::UseNullptrCheck(StringRef Name, ClangTidyContext *Context)
NullMacrosStr(Options.get("NullMacros", "NULL")),
IgnoredTypes(utils::options::parseStringList(Options.get(
"IgnoredTypes", "_CmpUnspecifiedParam;^std::__cmp_cat::__unspec"))) {
StringRef(NullMacrosStr).split(NullMacros, ",");
NullMacrosStr.split(NullMacros, ",");
}

void UseNullptrCheck::storeOptions(ClangTidyOptions::OptionMap &Opts) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ ExceptionEscapeCheck::ExceptionEscapeCheck(StringRef Name,
llvm::SmallVector<StringRef, 8> IgnoredExceptionsVec;

llvm::StringSet<> IgnoredExceptions;
StringRef(RawIgnoredExceptions).split(IgnoredExceptionsVec, ",", -1, false);
RawIgnoredExceptions.split(IgnoredExceptionsVec, ",", -1, false);
llvm::transform(IgnoredExceptionsVec, IgnoredExceptionsVec.begin(),
[](StringRef S) { return S.trim(); });
IgnoredExceptions.insert_range(IgnoredExceptionsVec);
Expand Down
2 changes: 1 addition & 1 deletion clang-tools-extra/clang-tidy/openmp/ExceptionEscapeCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class ExceptionEscapeCheck : public ClangTidyCheck {
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;

private:
std::string RawIgnoredExceptions;
StringRef RawIgnoredExceptions;

utils::ExceptionAnalyzer Tracer;
};
Expand Down
Loading