]> granicus.if.org Git - clang/commitdiff
[NFCI] Always initialize BugReport const fields
authorAlex Langford <apl@fb.com>
Thu, 15 Aug 2019 00:58:51 +0000 (00:58 +0000)
committerAlex Langford <apl@fb.com>
Thu, 15 Aug 2019 00:58:51 +0000 (00:58 +0000)
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

include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h

index f68e231a1f00266c6c024e96b02f5cc128a52baf..95aab663e2aef2b6341627a86a6c2e5ba9615cde 100644 (file)
@@ -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(BugTypebt, 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;