File indexing completed on 2026-05-10 08:37:08
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICCASTINFO_H
0010 #define LLVM_CLANG_STATICANALYZER_CORE_PATHSENSITIVE_DYNAMICCASTINFO_H
0011
0012 #include "clang/AST/Type.h"
0013
0014 namespace clang {
0015 namespace ento {
0016
0017 class DynamicCastInfo {
0018 public:
0019 enum CastResult { Success, Failure };
0020
0021 DynamicCastInfo(QualType from, QualType to, CastResult resultKind)
0022 : From(from), To(to), ResultKind(resultKind) {}
0023
0024 QualType from() const { return From; }
0025 QualType to() const { return To; }
0026
0027 bool equals(QualType from, QualType to) const {
0028 return From == from && To == to;
0029 }
0030
0031 bool succeeds() const { return ResultKind == CastResult::Success; }
0032 bool fails() const { return ResultKind == CastResult::Failure; }
0033
0034 bool operator==(const DynamicCastInfo &RHS) const {
0035 return From == RHS.From && To == RHS.To;
0036 }
0037 bool operator<(const DynamicCastInfo &RHS) const {
0038 return From < RHS.From && To < RHS.To;
0039 }
0040
0041 void Profile(llvm::FoldingSetNodeID &ID) const {
0042 ID.Add(From);
0043 ID.Add(To);
0044 ID.AddInteger(ResultKind);
0045 }
0046
0047 private:
0048 QualType From, To;
0049 CastResult ResultKind;
0050 };
0051
0052 }
0053 }
0054
0055 #endif