OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 9d60093..6d6a26d 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -51,7 +51,7 @@
class ArrayType;
class LabelStmt;
class SwitchStmt;
- class OCUVectorType;
+ class ExtVectorType;
class TypedefDecl;
class ObjCInterfaceDecl;
class ObjCCompatibleAliasDecl;
@@ -85,10 +85,10 @@
llvm::SmallVector<SwitchStmt*, 8> SwitchStack;
- /// OCUVectorDecls - This is a list all the OCU vector types. This allows
- /// us to associate a raw vector type with one of the OCU type names.
+ /// ExtVectorDecls - This is a list all the extended vector types. This allows
+ /// us to associate a raw vector type with one of the ext_vector type names.
/// This is only necessary for issuing pretty diagnostics.
- llvm::SmallVector<TypedefDecl*, 24> OCUVectorDecls;
+ llvm::SmallVector<TypedefDecl*, 24> ExtVectorDecls;
/// ObjCImplementations - Keep track of all of the classes with
/// @implementation's, so that we can emit errors on duplicates.
@@ -307,7 +307,7 @@
// for the variable, measured in bytes. If curType and rawAttr are well
// formed, this routine will return a new vector type.
QualType HandleVectorTypeAttribute(QualType curType, AttributeList *rawAttr);
- void HandleOCUVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
+ void HandleExtVectorTypeAttribute(TypedefDecl *d, AttributeList *rawAttr);
void HandleAlignedAttribute(Decl *d, AttributeList *rawAttr);
void HandlePackedAttribute(Decl *d, AttributeList *rawAttr);
@@ -821,7 +821,7 @@
QualType CheckRealImagOperand(Expr *&Op, SourceLocation OpLoc);
/// type checking primary expressions.
- QualType CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
+ QualType CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
IdentifierInfo &Comp, SourceLocation CmpLoc);
/// type checking declaration initializers (C99 6.7.8)
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index e51b797..eec8ce5 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1928,12 +1928,12 @@
tDecl->setUnderlyingType(newType);
}
break;
- case AttributeList::AT_ocu_vector_type:
+ case AttributeList::AT_ext_vector_type:
if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New))
- HandleOCUVectorTypeAttribute(tDecl, Attr);
+ HandleExtVectorTypeAttribute(tDecl, Attr);
else
Diag(Attr->getLoc(),
- diag::err_typecheck_ocu_vector_not_typedef);
+ diag::err_typecheck_ext_vector_not_typedef);
break;
case AttributeList::AT_address_space:
if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New)) {
@@ -2009,7 +2009,7 @@
}
}
-void Sema::HandleOCUVectorTypeAttribute(TypedefDecl *tDecl,
+void Sema::HandleExtVectorTypeAttribute(TypedefDecl *tDecl,
AttributeList *rawAttr) {
QualType curType = tDecl->getUnderlyingType();
// check the attribute arguments.
@@ -2022,7 +2022,7 @@
llvm::APSInt vecSize(32);
if (!sizeExpr->isIntegerConstantExpr(vecSize, Context)) {
Diag(rawAttr->getLoc(), diag::err_attribute_argument_not_int,
- "ocu_vector_type", sizeExpr->getSourceRange());
+ "ext_vector_type", sizeExpr->getSourceRange());
return;
}
// unlike gcc's vector_size attribute, we do not allow vectors to be defined
@@ -2043,9 +2043,9 @@
return;
}
// Instantiate/Install the vector type, the number of elements is > 0.
- tDecl->setUnderlyingType(Context.getOCUVectorType(curType, vectorSize));
+ tDecl->setUnderlyingType(Context.getExtVectorType(curType, vectorSize));
// Remember this typedef decl, we will need it later for diagnostics.
- OCUVectorDecls.push_back(tDecl);
+ ExtVectorDecls.push_back(tDecl);
}
QualType Sema::HandleVectorTypeAttribute(QualType curType,
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index fa3a188..fd02443 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -429,7 +429,7 @@
// Component access limited to variables (reject vec4.rg[1]).
if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr))
- return Diag(LLoc, diag::err_ocuvector_component_access,
+ return Diag(LLoc, diag::err_ext_vector_component_access,
SourceRange(LLoc, RLoc));
// FIXME: need to deal with const...
ResultType = VTy->getElementType();
@@ -455,14 +455,14 @@
}
QualType Sema::
-CheckOCUVectorComponent(QualType baseType, SourceLocation OpLoc,
+CheckExtVectorComponent(QualType baseType, SourceLocation OpLoc,
IdentifierInfo &CompName, SourceLocation CompLoc) {
- const OCUVectorType *vecType = baseType->getAsOCUVectorType();
+ const ExtVectorType *vecType = baseType->getAsExtVectorType();
// The vector accessor can't exceed the number of elements.
const char *compStr = CompName.getName();
if (strlen(compStr) > vecType->getNumElements()) {
- Diag(OpLoc, diag::err_ocuvector_component_exceeds_length,
+ Diag(OpLoc, diag::err_ext_vector_component_exceeds_length,
baseType.getAsString(), SourceRange(CompLoc));
return QualType();
}
@@ -484,7 +484,7 @@
if (*compStr) {
// We didn't get to the end of the string. This means the component names
// didn't come from the same set *or* we encountered an illegal name.
- Diag(OpLoc, diag::err_ocuvector_component_name_illegal,
+ Diag(OpLoc, diag::err_ext_vector_component_name_illegal,
std::string(compStr,compStr+1), SourceRange(CompLoc));
return QualType();
}
@@ -499,7 +499,7 @@
if (*compStr) {
// We didn't get to the end of the string. This means a component accessor
// exceeds the number of elements in the vector.
- Diag(OpLoc, diag::err_ocuvector_component_exceeds_length,
+ Diag(OpLoc, diag::err_ext_vector_component_exceeds_length,
baseType.getAsString(), SourceRange(CompLoc));
return QualType();
}
@@ -510,12 +510,12 @@
if (CompSize == 1)
return vecType->getElementType();
- QualType VT = Context.getOCUVectorType(vecType->getElementType(), CompSize);
+ QualType VT = Context.getExtVectorType(vecType->getElementType(), CompSize);
// Now look up the TypeDefDecl from the vector type. Without this,
- // diagostics look bad. We want OCU vector types to appear built-in.
- for (unsigned i = 0, E = OCUVectorDecls.size(); i != E; ++i) {
- if (OCUVectorDecls[i]->getUnderlyingType() == VT)
- return Context.getTypedefType(OCUVectorDecls[i]);
+ // diagostics look bad. We want extended vector types to appear built-in.
+ for (unsigned i = 0, E = ExtVectorDecls.size(); i != E; ++i) {
+ if (ExtVectorDecls[i]->getUnderlyingType() == VT)
+ return Context.getTypedefType(ExtVectorDecls[i]);
}
return VT; // should never get here (a typedef type should always be found).
}
@@ -540,7 +540,7 @@
return Diag(OpLoc, diag::err_typecheck_member_reference_arrow,
SourceRange(MemberLoc));
}
- // The base type is either a record or an OCUVectorType.
+ // The base type is either a record or an ExtVectorType.
if (const RecordType *RTy = BaseType->getAsRecordType()) {
RecordDecl *RDecl = RTy->getDecl();
if (RTy->isIncompleteType())
@@ -561,15 +561,15 @@
return new MemberExpr(BaseExpr, OpKind==tok::arrow, MemberDecl,
MemberLoc, MemberType);
- } else if (BaseType->isOCUVectorType() && OpKind == tok::period) {
+ } else if (BaseType->isExtVectorType() && OpKind == tok::period) {
// Component access limited to variables (reject vec4.rg.g).
if (!isa<DeclRefExpr>(BaseExpr) && !isa<ArraySubscriptExpr>(BaseExpr))
- return Diag(OpLoc, diag::err_ocuvector_component_access,
+ return Diag(OpLoc, diag::err_ext_vector_component_access,
SourceRange(MemberLoc));
- QualType ret = CheckOCUVectorComponent(BaseType, OpLoc, Member, MemberLoc);
+ QualType ret = CheckExtVectorComponent(BaseType, OpLoc, Member, MemberLoc);
if (ret.isNull())
return true;
- return new OCUVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
+ return new ExtVectorElementExpr(ret, BaseExpr, Member, MemberLoc);
} else if (BaseType->isObjCInterfaceType()) {
ObjCInterfaceDecl *IFace;
if (isa<ObjCInterfaceType>(BaseType.getCanonicalType()))
@@ -1208,8 +1208,8 @@
}
if (isa<VectorType>(lhsType) || isa<VectorType>(rhsType)) {
- // For OCUVector, allow vector splats; float -> <n x float>
- if (const OCUVectorType *LV = dyn_cast<OCUVectorType>(lhsType)) {
+ // For ExtVector, allow vector splats; float -> <n x float>
+ if (const ExtVectorType *LV = dyn_cast<ExtVectorType>(lhsType)) {
if (LV->getElementType().getTypePtr() == rhsType.getTypePtr())
return Compatible;
}
@@ -1310,9 +1310,9 @@
if (lhsType == rhsType)
return lhsType;
- // if the lhs is an ocu vector and the rhs is a scalar of the same type,
+ // if the lhs is an extended vector and the rhs is a scalar of the same type,
// promote the rhs to the vector type.
- if (const OCUVectorType *V = lhsType->getAsOCUVectorType()) {
+ if (const ExtVectorType *V = lhsType->getAsExtVectorType()) {
if (V->getElementType().getCanonicalType().getTypePtr()
== rhsType.getCanonicalType().getTypePtr()) {
ImpCastExprToType(rex, lhsType);
@@ -1320,9 +1320,9 @@
}
}
- // if the rhs is an ocu vector and the lhs is a scalar of the same type,
+ // if the rhs is an extended vector and the lhs is a scalar of the same type,
// promote the lhs to the vector type.
- if (const OCUVectorType *V = rhsType->getAsOCUVectorType()) {
+ if (const ExtVectorType *V = rhsType->getAsExtVectorType()) {
if (V->getElementType().getCanonicalType().getTypePtr()
== lhsType.getCanonicalType().getTypePtr()) {
ImpCastExprToType(lex, rhsType);