Author: Hans Wennborg Date: 2020-10-20T17:18:46+02:00 New Revision: c76cdeac93380b434349738d96f83d3ffda9869c
URL: https://github.com/llvm/llvm-project/commit/c76cdeac93380b434349738d96f83d3ffda9869c DIFF: https://github.com/llvm/llvm-project/commit/c76cdeac93380b434349738d96f83d3ffda9869c.diff LOG: Explicitly initialize StreamingDiagnostic in derived class copy ctors To pacify a GCC warning: [1/1] Building CXX object tools/clang/lib/Analysis/CMakeFiles/obj.clangAnalysis.dir/Dominators.cpp.o In file included from /work/llvm.monorepo/clang/include/clang/AST/NestedNameSpecifier.h:18:0, from /work/llvm.monorepo/clang/include/clang/AST/Type.h:21, from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16, from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18, from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20, from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16, from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9: /work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h: In copy constructor ‘clang::DiagnosticBuilder::DiagnosticBuilder(const clang::DiagnosticBuilder&)’: /work/llvm.monorepo/clang/include/clang/Basic/Diagnostic.h:1287:3: warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra] DiagnosticBuilder(const DiagnosticBuilder &D) { ^ In file included from /work/llvm.monorepo/clang/include/clang/AST/Type.h:29:0, from /work/llvm.monorepo/clang/include/clang/AST/DeclarationName.h:16, from /work/llvm.monorepo/clang/include/clang/AST/DeclBase.h:18, from /work/llvm.monorepo/clang/include/clang/Analysis/AnalysisDeclContext.h:20, from /work/llvm.monorepo/clang/include/clang/Analysis/Analyses/Dominators.h:16, from /work/llvm.monorepo/clang/lib/Analysis/Dominators.cpp:9: /work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h: In copy constructor ‘clang::PartialDiagnostic::PartialDiagnostic(const clang::PartialDiagnostic&)’: /work/llvm.monorepo/clang/include/clang/Basic/PartialDiagnostic.h:52:3: warning: base class ‘class clang::StreamingDiagnostic’ should be explicitly initialized in the copy constructor [-Wextra] PartialDiagnostic(const PartialDiagnostic &Other) : DiagID(Other.DiagID) { ^ 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 f17b98f74038..3499c551cfdf 100644 --- a/clang/include/clang/Basic/Diagnostic.h +++ b/clang/include/clang/Basic/Diagnostic.h @@ -1284,7 +1284,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 9e017902b120..370bc6861dd6 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(); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits