|
|
@@ -2015,6 +2015,46 @@ involves_protected(CPPType *type) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Returns true if the type involves an rvalue reference.
|
|
|
+ */
|
|
|
+bool TypeManager::
|
|
|
+involves_rvalue_reference(CPPType *type) {
|
|
|
+ switch (type->get_subtype()) {
|
|
|
+ case CPPDeclaration::ST_const:
|
|
|
+ return involves_rvalue_reference(type->as_const_type()->_wrapped_around);
|
|
|
+
|
|
|
+ case CPPDeclaration::ST_reference:
|
|
|
+ return type->as_reference_type()->_value_category == CPPReferenceType::VC_rvalue;
|
|
|
+
|
|
|
+ case CPPDeclaration::ST_pointer:
|
|
|
+ return involves_rvalue_reference(type->as_pointer_type()->_pointing_at);
|
|
|
+
|
|
|
+ case CPPDeclaration::ST_function:
|
|
|
+ {
|
|
|
+ CPPFunctionType *ftype = type->as_function_type();
|
|
|
+ if (involves_rvalue_reference(ftype->_return_type)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ const CPPParameterList::Parameters ¶ms =
|
|
|
+ ftype->_parameters->_parameters;
|
|
|
+ CPPParameterList::Parameters::const_iterator pi;
|
|
|
+ for (pi = params.begin(); pi != params.end(); ++pi) {
|
|
|
+ if (involves_rvalue_reference((*pi)->_type)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ case CPPDeclaration::ST_typedef:
|
|
|
+ return involves_rvalue_reference(type->as_typedef_type()->_type);
|
|
|
+
|
|
|
+ default:
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
/**
|
|
|
* Returns the type this pointer type points to.
|
|
|
*/
|