Remove tabs, and whitespace cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@81346 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AST/Type.cpp b/lib/AST/Type.cpp
index 9bcfb2a..1a6ea0a 100644
--- a/lib/AST/Type.cpp
+++ b/lib/AST/Type.cpp
@@ -64,7 +64,7 @@
C.Deallocate(this);
}
-void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID,
+void DependentSizedArrayType::Profile(llvm::FoldingSetNodeID &ID,
ASTContext &Context,
QualType ET,
ArraySizeModifier SizeMod,
@@ -76,8 +76,8 @@
E->Profile(ID, Context, true);
}
-void
-DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID,
+void
+DependentSizedExtVectorType::Profile(llvm::FoldingSetNodeID &ID,
ASTContext &Context,
QualType ElementType, Expr *SizeExpr) {
ID.AddPointer(ElementType.getAsOpaquePtr());
@@ -99,7 +99,7 @@
// If this is directly an array type, return it.
if (const ArrayType *ATy = dyn_cast<ArrayType>(this))
return ATy->getElementType().getTypePtr();
-
+
// If the canonical form of this type isn't the right kind, reject it.
if (!isa<ArrayType>(CanonicalType)) {
// Look through type qualifiers
@@ -107,7 +107,7 @@
return AT->getElementType().getTypePtr();
return 0;
}
-
+
// If this is a typedef for an array type, strip the typedef off without
// losing all typedef information.
return cast<ArrayType>(getDesugaredType())->getElementType().getTypePtr();
@@ -153,7 +153,7 @@
if (!DTT->getUnderlyingType()->isDependentType())
return DTT->getUnderlyingType().getDesugaredType();
}
- if (const TemplateSpecializationType *Spec
+ if (const TemplateSpecializationType *Spec
= dyn_cast<TemplateSpecializationType>(this)) {
if (ForDisplay)
return QualType(this, 0);
@@ -262,7 +262,7 @@
return CTy;
return 0;
}
-
+
// If the canonical form of this type isn't what we want, reject it.
if (!isa<ComplexType>(CanonicalType)) {
// Look through type qualifiers (e.g. ExtQualType's).
@@ -270,7 +270,7 @@
return CanonicalType.getUnqualifiedType()->getAsComplexIntegerType();
return 0;
}
-
+
// If this is a typedef for a complex type, strip the typedef off without
// losing all typedef information.
return cast<ComplexType>(getDesugaredType());
@@ -306,7 +306,7 @@
return CanonicalType.getUnqualifiedType()->getAsFunctionType();
return 0;
}
-
+
// If this is a typedef for a function type, strip the typedef off without
// losing all typedef information.
return cast<FunctionType>(getDesugaredType());
@@ -374,7 +374,7 @@
if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
if (!RT->getDecl()->isStruct())
return 0;
-
+
// If this is a typedef for a structure type, strip the typedef off without
// losing all typedef information.
return cast<RecordType>(getDesugaredType());
@@ -385,13 +385,13 @@
return 0;
}
-const RecordType *Type::getAsUnionType() const {
+const RecordType *Type::getAsUnionType() const {
// If this is directly a union type, return it.
if (const RecordType *RT = dyn_cast<RecordType>(this)) {
if (RT->getDecl()->isUnion())
return RT;
}
-
+
// If the canonical form of this type isn't the right kind, reject it.
if (const RecordType *RT = dyn_cast<RecordType>(CanonicalType)) {
if (!RT->getDecl()->isUnion())
@@ -401,7 +401,7 @@
// losing all typedef information.
return cast<RecordType>(getDesugaredType());
}
-
+
// Look through type qualifiers
if (isa<RecordType>(CanonicalType.getUnqualifiedType()))
return CanonicalType.getUnqualifiedType()->getAsUnionType();
@@ -419,7 +419,7 @@
// Are we directly a complex type?
if (const ComplexType *CTy = dyn_cast<ComplexType>(this))
return CTy;
-
+
// If the canonical form of this type isn't the right kind, reject it.
if (!isa<ComplexType>(CanonicalType)) {
// Look through type qualifiers
@@ -437,7 +437,7 @@
// Are we directly a vector type?
if (const VectorType *VTy = dyn_cast<VectorType>(this))
return VTy;
-
+
// If the canonical form of this type isn't the right kind, reject it.
if (!isa<VectorType>(CanonicalType)) {
// Look through type qualifiers
@@ -455,9 +455,9 @@
// Are we directly an OpenCU vector type?
if (const ExtVectorType *VTy = dyn_cast<ExtVectorType>(this))
return VTy;
-
+
// If the canonical form of this type isn't the right kind, reject it.
- if (!isa<ExtVectorType>(CanonicalType)) {
+ if (!isa<ExtVectorType>(CanonicalType)) {
// Look through type qualifiers
if (isa<ExtVectorType>(CanonicalType.getUnqualifiedType()))
return CanonicalType.getUnqualifiedType()->getAsExtVectorType();
@@ -612,14 +612,14 @@
return BT->getKind() >= BuiltinType::Char_S &&
BT->getKind() <= BuiltinType::LongLong;
}
-
+
if (const EnumType *ET = dyn_cast<EnumType>(CanonicalType))
return ET->getDecl()->getIntegerType()->isSignedIntegerType();
-
+
if (const FixedWidthIntType *FWIT =
dyn_cast<FixedWidthIntType>(CanonicalType))
return FWIT->isSigned();
-
+
if (const VectorType *VT = dyn_cast<VectorType>(CanonicalType))
return VT->getElementType()->isSignedIntegerType();
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(CanonicalType))
@@ -763,8 +763,8 @@
/// isIncompleteType - Return true if this is an incomplete type (C99 6.2.5p1)
/// - a type that can describe objects, but which lacks information needed to
/// determine its size.
-bool Type::isIncompleteType() const {
- switch (CanonicalType->getTypeClass()) {
+bool Type::isIncompleteType() const {
+ switch (CanonicalType->getTypeClass()) {
default: return false;
case ExtQual:
return cast<ExtQualType>(CanonicalType)->getBaseType()->isIncompleteType();
@@ -816,7 +816,7 @@
return true;
case Record:
- if (CXXRecordDecl *ClassDecl
+ if (CXXRecordDecl *ClassDecl
= dyn_cast<CXXRecordDecl>(cast<RecordType>(CanonicalType)->getDecl()))
return ClassDecl->isPOD();
@@ -836,7 +836,7 @@
case BuiltinType::Short:
case BuiltinType::UShort:
return true;
- default:
+ default:
return false;
}
return false;
@@ -918,7 +918,7 @@
ID.AddInteger(hasExceptionSpec);
if (hasExceptionSpec) {
ID.AddInteger(anyExceptionSpec);
- for(unsigned i = 0; i != NumExceptions; ++i)
+ for (unsigned i = 0; i != NumExceptions; ++i)
ID.AddPointer(Exs[i].getAsOpaquePtr());
}
ID.AddInteger(NoReturn);
@@ -957,14 +957,14 @@
QualType FirstType = getDecl()->getUnderlyingType();
if (!isa<TypedefType>(FirstType))
return FirstType;
-
+
// Otherwise, do the fully general loop.
unsigned TypeQuals = 0;
const TypedefType *TDT = this;
while (1) {
QualType CurType = TDT->getDecl()->getUnderlyingType();
-
-
+
+
/// FIXME:
/// FIXME: This is incorrect for ExtQuals!
/// FIXME:
@@ -980,25 +980,25 @@
: Type(TypeOfExpr, can, E->isTypeDependent()), TOExpr(E) {
}
-void DependentTypeOfExprType::Profile(llvm::FoldingSetNodeID &ID,
+void DependentTypeOfExprType::Profile(llvm::FoldingSetNodeID &ID,
ASTContext &Context, Expr *E) {
E->Profile(ID, Context, true);
}
DecltypeType::DecltypeType(Expr *E, QualType underlyingType, QualType can)
- : Type(Decltype, can, E->isTypeDependent()), E(E),
+ : Type(Decltype, can, E->isTypeDependent()), E(E),
UnderlyingType(underlyingType) {
}
DependentDecltypeType::DependentDecltypeType(ASTContext &Context, Expr *E)
: DecltypeType(E, Context.DependentTy), Context(Context) { }
-void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
+void DependentDecltypeType::Profile(llvm::FoldingSetNodeID &ID,
ASTContext &Context, Expr *E) {
E->Profile(ID, Context, true);
}
-TagType::TagType(TypeClass TC, TagDecl *D, QualType can)
+TagType::TagType(TypeClass TC, TagDecl *D, QualType can)
: Type(TC, can, D->isDependentType()), decl(D, 0) {}
bool RecordType::classof(const TagType *TT) {
@@ -1009,7 +1009,7 @@
return isa<EnumDecl>(TT->getDecl());
}
-bool
+bool
TemplateSpecializationType::
anyDependentTemplateArguments(const TemplateArgument *Args, unsigned NumArgs) {
for (unsigned Idx = 0; Idx < NumArgs; ++Idx) {
@@ -1017,12 +1017,12 @@
case TemplateArgument::Null:
assert(false && "Should not have a NULL template argument");
break;
-
+
case TemplateArgument::Type:
if (Args[Idx].getAsType()->isDependentType())
return true;
break;
-
+
case TemplateArgument::Declaration:
case TemplateArgument::Integral:
// Never dependent
@@ -1033,7 +1033,7 @@
Args[Idx].getAsExpr()->isValueDependent())
return true;
break;
-
+
case TemplateArgument::Pack:
assert(0 && "FIXME: Implement!");
break;
@@ -1044,20 +1044,19 @@
}
TemplateSpecializationType::
-TemplateSpecializationType(ASTContext &Context, TemplateName T,
+TemplateSpecializationType(ASTContext &Context, TemplateName T,
const TemplateArgument *Args,
unsigned NumArgs, QualType Canon)
- : Type(TemplateSpecialization,
+ : Type(TemplateSpecialization,
Canon.isNull()? QualType(this, 0) : Canon,
T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)),
Context(Context),
- Template(T), NumArgs(NumArgs)
-{
- assert((!Canon.isNull() ||
+ Template(T), NumArgs(NumArgs) {
+ assert((!Canon.isNull() ||
T.isDependent() || anyDependentTemplateArguments(Args, NumArgs)) &&
"No canonical type for non-dependent class template specialization");
- TemplateArgument *TemplateArgs
+ TemplateArgument *TemplateArgs
= reinterpret_cast<TemplateArgument *>(this + 1);
for (unsigned Arg = 0; Arg < NumArgs; ++Arg)
new (&TemplateArgs[Arg]) TemplateArgument(Args[Arg]);
@@ -1083,10 +1082,10 @@
return getArgs()[Idx];
}
-void
-TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
- TemplateName T,
- const TemplateArgument *Args,
+void
+TemplateSpecializationType::Profile(llvm::FoldingSetNodeID &ID,
+ TemplateName T,
+ const TemplateArgument *Args,
unsigned NumArgs,
ASTContext &Context) {
T.Profile(ID);
@@ -1097,7 +1096,7 @@
const Type *QualifierSet::strip(const Type* T) {
QualType DT = T->getDesugaredType();
addCVR(DT.getCVRQualifiers());
-
+
if (const ExtQualType* EQT = dyn_cast<ExtQualType>(DT)) {
if (EQT->getAddressSpace())
addAddressSpace(EQT->getAddressSpace());
@@ -1162,8 +1161,8 @@
return S;
}
-void
-QualType::getAsStringInternal(std::string &S,
+void
+QualType::getAsStringInternal(std::string &S,
const PrintingPolicy &Policy) const {
if (isNull()) {
S += "NULL TYPE";
@@ -1186,7 +1185,7 @@
getTypePtr()->getAsStringInternal(S, Policy);
}
-void BuiltinType::getAsStringInternal(std::string &S,
+void BuiltinType::getAsStringInternal(std::string &S,
const PrintingPolicy &Policy) const {
if (S.empty()) {
S = getName(Policy.LangOpts);
@@ -1238,12 +1237,12 @@
void PointerType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
S = '*' + S;
-
+
// Handle things like 'int (*A)[4];' correctly.
// FIXME: this should include vectors, but vectors use attributes I guess.
if (isa<ArrayType>(getPointeeType()))
S = '(' + S + ')';
-
+
getPointeeType().getAsStringInternal(S, Policy);
}
@@ -1292,7 +1291,7 @@
S += '[';
S += llvm::utostr(getSize().getZExtValue());
S += ']';
-
+
getElementType().getAsStringInternal(S, Policy);
}
@@ -1327,17 +1326,17 @@
void VariableArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
S += '[';
-
+
if (getIndexTypeQualifier()) {
AppendTypeQualList(S, getIndexTypeQualifier());
S += ' ';
}
-
+
if (getSizeModifier() == Static)
S += "static";
else if (getSizeModifier() == Star)
S += '*';
-
+
if (getSizeExpr()) {
std::string SStr;
llvm::raw_string_ostream s(SStr);
@@ -1345,23 +1344,23 @@
S += s.str();
}
S += ']';
-
+
getElementType().getAsStringInternal(S, Policy);
}
void DependentSizedArrayType::getAsStringInternal(std::string &S, const PrintingPolicy &Policy) const {
S += '[';
-
+
if (getIndexTypeQualifier()) {
AppendTypeQualList(S, getIndexTypeQualifier());
S += ' ';
}
-
+
if (getSizeModifier() == Static)
S += "static";
else if (getSizeModifier() == Star)
S += '*';
-
+
if (getSizeExpr()) {
std::string SStr;
llvm::raw_string_ostream s(SStr);
@@ -1369,7 +1368,7 @@
S += s.str();
}
S += ']';
-
+
getElementType().getAsStringInternal(S, Policy);
}
@@ -1419,7 +1418,7 @@
InnerString = "typeof(" + Tmp + ")" + InnerString;
}
-void DecltypeType::getAsStringInternal(std::string &InnerString,
+void DecltypeType::getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const {
if (!InnerString.empty()) // Prefix the basic type, e.g. 'decltype(t) X'.
InnerString = ' ' + InnerString;
@@ -1433,7 +1432,7 @@
// If needed for precedence reasons, wrap the inner part in grouping parens.
if (!S.empty())
S = "(" + S + ")";
-
+
S += "()";
if (getNoReturnAttr())
S += " __attribute__((noreturn))";
@@ -1444,7 +1443,7 @@
// If needed for precedence reasons, wrap the inner part in grouping parens.
if (!S.empty())
S = "(" + S + ")";
-
+
S += "(";
std::string Tmp;
PrintingPolicy ParamPolicy(Policy);
@@ -1455,7 +1454,7 @@
S += Tmp;
Tmp.clear();
}
-
+
if (isVariadic()) {
if (getNumArgs())
S += ", ";
@@ -1464,7 +1463,7 @@
// Do not emit int() if we have a proto, emit 'int(void)'.
S += "void";
}
-
+
S += ")";
if (getNoReturnAttr())
S += " __attribute__((noreturn))";
@@ -1483,13 +1482,13 @@
InnerString = ' ' + InnerString;
if (!Name)
- InnerString = "type-parameter-" + llvm::utostr_32(Depth) + '-' +
+ InnerString = "type-parameter-" + llvm::utostr_32(Depth) + '-' +
llvm::utostr_32(Index) + InnerString;
else
InnerString = Name->getName() + InnerString;
}
-std::string
+std::string
TemplateSpecializationType::PrintTemplateArgumentList(
const TemplateArgument *Args,
unsigned NumArgs,
@@ -1499,7 +1498,7 @@
for (unsigned Arg = 0; Arg < NumArgs; ++Arg) {
if (Arg)
SpecString += ", ";
-
+
// Print the argument into a string.
std::string ArgString;
switch (Args[Arg].getKind()) {
@@ -1549,7 +1548,7 @@
return SpecString;
}
-void
+void
TemplateSpecializationType::
getAsStringInternal(std::string &InnerString, const PrintingPolicy &Policy) const {
std::string SpecString;
@@ -1573,7 +1572,7 @@
llvm::raw_string_ostream OS(MyString);
NNS->print(OS, Policy);
}
-
+
std::string TypeStr;
PrintingPolicy InnerPolicy(Policy);
InnerPolicy.SuppressTagKind = true;
@@ -1600,12 +1599,12 @@
else if (const TemplateSpecializationType *Spec = getTemplateId()) {
Spec->getTemplateName().print(OS, Policy, true);
OS << TemplateSpecializationType::PrintTemplateArgumentList(
- Spec->getArgs(),
+ Spec->getArgs(),
Spec->getNumArgs(),
Policy);
}
}
-
+
if (InnerString.empty())
InnerString.swap(MyString);
else
@@ -1614,7 +1613,7 @@
void ObjCInterfaceType::Profile(llvm::FoldingSetNodeID &ID,
const ObjCInterfaceDecl *Decl,
- ObjCProtocolDecl **protocols,
+ ObjCProtocolDecl **protocols,
unsigned NumProtocols) {
ID.AddPointer(Decl);
for (unsigned i = 0; i != NumProtocols; i++)
@@ -1632,7 +1631,7 @@
const PrintingPolicy &Policy) const {
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
InnerString = ' ' + InnerString;
-
+
std::string ObjCQIString = getDecl()->getNameAsString();
if (getNumProtocols()) {
ObjCQIString += '<';
@@ -1649,10 +1648,10 @@
InnerString = ObjCQIString + InnerString;
}
-void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
+void ObjCObjectPointerType::getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const {
std::string ObjCQIString;
-
+
if (isObjCIdType() || isObjCQualifiedIdType())
ObjCQIString = "id";
else if (isObjCClassType() || isObjCQualifiedClassType())
@@ -1677,7 +1676,7 @@
InnerString = ObjCQIString + InnerString;
}
-void ElaboratedType::getAsStringInternal(std::string &InnerString,
+void ElaboratedType::getAsStringInternal(std::string &InnerString,
const PrintingPolicy &Policy) const {
std::string TypeStr;
PrintingPolicy InnerPolicy(Policy);
@@ -1693,7 +1692,7 @@
if (!InnerString.empty()) // Prefix the basic type, e.g. 'typedefname X'.
InnerString = ' ' + InnerString;
-
+
const char *Kind = Policy.SuppressTagKind? 0 : getDecl()->getKindName();
const char *ID;
if (const IdentifierInfo *II = getDecl()->getIdentifier())
@@ -1707,10 +1706,10 @@
// If this is a class template specialization, print the template
// arguments.
- if (ClassTemplateSpecializationDecl *Spec
+ if (ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(getDecl())) {
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
- std::string TemplateArgsStr
+ std::string TemplateArgsStr
= TemplateSpecializationType::PrintTemplateArgumentList(
TemplateArgs.getFlatArgumentList(),
TemplateArgs.flat_size(),
@@ -1722,13 +1721,13 @@
// Compute the full nested-name-specifier for this type. In C,
// this will always be empty.
std::string ContextStr;
- for (DeclContext *DC = getDecl()->getDeclContext();
+ for (DeclContext *DC = getDecl()->getDeclContext();
!DC->isTranslationUnit(); DC = DC->getParent()) {
std::string MyPart;
if (NamespaceDecl *NS = dyn_cast<NamespaceDecl>(DC)) {
if (NS->getIdentifier())
MyPart = NS->getNameAsString();
- } else if (ClassTemplateSpecializationDecl *Spec
+ } else if (ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(DC)) {
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
std::string TemplateArgsStr