[PATCH] D51886: [analyzer][UninitializedObjectChecker] Using the new const methods of ImmutableList
Umann Kristóf via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sun Sep 23 02:18:05 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rC342834: [analyzer][UninitializedObjectChecker] Using the new const methods of… (authored by Szelethus, committed by ).
Repository:
rC Clang
https://reviews.llvm.org/D51886
Files:
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
Index: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
+++ lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp
@@ -339,14 +339,6 @@
// Methods for FieldChainInfo.
//===----------------------------------------------------------------------===//
-const FieldRegion *FieldChainInfo::getUninitRegion() const {
- assert(!Chain.isEmpty() && "Empty fieldchain!");
-
- // ImmutableList::getHead() isn't a const method, hence the not too nice
- // implementation.
- return (*Chain.begin()).getRegion();
-}
-
bool FieldChainInfo::contains(const FieldRegion *FR) const {
for (const FieldNode &Node : Chain) {
if (Node.isSameRegion(FR))
@@ -360,7 +352,7 @@
/// recursive function to print the fieldchain correctly. The last element in
/// the chain is to be printed by `FieldChainInfo::print`.
static void printTail(llvm::raw_ostream &Out,
- const FieldChainInfo::FieldChainImpl *L);
+ const FieldChainInfo::FieldChain L);
// FIXME: This function constructs an incorrect string in the following case:
//
@@ -379,30 +371,29 @@
if (Chain.isEmpty())
return;
- const FieldChainImpl *L = Chain.getInternalPointer();
- const FieldNode &LastField = L->getHead();
+ const FieldNode &LastField = getHead();
LastField.printNoteMsg(Out);
Out << '\'';
for (const FieldNode &Node : Chain)
Node.printPrefix(Out);
Out << "this->";
- printTail(Out, L->getTail());
+ printTail(Out, Chain.getTail());
LastField.printNode(Out);
Out << '\'';
}
static void printTail(llvm::raw_ostream &Out,
- const FieldChainInfo::FieldChainImpl *L) {
- if (!L)
+ const FieldChainInfo::FieldChain L) {
+ if (L.isEmpty())
return;
- printTail(Out, L->getTail());
+ printTail(Out, L.getTail());
- L->getHead().printNode(Out);
- L->getHead().printSeparator(Out);
+ L.getHead().printNode(Out);
+ L.getHead().printSeparator(Out);
}
//===----------------------------------------------------------------------===//
Index: lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
===================================================================
--- lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
+++ lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObject.h
@@ -152,7 +152,6 @@
/// functions such as add() and replaceHead().
class FieldChainInfo {
public:
- using FieldChainImpl = llvm::ImmutableListImpl<const FieldNode &>;
using FieldChain = llvm::ImmutableList<const FieldNode &>;
private:
@@ -179,8 +178,8 @@
bool contains(const FieldRegion *FR) const;
bool isEmpty() const { return Chain.isEmpty(); }
- const FieldRegion *getUninitRegion() const;
- const FieldNode &getHead() { return Chain.getHead(); }
+ const FieldNode &getHead() const { return Chain.getHead(); }
+ const FieldRegion *getUninitRegion() const { return getHead().getRegion(); }
void printNoteMsg(llvm::raw_ostream &Out) const;
};
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D51886.166635.patch
Type: text/x-patch
Size: 3232 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180923/963e34aa/attachment.bin>
More information about the cfe-commits
mailing list