Skip to content

Commit a1f8ce6

Browse files
[StaticAnalyzer] Migrate away from PointerUnion::dyn_cast (NFC) (#122856)
Note that PointerUnion::dyn_cast has been soft deprecated in PointerUnion.h: // FIXME: Replace the uses of is(), get() and dyn_cast() with // isa<T>, cast<T> and the llvm::dyn_cast<T> Literal migration would result in dyn_cast_if_present (see the definition of PointerUnion::dyn_cast), but this patch uses dyn_cast because we expect Storage to be nonnull.
1 parent e673f9d commit a1f8ce6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clang/lib/StaticAnalyzer/Core/ExplodedGraph.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ void ExplodedNode::NodeGroup::addNode(ExplodedNode *N, ExplodedGraph &G) {
226226
return;
227227
}
228228

229-
ExplodedNodeVector *V = Storage.dyn_cast<ExplodedNodeVector *>();
229+
ExplodedNodeVector *V = dyn_cast<ExplodedNodeVector *>(Storage);
230230

231231
if (!V) {
232232
// Switch from single-node to multi-node representation.
@@ -251,7 +251,7 @@ unsigned ExplodedNode::NodeGroup::size() const {
251251
const GroupStorage &Storage = reinterpret_cast<const GroupStorage &>(P);
252252
if (Storage.isNull())
253253
return 0;
254-
if (ExplodedNodeVector *V = Storage.dyn_cast<ExplodedNodeVector *>())
254+
if (ExplodedNodeVector *V = dyn_cast<ExplodedNodeVector *>(Storage))
255255
return V->size();
256256
return 1;
257257
}
@@ -263,7 +263,7 @@ ExplodedNode * const *ExplodedNode::NodeGroup::begin() const {
263263
const GroupStorage &Storage = reinterpret_cast<const GroupStorage &>(P);
264264
if (Storage.isNull())
265265
return nullptr;
266-
if (ExplodedNodeVector *V = Storage.dyn_cast<ExplodedNodeVector *>())
266+
if (ExplodedNodeVector *V = dyn_cast<ExplodedNodeVector *>(Storage))
267267
return V->begin();
268268
return Storage.getAddrOfPtr1();
269269
}
@@ -275,7 +275,7 @@ ExplodedNode * const *ExplodedNode::NodeGroup::end() const {
275275
const GroupStorage &Storage = reinterpret_cast<const GroupStorage &>(P);
276276
if (Storage.isNull())
277277
return nullptr;
278-
if (ExplodedNodeVector *V = Storage.dyn_cast<ExplodedNodeVector *>())
278+
if (ExplodedNodeVector *V = dyn_cast<ExplodedNodeVector *>(Storage))
279279
return V->end();
280280
return Storage.getAddrOfPtr1() + 1;
281281
}

0 commit comments

Comments
 (0)