[clang-tools-extra] 8625f5b - [clang-tidy][NFC] Streamline CheckOptions error reporting.
Nathan James via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 7 06:10:44 PST 2020
Author: Nathan James
Date: 2020-12-07T14:05:49Z
New Revision: 8625f5bc799f4ee1c85126bd007166fe6dff14a1
URL: https://github.com/llvm/llvm-project/commit/8625f5bc799f4ee1c85126bd007166fe6dff14a1
DIFF: https://github.com/llvm/llvm-project/commit/8625f5bc799f4ee1c85126bd007166fe6dff14a1.diff
LOG: [clang-tidy][NFC] Streamline CheckOptions error reporting.
Added:
Modified:
clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
index c99931e0aa3a..be68dfbedb29 100644
--- a/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
+++ b/clang-tools-extra/clang-tidy/ClangTidyCheck.cpp
@@ -21,28 +21,22 @@ char UnparseableEnumOptionError::ID;
char UnparseableIntegerOptionError::ID;
std::string MissingOptionError::message() const {
- llvm::SmallString<128> Buffer;
- llvm::raw_svector_ostream Output(Buffer);
- Output << "option not found '" << OptionName << '\'';
+ llvm::SmallString<128> Buffer({"option not found '", OptionName, "'"});
return std::string(Buffer);
}
std::string UnparseableEnumOptionError::message() const {
- llvm::SmallString<128> Buffer;
- llvm::raw_svector_ostream Output(Buffer);
- Output << "invalid configuration value '" << LookupValue << "' for option '"
- << LookupName << '\'';
+ llvm::SmallString<256> Buffer({"invalid configuration value '", LookupValue,
+ "' for option '", LookupName, "'"});
if (SuggestedValue)
- Output << "; did you mean '" << *SuggestedValue << "'?";
+ Buffer.append({"; did you mean '", *SuggestedValue, "'?"});
return std::string(Buffer);
}
std::string UnparseableIntegerOptionError::message() const {
- llvm::SmallString<128> Buffer;
- llvm::raw_svector_ostream Output(Buffer);
- Output << "invalid configuration value '" << LookupValue << "' for option '"
- << LookupName << "'; expected "
- << (IsBoolean ? "a bool" : "an integer value");
+ llvm::SmallString<256> Buffer({"invalid configuration value '", LookupValue,
+ "' for option '", LookupName, "'; expected ",
+ (IsBoolean ? "a bool" : "an integer value")});
return std::string(Buffer);
}
More information about the cfe-commits
mailing list