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/APValue.cpp b/lib/AST/APValue.cpp
index 489dac7..772a884 100644
--- a/lib/AST/APValue.cpp
+++ b/lib/AST/APValue.cpp
@@ -91,7 +91,7 @@
return;
case Vector:
OS << "Vector: " << getVectorElt(0);
- for (unsigned i = 1; i != getVectorLength(); ++i)
+ for (unsigned i = 1; i != getVectorLength(); ++i)
OS << ", " << getVectorElt(i);
return;
case ComplexInt:
diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp
index 30e4234..bf1fac9 100644
--- a/lib/AST/ASTContext.cpp
+++ b/lib/AST/ASTContext.cpp
@@ -37,16 +37,16 @@
TargetInfo &t,
IdentifierTable &idents, SelectorTable &sels,
Builtin::Context &builtins,
- bool FreeMem, unsigned size_reserve) :
- GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0),
+ bool FreeMem, unsigned size_reserve) :
+ GlobalNestedNameSpecifier(0), CFConstantStringTypeDecl(0),
ObjCFastEnumerationStateTypeDecl(0), FILEDecl(0), jmp_bufDecl(0),
- sigjmp_bufDecl(0), SourceMgr(SM), LangOpts(LOpts),
- LoadedExternalComments(false), FreeMemory(FreeMem), Target(t),
+ sigjmp_bufDecl(0), SourceMgr(SM), LangOpts(LOpts),
+ LoadedExternalComments(false), FreeMemory(FreeMem), Target(t),
Idents(idents), Selectors(sels),
- BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts) {
+ BuiltinInfo(builtins), ExternalSource(0), PrintingPolicy(LOpts) {
ObjCIdRedefinitionType = QualType();
ObjCClassRedefinitionType = QualType();
- if (size_reserve > 0) Types.reserve(size_reserve);
+ if (size_reserve > 0) Types.reserve(size_reserve);
TUDecl = TranslationUnitDecl::Create(*this);
InitBuiltinTypes();
}
@@ -79,8 +79,8 @@
// Destroy nested-name-specifiers.
for (llvm::FoldingSet<NestedNameSpecifier>::iterator
NNS = NestedNameSpecifiers.begin(),
- NNSEnd = NestedNameSpecifiers.end();
- NNS != NNSEnd;
+ NNSEnd = NestedNameSpecifiers.end();
+ NNS != NNSEnd;
/* Increment in loop */)
(*NNS++).Destroy(*this);
@@ -90,7 +90,7 @@
TUDecl->Destroy(*this);
}
-void
+void
ASTContext::setExternalSource(llvm::OwningPtr<ExternalASTSource> &Source) {
ExternalSource.reset(Source.take());
}
@@ -100,7 +100,7 @@
fprintf(stderr, " %d types total.\n", (int)Types.size());
unsigned counts[] = {
-#define TYPE(Name, Parent) 0,
+#define TYPE(Name, Parent) 0,
#define ABSTRACT_TYPE(Name, Parent)
#include "clang/AST/TypeNodes.def"
0 // Extra
@@ -120,7 +120,7 @@
++Idx;
#define ABSTRACT_TYPE(Name, Parent)
#include "clang/AST/TypeNodes.def"
-
+
fprintf(stderr, "Total bytes = %d\n", int(TotalBytes));
if (ExternalSource.get()) {
@@ -136,10 +136,10 @@
void ASTContext::InitBuiltinTypes() {
assert(VoidTy.isNull() && "Context reinitialized?");
-
+
// C99 6.2.5p19.
InitBuiltinType(VoidTy, BuiltinType::Void);
-
+
// C99 6.2.5p2.
InitBuiltinType(BoolTy, BuiltinType::Bool);
// C99 6.2.5p3.
@@ -153,14 +153,14 @@
InitBuiltinType(IntTy, BuiltinType::Int);
InitBuiltinType(LongTy, BuiltinType::Long);
InitBuiltinType(LongLongTy, BuiltinType::LongLong);
-
+
// C99 6.2.5p6.
InitBuiltinType(UnsignedCharTy, BuiltinType::UChar);
InitBuiltinType(UnsignedShortTy, BuiltinType::UShort);
InitBuiltinType(UnsignedIntTy, BuiltinType::UInt);
InitBuiltinType(UnsignedLongTy, BuiltinType::ULong);
InitBuiltinType(UnsignedLongLongTy, BuiltinType::ULongLong);
-
+
// C99 6.2.5p10.
InitBuiltinType(FloatTy, BuiltinType::Float);
InitBuiltinType(DoubleTy, BuiltinType::Double);
@@ -195,27 +195,27 @@
// expressions.
InitBuiltinType(DependentTy, BuiltinType::Dependent);
- // Placeholder type for C++0x auto declarations whose real type has
+ // Placeholder type for C++0x auto declarations whose real type has
// not yet been deduced.
InitBuiltinType(UndeducedAutoTy, BuiltinType::UndeducedAuto);
-
+
// C99 6.2.5p11.
FloatComplexTy = getComplexType(FloatTy);
DoubleComplexTy = getComplexType(DoubleTy);
LongDoubleComplexTy = getComplexType(LongDoubleTy);
BuiltinVaListType = QualType();
-
+
// "Builtin" typedefs set by Sema::ActOnTranslationUnitScope().
ObjCIdTypedefType = QualType();
ObjCClassTypedefType = QualType();
-
+
// Builtin types for 'id' and 'Class'.
InitBuiltinType(ObjCBuiltinIdTy, BuiltinType::ObjCId);
InitBuiltinType(ObjCBuiltinClassTy, BuiltinType::ObjCClass);
ObjCConstantStringType = QualType();
-
+
// void * type
VoidPtrTy = getPointerType(VoidTy);
@@ -229,11 +229,11 @@
= InstantiatedFromStaticDataMember.find(Var);
if (Pos == InstantiatedFromStaticDataMember.end())
return 0;
-
+
return Pos->second;
}
-void
+void
ASTContext::setInstantiatedFromStaticDataMember(VarDecl *Inst, VarDecl *Tmpl) {
assert(Inst->isStaticDataMember() && "Not a static data member");
assert(Tmpl->isStaticDataMember() && "Not a static data member");
@@ -244,11 +244,11 @@
UnresolvedUsingDecl *
ASTContext::getInstantiatedFromUnresolvedUsingDecl(UsingDecl *UUD) {
- llvm::DenseMap<UsingDecl *, UnresolvedUsingDecl *>::iterator Pos
+ llvm::DenseMap<UsingDecl *, UnresolvedUsingDecl *>::iterator Pos
= InstantiatedFromUnresolvedUsingDecl.find(UUD);
if (Pos == InstantiatedFromUnresolvedUsingDecl.end())
return 0;
-
+
return Pos->second;
}
@@ -265,7 +265,7 @@
= InstantiatedFromUnnamedFieldDecl.find(Field);
if (Pos == InstantiatedFromUnnamedFieldDecl.end())
return 0;
-
+
return Pos->second;
}
@@ -275,18 +275,18 @@
assert(!Tmpl->getDeclName() && "Template field decl is not unnamed");
assert(!InstantiatedFromUnnamedFieldDecl[Inst] &&
"Already noted what unnamed field was instantiated from");
-
+
InstantiatedFromUnnamedFieldDecl[Inst] = Tmpl;
}
namespace {
- class BeforeInTranslationUnit
+ class BeforeInTranslationUnit
: std::binary_function<SourceRange, SourceRange, bool> {
SourceManager *SourceMgr;
-
+
public:
explicit BeforeInTranslationUnit(SourceManager *SM) : SourceMgr(SM) { }
-
+
bool operator()(SourceRange X, SourceRange Y) {
return SourceMgr->isBeforeInTranslationUnit(X.getBegin(), Y.getBegin());
}
@@ -302,14 +302,14 @@
/// \param Member whether we want to check whether this is a member comment
/// (which requires a < after the Doxygen-comment delimiter). Otherwise,
/// we only return true when we find a non-member comment.
-static bool
-isDoxygenComment(SourceManager &SourceMgr, SourceRange Comment,
+static bool
+isDoxygenComment(SourceManager &SourceMgr, SourceRange Comment,
bool Member = false) {
- const char *BufferStart
+ const char *BufferStart
= SourceMgr.getBufferData(SourceMgr.getFileID(Comment.getBegin())).first;
const char *Start = BufferStart + SourceMgr.getFileOffset(Comment.getBegin());
const char* End = BufferStart + SourceMgr.getFileOffset(Comment.getEnd());
-
+
if (End - Start < 4)
return false;
@@ -323,32 +323,32 @@
}
/// \brief Retrieve the comment associated with the given declaration, if
-/// it has one.
+/// it has one.
const char *ASTContext::getCommentForDecl(const Decl *D) {
if (!D)
return 0;
-
+
// Check whether we have cached a comment string for this declaration
// already.
- llvm::DenseMap<const Decl *, std::string>::iterator Pos
+ llvm::DenseMap<const Decl *, std::string>::iterator Pos
= DeclComments.find(D);
if (Pos != DeclComments.end())
return Pos->second.c_str();
- // If we have an external AST source and have not yet loaded comments from
+ // If we have an external AST source and have not yet loaded comments from
// that source, do so now.
if (ExternalSource && !LoadedExternalComments) {
std::vector<SourceRange> LoadedComments;
ExternalSource->ReadComments(LoadedComments);
-
+
if (!LoadedComments.empty())
Comments.insert(Comments.begin(), LoadedComments.begin(),
LoadedComments.end());
-
+
LoadedExternalComments = true;
}
-
- // If there are no comments anywhere, we won't find anything.
+
+ // If there are no comments anywhere, we won't find anything.
if (Comments.empty())
return 0;
@@ -360,17 +360,17 @@
// Find the comment that occurs just before this declaration.
std::vector<SourceRange>::iterator LastComment
- = std::lower_bound(Comments.begin(), Comments.end(),
+ = std::lower_bound(Comments.begin(), Comments.end(),
SourceRange(DeclStartLoc),
BeforeInTranslationUnit(&SourceMgr));
-
+
// Decompose the location for the start of the declaration and find the
// beginning of the file buffer.
- std::pair<FileID, unsigned> DeclStartDecomp
+ std::pair<FileID, unsigned> DeclStartDecomp
= SourceMgr.getDecomposedLoc(DeclStartLoc);
- const char *FileBufferStart
+ const char *FileBufferStart
= SourceMgr.getBufferData(DeclStartDecomp.first).first;
-
+
// First check whether we have a comment for a member.
if (LastComment != Comments.end() &&
!isa<TagDecl>(D) && !isa<NamespaceDecl>(D) &&
@@ -379,19 +379,19 @@
= SourceMgr.getDecomposedLoc(LastComment->getEnd());
if (DeclStartDecomp.first == LastCommentEndDecomp.first &&
SourceMgr.getLineNumber(DeclStartDecomp.first, DeclStartDecomp.second)
- == SourceMgr.getLineNumber(LastCommentEndDecomp.first,
+ == SourceMgr.getLineNumber(LastCommentEndDecomp.first,
LastCommentEndDecomp.second)) {
// The Doxygen member comment comes after the declaration starts and
// is on the same line and in the same file as the declaration. This
// is the comment we want.
std::string &Result = DeclComments[D];
- Result.append(FileBufferStart +
- SourceMgr.getFileOffset(LastComment->getBegin()),
+ Result.append(FileBufferStart +
+ SourceMgr.getFileOffset(LastComment->getBegin()),
FileBufferStart + LastCommentEndDecomp.second + 1);
return Result.c_str();
}
}
-
+
if (LastComment == Comments.begin())
return 0;
--LastComment;
@@ -399,33 +399,33 @@
// Decompose the end of the comment.
std::pair<FileID, unsigned> LastCommentEndDecomp
= SourceMgr.getDecomposedLoc(LastComment->getEnd());
-
+
// If the comment and the declaration aren't in the same file, then they
// aren't related.
if (DeclStartDecomp.first != LastCommentEndDecomp.first)
return 0;
-
+
// Check that we actually have a Doxygen comment.
if (!isDoxygenComment(SourceMgr, *LastComment))
return 0;
-
+
// Compute the starting line for the declaration and for the end of the
// comment (this is expensive).
- unsigned DeclStartLine
+ unsigned DeclStartLine
= SourceMgr.getLineNumber(DeclStartDecomp.first, DeclStartDecomp.second);
unsigned CommentEndLine
- = SourceMgr.getLineNumber(LastCommentEndDecomp.first,
+ = SourceMgr.getLineNumber(LastCommentEndDecomp.first,
LastCommentEndDecomp.second);
-
+
// If the comment does not end on the line prior to the declaration, then
// the comment is not associated with the declaration at all.
if (CommentEndLine + 1 != DeclStartLine)
return 0;
-
+
// We have a comment, but there may be more comments on the previous lines.
// Keep looking so long as the comments are still Doxygen comments and are
// still adjacent.
- unsigned ExpectedLine
+ unsigned ExpectedLine
= SourceMgr.getSpellingLineNumber(LastComment->getBegin()) - 1;
std::vector<SourceRange>::iterator FirstComment = LastComment;
while (FirstComment != Comments.begin()) {
@@ -433,31 +433,31 @@
--FirstComment;
std::pair<FileID, unsigned> Decomp
= SourceMgr.getDecomposedLoc(FirstComment->getEnd());
-
+
// If this previous comment is in a different file, we're done.
if (Decomp.first != DeclStartDecomp.first) {
++FirstComment;
break;
}
-
+
// If this comment is not a Doxygen comment, we're done.
if (!isDoxygenComment(SourceMgr, *FirstComment)) {
++FirstComment;
break;
}
-
+
// If the line number is not what we expected, we're done.
unsigned Line = SourceMgr.getLineNumber(Decomp.first, Decomp.second);
if (Line != ExpectedLine) {
++FirstComment;
break;
}
-
+
// Set the next expected line number.
- ExpectedLine
+ ExpectedLine
= SourceMgr.getSpellingLineNumber(FirstComment->getBegin()) - 1;
}
-
+
// The iterator range [FirstComment, LastComment] contains all of the
// BCPL comments that, together, are associated with this declaration.
// Form a single comment block string for this declaration that concatenates
@@ -472,10 +472,10 @@
FileBufferStart + DecompEnd.second + 1);
++FirstComment;
}
-
+
// Append the last comment line.
- Result.append(FileBufferStart +
- SourceMgr.getFileOffset(LastComment->getBegin()),
+ Result.append(FileBufferStart +
+ SourceMgr.getFileOffset(LastComment->getBegin()),
FileBufferStart + LastCommentEndDecomp.second + 1);
return Result.c_str();
}
@@ -555,7 +555,7 @@
case Type::ConstantArrayWithoutExpr:
case Type::ConstantArray: {
const ConstantArrayType *CAT = cast<ConstantArrayType>(T);
-
+
std::pair<uint64_t, unsigned> EltInfo = getTypeInfo(CAT->getElementType());
Width = EltInfo.first*CAT->getSize().getZExtValue();
Align = EltInfo.second;
@@ -563,7 +563,7 @@
}
case Type::ExtVector:
case Type::Vector: {
- std::pair<uint64_t, unsigned> EltInfo =
+ std::pair<uint64_t, unsigned> EltInfo =
getTypeInfo(cast<VectorType>(T)->getElementType());
Width = EltInfo.first*cast<VectorType>(T)->getNumElements();
Align = Width;
@@ -689,7 +689,7 @@
// If we ever want to support other ABIs this needs to be abstracted.
QualType Pointee = cast<MemberPointerType>(T)->getPointeeType();
- std::pair<uint64_t, unsigned> PtrDiffInfo =
+ std::pair<uint64_t, unsigned> PtrDiffInfo =
getTypeInfo(getPointerDiffType());
Width = PtrDiffInfo.first;
if (Pointee->isFunctionType())
@@ -700,7 +700,7 @@
case Type::Complex: {
// Complex types have the same alignment as their elements, but twice the
// size.
- std::pair<uint64_t, unsigned> EltInfo =
+ std::pair<uint64_t, unsigned> EltInfo =
getTypeInfo(cast<ComplexType>(T)->getElementType());
Width = EltInfo.first*2;
Align = EltInfo.second;
@@ -722,7 +722,7 @@
Align = 1;
break;
}
-
+
if (const EnumType *ET = dyn_cast<EnumType>(TT))
return getTypeInfo(ET->getDecl()->getIntegerType());
@@ -760,16 +760,16 @@
case Type::QualifiedName:
return getTypeInfo(cast<QualifiedNameType>(T)->getNamedType().getTypePtr());
-
+
case Type::TemplateSpecialization:
- assert(getCanonicalType(T) != T &&
+ assert(getCanonicalType(T) != T &&
"Cannot request the size of a dependent type");
// FIXME: this is likely to be wrong once we support template
// aliases, since a template alias could refer to a typedef that
// has an __aligned__ attribute on it.
return getTypeInfo(getCanonicalType(T));
}
-
+
assert(Align && (Align & (Align-1)) == 0 && "Alignment must be power of 2");
return std::make_pair(Width, Align);
}
@@ -829,7 +829,7 @@
E = PD->prop_end(); I != E; ++I)
if (ObjCIvarDecl *Ivar = (*I)->getPropertyIvarDecl())
Ivars.push_back(Ivar);
-
+
// Also look into nested protocols.
for (ObjCProtocolDecl::protocol_iterator P = PD->protocol_begin(),
E = PD->protocol_end(); P != E; ++P)
@@ -869,8 +869,7 @@
return count;
}
-unsigned ASTContext::CountSynthesizedIvars(const ObjCInterfaceDecl *OI)
-{
+unsigned ASTContext::CountSynthesizedIvars(const ObjCInterfaceDecl *OI) {
unsigned count = 0;
for (ObjCInterfaceDecl::prop_iterator I = OI->prop_begin(),
E = OI->prop_end(); I != E; ++I) {
@@ -944,7 +943,7 @@
assert(!D->isForwardDecl() && "Invalid interface decl!");
// Look up this layout, if already laid out, return what we have.
- ObjCContainerDecl *Key =
+ ObjCContainerDecl *Key =
Impl ? (ObjCContainerDecl*) Impl : (ObjCContainerDecl*) D;
if (const ASTRecordLayout *Entry = ObjCLayouts[Key])
return *Entry;
@@ -962,10 +961,10 @@
return getObjCLayout(D, 0);
}
- const ASTRecordLayout *NewEntry =
+ const ASTRecordLayout *NewEntry =
ASTRecordLayoutBuilder::ComputeLayout(*this, D, Impl);
ObjCLayouts[Key] = NewEntry;
-
+
return *NewEntry;
}
@@ -992,10 +991,10 @@
const ASTRecordLayout *Entry = ASTRecordLayouts[D];
if (Entry) return *Entry;
- const ASTRecordLayout *NewEntry =
+ const ASTRecordLayout *NewEntry =
ASTRecordLayoutBuilder::ComputeLayout(*this, D);
ASTRecordLayouts[D] = NewEntry;
-
+
return *NewEntry;
}
@@ -1013,7 +1012,7 @@
unsigned CVRQuals = T.getCVRQualifiers();
QualType::GCAttrTypes GCAttr = QualType::GCNone;
Type *TypeNode = T.getTypePtr();
-
+
if (ExtQualType *EQT = dyn_cast<ExtQualType>(TypeNode)) {
// If this type already has an address space specified, it cannot get
// another one.
@@ -1022,7 +1021,7 @@
GCAttr = EQT->getObjCGCAttr();
TypeNode = EQT->getBaseType();
}
-
+
// Check if we've already instantiated this type.
llvm::FoldingSetNodeID ID;
ExtQualType::Profile(ID, TypeNode, AddressSpace, GCAttr);
@@ -1035,7 +1034,7 @@
QualType Canonical;
if (!TypeNode->isCanonical()) {
Canonical = getAddrSpaceQualType(CanT, AddressSpace);
-
+
// Update InsertPos, the previous call could have invalidated it.
ExtQualType *NewIP = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1052,7 +1051,7 @@
QualType CanT = getCanonicalType(T);
if (CanT.getObjCGCAttr() == GCAttr)
return T;
-
+
if (T->isPointerType()) {
QualType Pointee = T->getAs<PointerType>()->getPointeeType();
if (Pointee->isAnyPointerType()) {
@@ -1065,7 +1064,7 @@
unsigned CVRQuals = T.getCVRQualifiers();
Type *TypeNode = T.getTypePtr();
unsigned AddressSpace = 0;
-
+
if (ExtQualType *EQT = dyn_cast<ExtQualType>(TypeNode)) {
// If this type already has an ObjCGC specified, it cannot get
// another one.
@@ -1074,14 +1073,14 @@
AddressSpace = EQT->getAddressSpace();
TypeNode = EQT->getBaseType();
}
-
+
// Check if we've already instantiated an gc qual'd type of this type.
llvm::FoldingSetNodeID ID;
ExtQualType::Profile(ID, TypeNode, AddressSpace, GCAttr);
void *InsertPos = 0;
if (ExtQualType *EXTQy = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(EXTQy, CVRQuals);
-
+
// If the base type isn't canonical, this won't be a canonical type either,
// so fill in the canonical type field.
// FIXME: Isn't this also not canonical if the base type is a array
@@ -1089,7 +1088,7 @@
QualType Canonical;
if (!T->isCanonical()) {
Canonical = getObjCGCQualType(CanT, GCAttr);
-
+
// Update InsertPos, the previous call could have invalidated it.
ExtQualType *NewIP = ExtQualTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1117,10 +1116,10 @@
ResultType = getBlockPointerType(ResultType);
ResultType.setCVRQualifiers(T.getCVRQualifiers());
return qs.apply(ResultType, *this);
- }
+ }
if (!T->isFunctionType())
assert(0 && "can't noreturn qualify non-pointer to function or block type");
-
+
if (const FunctionNoProtoType *F = T->getAsFunctionNoProtoType()) {
return getFunctionNoProtoType(F->getResultType(), true);
}
@@ -1138,17 +1137,17 @@
// structure.
llvm::FoldingSetNodeID ID;
ComplexType::Profile(ID, T);
-
+
void *InsertPos = 0;
if (ComplexType *CT = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(CT, 0);
-
+
// If the pointee type isn't canonical, this won't be a canonical type either,
// so fill in the canonical type field.
QualType Canonical;
if (!T->isCanonical()) {
Canonical = getComplexType(getCanonicalType(T));
-
+
// Get the new insert position for the node we care about.
ComplexType *NewIP = ComplexTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1175,17 +1174,17 @@
// structure.
llvm::FoldingSetNodeID ID;
PointerType::Profile(ID, T);
-
+
void *InsertPos = 0;
if (PointerType *PT = PointerTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(PT, 0);
-
+
// If the pointee type isn't canonical, this won't be a canonical type either,
// so fill in the canonical type field.
QualType Canonical;
if (!T->isCanonical()) {
Canonical = getPointerType(getCanonicalType(T));
-
+
// Get the new insert position for the node we care about.
PointerType *NewIP = PointerTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1196,7 +1195,7 @@
return QualType(New, 0);
}
-/// getBlockPointerType - Return the uniqued reference to the type for
+/// getBlockPointerType - Return the uniqued reference to the type for
/// a pointer to the specified block.
QualType ASTContext::getBlockPointerType(QualType T) {
assert(T->isFunctionType() && "block of function types only");
@@ -1204,18 +1203,18 @@
// structure.
llvm::FoldingSetNodeID ID;
BlockPointerType::Profile(ID, T);
-
+
void *InsertPos = 0;
if (BlockPointerType *PT =
BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(PT, 0);
-
- // If the block pointee type isn't canonical, this won't be a canonical
+
+ // If the block pointee type isn't canonical, this won't be a canonical
// type either so fill in the canonical type field.
QualType Canonical;
if (!T->isCanonical()) {
Canonical = getBlockPointerType(getCanonicalType(T));
-
+
// Get the new insert position for the node we care about.
BlockPointerType *NewIP =
BlockPointerTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -1291,8 +1290,7 @@
/// getMemberPointerType - Return the uniqued reference to the type for a
/// member pointer to the specified type, in the specified class.
-QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls)
-{
+QualType ASTContext::getMemberPointerType(QualType T, const Type *Cls) {
// Unique pointers, to guarantee there is only one pointer of a particular
// structure.
llvm::FoldingSetNodeID ID;
@@ -1320,9 +1318,9 @@
return QualType(New, 0);
}
-/// getConstantArrayType - Return the unique reference to the type for an
+/// getConstantArrayType - Return the unique reference to the type for an
/// array of the specified element type.
-QualType ASTContext::getConstantArrayType(QualType EltTy,
+QualType ASTContext::getConstantArrayType(QualType EltTy,
const llvm::APInt &ArySizeIn,
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals) {
@@ -1333,27 +1331,27 @@
// the target.
llvm::APInt ArySize(ArySizeIn);
ArySize.zextOrTrunc(Target.getPointerWidth(EltTy.getAddressSpace()));
-
+
llvm::FoldingSetNodeID ID;
ConstantArrayType::Profile(ID, EltTy, ArySize, ASM, EltTypeQuals);
-
+
void *InsertPos = 0;
- if (ConstantArrayType *ATP =
+ if (ConstantArrayType *ATP =
ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(ATP, 0);
-
+
// If the element type isn't canonical, this won't be a canonical type either,
// so fill in the canonical type field.
QualType Canonical;
if (!EltTy->isCanonical()) {
- Canonical = getConstantArrayType(getCanonicalType(EltTy), ArySize,
+ Canonical = getConstantArrayType(getCanonicalType(EltTy), ArySize,
ASM, EltTypeQuals);
// Get the new insert position for the node we care about.
- ConstantArrayType *NewIP =
+ ConstantArrayType *NewIP =
ConstantArrayTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
}
-
+
ConstantArrayType *New =
new(*this,8)ConstantArrayType(EltTy, Canonical, ArySize, ASM, EltTypeQuals);
ConstantArrayTypes.InsertNode(New, InsertPos);
@@ -1437,11 +1435,11 @@
ArrayType::ArraySizeModifier ASM,
unsigned EltTypeQuals,
SourceRange Brackets) {
- assert((NumElts->isTypeDependent() || NumElts->isValueDependent()) &&
+ assert((NumElts->isTypeDependent() || NumElts->isValueDependent()) &&
"Size must be type- or value-dependent!");
llvm::FoldingSetNodeID ID;
- DependentSizedArrayType::Profile(ID, *this, getCanonicalType(EltTy), ASM,
+ DependentSizedArrayType::Profile(ID, *this, getCanonicalType(EltTy), ASM,
EltTypeQuals, NumElts);
void *InsertPos = 0;
@@ -1451,7 +1449,7 @@
if (Canon) {
// We already have a canonical version of this array type; use it as
// the canonical type for a newly-built type.
- New = new (*this,8) DependentSizedArrayType(*this, EltTy,
+ New = new (*this,8) DependentSizedArrayType(*this, EltTy,
QualType(Canon, 0),
NumElts, ASM, EltTypeQuals,
Brackets);
@@ -1468,10 +1466,10 @@
SourceRange());
New = new (*this,8) DependentSizedArrayType(*this, EltTy, Canon,
NumElts, ASM, EltTypeQuals,
- Brackets);
+ Brackets);
}
}
-
+
Types.push_back(New);
return QualType(New, 0);
}
@@ -1483,7 +1481,7 @@
IncompleteArrayType::Profile(ID, EltTy, ASM, EltTypeQuals);
void *InsertPos = 0;
- if (IncompleteArrayType *ATP =
+ if (IncompleteArrayType *ATP =
IncompleteArrayTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(ATP, 0);
@@ -1514,13 +1512,13 @@
/// the specified element type and size. VectorType must be a built-in type.
QualType ASTContext::getVectorType(QualType vecType, unsigned NumElts) {
BuiltinType *baseType;
-
+
baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
assert(baseType != 0 && "getVectorType(): Expecting a built-in type");
-
+
// Check if we've already instantiated a vector of this type.
llvm::FoldingSetNodeID ID;
- VectorType::Profile(ID, vecType, NumElts, Type::Vector);
+ VectorType::Profile(ID, vecType, NumElts, Type::Vector);
void *InsertPos = 0;
if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(VTP, 0);
@@ -1530,7 +1528,7 @@
QualType Canonical;
if (!vecType->isCanonical()) {
Canonical = getVectorType(getCanonicalType(vecType), NumElts);
-
+
// Get the new insert position for the node we care about.
VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1545,13 +1543,13 @@
/// the specified element type and size. VectorType must be a built-in type.
QualType ASTContext::getExtVectorType(QualType vecType, unsigned NumElts) {
BuiltinType *baseType;
-
+
baseType = dyn_cast<BuiltinType>(getCanonicalType(vecType).getTypePtr());
assert(baseType != 0 && "getExtVectorType(): Expecting a built-in type");
-
+
// Check if we've already instantiated a vector of this type.
llvm::FoldingSetNodeID ID;
- VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);
+ VectorType::Profile(ID, vecType, NumElts, Type::ExtVector);
void *InsertPos = 0;
if (VectorType *VTP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(VTP, 0);
@@ -1561,7 +1559,7 @@
QualType Canonical;
if (!vecType->isCanonical()) {
Canonical = getExtVectorType(getCanonicalType(vecType), NumElts);
-
+
// Get the new insert position for the node we care about.
VectorType *NewIP = VectorTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
@@ -1572,13 +1570,13 @@
return QualType(New, 0);
}
-QualType ASTContext::getDependentSizedExtVectorType(QualType vecType,
+QualType ASTContext::getDependentSizedExtVectorType(QualType vecType,
Expr *SizeExpr,
SourceLocation AttrLoc) {
llvm::FoldingSetNodeID ID;
- DependentSizedExtVectorType::Profile(ID, *this, getCanonicalType(vecType),
+ DependentSizedExtVectorType::Profile(ID, *this, getCanonicalType(vecType),
SizeExpr);
-
+
void *InsertPos = 0;
DependentSizedExtVectorType *Canon
= DependentSizedExtVectorTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -1592,8 +1590,8 @@
} else {
QualType CanonVecTy = getCanonicalType(vecType);
if (CanonVecTy == vecType) {
- New = new (*this,8) DependentSizedExtVectorType(*this, vecType,
- QualType(), SizeExpr,
+ New = new (*this,8) DependentSizedExtVectorType(*this, vecType,
+ QualType(), SizeExpr,
AttrLoc);
DependentSizedExtVectorTypes.InsertNode(New, InsertPos);
} else {
@@ -1603,7 +1601,7 @@
SizeExpr, AttrLoc);
}
}
-
+
Types.push_back(New);
return QualType(New, 0);
}
@@ -1615,22 +1613,22 @@
// structure.
llvm::FoldingSetNodeID ID;
FunctionNoProtoType::Profile(ID, ResultTy, NoReturn);
-
+
void *InsertPos = 0;
- if (FunctionNoProtoType *FT =
+ if (FunctionNoProtoType *FT =
FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(FT, 0);
-
+
QualType Canonical;
if (!ResultTy->isCanonical()) {
Canonical = getFunctionNoProtoType(getCanonicalType(ResultTy), NoReturn);
-
+
// Get the new insert position for the node we care about.
FunctionNoProtoType *NewIP =
FunctionNoProtoTypes.FindNodeOrInsertPos(ID, InsertPos);
assert(NewIP == 0 && "Shouldn't be in the map!"); NewIP = NewIP;
}
-
+
FunctionNoProtoType *New
= new (*this,8) FunctionNoProtoType(ResultTy, Canonical, NoReturn);
Types.push_back(New);
@@ -1653,7 +1651,7 @@
NumExs, ExArray, NoReturn);
void *InsertPos = 0;
- if (FunctionProtoType *FTP =
+ if (FunctionProtoType *FTP =
FunctionProtoTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(FTP, 0);
@@ -1688,7 +1686,7 @@
// FunctionProtoType objects are allocated with extra bytes after them
// for two variable size arrays (for parameter and exception types) at the
// end of them.
- FunctionProtoType *FTP =
+ FunctionProtoType *FTP =
(FunctionProtoType*)Allocate(sizeof(FunctionProtoType) +
NumArgs*sizeof(QualType) +
NumExs*sizeof(QualType), 8);
@@ -1705,7 +1703,7 @@
QualType ASTContext::getTypeDeclType(TypeDecl *Decl, TypeDecl* PrevDecl) {
assert(Decl && "Passed null for Decl param");
if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
-
+
if (TypedefDecl *Typedef = dyn_cast<TypedefDecl>(Decl))
return getTypedefType(Typedef);
else if (isa<TemplateTypeParmDecl>(Decl)) {
@@ -1735,7 +1733,7 @@
/// specified typename decl.
QualType ASTContext::getTypedefType(TypedefDecl *Decl) {
if (Decl->TypeForDecl) return QualType(Decl->TypeForDecl, 0);
-
+
QualType Canonical = getCanonicalType(Decl->getUnderlyingType());
Decl->TypeForDecl = new(*this,8) TypedefType(Type::Typedef, Decl, Canonical);
Types.push_back(Decl->TypeForDecl);
@@ -1743,20 +1741,20 @@
}
/// \brief Retrieve the template type parameter type for a template
-/// parameter or parameter pack with the given depth, index, and (optionally)
+/// parameter or parameter pack with the given depth, index, and (optionally)
/// name.
-QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index,
+QualType ASTContext::getTemplateTypeParmType(unsigned Depth, unsigned Index,
bool ParameterPack,
IdentifierInfo *Name) {
llvm::FoldingSetNodeID ID;
TemplateTypeParmType::Profile(ID, Depth, Index, ParameterPack, Name);
void *InsertPos = 0;
- TemplateTypeParmType *TypeParm
+ TemplateTypeParmType *TypeParm
= TemplateTypeParmTypes.FindNodeOrInsertPos(ID, InsertPos);
if (TypeParm)
return QualType(TypeParm, 0);
-
+
if (Name) {
QualType Canon = getTemplateTypeParmType(Depth, Index, ParameterPack);
TypeParm = new (*this, 8) TemplateTypeParmType(Depth, Index, ParameterPack,
@@ -1770,7 +1768,7 @@
return QualType(TypeParm, 0);
}
-QualType
+QualType
ASTContext::getTemplateSpecializationType(TemplateName Template,
const TemplateArgument *Args,
unsigned NumArgs,
@@ -1788,65 +1786,65 @@
// Determine whether this canonical template specialization type already
// exists.
llvm::FoldingSetNodeID ID;
- TemplateSpecializationType::Profile(ID, CanonTemplate,
+ TemplateSpecializationType::Profile(ID, CanonTemplate,
CanonArgs.data(), NumArgs, *this);
void *InsertPos = 0;
TemplateSpecializationType *Spec
= TemplateSpecializationTypes.FindNodeOrInsertPos(ID, InsertPos);
-
+
if (!Spec) {
// Allocate a new canonical template specialization type.
- void *Mem = Allocate((sizeof(TemplateSpecializationType) +
+ void *Mem = Allocate((sizeof(TemplateSpecializationType) +
sizeof(TemplateArgument) * NumArgs),
8);
- Spec = new (Mem) TemplateSpecializationType(*this, CanonTemplate,
+ Spec = new (Mem) TemplateSpecializationType(*this, CanonTemplate,
CanonArgs.data(), NumArgs,
Canon);
Types.push_back(Spec);
- TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
+ TemplateSpecializationTypes.InsertNode(Spec, InsertPos);
}
-
+
if (Canon.isNull())
Canon = QualType(Spec, 0);
- assert(Canon->isDependentType() &&
+ assert(Canon->isDependentType() &&
"Non-dependent template-id type must have a canonical type");
}
// Allocate the (non-canonical) template specialization type, but don't
// try to unique it: these types typically have location information that
// we don't unique and don't want to lose.
- void *Mem = Allocate((sizeof(TemplateSpecializationType) +
+ void *Mem = Allocate((sizeof(TemplateSpecializationType) +
sizeof(TemplateArgument) * NumArgs),
8);
- TemplateSpecializationType *Spec
- = new (Mem) TemplateSpecializationType(*this, Template, Args, NumArgs,
+ TemplateSpecializationType *Spec
+ = new (Mem) TemplateSpecializationType(*this, Template, Args, NumArgs,
Canon);
-
+
Types.push_back(Spec);
- return QualType(Spec, 0);
+ return QualType(Spec, 0);
}
-QualType
+QualType
ASTContext::getQualifiedNameType(NestedNameSpecifier *NNS,
QualType NamedType) {
llvm::FoldingSetNodeID ID;
QualifiedNameType::Profile(ID, NNS, NamedType);
void *InsertPos = 0;
- QualifiedNameType *T
+ QualifiedNameType *T
= QualifiedNameTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T)
return QualType(T, 0);
- T = new (*this) QualifiedNameType(NNS, NamedType,
+ T = new (*this) QualifiedNameType(NNS, NamedType,
getCanonicalType(NamedType));
Types.push_back(T);
QualifiedNameTypes.InsertNode(T, InsertPos);
return QualType(T, 0);
}
-QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
+QualType ASTContext::getTypenameType(NestedNameSpecifier *NNS,
const IdentifierInfo *Name,
QualType Canon) {
assert(NNS->isDependent() && "nested-name-specifier must be dependent");
@@ -1861,7 +1859,7 @@
TypenameType::Profile(ID, NNS, Name);
void *InsertPos = 0;
- TypenameType *T
+ TypenameType *T
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T)
return QualType(T, 0);
@@ -1869,11 +1867,11 @@
T = new (*this) TypenameType(NNS, Name, Canon);
Types.push_back(T);
TypenameTypes.InsertNode(T, InsertPos);
- return QualType(T, 0);
+ return QualType(T, 0);
}
-QualType
-ASTContext::getTypenameType(NestedNameSpecifier *NNS,
+QualType
+ASTContext::getTypenameType(NestedNameSpecifier *NNS,
const TemplateSpecializationType *TemplateId,
QualType Canon) {
assert(NNS->isDependent() && "nested-name-specifier must be dependent");
@@ -1894,7 +1892,7 @@
TypenameType::Profile(ID, NNS, TemplateId);
void *InsertPos = 0;
- TypenameType *T
+ TypenameType *T
= TypenameTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T)
return QualType(T, 0);
@@ -1902,7 +1900,7 @@
T = new (*this) TypenameType(NNS, TemplateId, Canon);
Types.push_back(T);
TypenameTypes.InsertNode(T, InsertPos);
- return QualType(T, 0);
+ return QualType(T, 0);
}
QualType
@@ -1910,7 +1908,7 @@
ElaboratedType::TagKind Tag) {
llvm::FoldingSetNodeID ID;
ElaboratedType::Profile(ID, UnderlyingType, Tag);
-
+
void *InsertPos = 0;
ElaboratedType *T = ElaboratedTypes.FindNodeOrInsertPos(ID, InsertPos);
if (T)
@@ -1934,7 +1932,7 @@
static void SortAndUniqueProtocols(ObjCProtocolDecl **&Protocols,
unsigned &NumProtocols) {
ObjCProtocolDecl **ProtocolsEnd = Protocols+NumProtocols;
-
+
// Sort protocols, keyed by name.
std::sort(Protocols, Protocols+NumProtocols, CmpProtocolNames);
@@ -1946,7 +1944,7 @@
/// getObjCObjectPointerType - Return a ObjCObjectPointerType type for
/// the given interface decl and the conforming protocol list.
QualType ASTContext::getObjCObjectPointerType(QualType InterfaceT,
- ObjCProtocolDecl **Protocols,
+ ObjCProtocolDecl **Protocols,
unsigned NumProtocols) {
// Sort the protocol list alphabetically to canonicalize it.
if (NumProtocols)
@@ -1963,7 +1961,7 @@
// No Match;
ObjCObjectPointerType *QType =
new (*this,8) ObjCObjectPointerType(InterfaceT, Protocols, NumProtocols);
-
+
Types.push_back(QType);
ObjCObjectPointerTypes.InsertNode(QType, InsertPos);
return QualType(QType, 0);
@@ -1973,21 +1971,21 @@
/// specified ObjC interface decl. The list of protocols is optional.
QualType ASTContext::getObjCInterfaceType(const ObjCInterfaceDecl *Decl,
ObjCProtocolDecl **Protocols, unsigned NumProtocols) {
- if (NumProtocols)
+ if (NumProtocols)
// Sort the protocol list alphabetically to canonicalize it.
SortAndUniqueProtocols(Protocols, NumProtocols);
-
+
llvm::FoldingSetNodeID ID;
ObjCInterfaceType::Profile(ID, Decl, Protocols, NumProtocols);
-
+
void *InsertPos = 0;
if (ObjCInterfaceType *QT =
ObjCInterfaceTypes.FindNodeOrInsertPos(ID, InsertPos))
return QualType(QT, 0);
-
+
// No Match;
ObjCInterfaceType *QType =
- new (*this,8) ObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(Decl),
+ new (*this,8) ObjCInterfaceType(const_cast<ObjCInterfaceDecl*>(Decl),
Protocols, NumProtocols);
Types.push_back(QType);
ObjCInterfaceTypes.InsertNode(QType, InsertPos);
@@ -1997,21 +1995,21 @@
/// getTypeOfExprType - Unlike many "get<Type>" functions, we can't unique
/// TypeOfExprType AST's (since expression's are never shared). For example,
/// multiple declarations that refer to "typeof(x)" all contain different
-/// DeclRefExpr's. This doesn't effect the type checker, since it operates
+/// DeclRefExpr's. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getTypeOfExprType(Expr *tofExpr) {
TypeOfExprType *toe;
if (tofExpr->isTypeDependent()) {
llvm::FoldingSetNodeID ID;
DependentTypeOfExprType::Profile(ID, *this, tofExpr);
-
+
void *InsertPos = 0;
DependentTypeOfExprType *Canon
= DependentTypeOfExprTypes.FindNodeOrInsertPos(ID, InsertPos);
if (Canon) {
// We already have a "canonical" version of an identical, dependent
// typeof(expr) type. Use that as our canonical type.
- toe = new (*this, 8) TypeOfExprType(tofExpr,
+ toe = new (*this, 8) TypeOfExprType(tofExpr,
QualType((TypeOfExprType*)Canon, 0));
}
else {
@@ -2031,7 +2029,7 @@
/// getTypeOfType - Unlike many "get<Type>" functions, we don't unique
/// TypeOfType AST's. The only motivation to unique these nodes would be
/// memory savings. Since typeof(t) is fairly uncommon, space shouldn't be
-/// an issue. This doesn't effect the type checker, since it operates
+/// an issue. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getTypeOfType(QualType tofType) {
QualType Canonical = getCanonicalType(tofType);
@@ -2045,7 +2043,7 @@
static QualType getDecltypeForExpr(const Expr *e, ASTContext &Context) {
if (e->isTypeDependent())
return Context.DependentTy;
-
+
// If e is an id expression or a class member access, decltype(e) is defined
// as the type of the entity named by e.
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(e)) {
@@ -2061,28 +2059,28 @@
// return type of that function.
if (const CallExpr *CE = dyn_cast<CallExpr>(e->IgnoreParens()))
return CE->getCallReturnType();
-
+
QualType T = e->getType();
-
- // Otherwise, where T is the type of e, if e is an lvalue, decltype(e) is
+
+ // Otherwise, where T is the type of e, if e is an lvalue, decltype(e) is
// defined as T&, otherwise decltype(e) is defined as T.
if (e->isLvalue(Context) == Expr::LV_Valid)
T = Context.getLValueReferenceType(T);
-
+
return T;
}
/// getDecltypeType - Unlike many "get<Type>" functions, we don't unique
/// DecltypeType AST's. The only motivation to unique these nodes would be
/// memory savings. Since decltype(t) is fairly uncommon, space shouldn't be
-/// an issue. This doesn't effect the type checker, since it operates
+/// an issue. This doesn't effect the type checker, since it operates
/// on canonical type's (which are always unique).
QualType ASTContext::getDecltypeType(Expr *e) {
DecltypeType *dt;
if (e->isTypeDependent()) {
llvm::FoldingSetNodeID ID;
DependentDecltypeType::Profile(ID, *this, e);
-
+
void *InsertPos = 0;
DependentDecltypeType *Canon
= DependentDecltypeTypes.FindNodeOrInsertPos(ID, InsertPos);
@@ -2100,7 +2098,7 @@
}
} else {
QualType T = getDecltypeForExpr(e, *this);
- dt = new (*this, 8) DecltypeType(e, T, getCanonicalType(T));
+ dt = new (*this, 8) DecltypeType(e, T, getCanonicalType(T));
}
Types.push_back(dt);
return QualType(dt, 0);
@@ -2115,9 +2113,9 @@
return getTypeDeclType(const_cast<TagDecl*>(Decl));
}
-/// getSizeType - Return the unique type for "size_t" (C99 7.17), the result
-/// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and
-/// needs to agree with the definition in <stddef.h>.
+/// getSizeType - Return the unique type for "size_t" (C99 7.17), the result
+/// of the sizeof operator (C99 6.5.3.4p4). The value is target dependent and
+/// needs to agree with the definition in <stddef.h>.
QualType ASTContext::getSizeType() const {
return getFromTargetType(Target.getSizeType());
}
@@ -2154,10 +2152,10 @@
/// for exact equality with a simple pointer comparison.
CanQualType ASTContext::getCanonicalType(QualType T) {
QualType CanType = T.getTypePtr()->getCanonicalTypeInternal();
-
+
// If the result has type qualifiers, make sure to canonicalize them as well.
unsigned TypeQuals = T.getCVRQualifiers() | CanType.getCVRQualifiers();
- if (TypeQuals == 0)
+ if (TypeQuals == 0)
return CanQualType::CreateUnsafe(CanType);
// If the type qualifiers are on an array type, get the canonical type of the
@@ -2165,12 +2163,12 @@
ArrayType *AT = dyn_cast<ArrayType>(CanType);
if (!AT)
return CanQualType::CreateUnsafe(CanType.getQualifiedType(TypeQuals));
-
+
// Get the canonical version of the element with the extra qualifiers on it.
// This can recursively sink qualifiers through multiple levels of arrays.
QualType NewEltTy=AT->getElementType().getWithAdditionalQualifiers(TypeQuals);
NewEltTy = getCanonicalType(NewEltTy);
-
+
if (ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
return CanQualType::CreateUnsafe(
getConstantArrayType(NewEltTy, CAT->getSize(),
@@ -2180,7 +2178,7 @@
return CanQualType::CreateUnsafe(
getIncompleteArrayType(NewEltTy, IAT->getSizeModifier(),
IAT->getIndexTypeQualifier()));
-
+
if (DependentSizedArrayType *DSAT = dyn_cast<DependentSizedArrayType>(AT))
return CanQualType::CreateUnsafe(
getDependentSizedArrayType(NewEltTy,
@@ -2205,7 +2203,7 @@
if (TemplateDecl *Template = Name.getAsTemplateDecl())
return TemplateName(cast<TemplateDecl>(Template->getCanonicalDecl()));
- // If this template name refers to a set of overloaded function templates,
+ // If this template name refers to a set of overloaded function templates,
/// the canonical template name merely stores the set of function templates.
if (OverloadedFunctionDecl *Ovl = Name.getAsOverloadedFunctionDecl()) {
OverloadedFunctionDecl *CanonOvl = 0;
@@ -2215,55 +2213,55 @@
Decl *Canon = F->get()->getCanonicalDecl();
if (CanonOvl || Canon != F->get()) {
if (!CanonOvl)
- CanonOvl = OverloadedFunctionDecl::Create(*this,
- Ovl->getDeclContext(),
+ CanonOvl = OverloadedFunctionDecl::Create(*this,
+ Ovl->getDeclContext(),
Ovl->getDeclName());
-
+
CanonOvl->addOverload(
AnyFunctionDecl::getFromNamedDecl(cast<NamedDecl>(Canon)));
}
}
-
+
return TemplateName(CanonOvl? CanonOvl : Ovl);
}
-
+
DependentTemplateName *DTN = Name.getAsDependentTemplateName();
assert(DTN && "Non-dependent template names must refer to template decls.");
return DTN->CanonicalTemplateName;
}
-TemplateArgument
+TemplateArgument
ASTContext::getCanonicalTemplateArgument(const TemplateArgument &Arg) {
switch (Arg.getKind()) {
case TemplateArgument::Null:
return Arg;
-
+
case TemplateArgument::Expression:
// FIXME: Build canonical expression?
return Arg;
-
+
case TemplateArgument::Declaration:
return TemplateArgument(SourceLocation(),
Arg.getAsDecl()->getCanonicalDecl());
-
+
case TemplateArgument::Integral:
return TemplateArgument(SourceLocation(),
*Arg.getAsIntegral(),
getCanonicalType(Arg.getIntegralType()));
-
+
case TemplateArgument::Type:
return TemplateArgument(SourceLocation(),
getCanonicalType(Arg.getAsType()));
-
+
case TemplateArgument::Pack: {
// FIXME: Allocate in ASTContext
TemplateArgument *CanonArgs = new TemplateArgument[Arg.pack_size()];
unsigned Idx = 0;
- for (TemplateArgument::pack_iterator A = Arg.pack_begin(),
+ for (TemplateArgument::pack_iterator A = Arg.pack_begin(),
AEnd = Arg.pack_end();
A != AEnd; (void)++A, ++Idx)
CanonArgs[Idx] = getCanonicalTemplateArgument(*A);
-
+
TemplateArgument Result;
Result.setArgumentPack(CanonArgs, Arg.pack_size(), false);
return Result;
@@ -2277,13 +2275,13 @@
NestedNameSpecifier *
ASTContext::getCanonicalNestedNameSpecifier(NestedNameSpecifier *NNS) {
- if (!NNS)
+ if (!NNS)
return 0;
switch (NNS->getKind()) {
case NestedNameSpecifier::Identifier:
// Canonicalize the prefix but keep the identifier the same.
- return NestedNameSpecifier::Create(*this,
+ return NestedNameSpecifier::Create(*this,
getCanonicalNestedNameSpecifier(NNS->getPrefix()),
NNS->getAsIdentifier());
@@ -2295,8 +2293,8 @@
case NestedNameSpecifier::TypeSpec:
case NestedNameSpecifier::TypeSpecWithTemplate: {
QualType T = getCanonicalType(QualType(NNS->getAsType(), 0));
- return NestedNameSpecifier::Create(*this, 0,
- NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate,
+ return NestedNameSpecifier::Create(*this, 0,
+ NNS->getKind() == NestedNameSpecifier::TypeSpecWithTemplate,
T.getTypePtr());
}
@@ -2317,27 +2315,27 @@
if (const ArrayType *AT = dyn_cast<ArrayType>(T))
return AT;
}
-
+
// Handle the common negative case fast, ignoring CVR qualifiers.
QualType CType = T->getCanonicalTypeInternal();
-
+
// Make sure to look through type qualifiers (like ExtQuals) for the negative
// test.
if (!isa<ArrayType>(CType) &&
!isa<ArrayType>(CType.getUnqualifiedType()))
return 0;
-
+
// Apply any CVR qualifiers from the array type to the element type. This
// implements C99 6.7.3p8: "If the specification of an array type includes
// any type qualifiers, the element type is so qualified, not the array type."
-
+
// If we get here, we either have type qualifiers on the type, or we have
// sugar such as a typedef in the way. If we have type qualifiers on the type
// we must propagate them down into the element type.
unsigned CVRQuals = T.getCVRQualifiers();
unsigned AddrSpace = 0;
Type *Ty = T.getTypePtr();
-
+
// Rip through ExtQualType's and typedefs to get to a concrete type.
while (1) {
if (const ExtQualType *EXTQT = dyn_cast<ExtQualType>(Ty)) {
@@ -2351,12 +2349,12 @@
Ty = T.getTypePtr();
}
}
-
+
// If we have a simple case, just return now.
const ArrayType *ATy = dyn_cast<ArrayType>(Ty);
if (ATy == 0 || (AddrSpace == 0 && CVRQuals == 0))
return ATy;
-
+
// Otherwise, we have an array and we have qualifiers on it. Push the
// qualifiers into the array element type and return a new array type.
// Get the canonical version of the element with the extra qualifiers on it.
@@ -2365,7 +2363,7 @@
if (AddrSpace)
NewEltTy = getAddrSpaceQualType(NewEltTy, AddrSpace);
NewEltTy = NewEltTy.getWithAdditionalQualifiers(CVRQuals);
-
+
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(ATy))
return cast<ArrayType>(getConstantArrayType(NewEltTy, CAT->getSize(),
CAT->getSizeModifier(),
@@ -2375,16 +2373,16 @@
IAT->getSizeModifier(),
IAT->getIndexTypeQualifier()));
- if (const DependentSizedArrayType *DSAT
+ if (const DependentSizedArrayType *DSAT
= dyn_cast<DependentSizedArrayType>(ATy))
return cast<ArrayType>(
- getDependentSizedArrayType(NewEltTy,
+ getDependentSizedArrayType(NewEltTy,
DSAT->getSizeExpr() ?
DSAT->getSizeExpr()->Retain() : 0,
DSAT->getSizeModifier(),
DSAT->getIndexTypeQualifier(),
DSAT->getBracketsRange()));
-
+
const VariableArrayType *VAT = cast<VariableArrayType>(ATy);
return cast<ArrayType>(getVariableArrayType(NewEltTy,
VAT->getSizeExpr() ?
@@ -2408,7 +2406,7 @@
// (C99 6.7.3p8).
const ArrayType *PrettyArrayType = getAsArrayType(Ty);
assert(PrettyArrayType && "Not an array type!");
-
+
QualType PtrTy = getPointerType(PrettyArrayType->getElementType());
// int x[restrict 4] -> int *restrict
@@ -2429,15 +2427,15 @@
QualType ASTContext::getBaseElementType(const VariableArrayType *VAT) {
QualType ElemTy = VAT->getElementType();
-
+
if (const VariableArrayType *VAT = getAsVariableArrayType(ElemTy))
return getBaseElementType(VAT);
-
+
return ElemTy;
}
/// getConstantArrayElementCount - Returns number of constant array elements.
-uint64_t
+uint64_t
ASTContext::getConstantArrayElementCount(const ConstantArrayType *CA) const {
uint64_t ElementCount = 1;
do {
@@ -2462,8 +2460,8 @@
}
}
-/// getFloatingTypeOfSizeWithinDomain - Returns a real floating
-/// point or a complex type (based on typeDomain/typeSize).
+/// getFloatingTypeOfSizeWithinDomain - Returns a real floating
+/// point or a complex type (based on typeDomain/typeSize).
/// 'typeDomain' is a real floating point or complex type.
/// 'typeSize' is a real floating point or complex type.
QualType ASTContext::getFloatingTypeOfSizeWithinDomain(QualType Size,
@@ -2490,11 +2488,11 @@
/// getFloatingTypeOrder - Compare the rank of the two specified floating
/// point types, ignoring the domain of the type (i.e. 'double' ==
/// '_Complex double'). If LHS > RHS, return 1. If LHS == RHS, return 0. If
-/// LHS < RHS, return -1.
+/// LHS < RHS, return -1.
int ASTContext::getFloatingTypeOrder(QualType LHS, QualType RHS) {
FloatingRank LHSR = getFloatingRank(LHS);
FloatingRank RHSR = getFloatingRank(RHS);
-
+
if (LHSR == RHSR)
return 0;
if (LHSR > RHSR)
@@ -2597,77 +2595,77 @@
return (PromotableSize != IntSize) ? IntTy : UnsignedIntTy;
}
-/// getIntegerTypeOrder - Returns the highest ranked integer type:
+/// getIntegerTypeOrder - Returns the highest ranked integer type:
/// C99 6.3.1.8p1. If LHS > RHS, return 1. If LHS == RHS, return 0. If
-/// LHS < RHS, return -1.
+/// LHS < RHS, return -1.
int ASTContext::getIntegerTypeOrder(QualType LHS, QualType RHS) {
Type *LHSC = getCanonicalType(LHS).getTypePtr();
Type *RHSC = getCanonicalType(RHS).getTypePtr();
if (LHSC == RHSC) return 0;
-
+
bool LHSUnsigned = LHSC->isUnsignedIntegerType();
bool RHSUnsigned = RHSC->isUnsignedIntegerType();
-
+
unsigned LHSRank = getIntegerRank(LHSC);
unsigned RHSRank = getIntegerRank(RHSC);
-
+
if (LHSUnsigned == RHSUnsigned) { // Both signed or both unsigned.
if (LHSRank == RHSRank) return 0;
return LHSRank > RHSRank ? 1 : -1;
}
-
+
// Otherwise, the LHS is signed and the RHS is unsigned or visa versa.
if (LHSUnsigned) {
// If the unsigned [LHS] type is larger, return it.
if (LHSRank >= RHSRank)
return 1;
-
+
// If the signed type can represent all values of the unsigned type, it
// wins. Because we are dealing with 2's complement and types that are
- // powers of two larger than each other, this is always safe.
+ // powers of two larger than each other, this is always safe.
return -1;
}
// If the unsigned [RHS] type is larger, return it.
if (RHSRank >= LHSRank)
return -1;
-
+
// If the signed type can represent all values of the unsigned type, it
// wins. Because we are dealing with 2's complement and types that are
- // powers of two larger than each other, this is always safe.
+ // powers of two larger than each other, this is always safe.
return 1;
}
-// getCFConstantStringType - Return the type used for constant CFStrings.
+// getCFConstantStringType - Return the type used for constant CFStrings.
QualType ASTContext::getCFConstantStringType() {
if (!CFConstantStringTypeDecl) {
- CFConstantStringTypeDecl =
- RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
+ CFConstantStringTypeDecl =
+ RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
&Idents.get("NSConstantString"));
QualType FieldTypes[4];
-
+
// const int *isa;
- FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));
+ FieldTypes[0] = getPointerType(IntTy.getQualifiedType(QualType::Const));
// int flags;
FieldTypes[1] = IntTy;
// const char *str;
- FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));
+ FieldTypes[2] = getPointerType(CharTy.getQualifiedType(QualType::Const));
// long length;
- FieldTypes[3] = LongTy;
-
+ FieldTypes[3] = LongTy;
+
// Create fields
for (unsigned i = 0; i < 4; ++i) {
- FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl,
+ FieldDecl *Field = FieldDecl::Create(*this, CFConstantStringTypeDecl,
SourceLocation(), 0,
FieldTypes[i], /*DInfo=*/0,
- /*BitWidth=*/0,
+ /*BitWidth=*/0,
/*Mutable=*/false);
CFConstantStringTypeDecl->addDecl(Field);
}
CFConstantStringTypeDecl->completeDefinition(*this);
}
-
+
return getTagDeclType(CFConstantStringTypeDecl);
}
@@ -2677,13 +2675,12 @@
CFConstantStringTypeDecl = Rec->getDecl();
}
-QualType ASTContext::getObjCFastEnumerationStateType()
-{
+QualType ASTContext::getObjCFastEnumerationStateType() {
if (!ObjCFastEnumerationStateTypeDecl) {
ObjCFastEnumerationStateTypeDecl =
RecordDecl::Create(*this, TagDecl::TK_struct, TUDecl, SourceLocation(),
&Idents.get("__objcFastEnumerationState"));
-
+
QualType FieldTypes[] = {
UnsignedLongTy,
getPointerType(ObjCIdTypedefType),
@@ -2691,20 +2688,20 @@
getConstantArrayType(UnsignedLongTy,
llvm::APInt(32, 5), ArrayType::Normal, 0)
};
-
+
for (size_t i = 0; i < 4; ++i) {
- FieldDecl *Field = FieldDecl::Create(*this,
- ObjCFastEnumerationStateTypeDecl,
- SourceLocation(), 0,
+ FieldDecl *Field = FieldDecl::Create(*this,
+ ObjCFastEnumerationStateTypeDecl,
+ SourceLocation(), 0,
FieldTypes[i], /*DInfo=*/0,
- /*BitWidth=*/0,
+ /*BitWidth=*/0,
/*Mutable=*/false);
ObjCFastEnumerationStateTypeDecl->addDecl(Field);
}
-
+
ObjCFastEnumerationStateTypeDecl->completeDefinition(*this);
}
-
+
return getTagDeclType(ObjCFastEnumerationStateTypeDecl);
}
@@ -2720,7 +2717,7 @@
if (const TypedefType *TT = dyn_cast<TypedefType>(T))
if (IdentifierInfo *II = TT->getDecl()->getIdentifier())
return II->isStr("BOOL");
-
+
return false;
}
@@ -2728,7 +2725,7 @@
/// purpose.
int ASTContext::getObjCEncodingTypeSize(QualType type) {
uint64_t sz = getTypeSize(type);
-
+
// Make all integer and enum types at least as large as an int
if (sz > 0 && type->isIntegralType())
sz = std::max(sz, getTypeSize(IntTy));
@@ -2740,7 +2737,7 @@
/// getObjCEncodingForMethodDecl - Return the encoded type for this method
/// declaration.
-void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
+void ASTContext::getObjCEncodingForMethodDecl(const ObjCMethodDecl *Decl,
std::string& S) {
// FIXME: This is not very efficient.
// Encode type qualifer, 'in', 'inout', etc. for the return type.
@@ -2765,13 +2762,13 @@
S += llvm::utostr(ParmOffset);
S += "@0:";
S += llvm::utostr(PtrSize);
-
+
// Argument types.
ParmOffset = 2 * PtrSize;
for (ObjCMethodDecl::param_iterator PI = Decl->param_begin(),
E = Decl->param_end(); PI != E; ++PI) {
ParmVarDecl *PVDecl = *PI;
- QualType PType = PVDecl->getOriginalType();
+ QualType PType = PVDecl->getOriginalType();
if (const ArrayType *AT =
dyn_cast<ArrayType>(PType->getCanonicalTypeInternal())) {
// Use array's original type only if it has known number of
@@ -2793,11 +2790,11 @@
/// property declaration. If non-NULL, Container must be either an
/// ObjCCategoryImplDecl or ObjCImplementationDecl; it should only be
/// NULL when getting encodings for protocol properties.
-/// Property attributes are stored as a comma-delimited C string. The simple
-/// attributes readonly and bycopy are encoded as single characters. The
-/// parametrized attributes, getter=name, setter=name, and ivar=name, are
-/// encoded as single characters, followed by an identifier. Property types
-/// are also encoded as a parametrized attribute. The characters used to encode
+/// Property attributes are stored as a comma-delimited C string. The simple
+/// attributes readonly and bycopy are encoded as single characters. The
+/// parametrized attributes, getter=name, setter=name, and ivar=name, are
+/// encoded as single characters, followed by an identifier. Property types
+/// are also encoded as a parametrized attribute. The characters used to encode
/// these attributes are defined by the following enumeration:
/// @code
/// enum PropertyAttributes {
@@ -2814,7 +2811,7 @@
/// kPropertyNonAtomic = 'N' // property non-atomic
/// };
/// @endcode
-void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
+void ASTContext::getObjCEncodingForPropertyDecl(const ObjCPropertyDecl *PD,
const Decl *Container,
std::string& S) {
// Collect information from the property implementation decl(s).
@@ -2823,7 +2820,7 @@
// FIXME: Duplicated code due to poor abstraction.
if (Container) {
- if (const ObjCCategoryImplDecl *CID =
+ if (const ObjCCategoryImplDecl *CID =
dyn_cast<ObjCCategoryImplDecl>(Container)) {
for (ObjCCategoryImplDecl::propimpl_iterator
i = CID->propimpl_begin(), e = CID->propimpl_end();
@@ -2850,7 +2847,7 @@
SynthesizePID = PID;
}
}
- }
+ }
}
}
@@ -2860,7 +2857,7 @@
// Encode result type.
// GCC has some special rules regarding encoding of properties which
// closely resembles encoding of ivars.
- getObjCEncodingForTypeImpl(PD->getType(), S, true, true, 0,
+ getObjCEncodingForTypeImpl(PD->getType(), S, true, true, 0,
true /* outermost type */,
true /* encoding for property */);
@@ -2870,7 +2867,7 @@
switch (PD->getSetterKind()) {
case ObjCPropertyDecl::Assign: break;
case ObjCPropertyDecl::Copy: S += ",C"; break;
- case ObjCPropertyDecl::Retain: S += ",&"; break;
+ case ObjCPropertyDecl::Retain: S += ",&"; break;
}
}
@@ -2881,7 +2878,7 @@
if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_nonatomic)
S += ",N";
-
+
if (PD->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) {
S += ",G";
S += PD->getGetterName().getAsString();
@@ -2902,8 +2899,8 @@
}
/// getLegacyIntegralTypeEncoding -
-/// Another legacy compatibility encoding: 32-bit longs are encoded as
-/// 'l' or 'L' , but not always. For typedefs, we need to use
+/// Another legacy compatibility encoding: 32-bit longs are encoded as
+/// 'l' or 'L' , but not always. For typedefs, we need to use
/// 'i' or 'I' instead if encoding a struct field, or a pointer!
///
void ASTContext::getLegacyIntegralTypeEncoding (QualType &PointeeTy) const {
@@ -2912,7 +2909,7 @@
if (BT->getKind() == BuiltinType::ULong &&
((const_cast<ASTContext *>(this))->getIntWidth(PointeeTy) == 32))
PointeeTy = UnsignedIntTy;
- else
+ else
if (BT->getKind() == BuiltinType::Long &&
((const_cast<ASTContext *>(this))->getIntWidth(PointeeTy) == 32))
PointeeTy = IntTy;
@@ -2926,11 +2923,11 @@
// directly pointed to, and expanding embedded structures. Note that
// these rules are sufficient to prevent recursive encoding of the
// same type.
- getObjCEncodingForTypeImpl(T, S, true, true, Field,
+ getObjCEncodingForTypeImpl(T, S, true, true, Field,
true /* outermost type */);
}
-static void EncodeBitField(const ASTContext *Context, std::string& S,
+static void EncodeBitField(const ASTContext *Context, std::string& S,
const FieldDecl *FD) {
const Expr *E = FD->getBitWidth();
assert(E && "bitfield width not there - getObjCEncodingForTypeImpl");
@@ -2951,16 +2948,16 @@
return EncodeBitField(this, S, FD);
char encoding;
switch (BT->getKind()) {
- default: assert(0 && "Unhandled builtin type kind");
+ default: assert(0 && "Unhandled builtin type kind");
case BuiltinType::Void: encoding = 'v'; break;
case BuiltinType::Bool: encoding = 'B'; break;
case BuiltinType::Char_U:
case BuiltinType::UChar: encoding = 'C'; break;
case BuiltinType::UShort: encoding = 'S'; break;
case BuiltinType::UInt: encoding = 'I'; break;
- case BuiltinType::ULong:
- encoding =
- (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'L' : 'Q';
+ case BuiltinType::ULong:
+ encoding =
+ (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'L' : 'Q';
break;
case BuiltinType::UInt128: encoding = 'T'; break;
case BuiltinType::ULongLong: encoding = 'Q'; break;
@@ -2968,9 +2965,9 @@
case BuiltinType::SChar: encoding = 'c'; break;
case BuiltinType::Short: encoding = 's'; break;
case BuiltinType::Int: encoding = 'i'; break;
- case BuiltinType::Long:
- encoding =
- (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'l' : 'q';
+ case BuiltinType::Long:
+ encoding =
+ (const_cast<ASTContext *>(this))->getIntWidth(T) == 32 ? 'l' : 'q';
break;
case BuiltinType::LongLong: encoding = 'q'; break;
case BuiltinType::Int128: encoding = 't'; break;
@@ -2978,25 +2975,25 @@
case BuiltinType::Double: encoding = 'd'; break;
case BuiltinType::LongDouble: encoding = 'd'; break;
}
-
+
S += encoding;
return;
}
-
+
if (const ComplexType *CT = T->getAsComplexType()) {
S += 'j';
- getObjCEncodingForTypeImpl(CT->getElementType(), S, false, false, 0, false,
+ getObjCEncodingForTypeImpl(CT->getElementType(), S, false, false, 0, false,
false);
return;
}
-
+
if (const PointerType *PT = T->getAs<PointerType>()) {
QualType PointeeTy = PT->getPointeeType();
bool isReadOnly = false;
// For historical/compatibility reasons, the read-only qualifier of the
// pointee gets emitted _before_ the '^'. The read-only qualifier of
// the pointer itself gets ignored, _unless_ we are looking at a typedef!
- // Also, do not emit the 'r' for anything but the outermost type!
+ // Also, do not emit the 'r' for anything but the outermost type!
if (isa<TypedefType>(T.getTypePtr())) {
if (OutermostType && T.isConstQualified()) {
isReadOnly = true;
@@ -3026,7 +3023,7 @@
S += ':';
return;
}
-
+
if (PointeeTy->isCharType()) {
// char pointer types should be encoded as '*' unless it is a
// type that has been typedef'd to 'BOOL'.
@@ -3050,11 +3047,11 @@
S += '^';
getLegacyIntegralTypeEncoding(PointeeTy);
- getObjCEncodingForTypeImpl(PointeeTy, S, false, ExpandPointedToStructures,
+ getObjCEncodingForTypeImpl(PointeeTy, S, false, ExpandPointedToStructures,
NULL);
return;
}
-
+
if (const ArrayType *AT =
// Ignore type qualifiers etc.
dyn_cast<ArrayType>(T->getCanonicalTypeInternal())) {
@@ -3062,11 +3059,11 @@
// Incomplete arrays are encoded as a pointer to the array element.
S += '^';
- getObjCEncodingForTypeImpl(AT->getElementType(), S,
+ getObjCEncodingForTypeImpl(AT->getElementType(), S,
false, ExpandStructures, FD);
} else {
S += '[';
-
+
if (const ConstantArrayType *CAT = dyn_cast<ConstantArrayType>(AT))
S += llvm::utostr(CAT->getSize().getZExtValue());
else {
@@ -3074,19 +3071,19 @@
assert(isa<VariableArrayType>(AT) && "Unknown array type!");
S += '0';
}
-
- getObjCEncodingForTypeImpl(AT->getElementType(), S,
+
+ getObjCEncodingForTypeImpl(AT->getElementType(), S,
false, ExpandStructures, FD);
S += ']';
}
return;
}
-
+
if (T->getAsFunctionType()) {
S += '?';
return;
}
-
+
if (const RecordType *RTy = T->getAs<RecordType>()) {
RecordDecl *RDecl = RTy->getDecl();
S += RDecl->isUnion() ? '(' : '{';
@@ -3106,15 +3103,15 @@
S += Field->getNameAsString();
S += '"';
}
-
+
// Special case bit-fields.
if (Field->isBitField()) {
- getObjCEncodingForTypeImpl(Field->getType(), S, false, true,
+ getObjCEncodingForTypeImpl(Field->getType(), S, false, true,
(*Field));
} else {
QualType qt = Field->getType();
getLegacyIntegralTypeEncoding(qt);
- getObjCEncodingForTypeImpl(qt, S, false, true,
+ getObjCEncodingForTypeImpl(qt, S, false, true,
FD);
}
}
@@ -3122,7 +3119,7 @@
S += RDecl->isUnion() ? ')' : '}';
return;
}
-
+
if (T->isEnumeralType()) {
if (FD && FD->isBitField())
EncodeBitField(this, S, FD);
@@ -3130,12 +3127,12 @@
S += 'i';
return;
}
-
+
if (T->isBlockPointerType()) {
S += "@?"; // Unlike a pointer-to-function, which is "^?".
return;
}
-
+
if (T->isObjCInterfaceType()) {
// @encode(class_name)
ObjCInterfaceDecl *OI = T->getAsObjCInterfaceType()->getDecl();
@@ -3147,29 +3144,29 @@
CollectObjCIvars(OI, RecFields);
for (unsigned i = 0, e = RecFields.size(); i != e; ++i) {
if (RecFields[i]->isBitField())
- getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
+ getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
RecFields[i]);
else
- getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
+ getObjCEncodingForTypeImpl(RecFields[i]->getType(), S, false, true,
FD);
}
S += '}';
return;
}
-
+
if (const ObjCObjectPointerType *OPT = T->getAsObjCObjectPointerType()) {
if (OPT->isObjCIdType()) {
S += '@';
return;
}
-
+
if (OPT->isObjCClassType()) {
S += '#';
return;
}
-
+
if (OPT->isObjCQualifiedIdType()) {
- getObjCEncodingForTypeImpl(getObjCIdType(), S,
+ getObjCEncodingForTypeImpl(getObjCIdType(), S,
ExpandPointedToStructures,
ExpandStructures, FD);
if (FD || EncodingProperty) {
@@ -3186,16 +3183,16 @@
}
return;
}
-
+
QualType PointeeTy = OPT->getPointeeType();
if (!EncodingProperty &&
isa<TypedefType>(PointeeTy.getTypePtr())) {
// Another historical/compatibility reason.
- // We encode the underlying type which comes out as
+ // We encode the underlying type which comes out as
// {...};
S += '^';
- getObjCEncodingForTypeImpl(PointeeTy, S,
- false, ExpandPointedToStructures,
+ getObjCEncodingForTypeImpl(PointeeTy, S,
+ false, ExpandPointedToStructures,
NULL);
return;
}
@@ -3209,16 +3206,16 @@
S += '<';
S += (*I)->getNameAsString();
S += '>';
- }
+ }
S += '"';
}
return;
}
-
+
assert(0 && "@encode for type not implemented!");
}
-void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
+void ASTContext::getObjCEncodingForTypeQualifier(Decl::ObjCDeclQualifier QT,
std::string& S) const {
if (QT & Decl::OBJC_TQ_In)
S += 'n';
@@ -3236,7 +3233,7 @@
void ASTContext::setBuiltinVaListType(QualType T) {
assert(BuiltinVaListType.isNull() && "__builtin_va_list type already set!");
-
+
BuiltinVaListType = T;
}
@@ -3271,15 +3268,15 @@
}
void ASTContext::setObjCConstantStringInterface(ObjCInterfaceDecl *Decl) {
- assert(ObjCConstantStringType.isNull() &&
+ assert(ObjCConstantStringType.isNull() &&
"'NSConstantString' type already set!");
-
+
ObjCConstantStringType = getObjCInterfaceType(Decl);
}
/// \brief Retrieve the template name that represents a qualified
/// template name such as \c std::vector.
-TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
+TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
bool TemplateKeyword,
TemplateDecl *Template) {
llvm::FoldingSetNodeID ID;
@@ -3298,12 +3295,12 @@
/// \brief Retrieve the template name that represents a qualified
/// template name such as \c std::vector.
-TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
+TemplateName ASTContext::getQualifiedTemplateName(NestedNameSpecifier *NNS,
bool TemplateKeyword,
OverloadedFunctionDecl *Template) {
llvm::FoldingSetNodeID ID;
QualifiedTemplateName::Profile(ID, NNS, TemplateKeyword, Template);
-
+
void *InsertPos = 0;
QualifiedTemplateName *QTN =
QualifiedTemplateNames.FindNodeOrInsertPos(ID, InsertPos);
@@ -3311,15 +3308,15 @@
QTN = new (*this,4) QualifiedTemplateName(NNS, TemplateKeyword, Template);
QualifiedTemplateNames.InsertNode(QTN, InsertPos);
}
-
+
return TemplateName(QTN);
}
/// \brief Retrieve the template name that represents a dependent
/// template name such as \c MetaFun::template apply.
-TemplateName ASTContext::getDependentTemplateName(NestedNameSpecifier *NNS,
+TemplateName ASTContext::getDependentTemplateName(NestedNameSpecifier *NNS,
const IdentifierInfo *Name) {
- assert((!NNS || NNS->isDependent()) &&
+ assert((!NNS || NNS->isDependent()) &&
"Nested name specifier must be dependent");
llvm::FoldingSetNodeID ID;
@@ -3349,7 +3346,7 @@
/// is actually a value of type @c TargetInfo::IntType.
QualType ASTContext::getFromTargetType(unsigned Type) const {
switch (Type) {
- case TargetInfo::NoInt: return QualType();
+ case TargetInfo::NoInt: return QualType();
case TargetInfo::SignedShort: return ShortTy;
case TargetInfo::UnsignedShort: return UnsignedShortTy;
case TargetInfo::SignedInt: return IntTy;
@@ -3379,7 +3376,7 @@
if (TD->getAttr<ObjCNSObjectAttr>())
return true;
}
- return false;
+ return false;
}
/// getObjCGCAttr - Returns one of GCNone, Weak or Strong objc's
@@ -3391,7 +3388,7 @@
getLangOptions().getGCMode() != LangOptions::NonGC) {
GCAttrs = Ty.getObjCGCAttr();
// Default behavious under objective-c's gc is for objective-c pointers
- // (or pointers to them) be treated as though they were declared
+ // (or pointers to them) be treated as though they were declared
// as __strong.
if (GCAttrs == QualType::GCNone) {
if (Ty->isObjCObjectPointerType())
@@ -3411,7 +3408,7 @@
// Type Compatibility Testing
//===----------------------------------------------------------------------===//
-/// areCompatVectorTypes - Return true if the two specified vector types are
+/// areCompatVectorTypes - Return true if the two specified vector types are
/// compatible.
static bool areCompatVectorTypes(const VectorType *LHS,
const VectorType *RHS) {
@@ -3451,20 +3448,20 @@
bool ASTContext::ObjCQualifiedIdTypesAreCompatible(QualType lhs, QualType rhs,
bool compare) {
// Allow id<P..> and an 'id' or void* type in all cases.
- if (lhs->isVoidPointerType() ||
+ if (lhs->isVoidPointerType() ||
lhs->isObjCIdType() || lhs->isObjCClassType())
return true;
- else if (rhs->isVoidPointerType() ||
+ else if (rhs->isVoidPointerType() ||
rhs->isObjCIdType() || rhs->isObjCClassType())
return true;
if (const ObjCObjectPointerType *lhsQID = lhs->getAsObjCQualifiedIdType()) {
const ObjCObjectPointerType *rhsOPT = rhs->getAsObjCObjectPointerType();
-
+
if (!rhsOPT) return false;
-
+
if (rhsOPT->qual_empty()) {
- // If the RHS is a unqualified interface pointer "NSString*",
+ // If the RHS is a unqualified interface pointer "NSString*",
// make sure we check the class hierarchy.
if (ObjCInterfaceDecl *rhsID = rhsOPT->getInterfaceDecl()) {
for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
@@ -3479,7 +3476,7 @@
// If there are no qualifiers and no interface, we have an 'id'.
return true;
}
- // Both the right and left sides have qualifiers.
+ // Both the right and left sides have qualifiers.
for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
E = lhsQID->qual_end(); I != E; ++I) {
ObjCProtocolDecl *lhsProto = *I;
@@ -3497,7 +3494,7 @@
break;
}
}
- // If the RHS is a qualified interface pointer "NSString<P>*",
+ // If the RHS is a qualified interface pointer "NSString<P>*",
// make sure we check the class hierarchy.
if (ObjCInterfaceDecl *rhsID = rhsOPT->getInterfaceDecl()) {
for (ObjCObjectPointerType::qual_iterator I = lhsQID->qual_begin(),
@@ -3514,14 +3511,14 @@
if (!match)
return false;
}
-
+
return true;
}
-
+
const ObjCObjectPointerType *rhsQID = rhs->getAsObjCQualifiedIdType();
assert(rhsQID && "One of the LHS/RHS should be id<x>");
- if (const ObjCObjectPointerType *lhsOPT =
+ if (const ObjCObjectPointerType *lhsOPT =
lhs->getAsObjCInterfacePointerType()) {
if (lhsOPT->qual_empty()) {
bool match = false;
@@ -3541,7 +3538,7 @@
}
return true;
}
- // Both the right and left sides have qualifiers.
+ // Both the right and left sides have qualifiers.
for (ObjCObjectPointerType::qual_iterator I = lhsOPT->qual_begin(),
E = lhsOPT->qual_end(); I != E; ++I) {
ObjCProtocolDecl *lhsProto = *I;
@@ -3578,15 +3575,15 @@
return true;
if (LHSOPT->isObjCQualifiedIdType() || RHSOPT->isObjCQualifiedIdType())
- return ObjCQualifiedIdTypesAreCompatible(QualType(LHSOPT,0),
- QualType(RHSOPT,0),
+ return ObjCQualifiedIdTypesAreCompatible(QualType(LHSOPT,0),
+ QualType(RHSOPT,0),
false);
const ObjCInterfaceType* LHS = LHSOPT->getInterfaceType();
const ObjCInterfaceType* RHS = RHSOPT->getInterfaceType();
if (LHS && RHS) // We have 2 user-defined types.
return canAssignObjCInterfaces(LHS, RHS);
-
+
return false;
}
@@ -3596,17 +3593,17 @@
// the LHS.
if (!LHS->getDecl()->isSuperClassOf(RHS->getDecl()))
return false;
-
+
// RHS must have a superset of the protocols in the LHS. If the LHS is not
// protocol qualified at all, then we are good.
if (LHS->getNumProtocols() == 0)
return true;
-
+
// Okay, we know the LHS has protocol qualifiers. If the RHS doesn't, then it
// isn't a superset.
if (RHS->getNumProtocols() == 0)
return true; // FIXME: should return false!
-
+
for (ObjCInterfaceType::qual_iterator LHSPI = LHS->qual_begin(),
LHSPE = LHS->qual_end();
LHSPI != LHSPE; LHSPI++) {
@@ -3634,7 +3631,7 @@
// get the "pointed to" types
const ObjCObjectPointerType *LHSOPT = LHS->getAsObjCObjectPointerType();
const ObjCObjectPointerType *RHSOPT = RHS->getAsObjCObjectPointerType();
-
+
if (!LHSOPT || !RHSOPT)
return false;
@@ -3642,9 +3639,9 @@
canAssignObjCInterfaces(RHSOPT, LHSOPT);
}
-/// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible,
+/// typesAreCompatible - C99 6.7.3p9: For two qualified types to be compatible,
/// both shall have the identically qualified version of a compatible type.
-/// C99 6.2.7p1: Two types have compatible types if their types are the
+/// C99 6.2.7p1: Two types have compatible types if their types are the
/// same. See 6.7.[2,3,5] for additional rules.
bool ASTContext::typesAreCompatible(QualType LHS, QualType RHS) {
return !mergeTypes(LHS, RHS).isNull();
@@ -3671,7 +3668,7 @@
allLTypes = false;
if (NoReturn != rbase->getNoReturnAttr())
allRTypes = false;
-
+
if (lproto && rproto) { // two C99 style function prototypes
assert(!lproto->hasExceptionSpec() && !rproto->hasExceptionSpec() &&
"C++ shouldn't be here");
@@ -3783,15 +3780,15 @@
QualType::GCAttrTypes GCAttr = RHSCan.getObjCGCAttr();
if (GCAttr != QualType::GCNone) {
QualType::GCAttrTypes GCLHSAttr = LHSCan.getObjCGCAttr();
- // __weak attribute must appear on both declarations.
- // __strong attribue is redundant if other decl is an objective-c
+ // __weak attribute must appear on both declarations.
+ // __strong attribue is redundant if other decl is an objective-c
// object pointer (or decorated with __strong attribute); otherwise
// issue error.
if ((GCAttr == QualType::Weak && GCLHSAttr != GCAttr) ||
(GCAttr == QualType::Strong && GCLHSAttr != GCAttr &&
!LHSCan->isObjCObjectPointerType()))
return QualType();
-
+
RHS = QualType(cast<ExtQualType>(RHS.getDesugaredType())->getBaseType(),
RHS.getCVRQualifiers());
QualType Result = mergeTypes(LHS, RHS);
@@ -3809,14 +3806,14 @@
if (GCAttr != QualType::GCNone) {
QualType::GCAttrTypes GCRHSAttr = RHSCan.getObjCGCAttr();
// __weak attribute must appear on both declarations. __strong
- // __strong attribue is redundant if other decl is an objective-c
+ // __strong attribue is redundant if other decl is an objective-c
// object pointer (or decorated with __strong attribute); otherwise
// issue error.
if ((GCAttr == QualType::Weak && GCRHSAttr != GCAttr) ||
(GCAttr == QualType::Strong && GCRHSAttr != GCAttr &&
!RHSCan->isObjCObjectPointerType()))
return QualType();
-
+
LHS = QualType(cast<ExtQualType>(LHS.getDesugaredType())->getBaseType(),
LHS.getCVRQualifiers());
QualType Result = mergeTypes(LHS, RHS);
@@ -3835,15 +3832,15 @@
LHSClass = Type::ConstantArray;
if (RHSClass == Type::VariableArray || RHSClass == Type::IncompleteArray)
RHSClass = Type::ConstantArray;
-
+
// Canonicalize ExtVector -> Vector.
if (LHSClass == Type::ExtVector) LHSClass = Type::Vector;
if (RHSClass == Type::ExtVector) RHSClass = Type::Vector;
-
+
// If the canonical type classes don't match.
if (LHSClass != RHSClass) {
// C99 6.7.2.2p4: Each enumerated type shall be compatible with char,
- // a signed integer type, or an unsigned integer type.
+ // a signed integer type, or an unsigned integer type.
if (const EnumType* ETy = LHS->getAsEnumType()) {
if (ETy->getDecl()->getIntegerType() == RHSCan.getUnqualifiedType())
return RHS;
@@ -3976,7 +3973,7 @@
return QualType();
}
case Type::ObjCObjectPointer: {
- if (canAssignObjCInterfaces(LHS->getAsObjCObjectPointerType(),
+ if (canAssignObjCInterfaces(LHS->getAsObjCObjectPointerType(),
RHS->getAsObjCObjectPointerType()))
return LHS;
@@ -4072,18 +4069,18 @@
/// DecodeTypeFromStr - This decodes one type descriptor from Str, advancing the
/// pointer over the consumed characters. This returns the resultant type.
-static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
+static QualType DecodeTypeFromStr(const char *&Str, ASTContext &Context,
ASTContext::GetBuiltinTypeError &Error,
bool AllowTypeModifiers = true) {
// Modifiers.
int HowLong = 0;
bool Signed = false, Unsigned = false;
-
+
// Read the modifiers first.
bool Done = false;
while (!Done) {
switch (*Str++) {
- default: Done = true; --Str; break;
+ default: Done = true; --Str; break;
case 'S':
assert(!Unsigned && "Can't use both 'S' and 'U' modifiers!");
assert(!Signed && "Can't use 'S' modifier multiple times!");
@@ -4102,7 +4099,7 @@
}
QualType Type;
-
+
// Read the base type.
switch (*Str++) {
default: assert(0 && "Unknown builtin type letter!");
@@ -4186,9 +4183,9 @@
char *End;
unsigned NumElements = strtoul(Str, &End, 10);
assert(End != Str && "Missing vector size");
-
+
Str = End;
-
+
QualType ElementType = DecodeTypeFromStr(Str, Context, Error, false);
Type = Context.getVectorType(ElementType, NumElements);
break;
@@ -4212,10 +4209,10 @@
}
break;
}
-
+
if (!AllowTypeModifiers)
return Type;
-
+
Done = false;
while (!Done) {
switch (*Str++) {
@@ -4232,7 +4229,7 @@
break;
}
}
-
+
return Type;
}
@@ -4240,9 +4237,9 @@
QualType ASTContext::GetBuiltinType(unsigned id,
GetBuiltinTypeError &Error) {
const char *TypeStr = BuiltinInfo.GetTypeString(id);
-
+
llvm::SmallVector<QualType, 8> ArgTypes;
-
+
Error = GE_None;
QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error);
if (Error != GE_None)
@@ -4255,7 +4252,7 @@
// Do array -> pointer decay. The builtin should use the decayed type.
if (Ty->isArrayType())
Ty = getArrayDecayedType(Ty);
-
+
ArgTypes.push_back(Ty);
}
@@ -4288,42 +4285,42 @@
// If both types are identical, no conversion is needed.
if (lhs == rhs)
return lhs;
-
+
// If either side is a non-arithmetic type (e.g. a pointer), we are done.
// The caller can deal with this (e.g. pointer + int).
if (!lhs->isArithmeticType() || !rhs->isArithmeticType())
return lhs;
-
- // At this point, we have two different arithmetic types.
-
+
+ // At this point, we have two different arithmetic types.
+
// Handle complex types first (C99 6.3.1.8p1).
if (lhs->isComplexType() || rhs->isComplexType()) {
// if we have an integer operand, the result is the complex type.
- if (rhs->isIntegerType() || rhs->isComplexIntegerType()) {
+ if (rhs->isIntegerType() || rhs->isComplexIntegerType()) {
// convert the rhs to the lhs complex type.
return lhs;
}
- if (lhs->isIntegerType() || lhs->isComplexIntegerType()) {
+ if (lhs->isIntegerType() || lhs->isComplexIntegerType()) {
// convert the lhs to the rhs complex type.
return rhs;
}
// This handles complex/complex, complex/float, or float/complex.
- // When both operands are complex, the shorter operand is converted to the
- // type of the longer, and that is the type of the result. This corresponds
- // to what is done when combining two real floating-point operands.
- // The fun begins when size promotion occur across type domains.
+ // When both operands are complex, the shorter operand is converted to the
+ // type of the longer, and that is the type of the result. This corresponds
+ // to what is done when combining two real floating-point operands.
+ // The fun begins when size promotion occur across type domains.
// From H&S 6.3.4: When one operand is complex and the other is a real
- // floating-point type, the less precise type is converted, within it's
+ // floating-point type, the less precise type is converted, within it's
// real or complex domain, to the precision of the other type. For example,
- // when combining a "long double" with a "double _Complex", the
+ // when combining a "long double" with a "double _Complex", the
// "double _Complex" is promoted to "long double _Complex".
int result = getFloatingTypeOrder(lhs, rhs);
-
- if (result > 0) { // The left side is bigger, convert rhs.
+
+ if (result > 0) { // The left side is bigger, convert rhs.
rhs = getFloatingTypeOfSizeWithinDomain(lhs, rhs);
- } else if (result < 0) { // The right side is bigger, convert lhs.
+ } else if (result < 0) { // The right side is bigger, convert lhs.
lhs = getFloatingTypeOfSizeWithinDomain(rhs, lhs);
- }
+ }
// At this point, lhs and rhs have the same rank/size. Now, make sure the
// domains match. This is a requirement for our implementation, C99
// does not require this promotion.
@@ -4351,7 +4348,7 @@
// convert lhs to the rhs floating point type.
return rhs;
}
- if (lhs->isComplexIntegerType()) {
+ if (lhs->isComplexIntegerType()) {
// convert lhs to the complex floating point type.
return getComplexType(rhs);
}
@@ -4369,7 +4366,7 @@
const ComplexType *rhsComplexInt = rhs->getAsComplexIntegerType();
if (lhsComplexInt && rhsComplexInt) {
- if (getIntegerTypeOrder(lhsComplexInt->getElementType(),
+ if (getIntegerTypeOrder(lhsComplexInt->getElementType(),
rhsComplexInt->getElementType()) >= 0)
return lhs; // convert the rhs
return rhs;
diff --git a/lib/AST/Decl.cpp b/lib/AST/Decl.cpp
index 4e07b95..776a265 100644
--- a/lib/AST/Decl.cpp
+++ b/lib/AST/Decl.cpp
@@ -45,7 +45,7 @@
//===----------------------------------------------------------------------===//
// Decl Allocation/Deallocation Method Implementations
//===----------------------------------------------------------------------===//
-
+
TranslationUnitDecl *TranslationUnitDecl::Create(ASTContext &C) {
return new (C) TranslationUnitDecl(C);
@@ -59,7 +59,7 @@
void NamespaceDecl::Destroy(ASTContext& C) {
// NamespaceDecl uses "NextDeclarator" to chain namespace declarations
// together. They are all top-level Decls.
-
+
this->~NamespaceDecl();
C.Deallocate((void *)this);
}
@@ -75,9 +75,9 @@
case VarDecl::None: break;
case VarDecl::Auto: return "auto"; break;
case VarDecl::Extern: return "extern"; break;
- case VarDecl::PrivateExtern: return "__private_extern__"; break;
+ case VarDecl::PrivateExtern: return "__private_extern__"; break;
case VarDecl::Register: return "register"; break;
- case VarDecl::Static: return "static"; break;
+ case VarDecl::Static: return "static"; break;
}
assert(0 && "Invalid storage class");
@@ -92,13 +92,13 @@
}
QualType ParmVarDecl::getOriginalType() const {
- if (const OriginalParmVarDecl *PVD =
+ if (const OriginalParmVarDecl *PVD =
dyn_cast<OriginalParmVarDecl>(this))
return PVD->OriginalType;
return getType();
}
-void VarDecl::setInit(ASTContext &C, Expr *I) {
+void VarDecl::setInit(ASTContext &C, Expr *I) {
if (EvaluatedStmt *Eval = Init.dyn_cast<EvaluatedStmt *>()) {
Eval->~EvaluatedStmt();
C.Deallocate(Eval);
@@ -109,11 +109,11 @@
bool VarDecl::isExternC(ASTContext &Context) const {
if (!Context.getLangOptions().CPlusPlus)
- return (getDeclContext()->isTranslationUnit() &&
+ return (getDeclContext()->isTranslationUnit() &&
getStorageClass() != Static) ||
(getDeclContext()->isFunctionOrMethod() && hasExternalStorage());
- for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
+ for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
DC = DC->getParent()) {
if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC)) {
if (Linkage->getLanguage() == LinkageSpecDecl::lang_c)
@@ -138,12 +138,12 @@
}
FunctionDecl *FunctionDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
+ SourceLocation L,
DeclarationName N, QualType T,
DeclaratorInfo *DInfo,
- StorageClass S, bool isInline,
+ StorageClass S, bool isInline,
bool hasWrittenPrototype) {
- FunctionDecl *New
+ FunctionDecl *New
= new (C) FunctionDecl(Function, DC, L, N, T, DInfo, S, isInline);
New->HasWrittenPrototype = hasWrittenPrototype;
return New;
@@ -162,7 +162,7 @@
bool FieldDecl::isAnonymousStructOrUnion() const {
if (!isImplicit() || getDeclName())
return false;
-
+
if (const RecordType *Record = getType()->getAs<RecordType>())
return Record->getDecl()->isAnonymousStructOrUnion();
@@ -233,7 +233,7 @@
// scope class/struct/union. How do we handle this case?
break;
- if (const ClassTemplateSpecializationDecl *Spec
+ if (const ClassTemplateSpecializationDecl *Spec
= dyn_cast<ClassTemplateSpecializationDecl>(Ctx)) {
const TemplateArgumentList &TemplateArgs = Spec->getTemplateArgs();
std::string TemplateArgsStr
@@ -271,7 +271,7 @@
return cast<UsingDirectiveDecl>(this)->getNominatedNamespace() ==
cast<UsingDirectiveDecl>(OldD)->getNominatedNamespace();
}
-
+
if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(this))
// For function declarations, we keep track of redeclarations.
return FD->getPreviousDeclaration() == OldD;
@@ -283,11 +283,11 @@
= dyn_cast<FunctionTemplateDecl>(OldD))
return FunctionTemplate->getTemplatedDecl()
->declarationReplaces(OldFunctionTemplate->getTemplatedDecl());
-
+
// For method declarations, we keep track of redeclarations.
if (isa<ObjCMethodDecl>(this))
return false;
-
+
// For non-function declarations, if the declarations are of the
// same kind then this must be a redeclaration, or semantic analysis
// would not have given us the new declaration.
@@ -444,11 +444,11 @@
if (!Context.getLangOptions().CPlusPlus)
return getStorageClass() != Static && !getAttr<OverloadableAttr>();
- for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
+ for (const DeclContext *DC = getDeclContext(); !DC->isTranslationUnit();
DC = DC->getParent()) {
if (const LinkageSpecDecl *Linkage = dyn_cast<LinkageSpecDecl>(DC)) {
if (Linkage->getLanguage() == LinkageSpecDecl::lang_c)
- return getStorageClass() != Static &&
+ return getStorageClass() != Static &&
!getAttr<OverloadableAttr>();
break;
@@ -465,7 +465,7 @@
if (getStorageClass() == Static)
return false;
- for (const DeclContext *DC = getDeclContext();
+ for (const DeclContext *DC = getDeclContext();
DC->isNamespace();
DC = DC->getParent()) {
if (const NamespaceDecl *Namespace = cast<NamespaceDecl>(DC)) {
@@ -485,7 +485,7 @@
/// declared at translation scope or within an extern "C" block and
/// its name matches with the name of a builtin. The returned value
/// will be 0 for functions that do not correspond to a builtin, a
-/// value of type \c Builtin::ID if in the target-independent range
+/// value of type \c Builtin::ID if in the target-independent range
/// \c [1,Builtin::First), or a target-specific builtin value.
unsigned FunctionDecl::getBuiltinID(ASTContext &Context) const {
if (!getIdentifier() || !getIdentifier()->getBuiltinID())
@@ -512,7 +512,7 @@
// If the function is in an extern "C" linkage specification and is
// not marked "overloadable", it's the real function.
if (isa<LinkageSpecDecl>(getDeclContext()) &&
- cast<LinkageSpecDecl>(getDeclContext())->getLanguage()
+ cast<LinkageSpecDecl>(getDeclContext())->getLanguage()
== LinkageSpecDecl::lang_c &&
!getAttr<OverloadableAttr>())
return BuiltinID;
@@ -530,14 +530,14 @@
if (isa<FunctionNoProtoType>(FT))
return 0;
return cast<FunctionProtoType>(FT)->getNumArgs();
-
+
}
void FunctionDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
unsigned NumParams) {
assert(ParamInfo == 0 && "Already has param info!");
assert(NumParams == getNumParams() && "Parameter count mismatch!");
-
+
// Zero params -> null pointer.
if (NumParams) {
void *Mem = C.Allocate(sizeof(ParmVarDecl*)*NumParams);
@@ -586,12 +586,12 @@
return false;
}
-void
+void
FunctionDecl::setPreviousDeclaration(FunctionDecl *PrevDecl) {
redeclarable_base::setPreviousDeclaration(PrevDecl);
if (FunctionTemplateDecl *FunTmpl = getDescribedFunctionTemplate()) {
- FunctionTemplateDecl *PrevFunTmpl
+ FunctionTemplateDecl *PrevFunTmpl
= PrevDecl? PrevDecl->getDescribedFunctionTemplate() : 0;
assert((!PrevDecl || PrevFunTmpl) && "Function/function template mismatch");
FunTmpl->setPreviousDeclaration(PrevFunTmpl);
@@ -612,7 +612,7 @@
}
FunctionTemplateDecl *FunctionDecl::getPrimaryTemplate() const {
- if (FunctionTemplateSpecializationInfo *Info
+ if (FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization
.dyn_cast<FunctionTemplateSpecializationInfo*>()) {
return Info->Template.getPointer();
@@ -622,7 +622,7 @@
const TemplateArgumentList *
FunctionDecl::getTemplateSpecializationArgs() const {
- if (FunctionTemplateSpecializationInfo *Info
+ if (FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization
.dyn_cast<FunctionTemplateSpecializationInfo*>()) {
return Info->TemplateArguments;
@@ -630,53 +630,53 @@
return 0;
}
-void
+void
FunctionDecl::setFunctionTemplateSpecialization(ASTContext &Context,
FunctionTemplateDecl *Template,
const TemplateArgumentList *TemplateArgs,
void *InsertPos) {
- FunctionTemplateSpecializationInfo *Info
+ FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
if (!Info)
Info = new (Context) FunctionTemplateSpecializationInfo;
-
+
Info->Function = this;
Info->Template.setPointer(Template);
Info->Template.setInt(TSK_ImplicitInstantiation - 1);
Info->TemplateArguments = TemplateArgs;
TemplateOrSpecialization = Info;
-
+
// Insert this function template specialization into the set of known
// function template specialiations.
Template->getSpecializations().InsertNode(Info, InsertPos);
}
TemplateSpecializationKind FunctionDecl::getTemplateSpecializationKind() const {
- // For a function template specialization, query the specialization
+ // For a function template specialization, query the specialization
// information object.
- FunctionTemplateSpecializationInfo *Info
+ FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
if (Info)
return Info->getTemplateSpecializationKind();
-
+
if (!getInstantiatedFromMemberFunction())
return TSK_Undeclared;
-
+
// Find the class template specialization corresponding to this instantiation
// of a member function.
const DeclContext *Parent = getDeclContext();
while (Parent && !isa<ClassTemplateSpecializationDecl>(Parent))
Parent = Parent->getParent();
-
+
if (!Parent)
return TSK_Undeclared;
return cast<ClassTemplateSpecializationDecl>(Parent)->getSpecializationKind();
}
-void
+void
FunctionDecl::setTemplateSpecializationKind(TemplateSpecializationKind TSK) {
- FunctionTemplateSpecializationInfo *Info
+ FunctionTemplateSpecializationInfo *Info
= TemplateOrSpecialization.dyn_cast<FunctionTemplateSpecializationInfo*>();
assert(Info && "Not a function template specialization");
Info->setTemplateSpecializationKind(TSK);
@@ -714,12 +714,12 @@
TagDecl* TagDecl::getDefinition(ASTContext& C) const {
if (isDefinition())
return const_cast<TagDecl *>(this);
-
- for (redecl_iterator R = redecls_begin(), REnd = redecls_end();
+
+ for (redecl_iterator R = redecls_begin(), REnd = redecls_end();
R != REnd; ++R)
if (R->isDefinition())
return *R;
-
+
return 0;
}
@@ -750,7 +750,7 @@
RecordDecl *RecordDecl::Create(ASTContext &C, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
SourceLocation TKL, RecordDecl* PrevDecl) {
-
+
RecordDecl* R = new (C) RecordDecl(Record, TK, DC, L, Id, PrevDecl, TKL);
C.getTypeDeclType(R, PrevDecl);
return R;
@@ -764,7 +764,7 @@
}
bool RecordDecl::isInjectedClassName() const {
- return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
+ return isImplicit() && getDeclName() && getDeclContext()->isRecord() &&
cast<RecordDecl>(getDeclContext())->getDeclName() == getDeclName();
}
@@ -788,15 +788,15 @@
for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
(*I)->Destroy(C);
-
- C.Deallocate(ParamInfo);
+
+ C.Deallocate(ParamInfo);
Decl::Destroy(C);
}
void BlockDecl::setParams(ASTContext& C, ParmVarDecl **NewParamInfo,
unsigned NParms) {
assert(ParamInfo == 0 && "Already has param info!");
-
+
// Zero params -> null pointer.
if (NParms) {
NumParams = NParms;
diff --git a/lib/AST/DeclBase.cpp b/lib/AST/DeclBase.cpp
index acdbdbe..34bc2b9 100644
--- a/lib/AST/DeclBase.cpp
+++ b/lib/AST/DeclBase.cpp
@@ -62,12 +62,12 @@
void Decl::PrintStats() {
fprintf(stderr, "*** Decl Stats:\n");
-
+
int totalDecls = 0;
#define DECL(Derived, Base) totalDecls += n##Derived##s;
#include "clang/AST/DeclNodes.def"
fprintf(stderr, " %d decls total.\n", totalDecls);
-
+
int totalBytes = 0;
#define DECL(Derived, Base) \
if (n##Derived##s > 0) { \
@@ -77,7 +77,7 @@
(int)(n##Derived##s * sizeof(Derived##Decl))); \
}
#include "clang/AST/DeclNodes.def"
-
+
fprintf(stderr, "Total bytes = %d\n", totalBytes);
}
@@ -92,26 +92,26 @@
bool Decl::isTemplateParameterPack() const {
if (const TemplateTypeParmDecl *TTP = dyn_cast<TemplateTypeParmDecl>(this))
return TTP->isParameterPack();
-
+
return false;
}
bool Decl::isFunctionOrFunctionTemplate() const {
if (const UsingDecl *UD = dyn_cast<UsingDecl>(this))
return UD->getTargetDecl()->isFunctionOrFunctionTemplate();
-
+
return isa<FunctionDecl>(this) || isa<FunctionTemplateDecl>(this);
}
//===----------------------------------------------------------------------===//
// PrettyStackTraceDecl Implementation
//===----------------------------------------------------------------------===//
-
+
void PrettyStackTraceDecl::print(llvm::raw_ostream &OS) const {
SourceLocation TheLoc = Loc;
if (TheLoc.isInvalid() && TheDecl)
TheLoc = TheDecl->getLocation();
-
+
if (TheLoc.isValid()) {
TheLoc.print(OS, SM);
OS << ": ";
@@ -123,7 +123,7 @@
OS << " '" << DN->getQualifiedNameAsString() << '\'';
OS << '\n';
}
-
+
//===----------------------------------------------------------------------===//
// Decl Implementation
//===----------------------------------------------------------------------===//
@@ -132,14 +132,14 @@
Decl::~Decl() {
if (isOutOfSemaDC())
delete getMultipleDC();
-
+
assert(!HasAttrs && "attributes should have been freed by Destroy");
}
void Decl::setDeclContext(DeclContext *DC) {
if (isOutOfSemaDC())
delete getMultipleDC();
-
+
DeclCtx = DC;
}
@@ -163,22 +163,22 @@
DeclContext *DC = getDeclContext();
assert(DC && "This decl is not contained in a translation unit!");
-
+
while (!DC->isTranslationUnit()) {
DC = DC->getParent();
assert(DC && "This decl is not contained in a translation unit!");
}
-
+
return cast<TranslationUnitDecl>(DC);
}
ASTContext &Decl::getASTContext() const {
- return getTranslationUnitDecl()->getASTContext();
+ return getTranslationUnitDecl()->getASTContext();
}
unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) {
switch (DeclKind) {
- default:
+ default:
if (DeclKind >= FunctionFirst && DeclKind <= FunctionLast)
return IDNS_Ordinary;
assert(0 && "Unknown decl kind!");
@@ -202,7 +202,7 @@
case ObjCProtocol:
return IDNS_ObjCProtocol;
-
+
case ObjCImplementation:
return IDNS_ObjCImplementation;
@@ -213,13 +213,13 @@
case ObjCAtDefsField:
case ObjCIvar:
return IDNS_Member;
-
+
case Record:
case CXXRecord:
case Enum:
case TemplateTypeParm:
return IDNS_Tag;
-
+
case Namespace:
case Template:
case FunctionTemplate:
@@ -227,7 +227,7 @@
case TemplateTemplateParm:
case NamespaceAlias:
return IDNS_Tag | IDNS_Ordinary;
-
+
// Never have names.
case Friend:
case LinkageSpec:
@@ -252,41 +252,41 @@
NewAttr->setNext(ExistingAttr);
ExistingAttr = NewAttr;
-
+
HasAttrs = true;
}
void Decl::invalidateAttrs() {
if (!HasAttrs) return;
-
+
HasAttrs = false;
getASTContext().eraseDeclAttrs(this);
}
const Attr *Decl::getAttrsImpl() const {
- assert(HasAttrs && "getAttrs() should verify this!");
+ assert(HasAttrs && "getAttrs() should verify this!");
return getASTContext().getDeclAttrs(this);
}
void Decl::swapAttrs(Decl *RHS) {
bool HasLHSAttr = this->HasAttrs;
bool HasRHSAttr = RHS->HasAttrs;
-
+
// Usually, neither decl has attrs, nothing to do.
if (!HasLHSAttr && !HasRHSAttr) return;
-
+
// If 'this' has no attrs, swap the other way.
if (!HasLHSAttr)
return RHS->swapAttrs(this);
-
+
ASTContext &Context = getASTContext();
-
+
// Handle the case when both decls have attrs.
if (HasRHSAttr) {
std::swap(Context.getDeclAttrs(this), Context.getDeclAttrs(RHS));
return;
}
-
+
// Otherwise, LHS has an attr and RHS doesn't.
Context.getDeclAttrs(RHS) = Context.getDeclAttrs(this);
Context.eraseDeclAttrs(this);
@@ -302,7 +302,7 @@
invalidateAttrs();
HasAttrs = false;
}
-
+
#if 0
// FIXME: Once ownership is fully understood, we can enable this code
if (DeclContext *DC = dyn_cast<DeclContext>(this))
@@ -311,15 +311,15 @@
// Observe the unrolled recursion. By setting N->NextDeclInContext = 0x0
// within the loop, only the Destroy method for the first Decl
// will deallocate all of the Decls in a chain.
-
+
Decl* N = getNextDeclInContext();
-
+
while (N) {
Decl* Tmp = N->getNextDeclInContext();
N->NextDeclInContext = 0;
N->Destroy(C);
N = Tmp;
- }
+ }
this->~Decl();
C.Deallocate((void *)this);
@@ -384,8 +384,8 @@
if (isa<TranslationUnitDecl>(this) ||
!isa<CXXRecordDecl>(getDeclContext()))
return;
-
- assert(Access != AS_none &&
+
+ assert(Access != AS_none &&
"Access specifier is AS_none inside a record decl");
}
@@ -434,7 +434,7 @@
if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(this))
if (Function->getDescribedFunctionTemplate())
return true;
-
+
return getParent() && getParent()->isDependentContext();
}
@@ -454,18 +454,18 @@
bool DeclContext::Encloses(DeclContext *DC) {
if (getPrimaryContext() != this)
return getPrimaryContext()->Encloses(DC);
-
+
for (; DC; DC = DC->getParent())
if (DC->getPrimaryContext() == this)
return true;
- return false;
+ return false;
}
DeclContext *DeclContext::getPrimaryContext() {
switch (DeclKind) {
case Decl::TranslationUnit:
case Decl::LinkageSpec:
- case Decl::Block:
+ case Decl::Block:
// There is only one DeclContext for these entities.
return this;
@@ -491,7 +491,7 @@
// If this is a tag type that has a definition or is currently
// being defined, that definition is our primary context.
if (const TagType *TagT =cast<TagDecl>(this)->TypeForDecl->getAs<TagType>())
- if (TagT->isBeingDefined() ||
+ if (TagT->isBeingDefined() ||
(TagT->getDecl() && TagT->getDecl()->isDefinition()))
return TagT->getDecl();
return this;
@@ -516,13 +516,13 @@
/// \brief Load the declarations within this lexical storage from an
/// external source.
-void
+void
DeclContext::LoadLexicalDeclsFromExternalStorage() const {
ExternalASTSource *Source = getParentASTContext().getExternalSource();
assert(hasExternalLexicalStorage() && Source && "No external storage?");
llvm::SmallVector<uint32_t, 64> Decls;
- if (Source->ReadDeclsLexicallyInContext(const_cast<DeclContext *>(this),
+ if (Source->ReadDeclsLexicallyInContext(const_cast<DeclContext *>(this),
Decls))
return;
@@ -554,7 +554,7 @@
LastDecl = PrevDecl;
}
-void
+void
DeclContext::LoadVisibleDeclsFromExternalStorage() const {
DeclContext *This = const_cast<DeclContext *>(this);
ExternalASTSource *Source = getParentASTContext().getExternalSource();
@@ -583,14 +583,14 @@
// FIXME: Check whether we need to load some declarations from
// external storage.
- return decl_iterator(FirstDecl);
+ return decl_iterator(FirstDecl);
}
DeclContext::decl_iterator DeclContext::decls_end() const {
if (hasExternalLexicalStorage())
LoadLexicalDeclsFromExternalStorage();
- return decl_iterator();
+ return decl_iterator();
}
bool DeclContext::decls_empty() const {
@@ -603,7 +603,7 @@
void DeclContext::addHiddenDecl(Decl *D) {
assert(D->getLexicalDeclContext() == this &&
"Decl inserted into wrong lexical context");
- assert(!D->getNextDeclInContext() && D != LastDecl &&
+ assert(!D->getNextDeclInContext() && D != LastDecl &&
"Decl already inserted into a DeclContext");
if (FirstDecl) {
@@ -626,8 +626,8 @@
/// transparent contexts nested within it).
void DeclContext::buildLookup(DeclContext *DCtx) {
for (; DCtx; DCtx = DCtx->getNextContext()) {
- for (decl_iterator D = DCtx->decls_begin(),
- DEnd = DCtx->decls_end();
+ for (decl_iterator D = DCtx->decls_begin(),
+ DEnd = DCtx->decls_end();
D != DEnd; ++D) {
// Insert this declaration into the lookup structure, but only
// if it's semantically in its decl context. During non-lazy
@@ -645,7 +645,7 @@
}
}
-DeclContext::lookup_result
+DeclContext::lookup_result
DeclContext::lookup(DeclarationName Name) {
DeclContext *PrimaryContext = getPrimaryContext();
if (PrimaryContext != this)
@@ -671,7 +671,7 @@
return Pos->second.getLookupResult(getParentASTContext());
}
-DeclContext::lookup_const_result
+DeclContext::lookup_const_result
DeclContext::lookup(DeclarationName Name) const {
return const_cast<DeclContext*>(this)->lookup(Name);
}
@@ -744,14 +744,14 @@
// one, just replace it and return.
if (DeclNameEntries.HandleRedeclaration(getParentASTContext(), D))
return;
-
+
// Put this declaration into the appropriate slot.
DeclNameEntries.AddSubsequentDecl(D);
}
/// Returns iterator range [First, Last) of UsingDirectiveDecls stored within
/// this context.
-DeclContext::udir_iterator_range
+DeclContext::udir_iterator_range
DeclContext::getUsingDirectives() const {
lookup_const_result Result = lookup(UsingDirectiveDecl::getName());
return udir_iterator_range(reinterpret_cast<udir_iterator>(Result.first),
diff --git a/lib/AST/DeclCXX.cpp b/lib/AST/DeclCXX.cpp
index 155005a..e8f97a3 100644
--- a/lib/AST/DeclCXX.cpp
+++ b/lib/AST/DeclCXX.cpp
@@ -26,7 +26,7 @@
CXXRecordDecl::CXXRecordDecl(Kind K, TagKind TK, DeclContext *DC,
SourceLocation L, IdentifierInfo *Id,
CXXRecordDecl *PrevDecl,
- SourceLocation TKL)
+ SourceLocation TKL)
: RecordDecl(K, TK, DC, L, Id, PrevDecl, TKL),
UserDeclaredConstructor(false), UserDeclaredCopyConstructor(false),
UserDeclaredCopyAssignment(false), UserDeclaredDestructor(false),
@@ -42,12 +42,12 @@
SourceLocation TKL,
CXXRecordDecl* PrevDecl,
bool DelayTypeCreation) {
- CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id,
+ CXXRecordDecl* R = new (C) CXXRecordDecl(CXXRecord, TK, DC, L, Id,
PrevDecl, TKL);
-
+
// FIXME: DelayTypeCreation seems like such a hack
if (!DelayTypeCreation)
- C.getTypeDeclType(R, PrevDecl);
+ C.getTypeDeclType(R, PrevDecl);
return R;
}
@@ -60,22 +60,22 @@
this->RecordDecl::Destroy(C);
}
-void
+void
CXXRecordDecl::setBases(ASTContext &C,
- CXXBaseSpecifier const * const *Bases,
+ CXXBaseSpecifier const * const *Bases,
unsigned NumBases) {
- // C++ [dcl.init.aggr]p1:
+ // C++ [dcl.init.aggr]p1:
// An aggregate is an array or a class (clause 9) with [...]
// no base classes [...].
Aggregate = false;
if (this->Bases)
C.Deallocate(this->Bases);
-
+
int vbaseCount = 0;
llvm::SmallVector<const CXXBaseSpecifier*, 8> UniqueVbases;
bool hasDirectVirtualBase = false;
-
+
this->Bases = new(C) CXXBaseSpecifier [NumBases];
this->NumBases = NumBases;
for (unsigned i = 0; i < NumBases; ++i) {
@@ -83,7 +83,7 @@
// Keep track of inherited vbases for this base class.
const CXXBaseSpecifier *Base = Bases[i];
QualType BaseType = Base->getType();
- // Skip template types.
+ // Skip template types.
// FIXME. This means that this list must be rebuilt during template
// instantiation.
if (BaseType->isDependentType())
@@ -92,10 +92,10 @@
= cast<CXXRecordDecl>(BaseType->getAs<RecordType>()->getDecl());
if (Base->isVirtual())
hasDirectVirtualBase = true;
- for (CXXRecordDecl::base_class_iterator VBase =
+ for (CXXRecordDecl::base_class_iterator VBase =
BaseClassDecl->vbases_begin(),
E = BaseClassDecl->vbases_end(); VBase != E; ++VBase) {
- // Add this vbase to the array of vbases for current class if it is
+ // Add this vbase to the array of vbases for current class if it is
// not already in the list.
// FIXME. Note that we do a linear search as number of such classes are
// very few.
@@ -134,7 +134,7 @@
QualType QT = UniqueVbases[i]->getType();
CXXRecordDecl *VBaseClassDecl
= cast<CXXRecordDecl>(QT->getAs<RecordType>()->getDecl());
- this->VBases[i] =
+ this->VBases[i] =
CXXBaseSpecifier(VBaseClassDecl->getSourceRange(), true,
VBaseClassDecl->getTagKind() == RecordDecl::TK_class,
UniqueVbases[i]->getAccessSpecifier(), QT);
@@ -146,11 +146,11 @@
return getCopyConstructor(Context, QualType::Const) != 0;
}
-CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
+CXXConstructorDecl *CXXRecordDecl::getCopyConstructor(ASTContext &Context,
unsigned TypeQuals) const{
QualType ClassType
= Context.getTypeDeclType(const_cast<CXXRecordDecl*>(this));
- DeclarationName ConstructorName
+ DeclarationName ConstructorName
= Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(ClassType));
unsigned FoundTQs;
@@ -162,12 +162,12 @@
if (isa<FunctionTemplateDecl>(*Con))
continue;
- if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
+ if (cast<CXXConstructorDecl>(*Con)->isCopyConstructor(Context,
FoundTQs)) {
if (((TypeQuals & QualType::Const) == (FoundTQs & QualType::Const)) ||
(!(TypeQuals & QualType::Const) && (FoundTQs & QualType::Const)))
return cast<CXXConstructorDecl>(*Con);
-
+
}
}
return 0;
@@ -217,13 +217,13 @@
}
void
-CXXRecordDecl::addedConstructor(ASTContext &Context,
+CXXRecordDecl::addedConstructor(ASTContext &Context,
CXXConstructorDecl *ConDecl) {
assert(!ConDecl->isImplicit() && "addedConstructor - not for implicit decl");
// Note that we have a user-declared constructor.
UserDeclaredConstructor = true;
- // C++ [dcl.init.aggr]p1:
+ // C++ [dcl.init.aggr]p1:
// An aggregate is an array or a class (clause 9) with no
// user-declared constructors (12.1) [...].
Aggregate = false;
@@ -237,7 +237,7 @@
// constructor.
// FIXME: C++0x: don't do this for "= default" default constructors.
HasTrivialConstructor = false;
-
+
// Note when we have a user-declared copy constructor, which will
// suppress the implicit declaration of a copy constructor.
if (ConDecl->isCopyConstructor(Context)) {
@@ -282,14 +282,14 @@
PlainOldData = false;
}
-void CXXRecordDecl::addConversionFunction(ASTContext &Context,
+void CXXRecordDecl::addConversionFunction(ASTContext &Context,
CXXConversionDecl *ConvDecl) {
assert(!ConvDecl->getDescribedFunctionTemplate() &&
"Conversion function templates should cast to FunctionTemplateDecl.");
Conversions.addOverload(ConvDecl);
}
-void CXXRecordDecl::addConversionFunction(ASTContext &Context,
+void CXXRecordDecl::addConversionFunction(ASTContext &Context,
FunctionTemplateDecl *ConvDecl) {
assert(isa<CXXConversionDecl>(ConvDecl->getTemplatedDecl()) &&
"Function template is not a conversion function template");
@@ -302,7 +302,7 @@
DeclarationName ConstructorName
= Context.DeclarationNames.getCXXConstructorName(
Context.getCanonicalType(ClassType.getUnqualifiedType()));
-
+
DeclContext::lookup_const_iterator Con, ConEnd;
for (llvm::tie(Con, ConEnd) = lookup(ConstructorName);
Con != ConEnd; ++Con) {
@@ -320,18 +320,18 @@
const CXXDestructorDecl *
CXXRecordDecl::getDestructor(ASTContext &Context) {
QualType ClassType = Context.getTypeDeclType(this);
-
- DeclarationName Name
+
+ DeclarationName Name
= Context.DeclarationNames.getCXXDestructorName(
Context.getCanonicalType(ClassType));
DeclContext::lookup_iterator I, E;
- llvm::tie(I, E) = lookup(Name);
+ llvm::tie(I, E) = lookup(Name);
assert(I != E && "Did not find a destructor!");
-
+
const CXXDestructorDecl *Dtor = cast<CXXDestructorDecl>(*I);
assert(++I == E && "Found more than one destructor!");
-
+
return Dtor;
}
@@ -345,8 +345,8 @@
}
-typedef llvm::DenseMap<const CXXMethodDecl*,
- std::vector<const CXXMethodDecl *> *>
+typedef llvm::DenseMap<const CXXMethodDecl*,
+ std::vector<const CXXMethodDecl *> *>
OverriddenMethodsMapTy;
// FIXME: We hate static data. This doesn't survive PCH saving/loading, and
@@ -355,21 +355,21 @@
void CXXMethodDecl::addOverriddenMethod(const CXXMethodDecl *MD) {
// FIXME: The CXXMethodDecl dtor needs to remove and free the entry.
-
+
if (!OverriddenMethods)
OverriddenMethods = new OverriddenMethodsMapTy();
-
+
std::vector<const CXXMethodDecl *> *&Methods = (*OverriddenMethods)[this];
if (!Methods)
Methods = new std::vector<const CXXMethodDecl *>;
-
+
Methods->push_back(MD);
}
CXXMethodDecl::method_iterator CXXMethodDecl::begin_overridden_methods() const {
if (!OverriddenMethods)
return 0;
-
+
OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
if (it == OverriddenMethods->end() || it->second->empty())
return 0;
@@ -380,7 +380,7 @@
CXXMethodDecl::method_iterator CXXMethodDecl::end_overridden_methods() const {
if (!OverriddenMethods)
return 0;
-
+
OverriddenMethodsMapTy::iterator it = OverriddenMethods->find(this);
if (it == OverriddenMethods->end() || it->second->empty())
return 0;
@@ -409,12 +409,12 @@
CXXBaseOrMemberInitializer::
CXXBaseOrMemberInitializer(QualType BaseType, Expr **Args, unsigned NumArgs,
CXXConstructorDecl *C,
- SourceLocation L, SourceLocation R)
+ SourceLocation L, SourceLocation R)
: Args(0), NumArgs(0), CtorOrAnonUnion(), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(BaseType.getTypePtr());
assert((BaseOrMember & 0x01) == 0 && "Invalid base class type pointer");
BaseOrMember |= 0x01;
-
+
if (NumArgs > 0) {
this->NumArgs = NumArgs;
// FIXME. Allocation via Context
@@ -431,7 +431,7 @@
SourceLocation L, SourceLocation R)
: Args(0), NumArgs(0), CtorOrAnonUnion(), IdLoc(L), RParenLoc(R) {
BaseOrMember = reinterpret_cast<uintptr_t>(Member);
- assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
+ assert((BaseOrMember & 0x01) == 0 && "Invalid member pointer");
if (NumArgs > 0) {
this->NumArgs = NumArgs;
@@ -466,8 +466,8 @@
(getNumParams() > 0 && getParamDecl(0)->hasDefaultArg());
}
-bool
-CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
+bool
+CXXConstructorDecl::isCopyConstructor(ASTContext &Context,
unsigned &TypeQuals) const {
// C++ [class.copy]p2:
// A non-template constructor for class X is a copy constructor
@@ -508,7 +508,7 @@
if (isExplicit() && !AllowExplicit)
return false;
- return (getNumParams() == 0 &&
+ return (getNumParams() == 0 &&
getType()->getAsFunctionProtoType()->isVariadic()) ||
(getNumParams() == 1) ||
(getNumParams() > 1 && getParamDecl(1)->hasDefaultArg());
@@ -517,11 +517,11 @@
CXXDestructorDecl *
CXXDestructorDecl::Create(ASTContext &C, CXXRecordDecl *RD,
SourceLocation L, DeclarationName N,
- QualType T, bool isInline,
+ QualType T, bool isInline,
bool isImplicitlyDeclared) {
assert(N.getNameKind() == DeclarationName::CXXDestructorName &&
"Name must refer to a destructor");
- return new (C) CXXDestructorDecl(RD, L, N, T, isInline,
+ return new (C) CXXDestructorDecl(RD, L, N, T, isInline,
isImplicitlyDeclared);
}
@@ -556,7 +556,7 @@
OverloadIterator::OverloadIterator(NamedDecl *ND) : D(0) {
if (!ND)
return;
-
+
if (isa<FunctionDecl>(ND) || isa<FunctionTemplateDecl>(ND))
D = ND;
else if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(ND)) {
@@ -575,10 +575,10 @@
OverloadIterator::reference OverloadIterator::operator*() const {
if (FunctionDecl *FD = dyn_cast<FunctionDecl>(D))
return FD;
-
+
if (FunctionTemplateDecl *FTD = dyn_cast<FunctionTemplateDecl>(D))
return FTD;
-
+
assert(isa<OverloadedFunctionDecl>(D));
return *Iter;
}
@@ -588,20 +588,20 @@
D = 0;
return *this;
}
-
+
if (++Iter == cast<OverloadedFunctionDecl>(D)->function_end())
D = 0;
-
+
return *this;
}
bool OverloadIterator::Equals(const OverloadIterator &Other) const {
if (!D || !Other.D)
return D == Other.D;
-
+
if (D != Other.D)
return false;
-
+
return !isa<OverloadedFunctionDecl>(D) || Iter == Other.Iter;
}
@@ -621,10 +621,10 @@
#endif
return new (C) FriendDecl(DC, L, Friend, FriendL);
-}
+}
LinkageSpecDecl *LinkageSpecDecl::Create(ASTContext &C,
- DeclContext *DC,
+ DeclContext *DC,
SourceLocation L,
LanguageIDs Lang, bool Braces) {
return new (C) LinkageSpecDecl(DC, L, Lang, Braces);
@@ -638,19 +638,19 @@
SourceLocation IdentLoc,
NamespaceDecl *Used,
DeclContext *CommonAncestor) {
- return new (C) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierRange,
+ return new (C) UsingDirectiveDecl(DC, L, NamespaceLoc, QualifierRange,
Qualifier, IdentLoc, Used, CommonAncestor);
}
-NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
- SourceLocation AliasLoc,
- IdentifierInfo *Alias,
+NamespaceAliasDecl *NamespaceAliasDecl::Create(ASTContext &C, DeclContext *DC,
+ SourceLocation L,
+ SourceLocation AliasLoc,
+ IdentifierInfo *Alias,
SourceRange QualifierRange,
NestedNameSpecifier *Qualifier,
- SourceLocation IdentLoc,
+ SourceLocation IdentLoc,
NamedDecl *Namespace) {
- return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, QualifierRange,
+ return new (C) NamespaceAliasDecl(DC, L, AliasLoc, Alias, QualifierRange,
Qualifier, IdentLoc, Namespace);
}
diff --git a/lib/AST/DeclObjC.cpp b/lib/AST/DeclObjC.cpp
index ee2b815..d6e4b2c 100644
--- a/lib/AST/DeclObjC.cpp
+++ b/lib/AST/DeclObjC.cpp
@@ -30,8 +30,8 @@
void ObjCListBase::set(void *const* InList, unsigned Elts, ASTContext &Ctx) {
assert(List == 0 && "Elements already set!");
if (Elts == 0) return; // Setting to an empty list is a noop.
-
-
+
+
List = new (Ctx) void*[Elts];
NumElts = Elts;
memcpy(List, InList, sizeof(void*)*Elts);
@@ -83,15 +83,15 @@
for (prop_iterator I = prop_begin(), E = prop_end(); I != E; ++I)
if ((*I)->getIdentifier() == PropertyId)
return *I;
-
+
const ObjCProtocolDecl *PID = dyn_cast<ObjCProtocolDecl>(this);
if (PID) {
- for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(),
+ for (ObjCProtocolDecl::protocol_iterator I = PID->protocol_begin(),
E = PID->protocol_end(); I != E; ++I)
if (ObjCPropertyDecl *P = (*I)->FindPropertyDeclaration(PropertyId))
return P;
}
-
+
if (const ObjCInterfaceDecl *OID = dyn_cast<ObjCInterfaceDecl>(this)) {
// Look through categories.
for (ObjCCategoryDecl *Category = OID->getCategoryList();
@@ -151,11 +151,11 @@
bool isInstance) const {
const ObjCInterfaceDecl* ClassDecl = this;
ObjCMethodDecl *MethodDecl = 0;
-
+
while (ClassDecl != NULL) {
if ((MethodDecl = ClassDecl->getMethod(Sel, isInstance)))
return MethodDecl;
-
+
// Didn't find one yet - look through protocols.
const ObjCList<ObjCProtocolDecl> &Protocols =
ClassDecl->getReferencedProtocols();
@@ -163,13 +163,13 @@
E = Protocols.end(); I != E; ++I)
if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
return MethodDecl;
-
+
// Didn't find one yet - now look through categories.
ObjCCategoryDecl *CatDecl = ClassDecl->getCategoryList();
while (CatDecl) {
if ((MethodDecl = CatDecl->getMethod(Sel, isInstance)))
return MethodDecl;
-
+
// Didn't find one yet - look through protocols.
const ObjCList<ObjCProtocolDecl> &Protocols =
CatDecl->getReferencedProtocols();
@@ -191,7 +191,7 @@
//===----------------------------------------------------------------------===//
ObjCMethodDecl *ObjCMethodDecl::Create(ASTContext &C,
- SourceLocation beginLoc,
+ SourceLocation beginLoc,
SourceLocation endLoc,
Selector SelInfo, QualType T,
DeclContext *contextDecl,
@@ -201,14 +201,14 @@
ImplementationControl impControl) {
return new (C) ObjCMethodDecl(beginLoc, endLoc,
SelInfo, T, contextDecl,
- isInstance,
+ isInstance,
isVariadic, isSynthesized, impControl);
}
void ObjCMethodDecl::Destroy(ASTContext &C) {
if (Body) Body->Destroy(C);
if (SelfDecl) SelfDecl->Destroy(C);
-
+
for (param_iterator I=param_begin(), E=param_end(); I!=E; ++I)
if (*I) (*I)->Destroy(C);
@@ -267,7 +267,7 @@
return this;
}
-void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
+void ObjCMethodDecl::createImplicitParams(ASTContext &Context,
const ObjCInterfaceDecl *OID) {
QualType selfTy;
if (isInstanceMethod()) {
@@ -282,11 +282,11 @@
} else // we have a factory method.
selfTy = Context.getObjCClassType();
- setSelfDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
+ setSelfDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
&Context.Idents.get("self"), selfTy));
- setCmdDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
- &Context.Idents.get("_cmd"),
+ setCmdDecl(ImplicitParamDecl::Create(Context, this, SourceLocation(),
+ &Context.Idents.get("_cmd"),
Context.getObjCSelType()));
}
@@ -310,7 +310,7 @@
ObjCInterfaceDecl *ObjCInterfaceDecl::Create(ASTContext &C,
DeclContext *DC,
SourceLocation atLoc,
- IdentifierInfo *Id,
+ IdentifierInfo *Id,
SourceLocation ClassLoc,
bool ForwardDecl, bool isInternal){
return new (C) ObjCInterfaceDecl(DC, atLoc, Id, ClassLoc, ForwardDecl,
@@ -326,13 +326,13 @@
ClassLoc(CLoc) {
}
-void ObjCInterfaceDecl::Destroy(ASTContext &C) {
+void ObjCInterfaceDecl::Destroy(ASTContext &C) {
for (ivar_iterator I = ivar_begin(), E = ivar_end(); I != E; ++I)
if (*I) (*I)->Destroy(C);
-
+
IVars.Destroy(C);
// FIXME: CategoryList?
-
+
// FIXME: Because there is no clear ownership
// role between ObjCInterfaceDecls and the ObjCPropertyDecls that they
// reference, we destroy ObjCPropertyDecls in ~TranslationUnit.
@@ -391,7 +391,7 @@
// 1st, look up the class.
const ObjCList<ObjCProtocolDecl> &Protocols =
IDecl->getReferencedProtocols();
-
+
for (ObjCList<ObjCProtocolDecl>::iterator PI = Protocols.begin(),
E = Protocols.end(); PI != E; ++PI) {
if (getASTContext().ProtocolCompatibleWithProtocol(lProto, *PI))
@@ -402,11 +402,11 @@
// object. This IMO, should be a bug.
// FIXME: Treat this as an extension, and flag this as an error when GCC
// extensions are not enabled.
- if (RHSIsQualifiedID &&
+ if (RHSIsQualifiedID &&
getASTContext().ProtocolCompatibleWithProtocol(*PI, lProto))
return true;
}
-
+
// 2nd, look up the category.
if (lookupCategory)
for (ObjCCategoryDecl *CDecl = IDecl->getCategoryList(); CDecl;
@@ -416,13 +416,13 @@
if (getASTContext().ProtocolCompatibleWithProtocol(lProto, *PI))
return true;
}
-
+
// 3rd, look up the super class(s)
if (IDecl->getSuperClass())
return
IDecl->getSuperClass()->ClassImplementsProtocol(lProto, lookupCategory,
RHSIsQualifiedID);
-
+
return false;
}
@@ -451,7 +451,7 @@
void ObjCAtDefsFieldDecl::Destroy(ASTContext& C) {
this->~ObjCAtDefsFieldDecl();
- C.Deallocate((void *)this);
+ C.Deallocate((void *)this);
}
//===----------------------------------------------------------------------===//
@@ -459,7 +459,7 @@
//===----------------------------------------------------------------------===//
ObjCProtocolDecl *ObjCProtocolDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
+ SourceLocation L,
IdentifierInfo *Id) {
return new (C) ObjCProtocolDecl(DC, L, Id);
}
@@ -478,7 +478,7 @@
for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I)
if ((PDecl = (*I)->lookupProtocolNamed(Name)))
return PDecl;
-
+
return NULL;
}
@@ -487,10 +487,10 @@
ObjCMethodDecl *ObjCProtocolDecl::lookupMethod(Selector Sel,
bool isInstance) const {
ObjCMethodDecl *MethodDecl = NULL;
-
+
if ((MethodDecl = getMethod(Sel, isInstance)))
return MethodDecl;
-
+
for (protocol_iterator I = protocol_begin(), E = protocol_end(); I != E; ++I)
if ((MethodDecl = (*I)->lookupMethod(Sel, isInstance)))
return MethodDecl;
@@ -501,7 +501,7 @@
// ObjCClassDecl
//===----------------------------------------------------------------------===//
-ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L,
+ObjCClassDecl::ObjCClassDecl(DeclContext *DC, SourceLocation L,
ObjCInterfaceDecl *const *Elts, unsigned nElts,
ASTContext &C)
: Decl(ObjCClass, DC, L) {
@@ -517,7 +517,7 @@
}
void ObjCClassDecl::Destroy(ASTContext &C) {
-
+
// FIXME: There is no clear ownership policy now for referenced
// ObjCInterfaceDecls. Some of them can be forward declarations that
// are never later defined (in which case the ObjCClassDecl owns them)
@@ -525,7 +525,7 @@
// we should have separate objects for forward declarations and definitions,
// obviating this problem. Because of this situation, referenced
// ObjCInterfaceDecls are destroyed in ~TranslationUnit.
-
+
ForwardDecls.Destroy(C);
Decl::Destroy(C);
}
@@ -538,14 +538,14 @@
ObjCForwardProtocolDecl(DeclContext *DC, SourceLocation L,
ObjCProtocolDecl *const *Elts, unsigned nElts,
ASTContext &C)
-: Decl(ObjCForwardProtocol, DC, L) {
+: Decl(ObjCForwardProtocol, DC, L) {
ReferencedProtocols.set(Elts, nElts, C);
}
ObjCForwardProtocolDecl *
ObjCForwardProtocolDecl::Create(ASTContext &C, DeclContext *DC,
- SourceLocation L,
+ SourceLocation L,
ObjCProtocolDecl *const *Elts,
unsigned NumElts) {
return new (C) ObjCForwardProtocolDecl(DC, L, Elts, NumElts, C);
@@ -649,7 +649,7 @@
//===----------------------------------------------------------------------===//
ObjCImplementationDecl *
-ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
+ObjCImplementationDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
ObjCInterfaceDecl *ClassInterface,
ObjCInterfaceDecl *SuperDecl) {
@@ -663,7 +663,7 @@
ObjCCompatibleAliasDecl *
ObjCCompatibleAliasDecl::Create(ASTContext &C, DeclContext *DC,
SourceLocation L,
- IdentifierInfo *Id,
+ IdentifierInfo *Id,
ObjCInterfaceDecl* AliasedClass) {
return new (C) ObjCCompatibleAliasDecl(DC, L, Id, AliasedClass);
}
diff --git a/lib/AST/DeclPrinter.cpp b/lib/AST/DeclPrinter.cpp
index 275fa69..8aae742 100644
--- a/lib/AST/DeclPrinter.cpp
+++ b/lib/AST/DeclPrinter.cpp
@@ -34,9 +34,9 @@
void ProcessDeclGroup(llvm::SmallVectorImpl<Decl*>& Decls);
void Print(AccessSpecifier AS);
-
+
public:
- DeclPrinter(llvm::raw_ostream &Out, ASTContext &Context,
+ DeclPrinter(llvm::raw_ostream &Out, ASTContext &Context,
const PrintingPolicy &Policy,
unsigned Indentation = 0)
: Out(Out), Context(Context), Policy(Policy), Indentation(Indentation) { }
@@ -186,7 +186,7 @@
bool PrintAccess = isa<CXXRecordDecl>(DC);
AccessSpecifier CurAS = AS_none;
-
+
llvm::SmallVector<Decl*, 2> Decls;
for (DeclContext::decl_iterator D = DC->decls_begin(), DEnd = DC->decls_end();
D != DEnd; ++D) {
@@ -209,7 +209,7 @@
CurAS = AS;
}
}
-
+
// The next bits of code handles stuff like "struct {int x;} a,b"; we're
// forced to merge the declarations because there's no other way to
// refer to the struct in question. This limited merging is safe without
@@ -240,16 +240,16 @@
}
this->Indent();
Visit(*D);
-
- // FIXME: Need to be able to tell the DeclPrinter when
+
+ // FIXME: Need to be able to tell the DeclPrinter when
const char *Terminator = 0;
- if (isa<FunctionDecl>(*D) &&
+ if (isa<FunctionDecl>(*D) &&
cast<FunctionDecl>(*D)->isThisDeclarationADefinition())
Terminator = 0;
else if (isa<ObjCMethodDecl>(*D) && cast<ObjCMethodDecl>(*D)->getBody())
Terminator = 0;
else if (isa<NamespaceDecl>(*D) || isa<LinkageSpecDecl>(*D) ||
- isa<ObjCImplementationDecl>(*D) ||
+ isa<ObjCImplementationDecl>(*D) ||
isa<ObjCInterfaceDecl>(*D) ||
isa<ObjCProtocolDecl>(*D) ||
isa<ObjCCategoryImplDecl>(*D) ||
@@ -299,7 +299,7 @@
Out << " ";
Out << D->getNameAsString();
}
-
+
if (D->isDefinition()) {
Out << " {\n";
VisitDeclContext(D);
@@ -315,7 +315,7 @@
}
}
-void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
+void DeclPrinter::VisitFunctionDecl(FunctionDecl *D) {
if (!Policy.SuppressSpecifiers) {
switch (D->getStorageClass()) {
case FunctionDecl::None: break;
@@ -346,7 +346,7 @@
if (i) POut << ", ";
ParamPrinter.VisitParmVarDecl(D->getParamDecl(i));
}
-
+
if (FT->isVariadic()) {
if (D->getNumParams()) POut << ", ";
POut << "...";
@@ -367,29 +367,29 @@
Proto += " : ";
Out << Proto;
Proto.clear();
- for (CXXConstructorDecl::init_const_iterator B = CDecl->init_begin(),
+ for (CXXConstructorDecl::init_const_iterator B = CDecl->init_begin(),
E = CDecl->init_end();
B != E; ++B) {
CXXBaseOrMemberInitializer * BMInitializer = (*B);
if (B != CDecl->init_begin())
Out << ", ";
- bool hasArguments = (BMInitializer->arg_begin() !=
+ bool hasArguments = (BMInitializer->arg_begin() !=
BMInitializer->arg_end());
if (BMInitializer->isMemberInitializer()) {
FieldDecl *FD = BMInitializer->getMember();
Out << FD->getNameAsString();
}
else // FIXME. skip dependent types for now.
- if (const RecordType *RT =
+ if (const RecordType *RT =
BMInitializer->getBaseClass()->getAs<RecordType>()) {
- const CXXRecordDecl *BaseDecl =
+ const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(RT->getDecl());
Out << BaseDecl->getNameAsString();
}
if (hasArguments) {
Out << "(";
- for (CXXBaseOrMemberInitializer::const_arg_iterator BE =
- BMInitializer->const_arg_begin(),
+ for (CXXBaseOrMemberInitializer::const_arg_iterator BE =
+ BMInitializer->const_arg_begin(),
EE = BMInitializer->const_arg_end(); BE != EE; ++BE) {
if (BE != BMInitializer->const_arg_begin())
Out<< ", ";
@@ -407,7 +407,7 @@
// List order of base/member destruction for visualization purposes.
assert (D->isThisDeclarationADefinition() && "Destructor with dtor-list");
Proto += "/* : ";
- for (CXXDestructorDecl::destr_const_iterator *B = DDecl->destr_begin(),
+ for (CXXDestructorDecl::destr_const_iterator *B = DDecl->destr_begin(),
*E = DDecl->destr_end();
B != E; ++B) {
uintptr_t BaseOrMember = (*B);
@@ -420,10 +420,10 @@
Proto += FD->getNameAsString();
}
else // FIXME. skip dependent types for now.
- if (const RecordType *RT =
+ if (const RecordType *RT =
DDecl->getAnyBaseClassToDestroy(BaseOrMember)
->getAs<RecordType>()) {
- const CXXRecordDecl *BaseDecl =
+ const CXXRecordDecl *BaseDecl =
cast<CXXRecordDecl>(RT->getDecl());
Proto += "~";
Proto += BaseDecl->getNameAsString();
@@ -522,7 +522,7 @@
// C++ declarations
//----------------------------------------------------------------------------
void DeclPrinter::VisitOverloadedFunctionDecl(OverloadedFunctionDecl *D) {
- assert(false &&
+ assert(false &&
"OverloadedFunctionDecls aren't really decls and are never printed");
}
@@ -552,14 +552,13 @@
Out << " ";
Out << D->getNameAsString();
}
-
+
if (D->isDefinition()) {
// Print the base classes
if (D->getNumBases()) {
Out << " : ";
- for(CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
- BaseEnd = D->bases_end();
- Base != BaseEnd; ++Base) {
+ for (CXXRecordDecl::base_class_iterator Base = D->bases_begin(),
+ BaseEnd = D->bases_end(); Base != BaseEnd; ++Base) {
if (Base != D->bases_begin())
Out << ", ";
@@ -578,7 +577,7 @@
Out << " {\n";
VisitDeclContext(D);
Indent() << "}";
- }
+ }
}
void DeclPrinter::VisitLinkageSpecDecl(LinkageSpecDecl *D) {
@@ -602,17 +601,17 @@
void DeclPrinter::VisitTemplateDecl(TemplateDecl *D) {
Out << "template <";
-
+
TemplateParameterList *Params = D->getTemplateParameters();
for (unsigned i = 0, e = Params->size(); i != e; ++i) {
if (i != 0)
Out << ", ";
-
+
const Decl *Param = Params->getParam(i);
- if (const TemplateTypeParmDecl *TTP =
+ if (const TemplateTypeParmDecl *TTP =
dyn_cast<TemplateTypeParmDecl>(Param)) {
-
- QualType ParamType =
+
+ QualType ParamType =
Context.getTypeDeclType(const_cast<TemplateTypeParmDecl*>(TTP));
if (TTP->wasDeclaredWithTypename())
@@ -622,14 +621,14 @@
if (TTP->isParameterPack())
Out << "... ";
-
+
Out << ParamType.getAsString(Policy);
if (TTP->hasDefaultArgument()) {
Out << " = ";
Out << TTP->getDefaultArgument().getAsString(Policy);
};
- } else if (const NonTypeTemplateParmDecl *NTTP =
+ } else if (const NonTypeTemplateParmDecl *NTTP =
dyn_cast<NonTypeTemplateParmDecl>(Param)) {
Out << NTTP->getType().getAsString(Policy);
@@ -637,15 +636,15 @@
Out << ' ';
Out << Name->getName();
}
-
+
if (NTTP->hasDefaultArgument()) {
Out << " = ";
- NTTP->getDefaultArgument()->printPretty(Out, Context, 0, Policy,
+ NTTP->getDefaultArgument()->printPretty(Out, Context, 0, Policy,
Indentation);
}
}
}
-
+
Out << "> ";
Visit(D->getTemplatedDecl());
@@ -667,29 +666,29 @@
void DeclPrinter::VisitObjCMethodDecl(ObjCMethodDecl *OMD) {
if (OMD->isInstanceMethod())
Out << "- ";
- else
+ else
Out << "+ ";
if (!OMD->getResultType().isNull())
Out << '(' << OMD->getResultType().getAsString(Policy) << ")";
-
+
std::string name = OMD->getSelector().getAsString();
std::string::size_type pos, lastPos = 0;
for (ObjCMethodDecl::param_iterator PI = OMD->param_begin(),
E = OMD->param_end(); PI != E; ++PI) {
- // FIXME: selector is missing here!
+ // FIXME: selector is missing here!
pos = name.find_first_of(":", lastPos);
Out << " " << name.substr(lastPos, pos - lastPos);
Out << ":(" << (*PI)->getType().getAsString(Policy) << ")"
- << (*PI)->getNameAsString();
+ << (*PI)->getNameAsString();
lastPos = pos + 1;
}
-
+
if (OMD->param_begin() == OMD->param_end())
Out << " " << name;
-
+
if (OMD->isVariadic())
Out << ", ...";
-
+
if (OMD->getBody()) {
Out << ' ';
OMD->getBody()->printPretty(Out, Context, 0, Policy);
@@ -718,7 +717,7 @@
Out << "@interface " << I << " : " << SID->getNameAsString();
else
Out << "@interface " << I;
-
+
// Protocols?
const ObjCList<ObjCProtocolDecl> &Protocols = OID->getReferencedProtocols();
if (!Protocols.empty()) {
@@ -726,22 +725,22 @@
E = Protocols.end(); I != E; ++I)
Out << (I == Protocols.begin() ? '<' : ',') << (*I)->getNameAsString();
}
-
+
if (!Protocols.empty())
Out << "> ";
-
+
if (OID->ivar_size() > 0) {
Out << "{\n";
Indentation += Policy.Indentation;
for (ObjCInterfaceDecl::ivar_iterator I = OID->ivar_begin(),
E = OID->ivar_end(); I != E; ++I) {
Indent() << (*I)->getType().getAsString(Policy)
- << ' ' << (*I)->getNameAsString() << ";\n";
+ << ' ' << (*I)->getNameAsString() << ";\n";
}
Indentation -= Policy.Indentation;
Out << "}\n";
}
-
+
VisitDeclContext(OID, false);
Out << "@end";
// FIXME: implement the rest...
@@ -749,7 +748,7 @@
void DeclPrinter::VisitObjCForwardProtocolDecl(ObjCForwardProtocolDecl *D) {
Out << "@protocol ";
- for (ObjCForwardProtocolDecl::protocol_iterator I = D->protocol_begin(),
+ for (ObjCForwardProtocolDecl::protocol_iterator I = D->protocol_begin(),
E = D->protocol_end();
I != E; ++I) {
if (I != D->protocol_begin()) Out << ", ";
@@ -766,7 +765,7 @@
void DeclPrinter::VisitObjCCategoryImplDecl(ObjCCategoryImplDecl *PID) {
Out << "@implementation "
<< PID->getClassInterface()->getNameAsString()
- << '(' << PID->getNameAsString() << ")\n";
+ << '(' << PID->getNameAsString() << ")\n";
VisitDeclContext(PID, false);
Out << "@end";
@@ -774,18 +773,18 @@
}
void DeclPrinter::VisitObjCCategoryDecl(ObjCCategoryDecl *PID) {
- Out << "@interface "
+ Out << "@interface "
<< PID->getClassInterface()->getNameAsString()
<< '(' << PID->getNameAsString() << ")\n";
VisitDeclContext(PID, false);
Out << "@end";
-
+
// FIXME: implement the rest...
}
void DeclPrinter::VisitObjCCompatibleAliasDecl(ObjCCompatibleAliasDecl *AID) {
- Out << "@compatibility_alias " << AID->getNameAsString()
- << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
+ Out << "@compatibility_alias " << AID->getNameAsString()
+ << ' ' << AID->getClassInterface()->getNameAsString() << ";\n";
}
/// PrintObjCPropertyDecl - print a property declaration.
@@ -795,17 +794,17 @@
Out << "@required\n";
else if (PDecl->getPropertyImplementation() == ObjCPropertyDecl::Optional)
Out << "@optional\n";
-
+
Out << "@property";
if (PDecl->getPropertyAttributes() != ObjCPropertyDecl::OBJC_PR_noattr) {
bool first = true;
Out << " (";
- if (PDecl->getPropertyAttributes() &
+ if (PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_readonly) {
Out << (first ? ' ' : ',') << "readonly";
first = false;
}
-
+
if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_getter) {
Out << (first ? ' ' : ',') << "getter = "
<< PDecl->getGetterName().getAsString();
@@ -816,29 +815,29 @@
<< PDecl->getSetterName().getAsString();
first = false;
}
-
+
if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_assign) {
Out << (first ? ' ' : ',') << "assign";
first = false;
}
-
+
if (PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_readwrite) {
Out << (first ? ' ' : ',') << "readwrite";
first = false;
}
-
+
if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_retain) {
Out << (first ? ' ' : ',') << "retain";
first = false;
}
-
+
if (PDecl->getPropertyAttributes() & ObjCPropertyDecl::OBJC_PR_copy) {
Out << (first ? ' ' : ',') << "copy";
first = false;
}
-
- if (PDecl->getPropertyAttributes() &
+
+ if (PDecl->getPropertyAttributes() &
ObjCPropertyDecl::OBJC_PR_nonatomic) {
Out << (first ? ' ' : ',') << "nonatomic";
first = false;
diff --git a/lib/AST/DeclTemplate.cpp b/lib/AST/DeclTemplate.cpp
index 08e53eb..b46f627 100644
--- a/lib/AST/DeclTemplate.cpp
+++ b/lib/AST/DeclTemplate.cpp
@@ -40,26 +40,26 @@
unsigned Size = sizeof(TemplateParameterList) + sizeof(Decl *) * NumParams;
unsigned Align = llvm::AlignOf<TemplateParameterList>::Alignment;
void *Mem = C.Allocate(Size, Align);
- return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
+ return new (Mem) TemplateParameterList(TemplateLoc, LAngleLoc, Params,
NumParams, RAngleLoc);
}
unsigned TemplateParameterList::getMinRequiredArguments() const {
unsigned NumRequiredArgs = size();
- iterator Param = const_cast<TemplateParameterList *>(this)->end(),
+ iterator Param = const_cast<TemplateParameterList *>(this)->end(),
ParamBegin = const_cast<TemplateParameterList *>(this)->begin();
while (Param != ParamBegin) {
--Param;
-
+
if (!(*Param)->isTemplateParameterPack() &&
- !(isa<TemplateTypeParmDecl>(*Param) &&
+ !(isa<TemplateTypeParmDecl>(*Param) &&
cast<TemplateTypeParmDecl>(*Param)->hasDefaultArgument()) &&
!(isa<NonTypeTemplateParmDecl>(*Param) &&
cast<NonTypeTemplateParmDecl>(*Param)->hasDefaultArgument()) &&
!(isa<TemplateTemplateParmDecl>(*Param) &&
cast<TemplateTemplateParmDecl>(*Param)->hasDefaultArgument()))
break;
-
+
--NumRequiredArgs;
}
@@ -94,7 +94,7 @@
Spec != SpecEnd; ++Spec)
C.Deallocate(&*Spec);
}
-
+
Decl::Destroy(C);
}
@@ -110,7 +110,7 @@
FunctionTemplateDecl *First = this;
while (First->getPreviousDeclaration())
First = First->getPreviousDeclaration();
-
+
if (First->CommonOrPrev.isNull()) {
// FIXME: Allocate with the ASTContext
First->CommonOrPrev = new Common;
@@ -142,7 +142,7 @@
else
CommonPtr = new (C) Common;
- return new (C) ClassTemplateDecl(DC, L, Name, Params, Decl, PrevDecl,
+ return new (C) ClassTemplateDecl(DC, L, Name, Params, Decl, PrevDecl,
CommonPtr);
}
@@ -172,7 +172,7 @@
if (Context.hasSameType(Context.getTypeDeclType(&*P), T))
return &*P;
}
-
+
return 0;
}
@@ -188,21 +188,21 @@
TemplateParameterList *Params = getTemplateParameters();
llvm::SmallVector<TemplateArgument, 16> TemplateArgs;
TemplateArgs.reserve(Params->size());
- for (TemplateParameterList::iterator Param = Params->begin(),
- ParamEnd = Params->end();
+ for (TemplateParameterList::iterator Param = Params->begin(),
+ ParamEnd = Params->end();
Param != ParamEnd; ++Param) {
if (isa<TemplateTypeParmDecl>(*Param)) {
QualType ParamType = Context.getTypeDeclType(cast<TypeDecl>(*Param));
- TemplateArgs.push_back(TemplateArgument((*Param)->getLocation(),
+ TemplateArgs.push_back(TemplateArgument((*Param)->getLocation(),
ParamType));
- } else if (NonTypeTemplateParmDecl *NTTP =
+ } else if (NonTypeTemplateParmDecl *NTTP =
dyn_cast<NonTypeTemplateParmDecl>(*Param)) {
Expr *E = new (Context) DeclRefExpr(NTTP, NTTP->getType(),
NTTP->getLocation(),
NTTP->getType()->isDependentType(),
/*Value-dependent=*/true);
TemplateArgs.push_back(TemplateArgument(E));
- } else {
+ } else {
TemplateTemplateParmDecl *TTP = cast<TemplateTemplateParmDecl>(*Param);
TemplateArgs.push_back(TemplateArgument(TTP->getLocation(), TTP));
}
@@ -242,7 +242,7 @@
SourceLocation NonTypeTemplateParmDecl::getDefaultArgumentLoc() const {
return DefaultArgument? DefaultArgument->getSourceRange().getBegin()
- : SourceLocation();
+ : SourceLocation();
}
//===----------------------------------------------------------------------===//
@@ -259,7 +259,7 @@
SourceLocation TemplateTemplateParmDecl::getDefaultArgumentLoc() const {
return DefaultArgument? DefaultArgument->getSourceRange().getBegin()
- : SourceLocation();
+ : SourceLocation();
}
//===----------------------------------------------------------------------===//
@@ -272,10 +272,10 @@
}
/// \brief Construct a template argument pack.
-void TemplateArgument::setArgumentPack(TemplateArgument *args, unsigned NumArgs,
+void TemplateArgument::setArgumentPack(TemplateArgument *args, unsigned NumArgs,
bool CopyArgs) {
assert(isNull() && "Must call setArgumentPack on a null argument");
-
+
Kind = Pack;
Args.NumArgs = NumArgs;
Args.CopyArgs = CopyArgs;
@@ -283,7 +283,7 @@
Args.Args = args;
return;
}
-
+
// FIXME: Allocate in ASTContext
Args.Args = new TemplateArgument[NumArgs];
for (unsigned I = 0; I != Args.NumArgs; ++I)
@@ -301,21 +301,21 @@
assert(Arg.getAsType()->isCanonical() && "Type must be canonical!");
break;
}
-
+
assert(NumFlatArgs < MaxFlatArgs && "Argument list builder is full!");
- assert(!StructuredArgs &&
+ assert(!StructuredArgs &&
"Can't append arguments when an argument pack has been added!");
-
+
if (!FlatArgs)
FlatArgs = new TemplateArgument[MaxFlatArgs];
-
+
FlatArgs[NumFlatArgs++] = Arg;
}
void TemplateArgumentListBuilder::BeginPack() {
assert(!AddingToPack && "Already adding to pack!");
assert(!StructuredArgs && "Argument list already contains a pack!");
-
+
AddingToPack = true;
PackBeginIndex = NumFlatArgs;
}
@@ -323,24 +323,24 @@
void TemplateArgumentListBuilder::EndPack() {
assert(AddingToPack && "Not adding to pack!");
assert(!StructuredArgs && "Argument list already contains a pack!");
-
+
AddingToPack = false;
StructuredArgs = new TemplateArgument[MaxStructuredArgs];
-
+
// First copy the flat entries over to the list (if any)
for (unsigned I = 0; I != PackBeginIndex; ++I) {
NumStructuredArgs++;
StructuredArgs[I] = FlatArgs[I];
}
-
+
// Next, set the pack.
TemplateArgument *PackArgs = 0;
unsigned NumPackArgs = NumFlatArgs - PackBeginIndex;
if (NumPackArgs)
PackArgs = &FlatArgs[PackBeginIndex];
-
- StructuredArgs[NumStructuredArgs++].setArgumentPack(PackArgs, NumPackArgs,
+
+ StructuredArgs[NumStructuredArgs++].setArgumentPack(PackArgs, NumPackArgs,
/*CopyArgs=*/false);
}
@@ -359,14 +359,14 @@
TemplateArgumentList::TemplateArgumentList(ASTContext &Context,
TemplateArgumentListBuilder &Builder,
bool TakeArgs)
- : FlatArguments(Builder.getFlatArguments(), TakeArgs),
- NumFlatArguments(Builder.flatSize()),
+ : FlatArguments(Builder.getFlatArguments(), TakeArgs),
+ NumFlatArguments(Builder.flatSize()),
StructuredArguments(Builder.getStructuredArguments(), TakeArgs),
NumStructuredArguments(Builder.structuredSize()) {
-
+
if (!TakeArgs)
return;
-
+
if (Builder.getStructuredArguments() == Builder.getFlatArguments())
StructuredArguments.setInt(0);
Builder.ReleaseArgs();
@@ -385,8 +385,8 @@
ClassTemplateDecl *SpecializedTemplate,
TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl)
- : CXXRecordDecl(DK,
- SpecializedTemplate->getTemplatedDecl()->getTagKind(),
+ : CXXRecordDecl(DK,
+ SpecializedTemplate->getTemplatedDecl()->getTagKind(),
DC, L,
// FIXME: Should we use DeclarationName for the name of
// class template specializations?
@@ -396,17 +396,17 @@
TemplateArgs(Context, Builder, /*TakeArgs=*/true),
SpecializationKind(TSK_Undeclared) {
}
-
+
ClassTemplateSpecializationDecl *
-ClassTemplateSpecializationDecl::Create(ASTContext &Context,
+ClassTemplateSpecializationDecl::Create(ASTContext &Context,
DeclContext *DC, SourceLocation L,
ClassTemplateDecl *SpecializedTemplate,
TemplateArgumentListBuilder &Builder,
ClassTemplateSpecializationDecl *PrevDecl) {
ClassTemplateSpecializationDecl *Result
- = new (Context)ClassTemplateSpecializationDecl(Context,
+ = new (Context)ClassTemplateSpecializationDecl(Context,
ClassTemplateSpecialization,
- DC, L,
+ DC, L,
SpecializedTemplate,
Builder,
PrevDecl);
@@ -415,16 +415,16 @@
}
void ClassTemplateSpecializationDecl::Destroy(ASTContext &C) {
- if (SpecializedPartialSpecialization *PartialSpec
+ if (SpecializedPartialSpecialization *PartialSpec
= SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
C.Deallocate(PartialSpec);
-
+
CXXRecordDecl::Destroy(C);
}
ClassTemplateDecl *
-ClassTemplateSpecializationDecl::getSpecializedTemplate() const {
- if (SpecializedPartialSpecialization *PartialSpec
+ClassTemplateSpecializationDecl::getSpecializedTemplate() const {
+ if (SpecializedPartialSpecialization *PartialSpec
= SpecializedTemplate.dyn_cast<SpecializedPartialSpecialization*>())
return PartialSpec->PartialSpecialization->getSpecializedTemplate();
return SpecializedTemplate.get<ClassTemplateDecl*>();
@@ -441,7 +441,7 @@
TemplateArgumentListBuilder &Builder,
ClassTemplatePartialSpecializationDecl *PrevDecl) {
ClassTemplatePartialSpecializationDecl *Result
- = new (Context)ClassTemplatePartialSpecializationDecl(Context,
+ = new (Context)ClassTemplatePartialSpecializationDecl(Context,
DC, L, Params,
SpecializedTemplate,
Builder, PrevDecl);
diff --git a/lib/AST/DeclarationName.cpp b/lib/AST/DeclarationName.cpp
index da9f01a..a01a892 100644
--- a/lib/AST/DeclarationName.cpp
+++ b/lib/AST/DeclarationName.cpp
@@ -23,7 +23,7 @@
/// CXXSpecialName - Records the type associated with one of the
/// "special" kinds of declaration names in C++, e.g., constructors,
/// destructors, and conversion functions.
-class CXXSpecialName
+class CXXSpecialName
: public DeclarationNameExtra, public llvm::FoldingSetNode {
public:
/// Type - The type associated with this declaration name.
@@ -40,7 +40,7 @@
};
/// CXXOperatorIdName - Contains extra information for the name of an
-/// overloaded operator in C++, such as "operator+.
+/// overloaded operator in C++, such as "operator+.
class CXXOperatorIdName : public DeclarationNameExtra {
public:
/// FETokenInfo - Extra information associated with this operator
@@ -93,13 +93,13 @@
case StoredDeclarationNameExtra:
switch (getExtra()->ExtraKindOrNumArgs) {
- case DeclarationNameExtra::CXXConstructor:
+ case DeclarationNameExtra::CXXConstructor:
return CXXConstructorName;
- case DeclarationNameExtra::CXXDestructor:
+ case DeclarationNameExtra::CXXDestructor:
return CXXDestructorName;
- case DeclarationNameExtra::CXXConversionFunction:
+ case DeclarationNameExtra::CXXConversionFunction:
return CXXConversionFunctionName;
case DeclarationNameExtra::CXXUsingDirective:
@@ -107,7 +107,7 @@
default:
// Check if we have one of the CXXOperator* enumeration values.
- if (getExtra()->ExtraKindOrNumArgs <
+ if (getExtra()->ExtraKindOrNumArgs <
DeclarationNameExtra::CXXUsingDirective)
return CXXOperatorName;
@@ -159,7 +159,7 @@
};
const char *OpName = OperatorNames[getCXXOverloadedOperator()];
assert(OpName && "not an overloaded operator");
-
+
std::string Result = "operator";
if (OpName[0] >= 'a' && OpName[0] <= 'z')
Result += ' ';
@@ -193,7 +193,7 @@
OverloadedOperatorKind DeclarationName::getCXXOverloadedOperator() const {
if (CXXOperatorIdName *CXXOp = getAsCXXOperatorIdName()) {
- unsigned value
+ unsigned value
= CXXOp->ExtraKindOrNumArgs - DeclarationNameExtra::CXXConversionFunction;
return static_cast<OverloadedOperatorKind>(value);
} else {
@@ -276,7 +276,7 @@
// Initialize the overloaded operator names.
CXXOperatorNames = new CXXOperatorIdName[NUM_OVERLOADED_OPERATORS];
for (unsigned Op = 0; Op < NUM_OVERLOADED_OPERATORS; ++Op) {
- CXXOperatorNames[Op].ExtraKindOrNumArgs
+ CXXOperatorNames[Op].ExtraKindOrNumArgs
= Op + DeclarationNameExtra::CXXConversionFunction;
CXXOperatorNames[Op].FETokenInfo = 0;
}
@@ -296,18 +296,18 @@
delete [] CXXOperatorNames;
}
-DeclarationName
-DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
+DeclarationName
+DeclarationNameTable::getCXXSpecialName(DeclarationName::NameKind Kind,
CanQualType Ty) {
assert(Kind >= DeclarationName::CXXConstructorName &&
Kind <= DeclarationName::CXXConversionFunctionName &&
"Kind must be a C++ special name kind");
- llvm::FoldingSet<CXXSpecialName> *SpecialNames
+ llvm::FoldingSet<CXXSpecialName> *SpecialNames
= static_cast<llvm::FoldingSet<CXXSpecialName>*>(CXXSpecialNamesImpl);
DeclarationNameExtra::ExtraKind EKind;
switch (Kind) {
- case DeclarationName::CXXConstructorName:
+ case DeclarationName::CXXConstructorName:
EKind = DeclarationNameExtra::CXXConstructor;
assert(Ty.getCVRQualifiers() == 0 &&"Constructor type must be unqualified");
break;
@@ -340,12 +340,12 @@
return DeclarationName(SpecialName);
}
-DeclarationName
+DeclarationName
DeclarationNameTable::getCXXOperatorName(OverloadedOperatorKind Op) {
return DeclarationName(&CXXOperatorNames[(unsigned)Op]);
}
-unsigned
+unsigned
llvm::DenseMapInfo<clang::DeclarationName>::
getHashValue(clang::DeclarationName N) {
return DenseMapInfo<void*>::getHashValue(N.getAsOpaquePtr());
diff --git a/lib/AST/Expr.cpp b/lib/AST/Expr.cpp
index 013a941..a90b998 100644
--- a/lib/AST/Expr.cpp
+++ b/lib/AST/Expr.cpp
@@ -120,7 +120,7 @@
StringLiteral *StringLiteral::Create(ASTContext &C, const char *StrData,
unsigned ByteLength, bool Wide,
QualType Ty,
- const SourceLocation *Loc,
+ const SourceLocation *Loc,
unsigned NumStrs) {
// Allocate enough space for the StringLiteral plus an array of locations for
// any concatenated string tokens.
@@ -128,7 +128,7 @@
sizeof(SourceLocation)*(NumStrs-1),
llvm::alignof<StringLiteral>());
StringLiteral *SL = new (Mem) StringLiteral(Ty);
-
+
// OPTIMIZE: could allocate this appended to the StringLiteral.
char *AStrData = new (C, 1) char[ByteLength];
memcpy(AStrData, StrData, ByteLength);
@@ -191,7 +191,7 @@
}
}
-UnaryOperator::Opcode
+UnaryOperator::Opcode
UnaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO, bool Postfix) {
switch (OO) {
default: assert(false && "No unary operator for overloaded function");
@@ -227,11 +227,11 @@
CallExpr::CallExpr(ASTContext& C, StmtClass SC, Expr *fn, Expr **args,
unsigned numargs, QualType t, SourceLocation rparenloc)
- : Expr(SC, t,
+ : Expr(SC, t,
fn->isTypeDependent() || hasAnyTypeDependentArguments(args, numargs),
fn->isValueDependent() || hasAnyValueDependentArguments(args,numargs)),
NumArgs(numargs) {
-
+
SubExprs = new (C) Stmt*[numargs+1];
SubExprs[FN] = fn;
for (unsigned i = 0; i != numargs; ++i)
@@ -255,8 +255,8 @@
RParenLoc = rparenloc;
}
-CallExpr::CallExpr(ASTContext &C, StmtClass SC, EmptyShell Empty)
- : Expr(SC, Empty), SubExprs(0), NumArgs(0) {
+CallExpr::CallExpr(ASTContext &C, StmtClass SC, EmptyShell Empty)
+ : Expr(SC, Empty), SubExprs(0), NumArgs(0) {
SubExprs = new (C) Stmt*[1];
}
@@ -281,7 +281,7 @@
void CallExpr::setNumArgs(ASTContext& C, unsigned NumArgs) {
// No change, just return.
if (NumArgs == getNumArgs()) return;
-
+
// If shrinking # arguments, just delete the extras and forgot them.
if (NumArgs < getNumArgs()) {
for (unsigned i = NumArgs, e = getNumArgs(); i != e; ++i)
@@ -298,7 +298,7 @@
// Null out new args.
for (unsigned i = getNumArgs()+ARGS_START; i != NumArgs+ARGS_START; ++i)
NewSubExprs[i] = 0;
-
+
if (SubExprs) C.Deallocate(SubExprs);
SubExprs = NewSubExprs;
this->NumArgs = NumArgs;
@@ -308,20 +308,20 @@
/// not, return 0.
unsigned CallExpr::isBuiltinCall(ASTContext &Context) const {
// All simple function calls (e.g. func()) are implicitly cast to pointer to
- // function. As a result, we try and obtain the DeclRefExpr from the
+ // function. As a result, we try and obtain the DeclRefExpr from the
// ImplicitCastExpr.
const ImplicitCastExpr *ICE = dyn_cast<ImplicitCastExpr>(getCallee());
if (!ICE) // FIXME: deal with more complex calls (e.g. (func)(), (*func)()).
return 0;
-
+
const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(ICE->getSubExpr());
if (!DRE)
return 0;
-
+
const FunctionDecl *FDecl = dyn_cast<FunctionDecl>(DRE->getDecl());
if (!FDecl)
return 0;
-
+
if (!FDecl->getIdentifier())
return 0;
@@ -334,18 +334,18 @@
CalleeType = FnTypePtr->getPointeeType();
else if (const BlockPointerType *BPT = CalleeType->getAs<BlockPointerType>())
CalleeType = BPT->getPointeeType();
-
+
const FunctionType *FnType = CalleeType->getAsFunctionType();
return FnType->getResultType();
}
-MemberExpr::MemberExpr(Expr *base, bool isarrow, NestedNameSpecifier *qual,
- SourceRange qualrange, NamedDecl *memberdecl,
+MemberExpr::MemberExpr(Expr *base, bool isarrow, NestedNameSpecifier *qual,
+ SourceRange qualrange, NamedDecl *memberdecl,
SourceLocation l, bool has_explicit,
SourceLocation langle,
const TemplateArgument *targs, unsigned numtargs,
SourceLocation rangle, QualType ty)
- : Expr(MemberExprClass, ty,
+ : Expr(MemberExprClass, ty,
base->isTypeDependent() || (qual && qual->isDependent()),
base->isValueDependent() || (qual && qual->isDependent())),
Base(base), MemberDecl(memberdecl), MemberLoc(l), IsArrow(isarrow),
@@ -356,26 +356,26 @@
NQ->NNS = qual;
NQ->Range = qualrange;
}
-
+
// Initialize the explicit template argument list, if any.
if (HasExplicitTemplateArgumentList) {
- ExplicitTemplateArgumentList *ETemplateArgs
+ ExplicitTemplateArgumentList *ETemplateArgs
= getExplicitTemplateArgumentList();
ETemplateArgs->LAngleLoc = langle;
ETemplateArgs->RAngleLoc = rangle;
ETemplateArgs->NumTemplateArgs = numtargs;
-
+
TemplateArgument *TemplateArgs = ETemplateArgs->getTemplateArgs();
for (unsigned I = 0; I < numtargs; ++I)
- new (TemplateArgs + I) TemplateArgument(targs[I]);
+ new (TemplateArgs + I) TemplateArgument(targs[I]);
}
}
-MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow,
- NestedNameSpecifier *qual,
+MemberExpr *MemberExpr::Create(ASTContext &C, Expr *base, bool isarrow,
+ NestedNameSpecifier *qual,
SourceRange qualrange,
- NamedDecl *memberdecl,
- SourceLocation l,
+ NamedDecl *memberdecl,
+ SourceLocation l,
bool has_explicit,
SourceLocation langle,
const TemplateArgument *targs,
@@ -385,11 +385,11 @@
std::size_t Size = sizeof(MemberExpr);
if (qual != 0)
Size += sizeof(NameQualifier);
-
+
if (has_explicit)
- Size += sizeof(ExplicitTemplateArgumentList) +
+ Size += sizeof(ExplicitTemplateArgumentList) +
sizeof(TemplateArgument) * numtargs;
-
+
void *Mem = C.Allocate(Size, llvm::alignof<MemberExpr>());
return new (Mem) MemberExpr(base, isarrow, qual, qualrange, memberdecl, l,
has_explicit, langle, targs, numtargs, rangle,
@@ -423,7 +423,7 @@
case CastExpr::CK_ConstructorConversion:
return "ConstructorConversion";
}
-
+
assert(0 && "Unhandled cast kind!");
return 0;
}
@@ -469,7 +469,7 @@
return "";
}
-BinaryOperator::Opcode
+BinaryOperator::Opcode
BinaryOperator::getOverloadedOpcode(OverloadedOperatorKind OO) {
switch (OO) {
default: assert(false && "Not an overloadable binary operator");
@@ -531,13 +531,13 @@
return OverOps[Opc];
}
-InitListExpr::InitListExpr(SourceLocation lbraceloc,
+InitListExpr::InitListExpr(SourceLocation lbraceloc,
Expr **initExprs, unsigned numInits,
SourceLocation rbraceloc)
: Expr(InitListExprClass, QualType(),
hasAnyTypeDependentArguments(initExprs, numInits),
hasAnyValueDependentArguments(initExprs, numInits)),
- LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), SyntacticForm(0),
+ LBraceLoc(lbraceloc), RBraceLoc(rbraceloc), SyntacticForm(0),
UnionFieldInit(0), HadArrayRangeDesignator(false) {
InitExprs.insert(InitExprs.end(), initExprs, initExprs+numInits);
@@ -561,7 +561,7 @@
InitExprs.back() = expr;
return 0;
}
-
+
Expr *Result = cast_or_null<Expr>(InitExprs[Init]);
InitExprs[Init] = expr;
return Result;
@@ -574,14 +574,14 @@
getPointeeType()->getAsFunctionType();
}
-SourceLocation BlockExpr::getCaretLocation() const {
- return TheBlock->getCaretLocation();
+SourceLocation BlockExpr::getCaretLocation() const {
+ return TheBlock->getCaretLocation();
}
-const Stmt *BlockExpr::getBody() const {
+const Stmt *BlockExpr::getBody() const {
return TheBlock->getBody();
}
-Stmt *BlockExpr::getBody() {
- return TheBlock->getBody();
+Stmt *BlockExpr::getBody() {
+ return TheBlock->getBody();
}
@@ -599,7 +599,7 @@
// instantiating to void.
if (isTypeDependent())
return false;
-
+
switch (getStmtClass()) {
default:
Loc = getExprLoc();
@@ -610,7 +610,7 @@
isUnusedResultAWarning(Loc, R1, R2);
case UnaryOperatorClass: {
const UnaryOperator *UO = cast<UnaryOperator>(this);
-
+
switch (UO->getOpcode()) {
default: break;
case UnaryOperator::PostInc:
@@ -642,7 +642,7 @@
if (BO->getOpcode() == BinaryOperator::Comma)
return BO->getRHS()->isUnusedResultAWarning(Loc, R1, R2) ||
BO->getLHS()->isUnusedResultAWarning(Loc, R1, R2);
-
+
if (BO->isAssignmentOp())
return false;
Loc = BO->getOperatorLoc();
@@ -657,7 +657,7 @@
// The condition must be evaluated, but if either the LHS or RHS is a
// warning, warn about them.
const ConditionalOperator *Exp = cast<ConditionalOperator>(this);
- if (Exp->getLHS() &&
+ if (Exp->getLHS() &&
Exp->getLHS()->isUnusedResultAWarning(Loc, R1, R2))
return true;
return Exp->getRHS()->isUnusedResultAWarning(Loc, R1, R2);
@@ -672,7 +672,7 @@
R1 = SourceRange(Loc, Loc);
R2 = cast<MemberExpr>(this)->getBase()->getSourceRange();
return true;
-
+
case ArraySubscriptExprClass:
// If the base pointer or element is to a volatile pointer/field, accessing
// it is a side effect.
@@ -697,7 +697,7 @@
FD->getAttr<PureAttr>() || FD->getAttr<ConstAttr>()) {
Loc = CE->getCallee()->getLocStart();
R1 = CE->getCallee()->getSourceRange();
-
+
if (unsigned NumArgs = CE->getNumArgs())
R2 = SourceRange(CE->getArg(0)->getLocStart(),
CE->getArg(NumArgs-1)->getLocEnd());
@@ -708,10 +708,10 @@
}
case ObjCMessageExprClass:
return false;
-
+
case ObjCImplicitSetterGetterRefExprClass: { // Dot syntax for message send.
#if 0
- const ObjCImplicitSetterGetterRefExpr *Ref =
+ const ObjCImplicitSetterGetterRefExpr *Ref =
cast<ObjCImplicitSetterGetterRefExpr>(this);
// FIXME: We really want the location of the '.' here.
Loc = Ref->getLocation();
@@ -734,7 +734,7 @@
if (!CS->body_empty())
if (const Expr *E = dyn_cast<Expr>(CS->body_back()))
return E->isUnusedResultAWarning(Loc, R1, R2);
-
+
Loc = cast<StmtExpr>(this)->getLParenLoc();
R1 = getSourceRange();
return true;
@@ -756,7 +756,7 @@
Loc = cast<CXXFunctionalCastExpr>(this)->getTypeBeginLoc();
R1 = cast<CXXFunctionalCastExpr>(this)->getSubExpr()->getSourceRange();
return true;
-
+
case ImplicitCastExprClass:
// Check the operand, since implicit casts are inserted by Sema
return cast<ImplicitCastExpr>(this)
@@ -785,7 +785,7 @@
static bool DeclCanBeLvalue(const NamedDecl *Decl, ASTContext &Ctx) {
// C++ [temp.param]p6:
// A non-type non-reference template-parameter is not an lvalue.
- if (const NonTypeTemplateParmDecl *NTTParm
+ if (const NonTypeTemplateParmDecl *NTTParm
= dyn_cast<NonTypeTemplateParmDecl>(Decl))
return NTTParm->getType()->isReferenceType();
@@ -838,7 +838,7 @@
if (cast<ArraySubscriptExpr>(this)->getBase()->getType()->isVectorType())
return cast<ArraySubscriptExpr>(this)->getBase()->isLvalue(Ctx);
return LV_Valid;
- case DeclRefExprClass:
+ case DeclRefExprClass:
case QualifiedDeclRefExprClass: { // C99 6.5.1p2
const NamedDecl *RefdDecl = cast<DeclRefExpr>(this)->getDecl();
if (DeclCanBeLvalue(RefdDecl, Ctx))
@@ -885,7 +885,7 @@
// Not an lvalue.
return LV_InvalidExpression;
- }
+ }
// C99 6.5.2.3p4
return m->isArrow() ? LV_Valid : m->getBase()->isLvalue(Ctx);
@@ -905,7 +905,7 @@
return LV_Valid;
break;
case ImplicitCastExprClass:
- return cast<ImplicitCastExpr>(this)->isLvalueCast()? LV_Valid
+ return cast<ImplicitCastExpr>(this)->isLvalueCast()? LV_Valid
: LV_InvalidExpression;
case ParenExprClass: // C99 6.5.1p5
return cast<ParenExpr>(this)->getSubExpr()->isLvalue(Ctx);
@@ -927,7 +927,7 @@
return LV_InvalidExpression;
if (Ctx.getLangOptions().CPlusPlus)
- // C++ [expr.ass]p1:
+ // C++ [expr.ass]p1:
// The result of an assignment operation [...] is an lvalue.
return LV_Valid;
@@ -936,7 +936,7 @@
// An assignment expression [...] is not an lvalue.
return LV_InvalidExpression;
}
- case CallExprClass:
+ case CallExprClass:
case CXXOperatorCallExprClass:
case CXXMemberCallExprClass: {
// C++0x [expr.call]p10
@@ -1023,15 +1023,15 @@
/// isModifiableLvalue - C99 6.3.2.1: an lvalue that does not have array type,
/// does not have an incomplete type, does not have a const-qualified type, and
-/// if it is a structure or union, does not have any member (including,
+/// if it is a structure or union, does not have any member (including,
/// recursively, any member or element of all contained aggregates or unions)
/// with a const-qualified type.
-Expr::isModifiableLvalueResult
+Expr::isModifiableLvalueResult
Expr::isModifiableLvalue(ASTContext &Ctx, SourceLocation *Loc) const {
isLvalueResult lvalResult = isLvalue(Ctx);
-
+
switch (lvalResult) {
- case LV_Valid:
+ case LV_Valid:
// C++ 3.10p11: Functions cannot be modified, but pointers to
// functions can be modifiable.
if (Ctx.getLangOptions().CPlusPlus && TR->isFunctionType())
@@ -1068,27 +1068,27 @@
}
QualType CT = Ctx.getCanonicalType(getType());
-
+
if (CT.isConstQualified())
return MLV_ConstQualified;
if (CT->isArrayType())
return MLV_ArrayType;
if (CT->isIncompleteType())
return MLV_IncompleteType;
-
+
if (const RecordType *r = CT->getAs<RecordType>()) {
- if (r->hasConstFields())
+ if (r->hasConstFields())
return MLV_ConstQualified;
}
-
+
// Assigning to an 'implicit' property?
else if (isa<ObjCImplicitSetterGetterRefExpr>(this)) {
- const ObjCImplicitSetterGetterRefExpr* Expr =
+ const ObjCImplicitSetterGetterRefExpr* Expr =
cast<ObjCImplicitSetterGetterRefExpr>(this);
if (Expr->getSetterMethod() == 0)
return MLV_NoSetterProperty;
}
- return MLV_Valid;
+ return MLV_Valid;
}
/// isOBJCGCCandidate - Check if an expression is objc gc'able.
@@ -1131,7 +1131,7 @@
Expr* E = this;
while (ParenExpr* P = dyn_cast<ParenExpr>(E))
E = P->getSubExpr();
-
+
return E;
}
@@ -1159,17 +1159,17 @@
E = P->getSubExpr();
continue;
}
-
+
if (CastExpr *P = dyn_cast<CastExpr>(E)) {
// We ignore integer <-> casts that are of the same width, ptr<->ptr and
// ptr<->int casts of the same width. We also ignore all identify casts.
Expr *SE = P->getSubExpr();
-
+
if (Ctx.hasSameUnqualifiedType(E->getType(), SE->getType())) {
E = SE;
continue;
}
-
+
if ((E->getType()->isPointerType() || E->getType()->isIntegralType()) &&
(SE->getType()->isPointerType() || SE->getType()->isIntegralType()) &&
Ctx.getTypeSize(E->getType()) == Ctx.getTypeSize(SE->getType())) {
@@ -1177,7 +1177,7 @@
continue;
}
}
-
+
return E;
}
}
@@ -1233,7 +1233,7 @@
const InitListExpr *Exp = cast<InitListExpr>(this);
unsigned numInits = Exp->getNumInits();
for (unsigned i = 0; i < numInits; i++) {
- if (!Exp->getInit(i)->isConstantInitializer(Ctx))
+ if (!Exp->getInit(i)->isConstantInitializer(Ctx))
return false;
}
return true;
@@ -1274,9 +1274,9 @@
// CheckICE - This function does the fundamental ICE checking: the returned
// ICEDiag contains a Val of 0, 1, or 2, and a possibly null SourceLocation.
// Note that to reduce code duplication, this helper does no evaluation
-// itself; the caller checks whether the expression is evaluatable, and
+// itself; the caller checks whether the expression is evaluatable, and
// in the rare cases where CheckICE actually cares about the evaluated
-// value, it calls into Evalute.
+// value, it calls into Evalute.
//
// Meanings of Val:
// 0: This expression is an ICE if it can be evaluated by Evaluate.
@@ -1323,7 +1323,7 @@
case Expr::TypesCompatibleExprClass:
case Expr::UnaryTypeTraitExprClass:
return NoDiag();
- case Expr::CallExprClass:
+ case Expr::CallExprClass:
case Expr::CXXOperatorCallExprClass: {
const CallExpr *CE = cast<CallExpr>(E);
if (CE->isBuiltinCall(Ctx))
@@ -1474,7 +1474,7 @@
}
case Expr::ConditionalOperatorClass: {
const ConditionalOperator *Exp = cast<ConditionalOperator>(E);
- // If the condition (ignoring parens) is a __builtin_constant_p call,
+ // If the condition (ignoring parens) is a __builtin_constant_p call,
// then only the true side is actually considered in an integer constant
// expression, and it is fully evaluated. This is an important GNU
// extension. See GCC PR38377 for discussion.
@@ -1535,15 +1535,14 @@
/// isNullPointerConstant - C99 6.3.2.3p3 - Return true if this is either an
/// integer constant expression with the value zero, or if this is one that is
/// cast to void*.
-bool Expr::isNullPointerConstant(ASTContext &Ctx) const
-{
+bool Expr::isNullPointerConstant(ASTContext &Ctx) const {
// Strip off a cast to void*, if it exists. Except in C++.
if (const ExplicitCastExpr *CE = dyn_cast<ExplicitCastExpr>(this)) {
if (!Ctx.getLangOptions().CPlusPlus) {
// Check that it is a cast to void*.
if (const PointerType *PT = CE->getType()->getAs<PointerType>()) {
QualType Pointee = PT->getPointeeType();
- if (Pointee.getCVRQualifiers() == 0 &&
+ if (Pointee.getCVRQualifiers() == 0 &&
Pointee->isVoidType() && // to void*
CE->getSubExpr()->getType()->isIntegerType()) // from int.
return CE->getSubExpr()->isNullPointerConstant(Ctx);
@@ -1556,7 +1555,7 @@
// Accept ((void*)0) as a null pointer constant, as many other
// implementations do.
return PE->getSubExpr()->isNullPointerConstant(Ctx);
- } else if (const CXXDefaultArgExpr *DefaultArg
+ } else if (const CXXDefaultArgExpr *DefaultArg
= dyn_cast<CXXDefaultArgExpr>(this)) {
// See through default argument expressions
return DefaultArg->getExpr()->isNullPointerConstant(Ctx);
@@ -1572,7 +1571,7 @@
// This expression must be an integer type.
if (!getType()->isIntegerType())
return false;
-
+
// If we have an integer constant expression, we need to *evaluate* it and
// test for the value 0.
llvm::APSInt Result;
@@ -1612,20 +1611,20 @@
unsigned length = Accessor->getLength();
// Halving swizzles do not contain duplicate elements.
- if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") ||
+ if (!strcmp(compStr, "hi") || !strcmp(compStr, "lo") ||
!strcmp(compStr, "even") || !strcmp(compStr, "odd"))
return false;
-
+
// Advance past s-char prefix on hex swizzles.
if (*compStr == 's' || *compStr == 'S') {
compStr++;
length--;
}
-
+
for (unsigned i = 0; i != length-1; i++) {
const char *s = compStr+i;
for (const char c = *s++; *s; s++)
- if (c == *s)
+ if (c == *s)
return true;
}
return false;
@@ -1637,15 +1636,15 @@
const char *compStr = Accessor->getName();
if (*compStr == 's' || *compStr == 'S')
compStr++;
-
+
bool isHi = !strcmp(compStr, "hi");
bool isLo = !strcmp(compStr, "lo");
bool isEven = !strcmp(compStr, "even");
bool isOdd = !strcmp(compStr, "odd");
-
+
for (unsigned i = 0, e = getNumElements(); i != e; ++i) {
uint64_t Index;
-
+
if (isHi)
Index = e + i;
else if (isLo)
@@ -1666,7 +1665,7 @@
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
- : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+ : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
@@ -1679,13 +1678,13 @@
RBracloc = RBrac;
}
-// constructor for class messages.
+// constructor for class messages.
// FIXME: clsName should be typed to ObjCInterfaceType
ObjCMessageExpr::ObjCMessageExpr(IdentifierInfo *clsName, Selector selInfo,
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
- : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+ : Expr(ObjCMessageExprClass, retType), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
@@ -1698,12 +1697,12 @@
RBracloc = RBrac;
}
-// constructor for class messages.
+// constructor for class messages.
ObjCMessageExpr::ObjCMessageExpr(ObjCInterfaceDecl *cls, Selector selInfo,
QualType retType, ObjCMethodDecl *mproto,
SourceLocation LBrac, SourceLocation RBrac,
Expr **ArgExprs, unsigned nargs)
-: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
+: Expr(ObjCMessageExprClass, retType), SelName(selInfo),
MethodProto(mproto) {
NumArgs = nargs;
SubExprs = new Stmt*[NumArgs+1];
@@ -1753,7 +1752,7 @@
SubExprs = new (C) Stmt* [NumExprs];
this->NumExprs = NumExprs;
memcpy(SubExprs, Exprs, sizeof(Expr *) * NumExprs);
-}
+}
void ShuffleVectorExpr::DoDestroy(ASTContext& C) {
DestroyChildren(C);
@@ -1788,17 +1787,17 @@
return getField()->getIdentifier();
}
-DesignatedInitExpr::DesignatedInitExpr(QualType Ty, unsigned NumDesignators,
+DesignatedInitExpr::DesignatedInitExpr(QualType Ty, unsigned NumDesignators,
const Designator *Designators,
- SourceLocation EqualOrColonLoc,
+ SourceLocation EqualOrColonLoc,
bool GNUSyntax,
- Expr **IndexExprs,
+ Expr **IndexExprs,
unsigned NumIndexExprs,
Expr *Init)
- : Expr(DesignatedInitExprClass, Ty,
+ : Expr(DesignatedInitExprClass, Ty,
Init->isTypeDependent(), Init->isValueDependent()),
- EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax),
- NumDesignators(NumDesignators), NumSubExprs(NumIndexExprs + 1) {
+ EqualOrColonLoc(EqualOrColonLoc), GNUSyntax(GNUSyntax),
+ NumDesignators(NumDesignators), NumSubExprs(NumIndexExprs + 1) {
this->Designators = new Designator[NumDesignators];
// Record the initializer itself.
@@ -1814,7 +1813,7 @@
if (this->Designators[I].isArrayDesignator()) {
// Compute type- and value-dependence.
Expr *Index = IndexExprs[IndexIdx];
- ValueDependent = ValueDependent ||
+ ValueDependent = ValueDependent ||
Index->isTypeDependent() || Index->isValueDependent();
// Copy the index expressions into permanent storage.
@@ -1823,7 +1822,7 @@
// Compute type- and value-dependence.
Expr *Start = IndexExprs[IndexIdx];
Expr *End = IndexExprs[IndexIdx + 1];
- ValueDependent = ValueDependent ||
+ ValueDependent = ValueDependent ||
Start->isTypeDependent() || Start->isValueDependent() ||
End->isTypeDependent() || End->isValueDependent();
@@ -1837,7 +1836,7 @@
}
DesignatedInitExpr *
-DesignatedInitExpr::Create(ASTContext &C, Designator *Designators,
+DesignatedInitExpr::Create(ASTContext &C, Designator *Designators,
unsigned NumDesignators,
Expr **IndexExprs, unsigned NumIndexExprs,
SourceLocation ColonOrEqualLoc,
@@ -1849,14 +1848,14 @@
IndexExprs, NumIndexExprs, Init);
}
-DesignatedInitExpr *DesignatedInitExpr::CreateEmpty(ASTContext &C,
+DesignatedInitExpr *DesignatedInitExpr::CreateEmpty(ASTContext &C,
unsigned NumIndexExprs) {
void *Mem = C.Allocate(sizeof(DesignatedInitExpr) +
sizeof(Stmt *) * (NumIndexExprs + 1), 8);
return new (Mem) DesignatedInitExpr(NumIndexExprs + 1);
}
-void DesignatedInitExpr::setDesignators(const Designator *Desigs,
+void DesignatedInitExpr::setDesignators(const Designator *Desigs,
unsigned NumDesigs) {
if (Designators)
delete [] Designators;
@@ -1891,7 +1890,7 @@
}
Expr *DesignatedInitExpr::getArrayRangeStart(const Designator& D) {
- assert(D.Kind == Designator::ArrayRangeDesignator &&
+ assert(D.Kind == Designator::ArrayRangeDesignator &&
"Requires array range designator");
char* Ptr = static_cast<char*>(static_cast<void *>(this));
Ptr += sizeof(DesignatedInitExpr);
@@ -1900,7 +1899,7 @@
}
Expr *DesignatedInitExpr::getArrayRangeEnd(const Designator& D) {
- assert(D.Kind == Designator::ArrayRangeDesignator &&
+ assert(D.Kind == Designator::ArrayRangeDesignator &&
"Requires array range designator");
char* Ptr = static_cast<char*>(static_cast<void *>(this));
Ptr += sizeof(DesignatedInitExpr);
@@ -1910,8 +1909,8 @@
/// \brief Replaces the designator at index @p Idx with the series
/// of designators in [First, Last).
-void DesignatedInitExpr::ExpandDesignator(unsigned Idx,
- const Designator *First,
+void DesignatedInitExpr::ExpandDesignator(unsigned Idx,
+ const Designator *First,
const Designator *Last) {
unsigned NumNewDesignators = Last - First;
if (NumNewDesignators == 0) {
@@ -1925,7 +1924,7 @@
return;
}
- Designator *NewDesignators
+ Designator *NewDesignators
= new Designator[NumDesignators - 1 + NumNewDesignators];
std::copy(Designators, Designators + Idx, NewDesignators);
std::copy(First, Last, NewDesignators + Idx);
@@ -1941,14 +1940,14 @@
Expr::DoDestroy(C);
}
-ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc,
+ParenListExpr::ParenListExpr(ASTContext& C, SourceLocation lparenloc,
Expr **exprs, unsigned nexprs,
SourceLocation rparenloc)
: Expr(ParenListExprClass, QualType(),
hasAnyTypeDependentArguments(exprs, nexprs),
- hasAnyValueDependentArguments(exprs, nexprs)),
+ hasAnyValueDependentArguments(exprs, nexprs)),
NumExprs(nexprs), LParenLoc(lparenloc), RParenLoc(rparenloc) {
-
+
Exprs = new (C) Stmt*[nexprs];
for (unsigned i = 0; i != nexprs; ++i)
Exprs[i] = exprs[i];
@@ -1991,11 +1990,11 @@
Stmt::child_iterator ObjCPropertyRefExpr::child_end() { return &Base+1; }
// ObjCImplicitSetterGetterRefExpr
-Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() {
- return &Base;
+Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_begin() {
+ return &Base;
}
-Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() {
- return &Base+1;
+Stmt::child_iterator ObjCImplicitSetterGetterRefExpr::child_end() {
+ return &Base+1;
}
// ObjCSuperExpr
@@ -2039,7 +2038,7 @@
Stmt::child_iterator UnaryOperator::child_end() { return &Val+1; }
// SizeOfAlignOfExpr
-Stmt::child_iterator SizeOfAlignOfExpr::child_begin() {
+Stmt::child_iterator SizeOfAlignOfExpr::child_begin() {
// If this is of a type and the type is a VLA type (and not a typedef), the
// size expression of the VLA needs to be treated as an executable expression.
// Why isn't this weirdness documented better in StmtIterator?
@@ -2161,12 +2160,12 @@
}
// ImplicitValueInitExpr
-Stmt::child_iterator ImplicitValueInitExpr::child_begin() {
- return child_iterator();
+Stmt::child_iterator ImplicitValueInitExpr::child_begin() {
+ return child_iterator();
}
-Stmt::child_iterator ImplicitValueInitExpr::child_end() {
- return child_iterator();
+Stmt::child_iterator ImplicitValueInitExpr::child_end() {
+ return child_iterator();
}
// ParenListExpr
@@ -2178,7 +2177,7 @@
}
// ObjCStringLiteral
-Stmt::child_iterator ObjCStringLiteral::child_begin() {
+Stmt::child_iterator ObjCStringLiteral::child_begin() {
return &String;
}
Stmt::child_iterator ObjCStringLiteral::child_end() {
@@ -2190,7 +2189,7 @@
Stmt::child_iterator ObjCEncodeExpr::child_end() { return child_iterator(); }
// ObjCSelectorExpr
-Stmt::child_iterator ObjCSelectorExpr::child_begin() {
+Stmt::child_iterator ObjCSelectorExpr::child_begin() {
return child_iterator();
}
Stmt::child_iterator ObjCSelectorExpr::child_end() {
@@ -2206,7 +2205,7 @@
}
// ObjCMessageExpr
-Stmt::child_iterator ObjCMessageExpr::child_begin() {
+Stmt::child_iterator ObjCMessageExpr::child_begin() {
return getReceiver() ? &SubExprs[0] : &SubExprs[0] + ARGS_START;
}
Stmt::child_iterator ObjCMessageExpr::child_end() {
diff --git a/lib/AST/ExprCXX.cpp b/lib/AST/ExprCXX.cpp
index 7c36caa..7f39793 100644
--- a/lib/AST/ExprCXX.cpp
+++ b/lib/AST/ExprCXX.cpp
@@ -30,7 +30,7 @@
}
// CXXBoolLiteralExpr
-Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
+Stmt::child_iterator CXXBoolLiteralExpr::child_begin() {
return child_iterator();
}
Stmt::child_iterator CXXBoolLiteralExpr::child_end() {
@@ -38,7 +38,7 @@
}
// CXXNullPtrLiteralExpr
-Stmt::child_iterator CXXNullPtrLiteralExpr::child_begin() {
+Stmt::child_iterator CXXNullPtrLiteralExpr::child_begin() {
return child_iterator();
}
Stmt::child_iterator CXXNullPtrLiteralExpr::child_end() {
@@ -65,7 +65,7 @@
}
// CXXZeroInitValueExpr
-Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
+Stmt::child_iterator CXXZeroInitValueExpr::child_begin() {
return child_iterator();
}
Stmt::child_iterator CXXZeroInitValueExpr::child_end() {
@@ -93,8 +93,7 @@
Initializer(initializer), Array(arraySize), NumPlacementArgs(numPlaceArgs),
NumConstructorArgs(numConsArgs), OperatorNew(operatorNew),
OperatorDelete(operatorDelete), Constructor(constructor),
- StartLoc(startLoc), EndLoc(endLoc)
-{
+ StartLoc(startLoc), EndLoc(endLoc) {
unsigned TotalSize = Array + NumPlacementArgs + NumConstructorArgs;
SubExprs = new Stmt*[TotalSize];
unsigned i = 0;
@@ -123,8 +122,8 @@
}
// UnresolvedFunctionNameExpr
-Stmt::child_iterator UnresolvedFunctionNameExpr::child_begin() {
- return child_iterator();
+Stmt::child_iterator UnresolvedFunctionNameExpr::child_begin() {
+ return child_iterator();
}
Stmt::child_iterator UnresolvedFunctionNameExpr::child_end() {
return child_iterator();
@@ -147,16 +146,16 @@
}
TemplateIdRefExpr::TemplateIdRefExpr(QualType T,
- NestedNameSpecifier *Qualifier,
+ NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
- TemplateName Template,
+ TemplateName Template,
SourceLocation TemplateNameLoc,
- SourceLocation LAngleLoc,
+ SourceLocation LAngleLoc,
const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs,
SourceLocation RAngleLoc)
: Expr(TemplateIdRefExprClass, T,
- (Template.isDependent() ||
+ (Template.isDependent() ||
TemplateSpecializationType::anyDependentTemplateArguments(
TemplateArgs, NumTemplateArgs)),
(Template.isDependent() ||
@@ -164,10 +163,8 @@
TemplateArgs, NumTemplateArgs))),
Qualifier(Qualifier), QualifierRange(QualifierRange), Template(Template),
TemplateNameLoc(TemplateNameLoc), LAngleLoc(LAngleLoc),
- RAngleLoc(RAngleLoc), NumTemplateArgs(NumTemplateArgs)
-
-{
- TemplateArgument *StoredTemplateArgs
+ RAngleLoc(RAngleLoc), NumTemplateArgs(NumTemplateArgs) {
+ TemplateArgument *StoredTemplateArgs
= reinterpret_cast<TemplateArgument *> (this+1);
for (unsigned I = 0; I != NumTemplateArgs; ++I)
new (StoredTemplateArgs + I) TemplateArgument(TemplateArgs[I]);
@@ -175,10 +172,10 @@
TemplateIdRefExpr *
TemplateIdRefExpr::Create(ASTContext &Context, QualType T,
- NestedNameSpecifier *Qualifier,
+ NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
TemplateName Template, SourceLocation TemplateNameLoc,
- SourceLocation LAngleLoc,
+ SourceLocation LAngleLoc,
const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs, SourceLocation RAngleLoc) {
void *Mem = Context.Allocate(sizeof(TemplateIdRefExpr) +
@@ -298,7 +295,7 @@
if (Kind == OO_PlusPlus || Kind == OO_MinusMinus) {
if (getNumArgs() == 1)
// Prefix operator
- return SourceRange(getOperatorLoc(),
+ return SourceRange(getOperatorLoc(),
getArg(0)->getSourceRange().getEnd());
else
// Postfix operator
@@ -343,7 +340,7 @@
}
}
-CXXTemporary *CXXTemporary::Create(ASTContext &C,
+CXXTemporary *CXXTemporary::Create(ASTContext &C,
const CXXDestructorDecl *Destructor) {
return new (C) CXXTemporary(Destructor);
}
@@ -353,10 +350,10 @@
Ctx.Deallocate(this);
}
-CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C,
+CXXBindTemporaryExpr *CXXBindTemporaryExpr::Create(ASTContext &C,
CXXTemporary *Temp,
Expr* SubExpr) {
- assert(SubExpr->getType()->isRecordType() &&
+ assert(SubExpr->getType()->isRecordType() &&
"Expression bound to a temporary must have record type!");
return new (C) CXXBindTemporaryExpr(Temp, SubExpr);
@@ -371,46 +368,46 @@
CXXTemporaryObjectExpr::CXXTemporaryObjectExpr(ASTContext &C,
CXXConstructorDecl *Cons,
QualType writtenTy,
- SourceLocation tyBeginLoc,
+ SourceLocation tyBeginLoc,
Expr **Args,
- unsigned NumArgs,
+ unsigned NumArgs,
SourceLocation rParenLoc)
- : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons,
- false, Args, NumArgs),
+ : CXXConstructExpr(C, CXXTemporaryObjectExprClass, writtenTy, Cons,
+ false, Args, NumArgs),
TyBeginLoc(tyBeginLoc), RParenLoc(rParenLoc) {
}
-CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T,
+CXXConstructExpr *CXXConstructExpr::Create(ASTContext &C, QualType T,
CXXConstructorDecl *D, bool Elidable,
Expr **Args, unsigned NumArgs) {
- return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable,
+ return new (C) CXXConstructExpr(C, CXXConstructExprClass, T, D, Elidable,
Args, NumArgs);
}
-CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
+CXXConstructExpr::CXXConstructExpr(ASTContext &C, StmtClass SC, QualType T,
CXXConstructorDecl *D, bool elidable,
- Expr **args, unsigned numargs)
+ Expr **args, unsigned numargs)
: Expr(SC, T,
T->isDependentType(),
(T->isDependentType() ||
CallExpr::hasAnyValueDependentArguments(args, numargs))),
Constructor(D), Elidable(elidable), Args(0), NumArgs(numargs) {
// leave room for default arguments;
- const FunctionProtoType *FTy =
+ const FunctionProtoType *FTy =
cast<FunctionDecl>(D)->getType()->getAsFunctionProtoType();
-
+
unsigned NumArgsInProto = FTy->getNumArgs();
unsigned NumArgsToAllocate = FTy->isVariadic() ? NumArgs : NumArgsInProto;
if (NumArgsToAllocate) {
Args = new (C) Stmt*[NumArgsToAllocate];
-
+
for (unsigned i = 0; i != NumArgs; ++i)
Args[i] = args[i];
-
+
// Set default arguments to 0.
for (unsigned i = NumArgs; i != NumArgsToAllocate; ++i)
Args[i] = 0;
-
+
NumArgs = NumArgsToAllocate;
}
}
@@ -423,13 +420,13 @@
C.Deallocate(this);
}
-CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr,
- CXXTemporary **temps,
+CXXExprWithTemporaries::CXXExprWithTemporaries(Expr *subexpr,
+ CXXTemporary **temps,
unsigned numtemps,
bool shoulddestroytemps)
: Expr(CXXExprWithTemporariesClass, subexpr->getType(),
- subexpr->isTypeDependent(), subexpr->isValueDependent()),
- SubExpr(subexpr), Temps(0), NumTemps(numtemps),
+ subexpr->isTypeDependent(), subexpr->isValueDependent()),
+ SubExpr(subexpr), Temps(0), NumTemps(numtemps),
ShouldDestroyTemps(shoulddestroytemps) {
if (NumTemps > 0) {
Temps = new CXXTemporary*[NumTemps];
@@ -438,12 +435,12 @@
}
}
-CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C,
+CXXExprWithTemporaries *CXXExprWithTemporaries::Create(ASTContext &C,
Expr *SubExpr,
- CXXTemporary **Temps,
+ CXXTemporary **Temps,
unsigned NumTemps,
bool ShouldDestroyTemps){
- return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps,
+ return new (C) CXXExprWithTemporaries(SubExpr, Temps, NumTemps,
ShouldDestroyTemps);
}
@@ -462,7 +459,7 @@
return &SubExpr;
}
-Stmt::child_iterator CXXBindTemporaryExpr::child_end() {
+Stmt::child_iterator CXXBindTemporaryExpr::child_end() {
return &SubExpr + 1;
}
@@ -479,7 +476,7 @@
return &SubExpr;
}
-Stmt::child_iterator CXXExprWithTemporaries::child_end() {
+Stmt::child_iterator CXXExprWithTemporaries::child_end() {
return &SubExpr + 1;
}
@@ -502,7 +499,7 @@
}
CXXUnresolvedConstructExpr *
-CXXUnresolvedConstructExpr::Create(ASTContext &C,
+CXXUnresolvedConstructExpr::Create(ASTContext &C,
SourceLocation TyBegin,
QualType T,
SourceLocation LParenLoc,
@@ -523,8 +520,8 @@
return child_iterator(reinterpret_cast<Stmt **>(this + 1) + NumArgs);
}
-CXXUnresolvedMemberExpr::CXXUnresolvedMemberExpr(ASTContext &C,
- Expr *Base, bool IsArrow,
+CXXUnresolvedMemberExpr::CXXUnresolvedMemberExpr(ASTContext &C,
+ Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
@@ -537,29 +534,28 @@
unsigned NumTemplateArgs,
SourceLocation RAngleLoc)
: Expr(CXXUnresolvedMemberExprClass, C.DependentTy, true, true),
- Base(Base), IsArrow(IsArrow),
+ Base(Base), IsArrow(IsArrow),
HasExplicitTemplateArgumentList(HasExplicitTemplateArgs),
OperatorLoc(OperatorLoc),
Qualifier(Qualifier), QualifierRange(QualifierRange),
FirstQualifierFoundInScope(FirstQualifierFoundInScope),
- Member(Member), MemberLoc(MemberLoc)
-{
+ Member(Member), MemberLoc(MemberLoc) {
if (HasExplicitTemplateArgumentList) {
- ExplicitTemplateArgumentList *ETemplateArgs
+ ExplicitTemplateArgumentList *ETemplateArgs
= getExplicitTemplateArgumentList();
ETemplateArgs->LAngleLoc = LAngleLoc;
ETemplateArgs->RAngleLoc = RAngleLoc;
ETemplateArgs->NumTemplateArgs = NumTemplateArgs;
-
+
TemplateArgument *SavedTemplateArgs = ETemplateArgs->getTemplateArgs();
for (unsigned I = 0; I < NumTemplateArgs; ++I)
- new (SavedTemplateArgs + I) TemplateArgument(TemplateArgs[I]);
+ new (SavedTemplateArgs + I) TemplateArgument(TemplateArgs[I]);
}
}
CXXUnresolvedMemberExpr *
-CXXUnresolvedMemberExpr::Create(ASTContext &C,
- Expr *Base, bool IsArrow,
+CXXUnresolvedMemberExpr::Create(ASTContext &C,
+ Expr *Base, bool IsArrow,
SourceLocation OperatorLoc,
NestedNameSpecifier *Qualifier,
SourceRange QualifierRange,
@@ -570,16 +566,15 @@
SourceLocation LAngleLoc,
const TemplateArgument *TemplateArgs,
unsigned NumTemplateArgs,
- SourceLocation RAngleLoc)
-{
+ SourceLocation RAngleLoc) {
if (!HasExplicitTemplateArgs)
return new (C) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,
Qualifier, QualifierRange,
FirstQualifierFoundInScope,
Member, MemberLoc);
-
+
void *Mem = C.Allocate(sizeof(CXXUnresolvedMemberExpr) +
- sizeof(ExplicitTemplateArgumentList) +
+ sizeof(ExplicitTemplateArgumentList) +
sizeof(TemplateArgument) * NumTemplateArgs,
llvm::alignof<CXXUnresolvedMemberExpr>());
return new (Mem) CXXUnresolvedMemberExpr(C, Base, IsArrow, OperatorLoc,
diff --git a/lib/AST/ExprConstant.cpp b/lib/AST/ExprConstant.cpp
index 7d28149..4494896 100644
--- a/lib/AST/ExprConstant.cpp
+++ b/lib/AST/ExprConstant.cpp
@@ -42,11 +42,11 @@
/// certain things in certain situations.
struct EvalInfo {
ASTContext &Ctx;
-
+
/// EvalResult - Contains information about the evaluation.
Expr::EvalResult &EvalResult;
- EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx),
+ EvalInfo(ASTContext &ctx, Expr::EvalResult& evalresult) : Ctx(ctx),
EvalResult(evalresult) {}
};
@@ -104,12 +104,12 @@
return false;
}
-static APSInt HandleFloatToIntCast(QualType DestType, QualType SrcType,
+static APSInt HandleFloatToIntCast(QualType DestType, QualType SrcType,
APFloat &Value, ASTContext &Ctx) {
unsigned DestWidth = Ctx.getIntWidth(DestType);
// Determine whether we are converting to unsigned or signed.
bool DestSigned = DestType->isSignedIntegerType();
-
+
// FIXME: Warning for overflow.
uint64_t Space[4];
bool ignored;
@@ -118,16 +118,16 @@
return APSInt(llvm::APInt(DestWidth, 4, Space), !DestSigned);
}
-static APFloat HandleFloatToFloatCast(QualType DestType, QualType SrcType,
+static APFloat HandleFloatToFloatCast(QualType DestType, QualType SrcType,
APFloat &Value, ASTContext &Ctx) {
bool ignored;
APFloat Result = Value;
- Result.convert(Ctx.getFloatTypeSemantics(DestType),
+ Result.convert(Ctx.getFloatTypeSemantics(DestType),
APFloat::rmNearestTiesToEven, &ignored);
return Result;
}
-static APSInt HandleIntToIntCast(QualType DestType, QualType SrcType,
+static APSInt HandleIntToIntCast(QualType DestType, QualType SrcType,
APSInt &Value, ASTContext &Ctx) {
unsigned DestWidth = Ctx.getIntWidth(DestType);
APSInt Result = Value;
@@ -138,7 +138,7 @@
return Result;
}
-static APFloat HandleIntToFloatCast(QualType DestType, QualType SrcType,
+static APFloat HandleIntToFloatCast(QualType DestType, QualType SrcType,
APSInt &Value, ASTContext &Ctx) {
APFloat Result(Ctx.getFloatTypeSemantics(DestType), 1);
@@ -155,7 +155,7 @@
: public StmtVisitor<LValueExprEvaluator, APValue> {
EvalInfo &Info;
public:
-
+
LValueExprEvaluator(EvalInfo &info) : Info(info) {}
APValue VisitStmt(Stmt *S) {
@@ -185,8 +185,7 @@
return Result.isLValue();
}
-APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E)
-{
+APValue LValueExprEvaluator::VisitDeclRefExpr(DeclRefExpr *E) {
if (isa<FunctionDecl>(E->getDecl())) {
return APValue(E, 0);
} else if (VarDecl* VD = dyn_cast<VarDecl>(E->getDecl())) {
@@ -202,11 +201,10 @@
return APValue();
}
-APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E)
-{
+APValue LValueExprEvaluator::VisitBlockExpr(BlockExpr *E) {
if (E->hasBlockDeclRefExprs())
return APValue();
-
+
return APValue(E, 0);
}
@@ -255,13 +253,12 @@
return result;
}
-APValue LValueExprEvaluator::VisitArraySubscriptExpr(ArraySubscriptExpr *E)
-{
+APValue LValueExprEvaluator::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
APValue Result;
-
+
if (!EvaluatePointer(E->getBase(), Result, Info))
return APValue();
-
+
APSInt Index;
if (!EvaluateInteger(E->getIdx(), Index, Info))
return APValue();
@@ -269,13 +266,12 @@
uint64_t ElementSize = Info.Ctx.getTypeSize(E->getType()) / 8;
uint64_t Offset = Index.getSExtValue() * ElementSize;
- Result.setLValue(Result.getLValueBase(),
+ Result.setLValue(Result.getLValueBase(),
Result.getLValueOffset() + Offset);
return Result;
}
-APValue LValueExprEvaluator::VisitUnaryDeref(UnaryOperator *E)
-{
+APValue LValueExprEvaluator::VisitUnaryDeref(UnaryOperator *E) {
APValue Result;
if (!EvaluatePointer(E->getSubExpr(), Result, Info))
return APValue();
@@ -291,7 +287,7 @@
: public StmtVisitor<PointerExprEvaluator, APValue> {
EvalInfo &Info;
public:
-
+
PointerExprEvaluator(EvalInfo &info) : Info(info) {}
APValue VisitStmt(Stmt *S) {
@@ -337,23 +333,23 @@
if (E->getOpcode() != BinaryOperator::Add &&
E->getOpcode() != BinaryOperator::Sub)
return APValue();
-
+
const Expr *PExp = E->getLHS();
const Expr *IExp = E->getRHS();
if (IExp->getType()->isPointerType())
std::swap(PExp, IExp);
-
+
APValue ResultLValue;
if (!EvaluatePointer(PExp, ResultLValue, Info))
return APValue();
-
+
llvm::APSInt AdditionalOffset(32);
if (!EvaluateInteger(IExp, AdditionalOffset, Info))
return APValue();
QualType PointeeType = PExp->getType()->getAs<PointerType>()->getPointeeType();
uint64_t SizeOfPointee;
-
+
// Explicitly handle GNU void* and function pointer arithmetic extensions.
if (PointeeType->isVoidType() || PointeeType->isFunctionType())
SizeOfPointee = 1;
@@ -376,7 +372,7 @@
return result;
return APValue();
}
-
+
APValue PointerExprEvaluator::VisitCastExpr(const CastExpr* E) {
const Expr* SubExpr = E->getSubExpr();
@@ -389,7 +385,7 @@
return Result;
return APValue();
}
-
+
if (SubExpr->getType()->isIntegralType()) {
APValue Result;
if (!EvaluateIntegerOrLValue(SubExpr, Result, Info))
@@ -399,7 +395,7 @@
Result.getInt().extOrTrunc((unsigned)Info.Ctx.getTypeSize(E->getType()));
return APValue(0, Result.getInt().getZExtValue());
}
-
+
// Cast is of an lvalue, no need to change value.
return Result;
}
@@ -414,10 +410,10 @@
}
return APValue();
-}
+}
APValue PointerExprEvaluator::VisitCallExpr(CallExpr *E) {
- if (E->isBuiltinCall(Info.Ctx) ==
+ if (E->isBuiltinCall(Info.Ctx) ==
Builtin::BI__builtin___CFStringMakeConstantString)
return APValue(E, 0);
return APValue();
@@ -446,13 +442,13 @@
EvalInfo &Info;
APValue GetZeroVector(QualType VecType);
public:
-
+
VectorExprEvaluator(EvalInfo &info) : Info(info) {}
-
+
APValue VisitStmt(Stmt *S) {
return APValue();
}
-
+
APValue VisitParenExpr(ParenExpr *E)
{ return Visit(E->getSubExpr()); }
APValue VisitUnaryExtension(const UnaryOperator *E)
@@ -490,7 +486,7 @@
QualType EltTy = VTy->getElementType();
unsigned NElts = VTy->getNumElements();
unsigned EltWidth = Info.Ctx.getTypeSize(EltTy);
-
+
const Expr* SE = E->getSubExpr();
QualType SETy = SE->getType();
APValue Result = APValue();
@@ -540,12 +536,12 @@
// element.
APSInt Init;
Init = Result.isInt() ? Result.getInt() : Result.getFloat().bitcastToAPInt();
-
+
llvm::SmallVector<APValue, 4> Elts;
for (unsigned i = 0; i != NElts; ++i) {
APSInt Tmp = Init;
Tmp.extOrTrunc(EltWidth);
-
+
if (EltTy->isIntegerType())
Elts.push_back(APValue(Tmp));
else if (EltTy->isRealFloatingType())
@@ -558,17 +554,17 @@
return APValue(&Elts[0], Elts.size());
}
-APValue
+APValue
VectorExprEvaluator::VisitCompoundLiteralExpr(const CompoundLiteralExpr *E) {
return this->Visit(const_cast<Expr*>(E->getInitializer()));
}
-APValue
+APValue
VectorExprEvaluator::VisitInitListExpr(const InitListExpr *E) {
const VectorType *VT = E->getType()->getAsVectorType();
unsigned NumInits = E->getNumInits();
unsigned NumElements = VT->getNumElements();
-
+
QualType EltTy = VT->getElementType();
llvm::SmallVector<APValue, 4> Elements;
@@ -596,7 +592,7 @@
return APValue(&Elements[0], Elements.size());
}
-APValue
+APValue
VectorExprEvaluator::GetZeroVector(QualType T) {
const VectorType *VT = T->getAsVectorType();
QualType EltTy = VT->getElementType();
@@ -677,20 +673,20 @@
}
return false;
}
-
+
//===--------------------------------------------------------------------===//
// Visitor Methods
//===--------------------------------------------------------------------===//
-
+
bool VisitStmt(Stmt *) {
assert(0 && "This should be called on integers, stmts are not integers");
return false;
}
-
+
bool VisitExpr(Expr *E) {
return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E);
}
-
+
bool VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
bool VisitIntegerLiteral(const IntegerLiteral *E) {
@@ -705,7 +701,7 @@
// be able to strip CRV qualifiers from the type.
QualType T0 = Info.Ctx.getCanonicalType(E->getArgType1());
QualType T1 = Info.Ctx.getCanonicalType(E->getArgType2());
- return Success(Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(),
+ return Success(Info.Ctx.typesAreCompatible(T0.getUnqualifiedType(),
T1.getUnqualifiedType()),
E);
}
@@ -721,11 +717,11 @@
bool VisitCXXBoolLiteralExpr(const CXXBoolLiteralExpr *E) {
return Success(E->getValue(), E);
}
-
+
bool VisitGNUNullExpr(const GNUNullExpr *E) {
return Success(0, E);
}
-
+
bool VisitCXXZeroInitValueExpr(const CXXZeroInitValueExpr *E) {
return Success(0, E);
}
@@ -755,7 +751,7 @@
static bool EvaluateIntegerOrLValue(const Expr* E, APValue &Result, EvalInfo &Info) {
if (!E->getType()->isIntegralType())
return false;
-
+
return IntExprEvaluator(Info, Result).Visit(const_cast<Expr*>(E));
}
@@ -818,12 +814,12 @@
array_type_class, string_type_class,
lang_type_class
};
-
- // If no argument was supplied, default to "no_type_class". This isn't
+
+ // If no argument was supplied, default to "no_type_class". This isn't
// ideal, however it is what gcc does.
if (E->getNumArgs() == 0)
return no_type_class;
-
+
QualType ArgTy = E->getArg(0)->getType();
if (ArgTy->isVoidType())
return void_type_class;
@@ -864,7 +860,7 @@
return Error(E->getLocStart(), diag::note_invalid_subexpr_in_ice, E);
case Builtin::BI__builtin_classify_type:
return Success(EvaluateBuiltinClassifyType(E), E);
-
+
case Builtin::BI__builtin_constant_p:
// __builtin_constant_p always has one operand: it returns true if that
// operand can be folded, false otherwise.
@@ -889,7 +885,7 @@
// These need to be handled specially because the operands aren't
// necessarily integral
bool lhsResult, rhsResult;
-
+
if (HandleConversionToBool(E->getLHS(), lhsResult, Info)) {
// We were able to evaluate the LHS, see if we can get away with not
// evaluating the RHS: 0 && X -> 0, 1 || X -> 1
@@ -906,7 +902,7 @@
if (HandleConversionToBool(E->getRHS(), rhsResult, Info)) {
// We can't evaluate the LHS; however, sometimes the result
// is determined by the RHS: X && 0 -> 0, X || 1 -> 1.
- if (rhsResult == (E->getOpcode() == BinaryOperator::LOr) ||
+ if (rhsResult == (E->getOpcode() == BinaryOperator::LOr) ||
!rhsResult == (E->getOpcode() == BinaryOperator::LAnd)) {
// Since we weren't able to evaluate the left hand side, it
// must have had side effects.
@@ -934,9 +930,9 @@
return false;
if (LHS.isComplexFloat()) {
- APFloat::cmpResult CR_r =
+ APFloat::cmpResult CR_r =
LHS.getComplexFloatReal().compare(RHS.getComplexFloatReal());
- APFloat::cmpResult CR_i =
+ APFloat::cmpResult CR_i =
LHS.getComplexFloatImag().compare(RHS.getComplexFloatImag());
if (E->getOpcode() == BinaryOperator::EQ)
@@ -945,9 +941,9 @@
else {
assert(E->getOpcode() == BinaryOperator::NE &&
"Invalid complex comparison.");
- return Success(((CR_r == APFloat::cmpGreaterThan ||
+ return Success(((CR_r == APFloat::cmpGreaterThan ||
CR_r == APFloat::cmpLessThan) &&
- (CR_i == APFloat::cmpGreaterThan ||
+ (CR_i == APFloat::cmpGreaterThan ||
CR_i == APFloat::cmpLessThan)), E);
}
} else {
@@ -962,17 +958,17 @@
}
}
}
-
+
if (LHSTy->isRealFloatingType() &&
RHSTy->isRealFloatingType()) {
APFloat RHS(0.0), LHS(0.0);
-
+
if (!EvaluateFloat(E->getRHS(), RHS, Info))
return false;
-
+
if (!EvaluateFloat(E->getLHS(), LHS, Info))
return false;
-
+
APFloat::cmpResult CR = LHS.compare(RHS);
switch (E->getOpcode()) {
@@ -985,16 +981,16 @@
case BinaryOperator::LE:
return Success(CR == APFloat::cmpLessThan || CR == APFloat::cmpEqual, E);
case BinaryOperator::GE:
- return Success(CR == APFloat::cmpGreaterThan || CR == APFloat::cmpEqual,
+ return Success(CR == APFloat::cmpGreaterThan || CR == APFloat::cmpEqual,
E);
case BinaryOperator::EQ:
return Success(CR == APFloat::cmpEqual, E);
case BinaryOperator::NE:
- return Success(CR == APFloat::cmpGreaterThan
+ return Success(CR == APFloat::cmpGreaterThan
|| CR == APFloat::cmpLessThan, E);
}
}
-
+
if (LHSTy->isPointerType() && RHSTy->isPointerType()) {
if (E->getOpcode() == BinaryOperator::Sub || E->isEqualityOp()) {
APValue LHSValue;
@@ -1106,16 +1102,16 @@
return Success(Result.getInt() % RHS, E);
case BinaryOperator::Shl: {
// FIXME: Warn about out of range shift amounts!
- unsigned SA =
+ unsigned SA =
(unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
return Success(Result.getInt() << SA, E);
}
case BinaryOperator::Shr: {
- unsigned SA =
+ unsigned SA =
(unsigned) RHS.getLimitedValue(Result.getInt().getBitWidth()-1);
return Success(Result.getInt() >> SA, E);
}
-
+
case BinaryOperator::LT: return Success(Result.getInt() < RHS, E);
case BinaryOperator::GT: return Success(Result.getInt() > RHS, E);
case BinaryOperator::LE: return Success(Result.getInt() <= RHS, E);
@@ -1145,7 +1141,7 @@
E = E->IgnoreParens();
// alignof decl is always accepted, even if it doesn't make sense: we default
- // to 1 in those cases.
+ // to 1 in those cases.
if (const DeclRefExpr *DRE = dyn_cast<DeclRefExpr>(E))
return Info.Ctx.getDeclAlignInBytes(DRE->getDecl());
@@ -1225,7 +1221,7 @@
// If so, we could clear the diagnostic ID.
return true;
case UnaryOperator::Plus:
- // The result is always just the subexpr.
+ // The result is always just the subexpr.
return true;
case UnaryOperator::Minus:
if (!Result.isInt()) return false;
@@ -1235,7 +1231,7 @@
return Success(~Result.getInt(), E);
}
}
-
+
/// HandleCast - This is used to evaluate implicit or explicit casts where the
/// result type is integer.
bool IntExprEvaluator::VisitCastExpr(CastExpr *E) {
@@ -1263,7 +1259,7 @@
return Success(HandleIntToIntCast(DestType, SrcType,
Result.getInt(), Info.Ctx), E);
}
-
+
// FIXME: Clean this up!
if (SrcType->isPointerType()) {
APValue LV;
@@ -1317,7 +1313,7 @@
APFloat F(0.0);
if (!EvaluateFloat(SubExpr, F, Info))
return Error(E->getExprLoc(), diag::note_invalid_subexpr_in_ice, E);
-
+
return Success(HandleFloatToIntCast(DestType, SrcType, F, Info.Ctx), E);
}
@@ -1400,13 +1396,13 @@
Result = llvm::APFloat::getInf(Sem);
return true;
}
-
+
case Builtin::BI__builtin_nan:
case Builtin::BI__builtin_nanf:
case Builtin::BI__builtin_nanl:
// If this is __builtin_nan() turn this into a nan, otherwise we
// can't constant fold it.
- if (const StringLiteral *S =
+ if (const StringLiteral *S =
dyn_cast<StringLiteral>(E->getArg(0)->IgnoreParenCasts())) {
if (!S->isWide()) {
const llvm::fltSemantics &Sem =
@@ -1431,13 +1427,13 @@
case Builtin::BI__builtin_fabsl:
if (!EvaluateFloat(E->getArg(0), Result, Info))
return false;
-
+
if (Result.isNegative())
Result.changeSign();
return true;
- case Builtin::BI__builtin_copysign:
- case Builtin::BI__builtin_copysignf:
+ case Builtin::BI__builtin_copysign:
+ case Builtin::BI__builtin_copysignf:
case Builtin::BI__builtin_copysignl: {
APFloat RHS(0.);
if (!EvaluateFloat(E->getArg(0), Result, Info) ||
@@ -1458,7 +1454,7 @@
switch (E->getOpcode()) {
default: return false;
- case UnaryOperator::Plus:
+ case UnaryOperator::Plus:
return true;
case UnaryOperator::Minus:
Result.changeSign();
@@ -1499,12 +1495,12 @@
bool FloatExprEvaluator::VisitCastExpr(CastExpr *E) {
Expr* SubExpr = E->getSubExpr();
-
+
if (SubExpr->getType()->isIntegralType()) {
APSInt IntResult;
if (!EvaluateInteger(SubExpr, IntResult, Info))
return false;
- Result = HandleIntToFloatCast(E->getType(), SubExpr->getType(),
+ Result = HandleIntToFloatCast(E->getType(), SubExpr->getType(),
IntResult, Info.Ctx);
return true;
}
@@ -1533,10 +1529,10 @@
class VISIBILITY_HIDDEN ComplexExprEvaluator
: public StmtVisitor<ComplexExprEvaluator, APValue> {
EvalInfo &Info;
-
+
public:
ComplexExprEvaluator(EvalInfo &info) : Info(info) {}
-
+
//===--------------------------------------------------------------------===//
// Visitor Methods
//===--------------------------------------------------------------------===//
@@ -1544,7 +1540,7 @@
APValue VisitStmt(Stmt *S) {
return APValue();
}
-
+
APValue VisitParenExpr(ParenExpr *E) { return Visit(E->getSubExpr()); }
APValue VisitImaginaryLiteral(ImaginaryLiteral *E) {
@@ -1555,17 +1551,17 @@
if (!EvaluateFloat(SubExpr, Result, Info))
return APValue();
-
- return APValue(APFloat(Result.getSemantics(), APFloat::fcZero, false),
+
+ return APValue(APFloat(Result.getSemantics(), APFloat::fcZero, false),
Result);
} else {
- assert(SubExpr->getType()->isIntegerType() &&
+ assert(SubExpr->getType()->isIntegerType() &&
"Unexpected imaginary literal.");
llvm::APSInt Result;
if (!EvaluateInteger(SubExpr, Result, Info))
return APValue();
-
+
llvm::APSInt Zero(Result.getBitWidth(), !Result.isSigned());
Zero = 0;
return APValue(Zero, Result);
@@ -1585,7 +1581,7 @@
if (EltType->isRealFloatingType()) {
Result = HandleFloatToFloatCast(EltType, SubType, Result, Info.Ctx);
- return APValue(Result,
+ return APValue(Result,
APFloat(Result.getSemantics(), APFloat::fcZero, false));
} else {
llvm::APSInt IResult;
@@ -1603,7 +1599,7 @@
if (EltType->isRealFloatingType()) {
APFloat FResult =
HandleIntToFloatCast(EltType, SubType, Result, Info.Ctx);
- return APValue(FResult,
+ return APValue(FResult,
APFloat(FResult.getSemantics(), APFloat::fcZero, false));
} else {
Result = HandleIntToIntCast(EltType, SubType, Result, Info.Ctx);
@@ -1621,36 +1617,36 @@
if (Src.isComplexFloat()) {
if (EltType->isRealFloatingType()) {
- return APValue(HandleFloatToFloatCast(EltType, SrcType,
+ return APValue(HandleFloatToFloatCast(EltType, SrcType,
Src.getComplexFloatReal(),
Info.Ctx),
- HandleFloatToFloatCast(EltType, SrcType,
+ HandleFloatToFloatCast(EltType, SrcType,
Src.getComplexFloatImag(),
Info.Ctx));
} else {
return APValue(HandleFloatToIntCast(EltType, SrcType,
Src.getComplexFloatReal(),
Info.Ctx),
- HandleFloatToIntCast(EltType, SrcType,
+ HandleFloatToIntCast(EltType, SrcType,
Src.getComplexFloatImag(),
- Info.Ctx));
+ Info.Ctx));
}
} else {
assert(Src.isComplexInt() && "Invalid evaluate result.");
if (EltType->isRealFloatingType()) {
- return APValue(HandleIntToFloatCast(EltType, SrcType,
+ return APValue(HandleIntToFloatCast(EltType, SrcType,
Src.getComplexIntReal(),
Info.Ctx),
- HandleIntToFloatCast(EltType, SrcType,
+ HandleIntToFloatCast(EltType, SrcType,
Src.getComplexIntImag(),
Info.Ctx));
} else {
return APValue(HandleIntToIntCast(EltType, SrcType,
Src.getComplexIntReal(),
Info.Ctx),
- HandleIntToIntCast(EltType, SrcType,
+ HandleIntToIntCast(EltType, SrcType,
Src.getComplexIntImag(),
- Info.Ctx));
+ Info.Ctx));
}
}
}
@@ -1658,7 +1654,7 @@
// FIXME: Handle more casts.
return APValue();
}
-
+
APValue VisitBinaryOperator(const BinaryOperator *E);
APValue VisitChooseExpr(const ChooseExpr *E)
{ return Visit(E->getChosenSubExpr(Info.Ctx)); }
@@ -1669,23 +1665,21 @@
};
} // end anonymous namespace
-static bool EvaluateComplex(const Expr *E, APValue &Result, EvalInfo &Info)
-{
+static bool EvaluateComplex(const Expr *E, APValue &Result, EvalInfo &Info) {
Result = ComplexExprEvaluator(Info).Visit(const_cast<Expr*>(E));
assert((!Result.isComplexFloat() ||
- (&Result.getComplexFloatReal().getSemantics() ==
- &Result.getComplexFloatImag().getSemantics())) &&
+ (&Result.getComplexFloatReal().getSemantics() ==
+ &Result.getComplexFloatImag().getSemantics())) &&
"Invalid complex evaluation.");
return Result.isComplexFloat() || Result.isComplexInt();
}
-APValue ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E)
-{
+APValue ComplexExprEvaluator::VisitBinaryOperator(const BinaryOperator *E) {
APValue Result, RHS;
-
+
if (!EvaluateComplex(E->getLHS(), Result, Info))
return APValue();
-
+
if (!EvaluateComplex(E->getRHS(), RHS, Info))
return APValue();
@@ -1722,7 +1716,7 @@
APFloat &LHS_i = LHS.getComplexFloatImag();
APFloat &RHS_r = RHS.getComplexFloatReal();
APFloat &RHS_i = RHS.getComplexFloatImag();
-
+
APFloat Tmp = LHS_r;
Tmp.multiply(RHS_r, APFloat::rmNearestTiesToEven);
Result.getComplexFloatReal() = Tmp;
@@ -1738,10 +1732,10 @@
Result.getComplexFloatImag().add(Tmp, APFloat::rmNearestTiesToEven);
} else {
APValue LHS = Result;
- Result.getComplexIntReal() =
+ Result.getComplexIntReal() =
(LHS.getComplexIntReal() * RHS.getComplexIntReal() -
LHS.getComplexIntImag() * RHS.getComplexIntImag());
- Result.getComplexIntImag() =
+ Result.getComplexIntImag() =
(LHS.getComplexIntReal() * RHS.getComplexIntImag() +
LHS.getComplexIntImag() * RHS.getComplexIntReal());
}
@@ -1775,7 +1769,7 @@
llvm::APFloat f(0.0);
if (!EvaluateFloat(this, f, Info))
return false;
-
+
Result.Val = APValue(f);
} else if (getType()->isAnyComplexType()) {
if (!EvaluateComplex(this, Result.Val, Info))
diff --git a/lib/AST/InheritViz.cpp b/lib/AST/InheritViz.cpp
index 323048c..c47a9da 100644
--- a/lib/AST/InheritViz.cpp
+++ b/lib/AST/InheritViz.cpp
@@ -89,7 +89,7 @@
Out << " \"];\n";
// Display the base classes.
- const CXXRecordDecl *Decl
+ const CXXRecordDecl *Decl
= static_cast<const CXXRecordDecl *>(Type->getAs<RecordType>()->getDecl());
for (CXXRecordDecl::base_class_const_iterator Base = Decl->bases_begin();
Base != Decl->bases_end(); ++Base) {
@@ -120,8 +120,8 @@
/// WriteNodeReference - Write out a reference to the given node,
/// using a unique identifier for each direct base and for the
/// (only) virtual base.
-llvm::raw_ostream&
-InheritanceHierarchyWriter::WriteNodeReference(QualType Type,
+llvm::raw_ostream&
+InheritanceHierarchyWriter::WriteNodeReference(QualType Type,
bool FromVirtual) {
QualType CanonType = Context.getCanonicalType(Type);
diff --git a/lib/AST/NestedNameSpecifier.cpp b/lib/AST/NestedNameSpecifier.cpp
index 2ed8eb0..d969776 100644
--- a/lib/AST/NestedNameSpecifier.cpp
+++ b/lib/AST/NestedNameSpecifier.cpp
@@ -22,13 +22,13 @@
using namespace clang;
NestedNameSpecifier *
-NestedNameSpecifier::FindOrInsert(ASTContext &Context,
+NestedNameSpecifier::FindOrInsert(ASTContext &Context,
const NestedNameSpecifier &Mockup) {
llvm::FoldingSetNodeID ID;
Mockup.Profile(ID);
void *InsertPos = 0;
- NestedNameSpecifier *NNS
+ NestedNameSpecifier *NNS
= Context.NestedNameSpecifiers.FindNodeOrInsertPos(ID, InsertPos);
if (!NNS) {
NNS = new (Context, 4) NestedNameSpecifier(Mockup);
@@ -39,7 +39,7 @@
}
NestedNameSpecifier *
-NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
+NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
IdentifierInfo *II) {
assert(II && "Identifier cannot be NULL");
assert((!Prefix || Prefix->isDependent()) && "Prefix must be dependent");
@@ -52,10 +52,10 @@
}
NestedNameSpecifier *
-NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
+NestedNameSpecifier::Create(ASTContext &Context, NestedNameSpecifier *Prefix,
NamespaceDecl *NS) {
assert(NS && "Namespace cannot be NULL");
- assert((!Prefix ||
+ assert((!Prefix ||
(Prefix->getAsType() == 0 && Prefix->getAsIdentifier() == 0)) &&
"Broken nested name specifier");
NestedNameSpecifier Mockup;
@@ -115,8 +115,8 @@
/// \brief Print this nested name specifier to the given output
/// stream.
-void
-NestedNameSpecifier::print(llvm::raw_ostream &OS,
+void
+NestedNameSpecifier::print(llvm::raw_ostream &OS,
const PrintingPolicy &Policy) const {
if (getPrefix())
getPrefix()->print(OS, Policy);
@@ -144,26 +144,26 @@
PrintingPolicy InnerPolicy(Policy);
InnerPolicy.SuppressTagKind = true;
InnerPolicy.SuppressScope = true;
-
+
// Nested-name-specifiers are intended to contain minimally-qualified
// types. An actual QualifiedNameType will not occur, since we'll store
// just the type that is referred to in the nested-name-specifier (e.g.,
// a TypedefType, TagType, etc.). However, when we are dealing with
- // dependent template-id types (e.g., Outer<T>::template Inner<U>),
+ // dependent template-id types (e.g., Outer<T>::template Inner<U>),
// the type requires its own nested-name-specifier for uniqueness, so we
// suppress that nested-name-specifier during printing.
- assert(!isa<QualifiedNameType>(T) &&
+ assert(!isa<QualifiedNameType>(T) &&
"Qualified name type in nested-name-specifier");
if (const TemplateSpecializationType *SpecType
= dyn_cast<TemplateSpecializationType>(T)) {
- // Print the template name without its corresponding
+ // Print the template name without its corresponding
// nested-name-specifier.
SpecType->getTemplateName().print(OS, InnerPolicy, true);
-
+
// Print the template argument list.
TypeStr = TemplateSpecializationType::PrintTemplateArgumentList(
- SpecType->getArgs(),
- SpecType->getNumArgs(),
+ SpecType->getArgs(),
+ SpecType->getNumArgs(),
InnerPolicy);
} else {
// Print the type normally
diff --git a/lib/AST/ParentMap.cpp b/lib/AST/ParentMap.cpp
index 9d87daa..48251d5 100644
--- a/lib/AST/ParentMap.cpp
+++ b/lib/AST/ParentMap.cpp
@@ -32,7 +32,7 @@
if (S) {
MapTy *M = new MapTy();
BuildParentMap(*M, S);
- Impl = M;
+ Impl = M;
}
}
@@ -54,16 +54,16 @@
bool ParentMap::isConsumedExpr(Expr* E) const {
Stmt *P = getParent(E);
Stmt *DirectChild = E;
-
+
// Ignore parents that are parentheses or casts.
while (P && (isa<ParenExpr>(P) || isa<CastExpr>(P))) {
DirectChild = P;
P = getParent(P);
}
-
+
if (!P)
return false;
-
+
switch (P->getStmtClass()) {
default:
return isa<Expr>(P);
@@ -78,7 +78,7 @@
case Stmt::ForStmtClass:
return DirectChild == cast<ForStmt>(P)->getCond();
case Stmt::WhileStmtClass:
- return DirectChild == cast<WhileStmt>(P)->getCond();
+ return DirectChild == cast<WhileStmt>(P)->getCond();
case Stmt::DoStmtClass:
return DirectChild == cast<DoStmt>(P)->getCond();
case Stmt::IfStmtClass:
diff --git a/lib/AST/RecordLayoutBuilder.cpp b/lib/AST/RecordLayoutBuilder.cpp
index 071e3e8..05b5ee9 100644
--- a/lib/AST/RecordLayoutBuilder.cpp
+++ b/lib/AST/RecordLayoutBuilder.cpp
@@ -21,8 +21,8 @@
using namespace clang;
-ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx)
- : Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0),
+ASTRecordLayoutBuilder::ASTRecordLayoutBuilder(ASTContext &Ctx)
+ : Ctx(Ctx), Size(0), Alignment(8), Packed(false), MaxFieldAlignment(0),
NextOffset(0), IsUnion(false), NonVirtualSize(0), NonVirtualAlignment(8) {}
/// LayoutVtable - Lay out the vtable and set PrimaryBase.
@@ -43,12 +43,12 @@
}
}
-void
+void
ASTRecordLayoutBuilder::LayoutNonVirtualBases(const CXXRecordDecl *RD) {
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
if (!i->isVirtual()) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
// Skip the PrimaryBase here, as it is laid down first.
if (Base != PrimaryBase || PrimaryBaseWasVirtual)
@@ -83,7 +83,7 @@
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
// Only bases with virtual bases participate in computing the
// indirect primary virtual base classes.
@@ -97,7 +97,7 @@
llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary) {
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
if (!i->isVirtual()) {
SelectPrimaryVBase(Base, FirstPrimary, IndirectPrimary);
@@ -125,7 +125,7 @@
const CXXRecordDecl *FirstPrimary = 0;
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
SelectPrimaryForBase(Base, IndirectPrimary);
}
@@ -135,7 +135,7 @@
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
if (!i->isVirtual()) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
if (Base->isDynamicClass()) {
setPrimaryBase(Base, false);
@@ -174,7 +174,7 @@
llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary) {
for (CXXRecordDecl::base_class_const_iterator i = RD->bases_begin(),
e = RD->bases_end(); i != e; ++i) {
- const CXXRecordDecl *Base =
+ const CXXRecordDecl *Base =
cast<CXXRecordDecl>(i->getType()->getAs<RecordType>()->getDecl());
#if 0
const ASTRecordLayout &L = Ctx.getASTRecordLayout(Base);
@@ -224,12 +224,12 @@
void ASTRecordLayoutBuilder::LayoutBaseNonVirtually(const CXXRecordDecl *RD,
bool IsVirtualBase) {
const ASTRecordLayout &BaseInfo = Ctx.getASTRecordLayout(RD);
- assert(BaseInfo.getDataSize() > 0 &&
+ assert(BaseInfo.getDataSize() > 0 &&
"FIXME: Handle empty classes.");
-
+
unsigned BaseAlign = BaseInfo.getNonVirtualAlign();
uint64_t BaseSize = BaseInfo.getNonVirtualSize();
-
+
// Round up the current record size to the base's alignment boundary.
Size = (Size + (BaseAlign-1)) & ~(BaseAlign-1);
@@ -260,10 +260,10 @@
// Reserve space for this base.
Size += BaseSize;
-
+
// Remember the next available offset.
NextOffset = Size;
-
+
// Remember max struct/class alignment.
UpdateAlignment(BaseAlign);
}
@@ -276,7 +276,7 @@
// The #pragma pack attribute specifies the maximum field alignment.
if (const PragmaPackAttr *PPA = D->getAttr<PragmaPackAttr>())
MaxFieldAlignment = PPA->getAlignment();
-
+
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
UpdateAlignment(AA->getAlignment());
@@ -296,7 +296,7 @@
}
LayoutFields(D);
-
+
NonVirtualSize = Size;
NonVirtualAlignment = Alignment;
@@ -316,28 +316,28 @@
const ASTRecordLayout &SL = Ctx.getASTObjCInterfaceLayout(SD);
UpdateAlignment(SL.getAlignment());
-
+
// We start laying out ivars not at the end of the superclass
// structure, but at the next byte following the last field.
Size = llvm::RoundUpToAlignment(SL.getDataSize(), 8);
NextOffset = Size;
}
-
+
Packed = D->hasAttr<PackedAttr>();
-
+
// The #pragma pack attribute specifies the maximum field alignment.
if (const PragmaPackAttr *PPA = D->getAttr<PragmaPackAttr>())
MaxFieldAlignment = PPA->getAlignment();
-
+
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
UpdateAlignment(AA->getAlignment());
-
+
// Layout each ivar sequentially.
llvm::SmallVector<ObjCIvarDecl*, 16> Ivars;
Ctx.ShallowCollectObjCIvars(D, Ivars, Impl);
for (unsigned i = 0, e = Ivars.size(); i != e; ++i)
LayoutField(Ivars[i]);
-
+
// Finally, round the size of the total struct up to the alignment of the
// struct itself.
FinishLayout();
@@ -346,7 +346,7 @@
void ASTRecordLayoutBuilder::LayoutFields(const RecordDecl *D) {
// Layout each field, for now, just sequentially, respecting alignment. In
// the future, this will need to be tweakable by targets.
- for (RecordDecl::field_iterator Field = D->field_begin(),
+ for (RecordDecl::field_iterator Field = D->field_begin(),
FieldEnd = D->field_end(); Field != FieldEnd; ++Field)
LayoutField(*Field);
}
@@ -356,19 +356,19 @@
uint64_t FieldOffset = IsUnion ? 0 : Size;
uint64_t FieldSize;
unsigned FieldAlign;
-
- FieldPacked |= D->hasAttr<PackedAttr>();
-
+
+ FieldPacked |= D->hasAttr<PackedAttr>();
+
if (const Expr *BitWidthExpr = D->getBitWidth()) {
// TODO: Need to check this algorithm on other targets!
// (tested on Linux-X86)
FieldSize = BitWidthExpr->EvaluateAsInt(Ctx).getZExtValue();
-
+
std::pair<uint64_t, unsigned> FieldInfo = Ctx.getTypeInfo(D->getType());
uint64_t TypeSize = FieldInfo.first;
FieldAlign = FieldInfo.second;
-
+
if (FieldPacked)
FieldAlign = 1;
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
@@ -381,7 +381,7 @@
// alignment.
if (FieldSize == 0 || (FieldOffset & (FieldAlign-1)) + FieldSize > TypeSize)
FieldOffset = (FieldOffset + (FieldAlign-1)) & ~(FieldAlign-1);
-
+
// Padding members don't affect overall alignment
if (!D->getIdentifier())
FieldAlign = 1;
@@ -403,7 +403,7 @@
FieldSize = FieldInfo.first;
FieldAlign = FieldInfo.second;
}
-
+
if (FieldPacked)
FieldAlign = 8;
if (const AlignedAttr *AA = D->getAttr<AlignedAttr>())
@@ -411,23 +411,23 @@
// The maximum field alignment overrides the aligned attribute.
if (MaxFieldAlignment)
FieldAlign = std::min(FieldAlign, MaxFieldAlignment);
-
+
// Round up the current record size to the field's alignment boundary.
FieldOffset = (FieldOffset + (FieldAlign-1)) & ~(FieldAlign-1);
}
-
+
// Place this field at the current location.
FieldOffsets.push_back(FieldOffset);
-
+
// Reserve space for this field.
if (IsUnion)
Size = std::max(Size, FieldSize);
else
Size = FieldOffset + FieldSize;
-
+
// Remember the next available offset.
NextOffset = Size;
-
+
// Remember max struct/class alignment.
UpdateAlignment(FieldAlign);
}
@@ -444,14 +444,14 @@
void ASTRecordLayoutBuilder::UpdateAlignment(unsigned NewAlignment) {
if (NewAlignment <= Alignment)
return;
-
+
assert(llvm::isPowerOf2_32(NewAlignment && "Alignment not a power of 2"));
-
+
Alignment = NewAlignment;
}
-
+
const ASTRecordLayout *
-ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
+ASTRecordLayoutBuilder::ComputeLayout(ASTContext &Ctx,
const RecordDecl *D) {
ASTRecordLayoutBuilder Builder(Ctx);
@@ -459,27 +459,27 @@
if (!isa<CXXRecordDecl>(D))
return new ASTRecordLayout(Builder.Size, Builder.Alignment, Builder.Size,
- Builder.FieldOffsets.data(),
+ Builder.FieldOffsets.data(),
Builder.FieldOffsets.size());
-
+
// FIXME: This is not always correct. See the part about bitfields at
// http://www.codesourcery.com/public/cxx-abi/abi.html#POD for more info.
// FIXME: IsPODForThePurposeOfLayout should be stored in the record layout.
bool IsPODForThePurposeOfLayout = cast<CXXRecordDecl>(D)->isPOD();
-
- assert(Builder.Bases.size() == Builder.BaseOffsets.size() &&
+
+ assert(Builder.Bases.size() == Builder.BaseOffsets.size() &&
"Base offsets vector must be same size as bases vector!");
- assert(Builder.VBases.size() == Builder.VBaseOffsets.size() &&
+ assert(Builder.VBases.size() == Builder.VBaseOffsets.size() &&
"Base offsets vector must be same size as bases vector!");
// FIXME: This should be done in FinalizeLayout.
- uint64_t DataSize =
+ uint64_t DataSize =
IsPODForThePurposeOfLayout ? Builder.Size : Builder.NextOffset;
- uint64_t NonVirtualSize =
+ uint64_t NonVirtualSize =
IsPODForThePurposeOfLayout ? DataSize : Builder.NonVirtualSize;
-
+
return new ASTRecordLayout(Builder.Size, Builder.Alignment, DataSize,
- Builder.FieldOffsets.data(),
+ Builder.FieldOffsets.data(),
Builder.FieldOffsets.size(),
NonVirtualSize,
Builder.NonVirtualAlignment,
@@ -498,11 +498,11 @@
const ObjCInterfaceDecl *D,
const ObjCImplementationDecl *Impl) {
ASTRecordLayoutBuilder Builder(Ctx);
-
+
Builder.Layout(D, Impl);
-
+
return new ASTRecordLayout(Builder.Size, Builder.Alignment,
Builder.NextOffset,
- Builder.FieldOffsets.data(),
+ Builder.FieldOffsets.data(),
Builder.FieldOffsets.size());
}
diff --git a/lib/AST/RecordLayoutBuilder.h b/lib/AST/RecordLayoutBuilder.h
index 5813e27..efaa2ee 100644
--- a/lib/AST/RecordLayoutBuilder.h
+++ b/lib/AST/RecordLayoutBuilder.h
@@ -22,19 +22,19 @@
class ObjCImplementationDecl;
class ObjCInterfaceDecl;
class RecordDecl;
-
+
class ASTRecordLayoutBuilder {
ASTContext &Ctx;
uint64_t Size;
unsigned Alignment;
llvm::SmallVector<uint64_t, 16> FieldOffsets;
-
+
bool Packed;
unsigned MaxFieldAlignment;
uint64_t NextOffset;
bool IsUnion;
-
+
uint64_t NonVirtualSize;
unsigned NonVirtualAlignment;
const CXXRecordDecl *PrimaryBase;
@@ -45,9 +45,9 @@
llvm::SmallVector<const CXXRecordDecl *, 4> VBases;
llvm::SmallVector<uint64_t, 4> VBaseOffsets;
-
+
ASTRecordLayoutBuilder(ASTContext &Ctx);
-
+
void Layout(const RecordDecl *D);
void Layout(const CXXRecordDecl *D);
void Layout(const ObjCInterfaceDecl *D,
@@ -77,23 +77,23 @@
int64_t Offset,
llvm::SmallSet<const CXXRecordDecl*, 32> &mark,
llvm::SmallSet<const CXXRecordDecl*, 32> &IndirectPrimary);
-
+
/// FinishLayout - Finalize record layout. Adjust record size based on the
/// alignment.
void FinishLayout();
-
+
void UpdateAlignment(unsigned NewAlignment);
ASTRecordLayoutBuilder(const ASTRecordLayoutBuilder&); // DO NOT IMPLEMENT
void operator=(const ASTRecordLayoutBuilder&); // DO NOT IMPLEMENT
public:
- static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
+ static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
const RecordDecl *RD);
static const ASTRecordLayout *ComputeLayout(ASTContext &Ctx,
const ObjCInterfaceDecl *D,
const ObjCImplementationDecl *Impl);
};
-
+
} // end namespace clang
#endif
diff --git a/lib/AST/Stmt.cpp b/lib/AST/Stmt.cpp
index f230018..3a838fa 100644
--- a/lib/AST/Stmt.cpp
+++ b/lib/AST/Stmt.cpp
@@ -95,7 +95,7 @@
void SwitchStmt::DoDestroy(ASTContext &Ctx) {
// Destroy the SwitchCase statements in this switch. In the normal
- // case, this loop will merely decrement the reference counts from
+ // case, this loop will merely decrement the reference counts from
// the Retain() calls in addSwitchCase();
SwitchCase *SC = FirstCase;
while (SC) {
@@ -103,7 +103,7 @@
SC->Destroy(Ctx);
SC = Next;
}
-
+
Stmt::DoDestroy(Ctx);
}
@@ -187,7 +187,7 @@
void AsmStmt::setOutputsAndInputs(unsigned NumOutputs,
- unsigned NumInputs,
+ unsigned NumInputs,
const std::string *Names,
StringLiteral **Constraints,
Stmt **Exprs) {
@@ -196,7 +196,7 @@
this->Names.clear();
this->Names.insert(this->Names.end(), Names, Names + NumOutputs + NumInputs);
this->Constraints.clear();
- this->Constraints.insert(this->Constraints.end(),
+ this->Constraints.insert(this->Constraints.end(),
Constraints, Constraints + NumOutputs + NumInputs);
this->Exprs.clear();
this->Exprs.insert(this->Exprs.end(), Exprs, Exprs + NumOutputs + NumInputs);
@@ -207,13 +207,13 @@
/// This returns -1 if the operand name is invalid.
int AsmStmt::getNamedOperand(const std::string &SymbolicName) const {
unsigned NumPlusOperands = 0;
-
+
// Check if this is an output operand.
for (unsigned i = 0, e = getNumOutputs(); i != e; ++i) {
if (getOutputName(i) == SymbolicName)
return i;
}
-
+
for (unsigned i = 0, e = getNumInputs(); i != e; ++i)
if (getInputName(i) == SymbolicName)
return getNumOutputs() + NumPlusOperands + i;
@@ -235,7 +235,7 @@
const char *StrStart = getAsmString()->getStrData();
const char *StrEnd = StrStart + getAsmString()->getByteLength();
const char *CurPtr = StrStart;
-
+
// "Simple" inline asms have no constraints or operands, just convert the asm
// string to escape $'s.
if (isSimple()) {
@@ -257,7 +257,7 @@
// CurStringPiece - The current string that we are building up as we scan the
// asm string.
std::string CurStringPiece;
-
+
while (1) {
// Done with the string?
if (CurPtr == StrEnd) {
@@ -265,7 +265,7 @@
Pieces.push_back(AsmStringPiece(CurStringPiece));
return 0;
}
-
+
char CurChar = *CurPtr++;
if (CurChar == '$') {
CurStringPiece += "$$";
@@ -274,48 +274,48 @@
CurStringPiece += CurChar;
continue;
}
-
+
// Escaped "%" character in asm string.
if (CurPtr == StrEnd) {
// % at end of string is invalid (no escape).
DiagOffs = CurPtr-StrStart-1;
return diag::err_asm_invalid_escape;
}
-
+
char EscapedChar = *CurPtr++;
if (EscapedChar == '%') { // %% -> %
// Escaped percentage sign.
CurStringPiece += '%';
continue;
}
-
+
if (EscapedChar == '=') { // %= -> Generate an unique ID.
CurStringPiece += "${:uid}";
continue;
}
-
+
// Otherwise, we have an operand. If we have accumulated a string so far,
// add it to the Pieces list.
if (!CurStringPiece.empty()) {
Pieces.push_back(AsmStringPiece(CurStringPiece));
CurStringPiece.clear();
}
-
+
// Handle %x4 and %x[foo] by capturing x as the modifier character.
char Modifier = '\0';
if (isalpha(EscapedChar)) {
Modifier = EscapedChar;
EscapedChar = *CurPtr++;
}
-
+
if (isdigit(EscapedChar)) {
// %n - Assembler operand n
unsigned N = 0;
-
+
--CurPtr;
while (CurPtr != StrEnd && isdigit(*CurPtr))
N = N*10 + ((*CurPtr++)-'0');
-
+
unsigned NumOperands =
getNumOutputs() + getNumPlusOperands() + getNumInputs();
if (N >= NumOperands) {
@@ -326,20 +326,20 @@
Pieces.push_back(AsmStringPiece(N, Modifier));
continue;
}
-
+
// Handle %[foo], a symbolic operand reference.
if (EscapedChar == '[') {
DiagOffs = CurPtr-StrStart-1;
-
+
// Find the ']'.
const char *NameEnd = (const char*)memchr(CurPtr, ']', StrEnd-CurPtr);
if (NameEnd == 0)
return diag::err_asm_unterminated_symbolic_operand_name;
if (NameEnd == CurPtr)
return diag::err_asm_empty_symbolic_operand_name;
-
+
std::string SymbolicName(CurPtr, NameEnd);
-
+
int N = getNamedOperand(SymbolicName);
if (N == -1) {
// Verify that an operand with that name exists.
@@ -347,11 +347,11 @@
return diag::err_asm_unknown_symbolic_operand_name;
}
Pieces.push_back(AsmStringPiece(N, Modifier));
-
+
CurPtr = NameEnd+1;
continue;
}
-
+
DiagOffs = CurPtr-StrStart-1;
return diag::err_asm_invalid_escape;
}
@@ -509,7 +509,7 @@
}
// AsmStmt
-Stmt::child_iterator AsmStmt::child_begin() {
+Stmt::child_iterator AsmStmt::child_begin() {
return Exprs.empty() ? 0 : &Exprs[0];
}
Stmt::child_iterator AsmStmt::child_end() {
diff --git a/lib/AST/StmtDumper.cpp b/lib/AST/StmtDumper.cpp
index 5f32009..ed92da3 100644
--- a/lib/AST/StmtDumper.cpp
+++ b/lib/AST/StmtDumper.cpp
@@ -30,12 +30,12 @@
SourceManager *SM;
FILE *F;
unsigned IndentLevel;
-
+
/// MaxDepth - When doing a normal dump (not dumpAll) we only want to dump
/// the first few levels of an AST. This keeps track of how many ast levels
/// are left.
unsigned MaxDepth;
-
+
/// LastLocFilename/LastLocLine - Keep track of the last location we print
/// out so that we can print out deltas from then on out.
const char *LastLocFilename;
@@ -47,18 +47,18 @@
LastLocFilename = "";
LastLocLine = ~0U;
}
-
+
void DumpSubTree(Stmt *S) {
// Prune the recursion if not using dump all.
if (MaxDepth == 0) return;
-
+
++IndentLevel;
if (S) {
if (DeclStmt* DS = dyn_cast<DeclStmt>(S))
VisitDeclStmt(DS);
- else {
+ else {
Visit(S);
-
+
// Print out children.
Stmt::child_iterator CI = S->child_begin(), CE = S->child_end();
if (CI != CE) {
@@ -75,14 +75,14 @@
}
--IndentLevel;
}
-
+
void DumpDeclarator(Decl *D);
-
+
void Indent() const {
for (int i = 0, e = IndentLevel; i < e; ++i)
fprintf(F, " ");
}
-
+
void DumpType(QualType T) {
fprintf(F, "'%s'", T.getAsString().c_str());
@@ -90,7 +90,7 @@
// If the type is directly a typedef, strip off typedefness to give at
// least one level of concreteness.
if (TypedefType *TDT = dyn_cast<TypedefType>(T)) {
- QualType Simplified =
+ QualType Simplified =
TDT->LookThroughTypedefs().getQualifiedType(T.getCVRQualifiers());
fprintf(F, ":'%s'", Simplified.getAsString().c_str());
}
@@ -108,13 +108,13 @@
}
void DumpSourceRange(const Stmt *Node);
void DumpLocation(SourceLocation Loc);
-
+
// Stmts.
void VisitStmt(Stmt *Node);
void VisitDeclStmt(DeclStmt *Node);
void VisitLabelStmt(LabelStmt *Node);
void VisitGotoStmt(GotoStmt *Node);
-
+
// Exprs
void VisitExpr(Expr *Node);
void VisitCastExpr(CastExpr *Node);
@@ -142,7 +142,7 @@
void VisitCXXBindTemporaryExpr(CXXBindTemporaryExpr *Node);
void VisitCXXExprWithTemporaries(CXXExprWithTemporaries *Node);
void DumpCXXTemporary(CXXTemporary *Temporary);
-
+
// ObjC
void VisitObjCEncodeExpr(ObjCEncodeExpr *Node);
void VisitObjCMessageExpr(ObjCMessageExpr* Node);
@@ -162,7 +162,7 @@
void StmtDumper::DumpLocation(SourceLocation Loc) {
SourceLocation SpellingLoc = SM->getSpellingLoc(Loc);
-
+
if (SpellingLoc.isInvalid()) {
fprintf(stderr, "<invalid sloc>");
return;
@@ -188,11 +188,11 @@
void StmtDumper::DumpSourceRange(const Stmt *Node) {
// Can't translate locations if a SourceManager isn't available.
if (SM == 0) return;
-
+
// TODO: If the parent expression is available, we can print a delta vs its
// location.
SourceRange R = Node->getSourceRange();
-
+
fprintf(stderr, " <");
DumpLocation(R.getBegin());
if (R.getBegin() != R.getEnd()) {
@@ -200,7 +200,7 @@
DumpLocation(R.getEnd());
}
fprintf(stderr, ">");
-
+
// <t2.c:123:421[blah], t2.c:412:321>
}
@@ -226,15 +226,15 @@
// Emit storage class for vardecls.
if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
if (V->getStorageClass() != VarDecl::None)
- fprintf(F, "%s ",
+ fprintf(F, "%s ",
VarDecl::getStorageClassSpecifierString(V->getStorageClass()));
}
-
+
std::string Name = VD->getNameAsString();
- VD->getType().getAsStringInternal(Name,
+ VD->getType().getAsStringInternal(Name,
PrintingPolicy(VD->getASTContext().getLangOptions()));
fprintf(F, "%s", Name.c_str());
-
+
// If this is a vardecl with an initializer, emit it.
if (VarDecl *V = dyn_cast<VarDecl>(VD)) {
if (V->getInit()) {
@@ -321,15 +321,15 @@
case Decl::ObjCInterface: fprintf(F,"ObjCInterface"); break;
case Decl::ObjCClass: fprintf(F,"ObjCClass"); break;
}
-
- fprintf(F, "='%s' %p", Node->getDecl()->getNameAsString().c_str(),
+
+ fprintf(F, "='%s' %p", Node->getDecl()->getNameAsString().c_str(),
(void*)Node->getDecl());
}
void StmtDumper::VisitObjCIvarRefExpr(ObjCIvarRefExpr *Node) {
DumpExpr(Node);
- fprintf(F, " %sDecl='%s' %p", Node->getDecl()->getDeclKindName(),
+ fprintf(F, " %sDecl='%s' %p", Node->getDecl()->getDeclKindName(),
Node->getDecl()->getNameAsString().c_str(), (void*)Node->getDecl());
if (Node->isFreeIvar())
fprintf(F, " isFreeIvar");
@@ -370,7 +370,7 @@
switch (char C = Str->getStrData()[i]) {
default:
if (isprint(C))
- fputc(C, F);
+ fputc(C, F);
else
fprintf(F, "\\%03o", C);
break;
@@ -401,7 +401,7 @@
void StmtDumper::VisitMemberExpr(MemberExpr *Node) {
DumpExpr(Node);
fprintf(F, " %s%s %p", Node->isArrow() ? "->" : ".",
- Node->getMemberDecl()->getNameAsString().c_str(),
+ Node->getMemberDecl()->getNameAsString().c_str(),
(void*)Node->getMemberDecl());
}
void StmtDumper::VisitExtVectorElementExpr(ExtVectorElementExpr *Node) {
@@ -459,7 +459,7 @@
void StmtDumper::VisitCXXFunctionalCastExpr(CXXFunctionalCastExpr *Node) {
DumpExpr(Node);
- fprintf(F, " functional cast to %s",
+ fprintf(F, " functional cast to %s",
Node->getTypeAsWritten().getAsString().c_str());
}
@@ -503,21 +503,21 @@
void StmtDumper::VisitObjCEncodeExpr(ObjCEncodeExpr *Node) {
DumpExpr(Node);
-
+
fprintf(F, " ");
DumpType(Node->getEncodedType());
}
void StmtDumper::VisitObjCSelectorExpr(ObjCSelectorExpr *Node) {
DumpExpr(Node);
-
+
fprintf(F, " ");
fprintf(F, "%s", Node->getSelector().getAsString().c_str());
}
void StmtDumper::VisitObjCProtocolExpr(ObjCProtocolExpr *Node) {
DumpExpr(Node);
-
+
fprintf(F, " ");
fprintf(F, "%s", Node->getProtocol()->getNameAsString().c_str());
}
@@ -525,17 +525,17 @@
void StmtDumper::VisitObjCPropertyRefExpr(ObjCPropertyRefExpr *Node) {
DumpExpr(Node);
- fprintf(F, " Kind=PropertyRef Property=\"%s\"",
+ fprintf(F, " Kind=PropertyRef Property=\"%s\"",
Node->getProperty()->getNameAsString().c_str());
}
void StmtDumper::VisitObjCImplicitSetterGetterRefExpr(
ObjCImplicitSetterGetterRefExpr *Node) {
DumpExpr(Node);
-
+
ObjCMethodDecl *Getter = Node->getGetterMethod();
ObjCMethodDecl *Setter = Node->getSetterMethod();
- fprintf(F, " Kind=MethodRef Getter=\"%s\" Setter=\"%s\"",
+ fprintf(F, " Kind=MethodRef Getter=\"%s\" Setter=\"%s\"",
Getter->getSelector().getAsString().c_str(),
Setter ? Setter->getSelector().getAsString().c_str() : "(null)");
}
diff --git a/lib/AST/StmtIterator.cpp b/lib/AST/StmtIterator.cpp
index 5c22e28..4f62b66 100644
--- a/lib/AST/StmtIterator.cpp
+++ b/lib/AST/StmtIterator.cpp
@@ -23,10 +23,10 @@
if (VariableArrayType* vat = dyn_cast<VariableArrayType>(vt))
if (vat->getSizeExpr())
return vat;
-
+
t = vt->getElementType().getTypePtr();
}
-
+
return NULL;
}
@@ -39,20 +39,20 @@
if (p)
return;
-
+
if (inDecl()) {
- if (VarDecl* VD = dyn_cast<VarDecl>(decl))
+ if (VarDecl* VD = dyn_cast<VarDecl>(decl))
if (VD->Init)
return;
-
+
NextDecl();
}
else if (inDeclGroup()) {
- if (VarDecl* VD = dyn_cast<VarDecl>(*DGI))
+ if (VarDecl* VD = dyn_cast<VarDecl>(*DGI))
if (VD->Init)
return;
-
- NextDecl();
+
+ NextDecl();
}
else {
assert (inSizeOfTypeVA());
@@ -63,10 +63,10 @@
void StmtIteratorBase::NextDecl(bool ImmediateAdvance) {
assert (getVAPtr() == NULL);
-
+
if (inDecl()) {
assert (decl);
-
+
// FIXME: SIMPLIFY AWAY.
if (ImmediateAdvance)
decl = 0;
@@ -75,10 +75,10 @@
}
else {
assert (inDeclGroup());
-
+
if (ImmediateAdvance)
++DGI;
-
+
for ( ; DGI != DGE; ++DGI)
if (HandleDecl(*DGI))
return;
@@ -88,18 +88,18 @@
}
bool StmtIteratorBase::HandleDecl(Decl* D) {
-
- if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
+
+ if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
if (VariableArrayType* VAPtr = FindVA(VD->getType().getTypePtr())) {
setVAPtr(VAPtr);
return true;
}
-
+
if (VD->getInit())
return true;
}
else if (TypedefDecl* TD = dyn_cast<TypedefDecl>(D)) {
- if (VariableArrayType* VAPtr =
+ if (VariableArrayType* VAPtr =
FindVA(TD->getUnderlyingType().getTypePtr())) {
setVAPtr(VAPtr);
return true;
@@ -110,7 +110,7 @@
return true;
}
- return false;
+ return false;
}
StmtIteratorBase::StmtIteratorBase(Decl* d)
@@ -130,19 +130,19 @@
}
Stmt*& StmtIteratorBase::GetDeclExpr() const {
-
+
if (VariableArrayType* VAPtr = getVAPtr()) {
assert (VAPtr->SizeExpr);
return VAPtr->SizeExpr;
}
assert (inDecl() || inDeclGroup());
-
+
if (inDeclGroup()) {
VarDecl* VD = cast<VarDecl>(*DGI);
return *VD->getInitAddress();
}
-
+
assert (inDecl());
if (VarDecl* VD = dyn_cast<VarDecl>(decl)) {
diff --git a/lib/AST/StmtPrinter.cpp b/lib/AST/StmtPrinter.cpp
index 7a0d6d6..a6f2b82 100644
--- a/lib/AST/StmtPrinter.cpp
+++ b/lib/AST/StmtPrinter.cpp
@@ -33,12 +33,12 @@
PrintingPolicy Policy;
public:
- StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper,
+ StmtPrinter(llvm::raw_ostream &os, ASTContext &C, PrinterHelper* helper,
const PrintingPolicy &Policy,
unsigned Indentation = 0)
: OS(os), Context(C), IndentLevel(Indentation), Helper(helper),
Policy(Policy) {}
-
+
void PrintStmt(Stmt *S) {
PrintStmt(S, Policy.Indentation);
}
@@ -63,29 +63,29 @@
void PrintRawDeclStmt(DeclStmt *S);
void PrintRawIfStmt(IfStmt *If);
void PrintRawCXXCatchStmt(CXXCatchStmt *Catch);
-
+
void PrintExpr(Expr *E) {
if (E)
Visit(E);
else
OS << "<null expr>";
}
-
+
llvm::raw_ostream &Indent(int Delta = 0) {
for (int i = 0, e = IndentLevel+Delta; i < e; ++i)
OS << " ";
return OS;
}
-
+
bool PrintOffsetOfDesignator(Expr *E);
void VisitUnaryOffsetOf(UnaryOperator *Node);
-
- void Visit(Stmt* S) {
+
+ void Visit(Stmt* S) {
if (Helper && Helper->handledStmt(S,OS))
return;
else StmtVisitor<StmtPrinter>::Visit(S);
}
-
+
void VisitStmt(Stmt *Node);
#define STMT(CLASS, PARENT) \
void Visit##CLASS(CLASS *Node);
@@ -108,7 +108,7 @@
for (CompoundStmt::body_iterator I = Node->body_begin(), E = Node->body_end();
I != E; ++I)
PrintStmt(*I);
-
+
Indent() << "}";
}
@@ -119,7 +119,7 @@
void StmtPrinter::PrintRawDeclStmt(DeclStmt *S) {
DeclStmt::decl_iterator Begin = S->decl_begin(), End = S->decl_end();
llvm::SmallVector<Decl*, 2> Decls;
- for ( ; Begin != End; ++Begin)
+ for ( ; Begin != End; ++Begin)
Decls.push_back(*Begin);
Decl::printGroup(Decls.data(), Decls.size(), OS, Policy, IndentLevel);
@@ -149,7 +149,7 @@
PrintExpr(Node->getRHS());
}
OS << ":\n";
-
+
PrintStmt(Node->getSubStmt(), 0);
}
@@ -167,7 +167,7 @@
OS << "if (";
PrintExpr(If->getCond());
OS << ')';
-
+
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(If->getThen())) {
OS << ' ';
PrintRawCompoundStmt(CS);
@@ -177,10 +177,10 @@
PrintStmt(If->getThen());
if (If->getElse()) Indent();
}
-
+
if (Stmt *Else = If->getElse()) {
OS << "else";
-
+
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Else)) {
OS << ' ';
PrintRawCompoundStmt(CS);
@@ -204,7 +204,7 @@
Indent() << "switch (";
PrintExpr(Node->getCond());
OS << ")";
-
+
// Pretty print compoundstmt bodies (very common).
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
OS << " ";
@@ -237,7 +237,7 @@
PrintStmt(Node->getBody());
Indent();
}
-
+
OS << "while (";
PrintExpr(Node->getCond());
OS << ");\n";
@@ -262,7 +262,7 @@
PrintExpr(Node->getInc());
}
OS << ") ";
-
+
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
PrintRawCompoundStmt(CS);
OS << "\n";
@@ -281,7 +281,7 @@
OS << " in ";
PrintExpr(Node->getCollection());
OS << ") ";
-
+
if (CompoundStmt *CS = dyn_cast<CompoundStmt>(Node->getBody())) {
PrintRawCompoundStmt(CS);
OS << "\n";
@@ -322,63 +322,63 @@
void StmtPrinter::VisitAsmStmt(AsmStmt *Node) {
Indent() << "asm ";
-
+
if (Node->isVolatile())
OS << "volatile ";
-
+
OS << "(";
VisitStringLiteral(Node->getAsmString());
-
+
// Outputs
if (Node->getNumOutputs() != 0 || Node->getNumInputs() != 0 ||
Node->getNumClobbers() != 0)
OS << " : ";
-
+
for (unsigned i = 0, e = Node->getNumOutputs(); i != e; ++i) {
if (i != 0)
OS << ", ";
-
+
if (!Node->getOutputName(i).empty()) {
OS << '[';
OS << Node->getOutputName(i);
OS << "] ";
}
-
+
VisitStringLiteral(Node->getOutputConstraintLiteral(i));
OS << " ";
Visit(Node->getOutputExpr(i));
}
-
+
// Inputs
if (Node->getNumInputs() != 0 || Node->getNumClobbers() != 0)
OS << " : ";
-
+
for (unsigned i = 0, e = Node->getNumInputs(); i != e; ++i) {
if (i != 0)
OS << ", ";
-
+
if (!Node->getInputName(i).empty()) {
OS << '[';
OS << Node->getInputName(i);
OS << "] ";
}
-
+
VisitStringLiteral(Node->getInputConstraintLiteral(i));
OS << " ";
Visit(Node->getInputExpr(i));
}
-
+
// Clobbers
if (Node->getNumClobbers() != 0)
OS << " : ";
-
+
for (unsigned i = 0, e = Node->getNumClobbers(); i != e; ++i) {
if (i != 0)
OS << ", ";
-
+
VisitStringLiteral(Node->getClobber(i));
}
-
+
OS << ");\n";
}
@@ -388,11 +388,11 @@
PrintRawCompoundStmt(TS);
OS << "\n";
}
-
- for (ObjCAtCatchStmt *catchStmt =
+
+ for (ObjCAtCatchStmt *catchStmt =
static_cast<ObjCAtCatchStmt *>(Node->getCatchStmts());
- catchStmt;
- catchStmt =
+ catchStmt;
+ catchStmt =
static_cast<ObjCAtCatchStmt *>(catchStmt->getNextCatchStmt())) {
Indent() << "@catch(";
if (catchStmt->getCatchParamDecl()) {
@@ -400,19 +400,18 @@
PrintRawDecl(DS);
}
OS << ")";
- if (CompoundStmt *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody()))
- {
- PrintRawCompoundStmt(CS);
- OS << "\n";
- }
+ if (CompoundStmt *CS = dyn_cast<CompoundStmt>(catchStmt->getCatchBody())) {
+ PrintRawCompoundStmt(CS);
+ OS << "\n";
+ }
}
-
- if (ObjCAtFinallyStmt *FS =static_cast<ObjCAtFinallyStmt *>(
- Node->getFinallyStmt())) {
+
+ if (ObjCAtFinallyStmt *FS = static_cast<ObjCAtFinallyStmt *>(
+ Node->getFinallyStmt())) {
Indent() << "@finally";
PrintRawCompoundStmt(dyn_cast<CompoundStmt>(FS->getFinallyBody()));
OS << "\n";
- }
+ }
}
void StmtPrinter::VisitObjCAtFinallyStmt(ObjCAtFinallyStmt *Node) {
@@ -458,7 +457,7 @@
void StmtPrinter::VisitCXXTryStmt(CXXTryStmt *Node) {
Indent() << "try ";
PrintRawCompoundStmt(Node->getTryBlock());
- for(unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
+ for (unsigned i = 0, e = Node->getNumHandlers(); i < e; ++i) {
OS << " ";
PrintRawCXXCatchStmt(Node->getHandler(i));
}
@@ -477,14 +476,14 @@
OS << Node->getDecl()->getNameAsString();
}
-void StmtPrinter::VisitQualifiedDeclRefExpr(QualifiedDeclRefExpr *Node) {
+void StmtPrinter::VisitQualifiedDeclRefExpr(QualifiedDeclRefExpr *Node) {
NamedDecl *D = Node->getDecl();
Node->getQualifier()->print(OS, Policy);
OS << D->getNameAsString();
}
-void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {
+void StmtPrinter::VisitUnresolvedDeclRefExpr(UnresolvedDeclRefExpr *Node) {
Node->getQualifier()->print(OS, Policy);
OS << Node->getDeclName().getAsString();
}
@@ -523,7 +522,7 @@
}
if (Node->getGetterMethod())
OS << Node->getGetterMethod()->getNameAsString();
-
+
}
void StmtPrinter::VisitPredefinedExpr(PredefinedExpr *Node) {
@@ -594,7 +593,7 @@
void StmtPrinter::VisitIntegerLiteral(IntegerLiteral *Node) {
bool isSigned = Node->getType()->isSignedIntegerType();
OS << Node->getValue().toString(10, isSigned);
-
+
// Emit suffixes. Integer literals are always a builtin integer type.
switch (Node->getType()->getAsBuiltinType()->getKind()) {
default: assert(0 && "Unexpected type for integer literal!");
@@ -623,7 +622,7 @@
// FIXME: this doesn't print wstrings right.
for (unsigned i = 0, e = Str->getByteLength(); i != e; ++i) {
unsigned char Char = Str->getStrData()[i];
-
+
switch (Char) {
default:
if (isprint(Char))
@@ -653,7 +652,7 @@
void StmtPrinter::VisitUnaryOperator(UnaryOperator *Node) {
if (!Node->isPostfix()) {
OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
-
+
// Print a space if this is an "identifier operator" like __real, or if
// it might be concatenated incorrectly like '+'.
switch (Node->getOpcode()) {
@@ -671,7 +670,7 @@
}
}
PrintExpr(Node->getSubExpr());
-
+
if (Node->isPostfix())
OS << UnaryOperator::getOpcodeStr(Node->getOpcode());
}
@@ -741,7 +740,7 @@
Qualifier->print(OS, Policy);
OS << Node->getMemberDecl()->getNameAsString();
-
+
if (Node->hasExplicitTemplateArgumentList())
OS << TemplateSpecializationType::PrintTemplateArgumentList(
Node->getTemplateArgs(),
@@ -788,7 +787,7 @@
}
void StmtPrinter::VisitConditionalOperator(ConditionalOperator *Node) {
PrintExpr(Node->getCond());
-
+
if (Node->getLHS()) {
OS << " ? ";
PrintExpr(Node->getLHS());
@@ -797,7 +796,7 @@
else { // Handle GCC extension where LHS can be NULL.
OS << " ?: ";
}
-
+
PrintExpr(Node->getRHS());
}
@@ -884,7 +883,7 @@
} else {
PrintExpr(Node->getArrayRangeStart(*D));
OS << " ... ";
- PrintExpr(Node->getArrayRangeEnd(*D));
+ PrintExpr(Node->getArrayRangeEnd(*D));
}
OS << "]";
}
@@ -1036,7 +1035,7 @@
OS << Node->getType().getAsString();
OS << "(";
for (CXXTemporaryObjectExpr::arg_iterator Arg = Node->arg_begin(),
- ArgEnd = Node->arg_end();
+ ArgEnd = Node->arg_end();
Arg != ArgEnd; ++Arg) {
if (Arg != Node->arg_begin())
OS << ", ";
@@ -1113,7 +1112,7 @@
OS << '.';
if (E->getQualifier())
E->getQualifier()->print(OS, Policy);
-
+
std::string TypeS;
E->getDestroyedType().getAsStringInternal(TypeS, Policy);
OS << TypeS;
@@ -1132,13 +1131,13 @@
PrintExpr(E->getSubExpr());
}
-void
+void
StmtPrinter::VisitCXXUnresolvedConstructExpr(
CXXUnresolvedConstructExpr *Node) {
OS << Node->getTypeAsWritten().getAsString();
OS << "(";
for (CXXUnresolvedConstructExpr::arg_iterator Arg = Node->arg_begin(),
- ArgEnd = Node->arg_end();
+ ArgEnd = Node->arg_end();
Arg != ArgEnd; ++Arg) {
if (Arg != Node->arg_begin())
OS << ", ";
@@ -1155,9 +1154,9 @@
else if (Node->hasExplicitTemplateArgumentList())
// FIXME: Track use of "template" keyword explicitly?
OS << "template ";
-
+
OS << Node->getMember().getAsString();
-
+
if (Node->hasExplicitTemplateArgumentList()) {
OS << TemplateSpecializationType::PrintTemplateArgumentList(
Node->getTemplateArgs(),
@@ -1192,7 +1191,7 @@
<< E->getQueriedType().getAsString() << ")";
}
-// Obj-C
+// Obj-C
void StmtPrinter::VisitObjCStringLiteral(ObjCStringLiteral *Node) {
OS << "@";
@@ -1230,7 +1229,7 @@
OS << ":";
}
else OS << ", "; // Handle variadic methods.
-
+
PrintExpr(Mess->getArg(i));
}
}
@@ -1244,9 +1243,9 @@
void StmtPrinter::VisitBlockExpr(BlockExpr *Node) {
BlockDecl *BD = Node->getBlockDecl();
OS << "^";
-
+
const FunctionType *AFT = Node->getFunctionType();
-
+
if (isa<FunctionNoProtoType>(AFT)) {
OS << "()";
} else if (!BD->param_empty() || cast<FunctionProtoType>(AFT)->isVariadic()) {
@@ -1259,7 +1258,7 @@
(*AI)->getType().getAsStringInternal(ParamStr, Policy);
OS << ParamStr;
}
-
+
const FunctionProtoType *FT = cast<FunctionProtoType>(AFT);
if (FT->isVariadic()) {
if (!BD->param_empty()) OS << ", ";
@@ -1294,7 +1293,7 @@
dump(Context.getSourceManager());
return;
}
-
+
StmtPrinter P(OS, Context, Helper, Policy, Indentation);
P.Visit(const_cast<Stmt*>(this));
}
diff --git a/lib/AST/StmtProfile.cpp b/lib/AST/StmtProfile.cpp
index 806eb8d..5a5badd 100644
--- a/lib/AST/StmtProfile.cpp
+++ b/lib/AST/StmtProfile.cpp
@@ -28,36 +28,36 @@
llvm::FoldingSetNodeID &ID;
ASTContext &Context;
bool Canonical;
-
+
public:
StmtProfiler(llvm::FoldingSetNodeID &ID, ASTContext &Context,
- bool Canonical)
+ bool Canonical)
: ID(ID), Context(Context), Canonical(Canonical) { }
-
+
void VisitStmt(Stmt *S);
-
+
#define STMT(Node, Base) void Visit##Node(Node *S);
#include "clang/AST/StmtNodes.def"
-
+
/// \brief Visit a declaration that is referenced within an expression
/// or statement.
void VisitDecl(Decl *D);
-
- /// \brief Visit a type that is referenced within an expression or
+
+ /// \brief Visit a type that is referenced within an expression or
/// statement.
void VisitType(QualType T);
-
+
/// \brief Visit a name that occurs within an expression or statement.
void VisitName(DeclarationName Name);
-
+
/// \brief Visit a nested-name-specifier that occurs within an expression
/// or statement.
void VisitNestedNameSpecifier(NestedNameSpecifier *NNS);
-
+
/// \brief Visit a template name that occurs within an expression or
/// statement.
void VisitTemplateName(TemplateName Name);
-
+
/// \brief Visit template arguments that occur within an expression or
/// statement.
void VisitTemplateArguments(const TemplateArgument *Args, unsigned NumArgs);
@@ -348,7 +348,7 @@
VisitInitListExpr(S->getSyntacticForm());
return;
}
-
+
VisitExpr(S);
}
@@ -363,7 +363,7 @@
VisitName(D->getFieldName());
continue;
}
-
+
if (D->isArrayDesignator()) {
ID.AddInteger(1);
} else {
@@ -509,7 +509,7 @@
VisitType(S->getDestroyedType());
}
-void
+void
StmtProfiler::VisitUnresolvedFunctionNameExpr(UnresolvedFunctionNameExpr *S) {
VisitExpr(S);
VisitName(S->getName());
@@ -548,7 +548,7 @@
const_cast<CXXDestructorDecl *>(S->getTemporary(I)->getDestructor()));
}
-void
+void
StmtProfiler::VisitCXXUnresolvedConstructExpr(CXXUnresolvedConstructExpr *S) {
VisitExpr(S);
VisitType(S->getTypeAsWritten());
@@ -617,7 +617,7 @@
void StmtProfiler::VisitDecl(Decl *D) {
ID.AddInteger(D? D->getKind() : 0);
-
+
if (Canonical && D) {
if (NonTypeTemplateParmDecl *NTTP = dyn_cast<NonTypeTemplateParmDecl>(D)) {
ID.AddInteger(NTTP->getDepth());
@@ -625,38 +625,38 @@
VisitType(NTTP->getType());
return;
}
-
+
if (ParmVarDecl *Parm = dyn_cast<ParmVarDecl>(D)) {
// The Itanium C++ ABI uses the type of a parameter when mangling
// expressions that involve function parameters, so we will use the
// parameter's type for establishing function parameter identity. That
- // way, our definition of "equivalent" (per C++ [temp.over.link])
+ // way, our definition of "equivalent" (per C++ [temp.over.link])
// matches the definition of "equivalent" used for name mangling.
VisitType(Parm->getType());
return;
}
-
+
if (TemplateTemplateParmDecl *TTP = dyn_cast<TemplateTemplateParmDecl>(D)) {
ID.AddInteger(TTP->getDepth());
ID.AddInteger(TTP->getIndex());
return;
}
-
+
if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
- // The Itanium C++ ABI mangles references to a set of overloaded
+ // The Itanium C++ ABI mangles references to a set of overloaded
// functions using just the function name, so we do the same here.
VisitName(Ovl->getDeclName());
return;
}
}
-
+
ID.AddPointer(D? D->getCanonicalDecl() : 0);
}
void StmtProfiler::VisitType(QualType T) {
if (Canonical)
T = Context.getCanonicalType(T);
-
+
ID.AddPointer(T.getAsOpaquePtr());
}
@@ -673,39 +673,39 @@
void StmtProfiler::VisitTemplateName(TemplateName Name) {
if (Canonical)
Name = Context.getCanonicalTemplateName(Name);
-
+
Name.Profile(ID);
}
-void StmtProfiler::VisitTemplateArguments(const TemplateArgument *Args,
+void StmtProfiler::VisitTemplateArguments(const TemplateArgument *Args,
unsigned NumArgs) {
ID.AddInteger(NumArgs);
for (unsigned I = 0; I != NumArgs; ++I) {
const TemplateArgument &Arg = Args[I];
-
+
// Mostly repetitive with TemplateArgument::Profile!
ID.AddInteger(Arg.getKind());
switch (Arg.getKind()) {
case TemplateArgument::Null:
break;
-
+
case TemplateArgument::Type:
VisitType(Arg.getAsType());
break;
-
+
case TemplateArgument::Declaration:
VisitDecl(Arg.getAsDecl());
break;
-
+
case TemplateArgument::Integral:
Arg.getAsIntegral()->Profile(ID);
VisitType(Arg.getIntegralType());
break;
-
+
case TemplateArgument::Expression:
Visit(Arg.getAsExpr());
break;
-
+
case TemplateArgument::Pack:
VisitTemplateArguments(Arg.pack_begin(), Arg.pack_size());
break;
diff --git a/lib/AST/StmtViz.cpp b/lib/AST/StmtViz.cpp
index a8f7c76..61fd750 100644
--- a/lib/AST/StmtViz.cpp
+++ b/lib/AST/StmtViz.cpp
@@ -32,26 +32,26 @@
struct DOTGraphTraits<const Stmt*> : public DefaultDOTGraphTraits {
static std::string getNodeLabel(const Stmt* Node, const Stmt* Graph,
bool ShortNames) {
-
+
#ifndef NDEBUG
std::string OutSStr;
llvm::raw_string_ostream Out(OutSStr);
-
+
if (Node)
Out << Node->getStmtClassName();
else
Out << "<NULL>";
-
- std::string OutStr = Out.str();
+
+ std::string OutStr = Out.str();
if (OutStr[0] == '\n') OutStr.erase(OutStr.begin());
-
+
// Process string output to make it nicer...
for (unsigned i = 0; i != OutStr.length(); ++i)
if (OutStr[i] == '\n') { // Left justify
OutStr[i] = '\\';
OutStr.insert(OutStr.begin()+i+1, 'l');
}
-
+
return OutStr;
#else
return "";
diff --git a/lib/AST/TemplateName.cpp b/lib/AST/TemplateName.cpp
index 92c741b..24588bc 100644
--- a/lib/AST/TemplateName.cpp
+++ b/lib/AST/TemplateName.cpp
@@ -22,7 +22,7 @@
TemplateDecl *TemplateName::getAsTemplateDecl() const {
if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
return Template;
-
+
if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName())
return QTN->getTemplateDecl();
@@ -30,34 +30,34 @@
}
OverloadedFunctionDecl *TemplateName::getAsOverloadedFunctionDecl() const {
- if (OverloadedFunctionDecl *Ovl
+ if (OverloadedFunctionDecl *Ovl
= Storage.dyn_cast<OverloadedFunctionDecl *>())
return Ovl;
-
+
if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName())
return QTN->getOverloadedFunctionDecl();
-
+
return 0;
}
bool TemplateName::isDependent() const {
if (TemplateDecl *Template = getAsTemplateDecl()) {
- return isa<TemplateTemplateParmDecl>(Template) ||
+ return isa<TemplateTemplateParmDecl>(Template) ||
Template->getDeclContext()->isDependentContext();
}
if (OverloadedFunctionDecl *Ovl = getAsOverloadedFunctionDecl())
return Ovl->getDeclContext()->isDependentContext();
-
+
return true;
}
-void
+void
TemplateName::print(llvm::raw_ostream &OS, const PrintingPolicy &Policy,
bool SuppressNNS) const {
if (TemplateDecl *Template = Storage.dyn_cast<TemplateDecl *>())
OS << Template->getIdentifier()->getName();
- else if (OverloadedFunctionDecl *Ovl
+ else if (OverloadedFunctionDecl *Ovl
= Storage.dyn_cast<OverloadedFunctionDecl *>())
OS << Ovl->getNameAsString();
else if (QualifiedTemplateName *QTN = getAsQualifiedTemplateName()) {
@@ -82,12 +82,12 @@
print(llvm::errs(), PrintingPolicy(LO));
}
-TemplateDecl *QualifiedTemplateName::getTemplateDecl() const {
- return dyn_cast<TemplateDecl>(Template);
+TemplateDecl *QualifiedTemplateName::getTemplateDecl() const {
+ return dyn_cast<TemplateDecl>(Template);
}
OverloadedFunctionDecl *
QualifiedTemplateName::getOverloadedFunctionDecl() const {
- return dyn_cast<OverloadedFunctionDecl>(Template);
+ return dyn_cast<OverloadedFunctionDecl>(Template);
}
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
diff --git a/lib/AST/TypeLoc.cpp b/lib/AST/TypeLoc.cpp
index 85415ba..a95f388 100644
--- a/lib/AST/TypeLoc.cpp
+++ b/lib/AST/TypeLoc.cpp
@@ -30,7 +30,7 @@
if (const DeclaratorLoc *DL = dyn_cast<DeclaratorLoc>(this))
return DL->getTypeSpecLoc();
- return cast<TypeSpecLoc>(*this);
+ return cast<TypeSpecLoc>(*this);
}
/// \brief Find the TypeSpecLoc that is part of this TypeLoc and return its
@@ -46,9 +46,9 @@
public:
#define ABSTRACT_TYPELOC(CLASS)
#define TYPELOC(CLASS, PARENT, TYPE) \
- unsigned Visit##CLASS(CLASS TyLoc) { return TyLoc.getFullDataSize(); }
+ unsigned Visit##CLASS(CLASS TyLoc) { return TyLoc.getFullDataSize(); }
#include "clang/AST/TypeLocNodes.def"
-
+
unsigned VisitTypeLoc(TypeLoc TyLoc) {
assert(0 && "A type loc wrapper was not handled!");
return 0;
@@ -70,7 +70,7 @@
public:
#define TYPELOC(CLASS, PARENT, TYPE)
#define DECLARATOR_TYPELOC(CLASS, TYPE) \
- TypeLoc Visit##CLASS(CLASS TyLoc);
+ TypeLoc Visit##CLASS(CLASS TyLoc);
#include "clang/AST/TypeLocNodes.def"
TypeLoc VisitTypeSpecLoc(TypeLoc TyLoc) { return TypeLoc(); }
@@ -84,16 +84,16 @@
}
TypeLoc NextLoc::VisitPointerLoc(PointerLoc TL) {
- return TL.getPointeeLoc();
+ return TL.getPointeeLoc();
}
TypeLoc NextLoc::VisitMemberPointerLoc(MemberPointerLoc TL) {
- return TL.getPointeeLoc();
+ return TL.getPointeeLoc();
}
TypeLoc NextLoc::VisitBlockPointerLoc(BlockPointerLoc TL) {
- return TL.getPointeeLoc();
+ return TL.getPointeeLoc();
}
TypeLoc NextLoc::VisitReferenceLoc(ReferenceLoc TL) {
- return TL.getPointeeLoc();
+ return TL.getPointeeLoc();
}
TypeLoc NextLoc::VisitFunctionLoc(FunctionLoc TL) {
return TL.getResultLoc();
@@ -105,7 +105,7 @@
/// \brief Get the next TypeLoc pointed by this TypeLoc, e.g for "int*" the
/// TypeLoc is a PointerLoc and next TypeLoc is for "int".
TypeLoc TypeLoc::getNextTypeLoc() const {
- return NextLoc().Visit(*this);
+ return NextLoc().Visit(*this);
}
//===----------------------------------------------------------------------===//
@@ -119,7 +119,7 @@
public:
#define TYPELOC(CLASS, PARENT, TYPE)
#define TYPESPEC_TYPELOC(CLASS, TYPE) \
- SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); }
+ SourceRange Visit##CLASS(CLASS TyLoc) { return TyLoc.getSourceRange(); }
#include "clang/AST/TypeLocNodes.def"
SourceRange VisitTypeLoc(TypeLoc TyLoc) {
@@ -139,13 +139,13 @@
namespace {
class TypeSpecChecker : public TypeLocVisitor<TypeSpecChecker, bool> {
public:
- bool VisitTypeSpecLoc(TypeSpecLoc TyLoc) { return true; }
+ bool VisitTypeSpecLoc(TypeSpecLoc TyLoc) { return true; }
};
}
bool TypeSpecLoc::classof(const TypeLoc *TL) {
- return TypeSpecChecker().Visit(*TL);
+ return TypeSpecChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -159,7 +159,7 @@
public:
#define TYPELOC(CLASS, PARENT, TYPE)
#define DECLARATOR_TYPELOC(CLASS, TYPE) \
- TypeSpecLoc Visit##CLASS(CLASS TyLoc) { return TyLoc.getTypeSpecLoc(); }
+ TypeSpecLoc Visit##CLASS(CLASS TyLoc) { return TyLoc.getTypeSpecLoc(); }
#include "clang/AST/TypeLocNodes.def"
TypeSpecLoc VisitTypeLoc(TypeLoc TyLoc) {
@@ -179,13 +179,13 @@
class DeclaratorLocChecker : public TypeLocVisitor<DeclaratorLocChecker, bool> {
public:
- bool VisitDeclaratorLoc(DeclaratorLoc TyLoc) { return true; }
+ bool VisitDeclaratorLoc(DeclaratorLoc TyLoc) { return true; }
};
}
bool DeclaratorLoc::classof(const TypeLoc *TL) {
- return DeclaratorLocChecker().Visit(*TL);
+ return DeclaratorLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -197,13 +197,13 @@
class DefaultTypeSpecLocChecker :
public TypeLocVisitor<DefaultTypeSpecLocChecker, bool> {
public:
- bool VisitDefaultTypeSpecLoc(DefaultTypeSpecLoc TyLoc) { return true; }
+ bool VisitDefaultTypeSpecLoc(DefaultTypeSpecLoc TyLoc) { return true; }
};
}
bool DefaultTypeSpecLoc::classof(const TypeLoc *TL) {
- return DefaultTypeSpecLocChecker().Visit(*TL);
+ return DefaultTypeSpecLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -214,13 +214,13 @@
class TypedefLocChecker : public TypeLocVisitor<TypedefLocChecker, bool> {
public:
- bool VisitTypedefLoc(TypedefLoc TyLoc) { return true; }
+ bool VisitTypedefLoc(TypedefLoc TyLoc) { return true; }
};
}
bool TypedefLoc::classof(const TypeLoc *TL) {
- return TypedefLocChecker().Visit(*TL);
+ return TypedefLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -231,13 +231,13 @@
class PointerLocChecker : public TypeLocVisitor<PointerLocChecker, bool> {
public:
- bool VisitPointerLoc(PointerLoc TyLoc) { return true; }
+ bool VisitPointerLoc(PointerLoc TyLoc) { return true; }
};
}
bool PointerLoc::classof(const TypeLoc *TL) {
- return PointerLocChecker().Visit(*TL);
+ return PointerLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -249,13 +249,13 @@
class BlockPointerLocChecker :
public TypeLocVisitor<BlockPointerLocChecker, bool> {
public:
- bool VisitBlockPointerLoc(BlockPointerLoc TyLoc) { return true; }
+ bool VisitBlockPointerLoc(BlockPointerLoc TyLoc) { return true; }
};
}
bool BlockPointerLoc::classof(const TypeLoc *TL) {
- return BlockPointerLocChecker().Visit(*TL);
+ return BlockPointerLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -267,13 +267,13 @@
class MemberPointerLocChecker :
public TypeLocVisitor<MemberPointerLocChecker, bool> {
public:
- bool VisitMemberPointerLoc(MemberPointerLoc TyLoc) { return true; }
+ bool VisitMemberPointerLoc(MemberPointerLoc TyLoc) { return true; }
};
}
bool MemberPointerLoc::classof(const TypeLoc *TL) {
- return MemberPointerLocChecker().Visit(*TL);
+ return MemberPointerLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -284,13 +284,13 @@
class ReferenceLocChecker : public TypeLocVisitor<ReferenceLocChecker, bool> {
public:
- bool VisitReferenceLoc(ReferenceLoc TyLoc) { return true; }
+ bool VisitReferenceLoc(ReferenceLoc TyLoc) { return true; }
};
}
bool ReferenceLoc::classof(const TypeLoc *TL) {
- return ReferenceLocChecker().Visit(*TL);
+ return ReferenceLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -301,13 +301,13 @@
class FunctionLocChecker : public TypeLocVisitor<FunctionLocChecker, bool> {
public:
- bool VisitFunctionLoc(FunctionLoc TyLoc) { return true; }
+ bool VisitFunctionLoc(FunctionLoc TyLoc) { return true; }
};
}
bool FunctionLoc::classof(const TypeLoc *TL) {
- return FunctionLocChecker().Visit(*TL);
+ return FunctionLocChecker().Visit(*TL);
}
//===----------------------------------------------------------------------===//
@@ -318,11 +318,11 @@
class ArrayLocChecker : public TypeLocVisitor<ArrayLocChecker, bool> {
public:
- bool VisitArrayLoc(ArrayLoc TyLoc) { return true; }
+ bool VisitArrayLoc(ArrayLoc TyLoc) { return true; }
};
}
bool ArrayLoc::classof(const TypeLoc *TL) {
- return ArrayLocChecker().Visit(*TL);
+ return ArrayLocChecker().Visit(*TL);
}