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

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 10 09:22:14 PST 2022


Author: Kazu Hirata
Date: 2022-01-10T09:21:59-08:00
New Revision: 7485e6c7e9c7d484ba1faf2dc53c9b598286455b

URL: https://github.com/llvm/llvm-project/commit/7485e6c7e9c7d484ba1faf2dc53c9b598286455b
DIFF: https://github.com/llvm/llvm-project/commit/7485e6c7e9c7d484ba1faf2dc53c9b598286455b.diff

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

This reverts commit 80e2c587498a7b2bf14dde47a33a058da6e88a9a.

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]

Added: 
    

Modified: 
    clang/include/clang/AST/ASTConcept.h
    clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
    clang/include/clang/Basic/Diagnostic.h
    clang/include/clang/Basic/PartialDiagnostic.h
    clang/include/clang/Parse/Parser.h
    clang/include/clang/Sema/ParsedAttr.h
    clang/include/clang/Sema/ParsedTemplate.h
    clang/lib/AST/MicrosoftCXXABI.cpp
    clang/lib/Sema/Sema.cpp
    clang/lib/Sema/SemaExprCXX.cpp
    clang/utils/TableGen/MveEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/AST/ASTConcept.h b/clang/include/clang/AST/ASTConcept.h
index 25e00860060f..fbd506f2a160 100644
--- a/clang/include/clang/AST/ASTConcept.h
+++ b/clang/include/clang/AST/ASTConcept.h
@@ -131,7 +131,8 @@ class ConceptReference {
         NamedConcept(NamedConcept), ArgsAsWritten(ArgsAsWritten) {}
 
   ConceptReference()
-      : FoundDecl(nullptr), NamedConcept(nullptr), ArgsAsWritten(nullptr) {}
+      : TemplateKWLoc(), FoundDecl(nullptr), NamedConcept(nullptr),
+        ArgsAsWritten(nullptr) {}
 
   const NestedNameSpecifierLoc &getNestedNameSpecifierLoc() const {
     return NestedNameSpec;

diff  --git a/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h b/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
index 3f6f364d6505..25eb38e6435e 100644
--- a/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
+++ b/clang/include/clang/ASTMatchers/Dynamic/Diagnostics.h
@@ -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;

diff  --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h
index 6a80823d1242..e5577e74fa63 100644
--- a/clang/include/clang/Basic/Diagnostic.h
+++ b/clang/include/clang/Basic/Diagnostic.h
@@ -1326,7 +1326,7 @@ class DiagnosticBuilder : public StreamingDiagnostic {
 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;

diff  --git a/clang/include/clang/Basic/PartialDiagnostic.h b/clang/include/clang/Basic/PartialDiagnostic.h
index d2135f5da0bd..ddee6821e2e1 100644
--- a/clang/include/clang/Basic/PartialDiagnostic.h
+++ b/clang/include/clang/Basic/PartialDiagnostic.h
@@ -46,7 +46,8 @@ class PartialDiagnostic : public StreamingDiagnostic {
   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();

diff  --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index b651929fa9da..a98ad78401f0 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -1475,7 +1475,8 @@ class Parser : public CodeCompletionHandler {
   /// 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,

diff  --git a/clang/include/clang/Sema/ParsedAttr.h b/clang/include/clang/Sema/ParsedAttr.h
index 4fa6f09d3321..657cf9253c77 100644
--- a/clang/include/clang/Sema/ParsedAttr.h
+++ b/clang/include/clang/Sema/ParsedAttr.h
@@ -1080,7 +1080,7 @@ struct ParsedAttributesWithRange : ParsedAttributes {
   SourceRange Range;
 };
 struct ParsedAttributesViewWithRange : ParsedAttributesView {
-  ParsedAttributesViewWithRange() {}
+  ParsedAttributesViewWithRange() : ParsedAttributesView() {}
   void clearListOnly() {
     ParsedAttributesView::clearListOnly();
     Range = SourceRange();

diff  --git a/clang/include/clang/Sema/ParsedTemplate.h b/clang/include/clang/Sema/ParsedTemplate.h
index 72f91d0aa41a..f0245b93c7eb 100644
--- a/clang/include/clang/Sema/ParsedTemplate.h
+++ b/clang/include/clang/Sema/ParsedTemplate.h
@@ -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; }

diff  --git a/clang/lib/AST/MicrosoftCXXABI.cpp b/clang/lib/AST/MicrosoftCXXABI.cpp
index b7dc0e62e66a..53d7e0b042ff 100644
--- a/clang/lib/AST/MicrosoftCXXABI.cpp
+++ b/clang/lib/AST/MicrosoftCXXABI.cpp
@@ -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;

diff  --git a/clang/lib/Sema/Sema.cpp b/clang/lib/Sema/Sema.cpp
index 683e82ec3f18..60f37c17c3f1 100644
--- a/clang/lib/Sema/Sema.cpp
+++ b/clang/lib/Sema/Sema.cpp
@@ -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),

diff  --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index b34b744d7312..64d045d697db 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -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) {

diff  --git a/clang/utils/TableGen/MveEmitter.cpp b/clang/utils/TableGen/MveEmitter.cpp
index cc830c1d5416..1a2532fbf53f 100644
--- a/clang/utils/TableGen/MveEmitter.cpp
+++ b/clang/utils/TableGen/MveEmitter.cpp
@@ -1489,7 +1489,8 @@ class string_holder {
 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[] =


        


More information about the cfe-commits mailing list