LLVM 24.0.0git
TargetInfo.cpp File Reference
#include "llvm/ABI/TargetInfo.h"
#include "llvm/Support/Casting.h"
#include <algorithm>
#include <cstdint>

Go to the source code of this file.

Functions

template<typename To, typename From>
decltype(auto) dyn_cast (const From &Val)
 dyn_cast<X> - Return the argument parameter cast to the specified type.

Function Documentation

◆ dyn_cast()

template<typename To, typename From>
decltype(auto) llvm::dyn_cast ( const From & Val)
inlinenodiscard

dyn_cast<X> - Return the argument parameter cast to the specified type.

This casting operator returns null if the argument is of the wrong type, so it can be used to test for a type as well as cast if successful. The value passed in must be present, if not, use dyn_cast_if_present. This should be used in the context of an if statement like this:

if (const Instruction *I = dyn_cast<Instruction>(myVal)) { ... }

Definition at line 643 of file Casting.h.