From: Alex Langford Date: Thu, 15 Aug 2019 00:58:51 +0000 (+0000) Subject: [NFCI] Always initialize BugReport const fields X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5aab38320df8ed2e1f6cf8502ad84cec8e2da13d;p=clang [NFCI] Always initialize BugReport const fields Summary: Some compilers require that const fields of an object must be explicitly initialized by the constructor. I ran into this issue building with clang 3.8 on Ubuntu 16.04. Reviewers: compnerd, Szelethus, NoQ Subscribers: cfe-commits, llvm-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D66265 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@368950 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h index f68e231a1f..95aab663e2 100644 --- a/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h +++ b/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h @@ -180,10 +180,12 @@ public: /// to the user. This method allows to rest the location which should be used /// for uniquing reports. For example, memory leaks checker, could set this to /// the allocation site, rather then the location where the bug is reported. - BugReport(BugType& bt, StringRef desc, const ExplodedNode *errornode, + BugReport(BugType &bt, StringRef desc, const ExplodedNode *errornode, PathDiagnosticLocation LocationToUnique, const Decl *DeclToUnique) : BT(bt), Description(desc), UniqueingLocation(LocationToUnique), - UniqueingDecl(DeclToUnique), ErrorNode(errornode) {} + UniqueingDecl(DeclToUnique), ErrorNode(errornode), + ErrorNodeRange(getStmt() ? getStmt()->getSourceRange() + : SourceRange()) {} virtual ~BugReport() = default;