[PATCH] D66265: [NFCI] Always initialize BugReport const fields
Alex Langford via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 14 17:30:37 PDT 2019
xiaobai created this revision.
xiaobai added reviewers: compnerd, Szelethus, NoQ.
Herald added a project: clang.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D66265
Files:
clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
Index: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
===================================================================
--- clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
+++ clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h
@@ -180,10 +180,12 @@
/// 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;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D66265.215292.patch
Type: text/x-patch
Size: 1124 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190815/8b74a4ac/attachment.bin>
More information about the cfe-commits
mailing list