aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/AST/Type.h4
-rw-r--r--lib/AST/Type.cpp2
-rw-r--r--lib/Sema/SemaTemplateDeduction.cpp30
-rw-r--r--lib/Sema/SemaTemplateInstantiate.cpp8
4 files changed, 22 insertions, 22 deletions
diff --git a/include/clang/AST/Type.h b/include/clang/AST/Type.h
index f108bd5a45..ca55ea670b 100644
--- a/include/clang/AST/Type.h
+++ b/include/clang/AST/Type.h
@@ -994,7 +994,7 @@ public:
}
};
-/// DependentSizedExtVectorType - This type represent an ext vectory type
+/// DependentSizedExtVectorType - This type represent an extended vector type
/// where either the type or size is dependent. For example:
/// @code
/// template<typename T, int Size>
@@ -1016,7 +1016,7 @@ class DependentSizedExtVectorType : public Type {
virtual void Destroy(ASTContext& C);
public:
- Expr *getSizeExpr() const { return SizeExpr; }
+ const Expr *getSizeExpr() const { return SizeExpr; }
QualType getElementType() const { return ElementType; }
SourceLocation getAttributeLoc() const { return loc; }
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 1db666fdae..7b45b21e5d 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -1378,7 +1378,7 @@ void DependentSizedArrayType::getAsStringInternal(std::string &S, const Printing
void DependentSizedExtVectorType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
getElementType().getAsStringInternal(S, Policy);
- S += " __attribute__((ext_vector_ type(";
+ S += " __attribute__((ext_vector_type(";
if (getSizeExpr()) {
std::string SStr;
llvm::raw_string_ostream s(SStr);
diff --git a/lib/Sema/SemaTemplateDeduction.cpp b/lib/Sema/SemaTemplateDeduction.cpp
index 935883312e..784e451804 100644
--- a/lib/Sema/SemaTemplateDeduction.cpp
+++ b/lib/Sema/SemaTemplateDeduction.cpp
@@ -725,12 +725,13 @@ MarkDeducedTemplateParameters(Sema &SemaRef,
/// \brief Mark the template arguments that are deduced by the given
/// expression.
static void
-MarkDeducedTemplateParameters(Expr *E, llvm::SmallVectorImpl<bool> &Deduced) {
- DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
+MarkDeducedTemplateParameters(const Expr *E,
+ llvm::SmallVectorImpl<bool> &Deduced) {
+ const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E);
if (!E)
return;
- NonTypeTemplateParmDecl *NTTP
+ const NonTypeTemplateParmDecl *NTTP
= dyn_cast<NonTypeTemplateParmDecl>(DRE->getDecl());
if (!NTTP)
return;
@@ -751,26 +752,26 @@ MarkDeducedTemplateParameters(Sema &SemaRef, QualType T,
switch (T->getTypeClass()) {
case Type::ExtQual:
MarkDeducedTemplateParameters(SemaRef,
- QualType(cast<ExtQualType>(T.getTypePtr())->getBaseType(), 0),
+ QualType(cast<ExtQualType>(T)->getBaseType(), 0),
Deduced);
break;
case Type::Pointer:
MarkDeducedTemplateParameters(SemaRef,
- cast<PointerType>(T.getTypePtr())->getPointeeType(),
+ cast<PointerType>(T)->getPointeeType(),
Deduced);
break;
case Type::BlockPointer:
MarkDeducedTemplateParameters(SemaRef,
- cast<BlockPointerType>(T.getTypePtr())->getPointeeType(),
+ cast<BlockPointerType>(T)->getPointeeType(),
Deduced);
break;
case Type::LValueReference:
case Type::RValueReference:
MarkDeducedTemplateParameters(SemaRef,
- cast<ReferenceType>(T.getTypePtr())->getPointeeType(),
+ cast<ReferenceType>(T)->getPointeeType(),
Deduced);
break;
@@ -783,35 +784,34 @@ MarkDeducedTemplateParameters(Sema &SemaRef, QualType T,
}
case Type::DependentSizedArray:
- MarkDeducedTemplateParameters(
- cast<DependentSizedArrayType>(T.getTypePtr())->getSizeExpr(),
+ MarkDeducedTemplateParameters(cast<DependentSizedArrayType>(T)->getSizeExpr(),
Deduced);
// Fall through to check the element type
case Type::ConstantArray:
case Type::IncompleteArray:
MarkDeducedTemplateParameters(SemaRef,
- cast<ArrayType>(T.getTypePtr())->getElementType(),
+ cast<ArrayType>(T)->getElementType(),
Deduced);
break;
case Type::Vector:
case Type::ExtVector:
MarkDeducedTemplateParameters(SemaRef,
- cast<VectorType>(T.getTypePtr())->getElementType(),
+ cast<VectorType>(T)->getElementType(),
Deduced);
break;
case Type::DependentSizedExtVector: {
const DependentSizedExtVectorType *VecType
- = cast<DependentSizedExtVectorType>(T.getTypePtr());
+ = cast<DependentSizedExtVectorType>(T);
MarkDeducedTemplateParameters(SemaRef, VecType->getElementType(), Deduced);
MarkDeducedTemplateParameters(VecType->getSizeExpr(), Deduced);
break;
}
case Type::FunctionProto: {
- const FunctionProtoType *Proto = cast<FunctionProtoType>(T.getTypePtr());
+ const FunctionProtoType *Proto = cast<FunctionProtoType>(T);
MarkDeducedTemplateParameters(SemaRef, Proto->getResultType(), Deduced);
for (unsigned I = 0, N = Proto->getNumArgs(); I != N; ++I)
MarkDeducedTemplateParameters(SemaRef, Proto->getArgType(I), Deduced);
@@ -819,12 +819,12 @@ MarkDeducedTemplateParameters(Sema &SemaRef, QualType T,
}
case Type::TemplateTypeParm:
- Deduced[cast<TemplateTypeParmType>(T.getTypePtr())->getIndex()] = true;
+ Deduced[cast<TemplateTypeParmType>(T)->getIndex()] = true;
break;
case Type::TemplateSpecialization: {
const TemplateSpecializationType *Spec
- = cast<TemplateSpecializationType>(T.getTypePtr());
+ = cast<TemplateSpecializationType>(T);
if (TemplateDecl *Template = Spec->getTemplateName().getAsTemplateDecl())
if (TemplateTemplateParmDecl *TTP
= dyn_cast<TemplateTemplateParmDecl>(Template))
diff --git a/lib/Sema/SemaTemplateInstantiate.cpp b/lib/Sema/SemaTemplateInstantiate.cpp
index 72f9511fdd..3992f8cbe5 100644
--- a/lib/Sema/SemaTemplateInstantiate.cpp
+++ b/lib/Sema/SemaTemplateInstantiate.cpp
@@ -435,7 +435,7 @@ TemplateTypeInstantiator::
InstantiateDependentSizedExtVectorType(const DependentSizedExtVectorType *T,
unsigned Quals) const {
- // Instantiate the element type if needed
+ // Instantiate the element type if needed.
QualType ElementType = T->getElementType();
if (ElementType->isDependentType()) {
ElementType = Instantiate(ElementType);
@@ -443,10 +443,10 @@ InstantiateDependentSizedExtVectorType(const DependentSizedExtVectorType *T,
return QualType();
}
- // Instantiate the size expression
- Expr *SizeExpr = T->getSizeExpr();
+ // Instantiate the size expression.
+ const Expr *SizeExpr = T->getSizeExpr();
Sema::OwningExprResult InstantiatedArraySize =
- SemaRef.InstantiateExpr(SizeExpr, TemplateArgs);
+ SemaRef.InstantiateExpr(const_cast<Expr *>(SizeExpr), TemplateArgs);
if (InstantiatedArraySize.isInvalid())
return QualType();