Rename simplisticCast to castAs.

This commit is contained in:
Vassil Vassilev 2022-09-16 11:11:40 +00:00 committed by jenkins
parent ad78ae2c61
commit 5add0d7732
4 changed files with 8 additions and 6 deletions

View File

@ -55,7 +55,7 @@ namespace runtime {
// Check whether the expected return type and the actual return type are
// compatible with Sema::CheckAssingmentConstraints or
// ASTContext::typesAreCompatible.
return result.simplisticCastAs<T>();
return result.castAs<T>();
return T();
}

View File

@ -133,7 +133,7 @@ namespace cling {
bool hasPointerType() const;
bool hasBuiltinType() const;
// Allow simplisticCastAs to be partially specialized.
// Allow castAs to be partially specialized.
template<typename T>
struct CastFwd {
static T cast(const Value& V) {
@ -145,7 +145,6 @@ namespace cling {
return T();
}
};
template<typename T>
struct CastFwd<T*> {
static T* cast(const Value& V) {
@ -156,6 +155,9 @@ namespace cling {
}
};
/// \brief Get a reference to the value with type checking.
template <typename T> T getAs() const;
public:
/// \brief Default constructor, creates a value that IsInvalid().
Value():
@ -249,7 +251,7 @@ namespace cling {
/// casting the value of builtins (except void), enums and pointers.
/// Values referencing an object are treated as pointers to the object.
template <typename T>
T simplisticCastAs() const {
T castAs() const {
return CastFwd<T>::cast(*this);
}

View File

@ -958,7 +958,7 @@ namespace cling {
Value res = Interp->Evaluate(ctor.c_str(), DC,
ExprInfo->isValuePrinterRequested()
);
m_Memory = (void*)res.getAs<void*>();
m_Memory = res.getPtr();
}
LifetimeHandler::~LifetimeHandler() {

View File

@ -141,7 +141,7 @@ namespace cling {
}
}
void dumpTracerSVR(cling::Value& svr) {
((Tracer*)svr.getAs<void*>())->dump("dump");
((Tracer*)svr.castAs<void*>())->dump("dump");
}
.rawInput 0