[clang] 7505aee - [clang] Pacify GCC warning. NFC.

Michael Liao via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 3 08:06:58 PST 2022


Author: Michael Liao
Date: 2022-01-03T11:05:36-05:00
New Revision: 7505aeefc4e615520e2c822b9647dad4a48276b9

URL: https://github.com/llvm/llvm-project/commit/7505aeefc4e615520e2c822b9647dad4a48276b9
DIFF: https://github.com/llvm/llvm-project/commit/7505aeefc4e615520e2c822b9647dad4a48276b9.diff

LOG: [clang] Pacify GCC warning. NFC.

- This partially reverts d677a7cb056b17145a50ec8ca2ab6d5f4c494749 to
  pacify GCC warnings like
  ```
  base class should be explicitly initialized in the copy constructor
  ```
- Shall we keep turning on option `IgnoreBaseInCopyConstructors` when
  enabling `readability-redundant-member-init` check?

Added: 
    

Modified: 
    clang/include/clang/Basic/Diagnostic.h
    clang/include/clang/Basic/PartialDiagnostic.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/Diagnostic.h b/clang/include/clang/Basic/Diagnostic.h
index 6a80823d12422..e5577e74fa639 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 217441979869b..9fb70bff7fee1 100644
--- a/clang/include/clang/Basic/PartialDiagnostic.h
+++ b/clang/include/clang/Basic/PartialDiagnostic.h
@@ -49,7 +49,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();


        


More information about the cfe-commits mailing list