Moved implementation of cast<> for SymbolData closer to SymbolData's definition.

llvm-svn: 46772
This commit is contained in:
Ted Kremenek 2008-02-05 22:21:54 +00:00
parent 1ee50cd9c1
commit 8f6dcfaa30
1 changed files with 28 additions and 24 deletions

View File

@ -152,11 +152,39 @@ public:
const SymIntConstraint& getConstraint(SymbolID sym, BinaryOperator::Opcode Op,
const llvm::APSInt& V);
};
} // end clang namespace
//==------------------------------------------------------------------------==//
// Casting machinery to get cast<> and dyn_cast<> working with SymbolData.
//==------------------------------------------------------------------------==//
namespace llvm {
template<> inline bool
isa<clang::ParmVarDecl,clang::SymbolData>(const clang::SymbolData& V) {
return V.getKind() == clang::SymbolData::ParmKind;
}
template<> struct cast_retty_impl<clang::ParmVarDecl,clang::SymbolData> {
typedef const clang::ParmVarDecl* ret_type;
};
template<> struct simplify_type<clang::SymbolData> {
typedef void* SimpleType;
static inline SimpleType getSimplifiedValue(const clang::SymbolData &V) {
return V.getPtr();
}
};
} // end llvm namespace
//==------------------------------------------------------------------------==//
// Base RValue types.
//==------------------------------------------------------------------------==//
namespace clang {
class RValue {
public:
enum BaseKind { LValueKind=0x0,
@ -496,28 +524,4 @@ namespace lval {
} // end clang namespace
//==------------------------------------------------------------------------==//
// Casting machinery to get cast<> and dyn_cast<> working with SymbolData.
//==------------------------------------------------------------------------==//
namespace llvm {
template<> inline bool
isa<clang::ParmVarDecl,clang::SymbolData>(const clang::SymbolData& V) {
return V.getKind() == clang::SymbolData::ParmKind;
}
template<> struct cast_retty_impl<clang::ParmVarDecl,clang::SymbolData> {
typedef const clang::ParmVarDecl* ret_type;
};
template<> struct simplify_type<clang::SymbolData> {
typedef void* SimpleType;
static inline SimpleType getSimplifiedValue(const clang::SymbolData &V) {
return V.getPtr();
}
};
} // end llvm namespace
#endif