Revert "[clang] Remove redundant member initialization (NFC)"

This reverts commit 80e2c58749.

The original patch causes a lot of warnings on gcc like:

  llvm-project/clang/include/clang/Basic/Diagnostic.h:1329:3: warning:
  base class ‘class clang::StreamingDiagnostic’ should be explicitly
  initialized in the copy constructor [-Wextra]
This commit is contained in:
Kazu Hirata 2022-01-10 09:21:59 -08:00
parent 7febd60a90
commit 7485e6c7e9
11 changed files with 16 additions and 12 deletions

View File

@ -131,7 +131,8 @@ public:
NamedConcept(NamedConcept), ArgsAsWritten(ArgsAsWritten) {}
ConceptReference()
: FoundDecl(nullptr), NamedConcept(nullptr), ArgsAsWritten(nullptr) {}
: TemplateKWLoc(), FoundDecl(nullptr), NamedConcept(nullptr),
ArgsAsWritten(nullptr) {}
const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
return NestedNameSpec;

View File

@ -40,7 +40,7 @@ struct SourceRange {
/// A VariantValue instance annotated with its parser context.
struct ParserValue {
ParserValue() {}
ParserValue() : Range() {}
StringRef Text;
SourceRange Range;
VariantValue Value;

View File

@ -1326,7 +1326,7 @@ protected:
public:
/// Copy constructor. When copied, this "takes" the diagnostic info from the
/// input and neuters it.
DiagnosticBuilder(const DiagnosticBuilder &D) {
DiagnosticBuilder(const DiagnosticBuilder &D) : StreamingDiagnostic() {
DiagObj = D.DiagObj;
DiagStorage = D.DiagStorage;
IsActive = D.IsActive;

View File

@ -46,7 +46,8 @@ public:
PartialDiagnostic(unsigned DiagID, DiagStorageAllocator &Allocator_)
: StreamingDiagnostic(Allocator_), DiagID(DiagID) {}
PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID) {
PartialDiagnostic(const PartialDiagnostic &Other)
: StreamingDiagnostic(), DiagID(Other.DiagID) {
Allocator = Other.Allocator;
if (Other.DiagStorage) {
DiagStorage = getStorage();

View File

@ -1475,7 +1475,8 @@ private:
/// information that has been parsed prior to parsing declaration
/// specifiers.
struct ParsedTemplateInfo {
ParsedTemplateInfo() : Kind(NonTemplate), TemplateParams(nullptr) {}
ParsedTemplateInfo()
: Kind(NonTemplate), TemplateParams(nullptr), TemplateLoc() { }
ParsedTemplateInfo(TemplateParameterLists *TemplateParams,
bool isSpecialization,

View File

@ -1080,7 +1080,7 @@ struct ParsedAttributesWithRange : ParsedAttributes {
SourceRange Range;
};
struct ParsedAttributesViewWithRange : ParsedAttributesView {
ParsedAttributesViewWithRange() {}
ParsedAttributesViewWithRange() : ParsedAttributesView() {}
void clearListOnly() {
ParsedAttributesView::clearListOnly();
Range = SourceRange();

View File

@ -64,7 +64,7 @@ namespace clang {
SourceLocation TemplateLoc)
: Kind(ParsedTemplateArgument::Template),
Arg(Template.getAsOpaquePtr()),
SS(SS), Loc(TemplateLoc) { }
SS(SS), Loc(TemplateLoc), EllipsisLoc() { }
/// Determine whether the given template argument is invalid.
bool isInvalid() const { return Arg == nullptr; }

View File

@ -36,8 +36,8 @@ class MicrosoftNumberingContext : public MangleNumberingContext {
public:
MicrosoftNumberingContext()
: LambdaManglingNumber(0), StaticLocalNumber(0),
StaticThreadlocalNumber(0) {}
: MangleNumberingContext(), LambdaManglingNumber(0),
StaticLocalNumber(0), StaticThreadlocalNumber(0) {}
unsigned getManglingNumber(const CXXMethodDecl *CallOperator) override {
return ++LambdaManglingNumber;

View File

@ -187,7 +187,7 @@ Sema::Sema(Preprocessor &pp, ASTContext &ctxt, ASTConsumer &consumer,
CodeSegStack(nullptr), FpPragmaStack(FPOptionsOverride()),
CurInitSeg(nullptr), VisContext(nullptr),
PragmaAttributeCurrentTargetDecl(nullptr),
IsBuildingRecoveryCallExpr(false), LateTemplateParser(nullptr),
IsBuildingRecoveryCallExpr(false), Cleanup{}, LateTemplateParser(nullptr),
LateTemplateParserCleanup(nullptr), OpaqueParser(nullptr), IdResolver(pp),
StdExperimentalNamespaceCache(nullptr), StdInitializerList(nullptr),
StdCoroutineTraitsCache(nullptr), CXXTypeInfoDecl(nullptr),

View File

@ -6614,7 +6614,7 @@ QualType Sema::FindCompositePointerType(SourceLocation Loc,
const Type *ClassOrBound;
Step(Kind K, const Type *ClassOrBound = nullptr)
: K(K), ClassOrBound(ClassOrBound) {}
: K(K), Quals(), ClassOrBound(ClassOrBound) {}
QualType rebuild(ASTContext &Ctx, QualType T) const {
T = Ctx.getQualifiedType(T, Quals);
switch (K) {

View File

@ -1489,7 +1489,8 @@ protected:
class raw_self_contained_string_ostream : private string_holder,
public raw_string_ostream {
public:
raw_self_contained_string_ostream() : raw_string_ostream(S) {}
raw_self_contained_string_ostream()
: string_holder(), raw_string_ostream(S) {}
};
const char LLVMLicenseHeader[] =