Skip to content

Commit d408770

Browse files
[Passes] Use llvm::any_cast instead of any_cast (NFC)
This patch replaces any_cast with llvm::any_cast. This in turn allows us to gracefully switch to std::any in future by forwarding llvm::Any and llvm::any_cast to: using Any = std::any; template <class T> T *any_cast(Any *Value) { return std::any_cast<T>(Value); } respectively. Without this patch, it's ambiguous whether any_cast refers to std::any_cast or llvm::any_cast. As an added bonus, this patch makes it easier to mechanically replace llvm::any_cast with std::any_cast without affecting other occurrences of any_cast (e.g. in libcxx).
1 parent 4909e7c commit d408770

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Passes/StandardInstrumentations.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,19 +702,19 @@ static SmallString<32> getIRFileDisplayName(Any IR) {
702702
stable_hash NameHash = stable_hash_combine_string(M->getName());
703703
unsigned int MaxHashWidth = sizeof(stable_hash) * 8 / 4;
704704
write_hex(ResultStream, NameHash, HexPrintStyle::Lower, MaxHashWidth);
705-
if (any_cast<const Module *>(&IR)) {
705+
if (llvm::any_cast<const Module *>(&IR)) {
706706
ResultStream << "-module";
707-
} else if (const Function **F = any_cast<const Function *>(&IR)) {
707+
} else if (const Function **F = llvm::any_cast<const Function *>(&IR)) {
708708
ResultStream << "-function-";
709709
stable_hash FunctionNameHash = stable_hash_combine_string((*F)->getName());
710710
write_hex(ResultStream, FunctionNameHash, HexPrintStyle::Lower,
711711
MaxHashWidth);
712712
} else if (const LazyCallGraph::SCC **C =
713-
any_cast<const LazyCallGraph::SCC *>(&IR)) {
713+
llvm::any_cast<const LazyCallGraph::SCC *>(&IR)) {
714714
ResultStream << "-scc-";
715715
stable_hash SCCNameHash = stable_hash_combine_string((*C)->getName());
716716
write_hex(ResultStream, SCCNameHash, HexPrintStyle::Lower, MaxHashWidth);
717-
} else if (const Loop **L = any_cast<const Loop *>(&IR)) {
717+
} else if (const Loop **L = llvm::any_cast<const Loop *>(&IR)) {
718718
ResultStream << "-loop-";
719719
stable_hash LoopNameHash = stable_hash_combine_string((*L)->getName());
720720
write_hex(ResultStream, LoopNameHash, HexPrintStyle::Lower, MaxHashWidth);

0 commit comments

Comments
 (0)