Remove redundant string initialization (NFC)

Identified by readability-redundant-string-init.
This commit is contained in:
Kazu Hirata 2022-01-01 12:34:11 -08:00
parent 319e77592f
commit f4ffcab178
6 changed files with 9 additions and 10 deletions

View File

@ -307,7 +307,7 @@ public:
std::shared_ptr<llvm::Regex> Regex;
/// By default, optimization remark is missing.
OptRemark() : Kind(RK_Missing), Pattern(""), Regex(nullptr) {}
OptRemark() : Kind(RK_Missing), Regex(nullptr) {}
/// Returns true iff the optimization remark holds a valid regular
/// expression.

View File

@ -30,8 +30,7 @@ template <> struct MappingTraits<clang::tooling::Replacement> {
/// Helper to (de)serialize a Replacement since we don't have direct
/// access to its data members.
struct NormalizedReplacement {
NormalizedReplacement(const IO &)
: FilePath(""), Offset(0), Length(0), ReplacementText("") {}
NormalizedReplacement(const IO &) : Offset(0), Length(0) {}
NormalizedReplacement(const IO &, const clang::tooling::Replacement &R)
: FilePath(R.getFilePath()), Offset(R.getOffset()),

View File

@ -174,9 +174,9 @@ Driver::Driver(StringRef ClangExecutable, StringRef TargetTriple,
CCPrintHeadersFilename(), CCLogDiagnosticsFilename(),
CCCPrintBindings(false), CCPrintOptions(false), CCPrintHeaders(false),
CCLogDiagnostics(false), CCGenDiagnostics(false),
CCPrintProcessStats(false), TargetTriple(TargetTriple),
CCCGenericGCCName(""), Saver(Alloc), CheckInputsExist(true),
GenReproducer(false), SuppressMissingInputWarning(false) {
CCPrintProcessStats(false), TargetTriple(TargetTriple), Saver(Alloc),
CheckInputsExist(true), GenReproducer(false),
SuppressMissingInputWarning(false) {
// Provide a sane fallback if no VFS is specified.
if (!this->VFS)
this->VFS = llvm::vfs::getRealFileSystem();

View File

@ -292,7 +292,7 @@ class Variable {
std::string N;
public:
Variable() : T(Type::getVoid()), N("") {}
Variable() : T(Type::getVoid()) {}
Variable(Type T, std::string N) : T(std::move(T)), N(std::move(N)) {}
Type getType() const { return T; }

View File

@ -59,7 +59,7 @@ uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) {
// "{CGRect=\"origin\"{CGPoint=\"x\"d\"y\"d}\"size\"{CGSize=\"width\"d\"height\"d}}"
AppleObjCTypeEncodingParser::StructElement::StructElement()
: name(""), type(clang::QualType()) {}
: type(clang::QualType()) {}
AppleObjCTypeEncodingParser::StructElement
AppleObjCTypeEncodingParser::ReadStructElement(TypeSystemClang &ast_ctx,

View File

@ -97,8 +97,8 @@ private:
class EvalResult {
public:
EvalResult() : Value(0), ErrorMsg("") {}
EvalResult(uint64_t Value) : Value(Value), ErrorMsg("") {}
EvalResult() : Value(0) {}
EvalResult(uint64_t Value) : Value(Value) {}
EvalResult(std::string ErrorMsg)
: Value(0), ErrorMsg(std::move(ErrorMsg)) {}
uint64_t getValue() const { return Value; }