Move Sema::GetNonReferenceType to QualType::getNonReferenceType and make it inline
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57951 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index d53e200..2508d1a 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -259,7 +259,6 @@
QualType ConvertDeclSpecToType(const DeclSpec &DS);
void ProcessTypeAttributeList(QualType &Result, const AttributeList *AL);
QualType GetTypeForDeclarator(Declarator &D, Scope *S);
- QualType GetNonReferenceType(QualType Type);
QualType ObjCGetTypeForMethodDefinition(DeclTy *D);
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 3ead430..9292017 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -450,7 +450,7 @@
}
// If this reference is not in a block or if the referenced variable is
// within the block, create a normal DeclRefExpr.
- return new DeclRefExpr(VD, GetNonReferenceType(VD->getType()), Loc);
+ return new DeclRefExpr(VD, VD->getType().getNonReferenceType(), Loc);
}
Sema::ExprResult Sema::ActOnPredefinedExpr(SourceLocation Loc,
diff --git a/lib/Sema/SemaType.cpp b/lib/Sema/SemaType.cpp
index 942d706..f1edabf 100644
--- a/lib/Sema/SemaType.cpp
+++ b/lib/Sema/SemaType.cpp
@@ -500,23 +500,6 @@
return T;
}
-/// GetNonReferenceType - If Type is a reference type (e.g., const
-/// int&), returns the type that the reference refers to ("const
-/// int"). Otherwise, returns the type itself. This routine is used
-/// throughout to implement C++ 5p6:
-///
-/// If an expression initially has the type "reference to T" (8.3.2,
-/// 8.5.3), the type is adjusted to "T" prior to any further
-/// analysis, the expression designates the object or function
-/// denoted by the reference, and the expression is an lvalue.
-QualType Sema::GetNonReferenceType(QualType Type)
-{
- if (const ReferenceType *RefType = Type->getAsReferenceType())
- return RefType->getPointeeType();
- else
- return Type;
-}
-
/// ObjCGetTypeForMethodDefinition - Builds the type for a method definition
/// declarator
QualType Sema::ObjCGetTypeForMethodDefinition(DeclTy *D) {