r203237 - Fully reverting r203236 -- it seems the only bots that are happy are the MSVC bots.
Aaron Ballman
aaron at aaronballman.com
Fri Mar 7 05:13:39 PST 2014
Author: aaronballman
Date: Fri Mar 7 07:13:38 2014
New Revision: 203237
URL: http://llvm.org/viewvc/llvm-project?rev=203237&view=rev
Log:
Fully reverting r203236 -- it seems the only bots that are happy are the MSVC bots.
Modified:
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
cfe/trunk/include/clang/AST/DeclBase.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/lib/AST/ASTDumper.cpp
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/AST/DeclBase.cpp
cfe/trunk/lib/Sema/SemaCodeComplete.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaObjCProperty.cpp
cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
cfe/trunk/tools/libclang/CIndex.cpp
cfe/trunk/tools/libclang/IndexingContext.cpp
Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Fri Mar 7 07:13:38 2014
@@ -598,8 +598,8 @@ bool DataRecursiveASTVisitor<Derived>::T
}
// Visit any attributes attached to this declaration.
- for (auto I : D->attrs()) {
- if (!getDerived().TraverseAttr(I))
+ for (Decl::attr_iterator I=D->attr_begin(), E=D->attr_end(); I != E; ++I) {
+ if (!getDerived().TraverseAttr(*I))
return false;
}
return true;
Modified: cfe/trunk/include/clang/AST/DeclBase.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclBase.h?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclBase.h (original)
+++ cfe/trunk/include/clang/AST/DeclBase.h Fri Mar 7 07:13:38 2014
@@ -18,7 +18,6 @@
#include "clang/AST/DeclarationName.h"
#include "clang/Basic/Linkage.h"
#include "clang/Basic/Specifiers.h"
-#include "llvm/ADT/iterator_range.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/iterator_range.h"
#include "llvm/Support/Compiler.h"
@@ -448,23 +447,14 @@ public:
}
typedef AttrVec::const_iterator attr_iterator;
- typedef llvm::iterator_range<attr_iterator> attr_range;
-
- attr_range attrs() const {
- // FIXME: Do not rely on iterators having comparable singular values.
- // Note that this should error out if they do not.
- if (!hasAttrs())
- return attr_range();
-
- auto const &A = getAttrs();
- return attr_range(A.begin(), A.end());
- }
+ // FIXME: Do not rely on iterators having comparable singular values.
+ // Note that this should error out if they do not.
attr_iterator attr_begin() const {
- return attrs().begin();
+ return hasAttrs() ? getAttrs().begin() : 0;
}
attr_iterator attr_end() const {
- return attrs().end();
+ return hasAttrs() ? getAttrs().end() : 0;
}
template <typename T>
Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Fri Mar 7 07:13:38 2014
@@ -669,8 +669,8 @@ bool RecursiveASTVisitor<Derived>::Trave
}
// Visit any attributes attached to this declaration.
- for (auto I : D->attrs()) {
- if (!getDerived().TraverseAttr(I))
+ for (Decl::attr_iterator I=D->attr_begin(), E=D->attr_end(); I != E; ++I) {
+ if (!getDerived().TraverseAttr(*I))
return false;
}
return true;
Modified: cfe/trunk/lib/AST/ASTDumper.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTDumper.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTDumper.cpp (original)
+++ cfe/trunk/lib/AST/ASTDumper.cpp Fri Mar 7 07:13:38 2014
@@ -762,7 +762,7 @@ void ASTDumper::dumpDecl(const Decl *D)
if (ND->isHidden())
OS << " hidden";
- bool HasAttrs = D->hasAttrs();
+ bool HasAttrs = D->attr_begin() != D->attr_end();
const FullComment *Comment =
D->getASTContext().getLocalCommentForDeclUncached(D);
// Decls within functions are visited by the body
Modified: cfe/trunk/lib/AST/Decl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Mar 7 07:13:38 2014
@@ -3501,8 +3501,8 @@ LabelDecl *LabelDecl::CreateDeserialized
void ValueDecl::anchor() { }
bool ValueDecl::isWeak() const {
- for (auto I : attrs())
- if (isa<WeakAttr>(I) || isa<WeakRefAttr>(I))
+ for (attr_iterator I = attr_begin(), E = attr_end(); I != E; ++I)
+ if (isa<WeakAttr>(*I) || isa<WeakRefAttr>(*I))
return true;
return isWeakImported();
Modified: cfe/trunk/lib/AST/DeclBase.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclBase.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclBase.cpp (original)
+++ cfe/trunk/lib/AST/DeclBase.cpp Fri Mar 7 07:13:38 2014
@@ -408,8 +408,8 @@ AvailabilityResult Decl::getAvailability
AvailabilityResult Result = AR_Available;
std::string ResultMessage;
- for (auto A : attrs()) {
- if (auto Deprecated = dyn_cast<DeprecatedAttr>(A)) {
+ for (attr_iterator A = attr_begin(), AEnd = attr_end(); A != AEnd; ++A) {
+ if (DeprecatedAttr *Deprecated = dyn_cast<DeprecatedAttr>(*A)) {
if (Result >= AR_Deprecated)
continue;
@@ -420,13 +420,13 @@ AvailabilityResult Decl::getAvailability
continue;
}
- if (auto Unavailable = dyn_cast<UnavailableAttr>(A)) {
+ if (UnavailableAttr *Unavailable = dyn_cast<UnavailableAttr>(*A)) {
if (Message)
*Message = Unavailable->getMessage();
return AR_Unavailable;
}
- if (auto Availability = dyn_cast<AvailabilityAttr>(A)) {
+ if (AvailabilityAttr *Availability = dyn_cast<AvailabilityAttr>(*A)) {
AvailabilityResult AR = CheckAvailability(getASTContext(), Availability,
Message);
@@ -482,11 +482,11 @@ bool Decl::isWeakImported() const {
if (!canBeWeakImported(IsDefinition))
return false;
- for (auto A : attrs()) {
- if (isa<WeakImportAttr>(A))
+ for (attr_iterator A = attr_begin(), AEnd = attr_end(); A != AEnd; ++A) {
+ if (isa<WeakImportAttr>(*A))
return true;
- if (AvailabilityAttr *Availability = dyn_cast<AvailabilityAttr>(A)) {
+ if (AvailabilityAttr *Availability = dyn_cast<AvailabilityAttr>(*A)) {
if (CheckAvailability(getASTContext(), Availability, 0)
== AR_NotYetIntroduced)
return true;
Modified: cfe/trunk/lib/Sema/SemaCodeComplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCodeComplete.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaCodeComplete.cpp (original)
+++ cfe/trunk/lib/Sema/SemaCodeComplete.cpp Fri Mar 7 07:13:38 2014
@@ -2638,11 +2638,12 @@ CodeCompletionResult::CreateCodeCompleti
return Result.TakeString();
}
- for (auto i = ND->specific_attr_begin<AnnotateAttr>(),
- e = ND->specific_attr_end<AnnotateAttr>(); i != e; ++i)
- Result.AddAnnotation(
- Result.getAllocator().CopyString((*i)->getAnnotation()));
-
+ for (Decl::attr_iterator i = ND->attr_begin(); i != ND->attr_end(); ++i) {
+ if (AnnotateAttr *Attr = dyn_cast_or_null<AnnotateAttr>(*i)) {
+ Result.AddAnnotation(Result.getAllocator().CopyString(Attr->getAnnotation()));
+ }
+ }
+
AddResultTypeChunk(Ctx, Policy, ND, Result);
if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(ND)) {
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Fri Mar 7 07:13:38 2014
@@ -1791,16 +1791,16 @@ void Sema::MergeTypedefNameDecl(TypedefN
static bool DeclHasAttr(const Decl *D, const Attr *A) {
const OwnershipAttr *OA = dyn_cast<OwnershipAttr>(A);
const AnnotateAttr *Ann = dyn_cast<AnnotateAttr>(A);
- for (auto i : D->attrs())
- if (i->getKind() == A->getKind()) {
+ for (Decl::attr_iterator i = D->attr_begin(), e = D->attr_end(); i != e; ++i)
+ if ((*i)->getKind() == A->getKind()) {
if (Ann) {
- if (Ann->getAnnotation() == cast<AnnotateAttr>(i)->getAnnotation())
+ if (Ann->getAnnotation() == cast<AnnotateAttr>(*i)->getAnnotation())
return true;
continue;
}
// FIXME: Don't hardcode this check
- if (OA && isa<OwnershipAttr>(i))
- return OA->getOwnKind() == cast<OwnershipAttr>(i)->getOwnKind();
+ if (OA && isa<OwnershipAttr>(*i))
+ return OA->getOwnKind() == cast<OwnershipAttr>(*i)->getOwnKind();
return true;
}
@@ -1997,9 +1997,12 @@ static const Decl *getDefinition(const D
}
static bool hasAttribute(const Decl *D, attr::Kind Kind) {
- for (auto Attribute : D->attrs())
+ for (Decl::attr_iterator I = D->attr_begin(), E = D->attr_end();
+ I != E; ++I) {
+ Attr *Attribute = *I;
if (Attribute->getKind() == Kind)
return true;
+ }
return false;
}
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Mar 7 07:13:38 2014
@@ -12723,41 +12723,48 @@ bool Sema::checkThisInStaticMemberFuncti
FindCXXThisExpr Finder(*this);
// Check attributes.
- for (auto A : Method->attrs()) {
+ for (Decl::attr_iterator A = Method->attr_begin(), AEnd = Method->attr_end();
+ A != AEnd; ++A) {
// FIXME: This should be emitted by tblgen.
Expr *Arg = 0;
ArrayRef<Expr *> Args;
- if (auto G = dyn_cast<GuardedByAttr>(A))
+ if (GuardedByAttr *G = dyn_cast<GuardedByAttr>(*A))
Arg = G->getArg();
- else if (auto G = dyn_cast<PtGuardedByAttr>(A))
+ else if (PtGuardedByAttr *G = dyn_cast<PtGuardedByAttr>(*A))
Arg = G->getArg();
- else if (auto AA = dyn_cast<AcquiredAfterAttr>(A))
+ else if (AcquiredAfterAttr *AA = dyn_cast<AcquiredAfterAttr>(*A))
Args = ArrayRef<Expr *>(AA->args_begin(), AA->args_size());
- else if (auto AB = dyn_cast<AcquiredBeforeAttr>(A))
+ else if (AcquiredBeforeAttr *AB = dyn_cast<AcquiredBeforeAttr>(*A))
Args = ArrayRef<Expr *>(AB->args_begin(), AB->args_size());
- else if (auto ELF = dyn_cast<ExclusiveLockFunctionAttr>(A))
+ else if (ExclusiveLockFunctionAttr *ELF
+ = dyn_cast<ExclusiveLockFunctionAttr>(*A))
Args = ArrayRef<Expr *>(ELF->args_begin(), ELF->args_size());
- else if (auto SLF = dyn_cast<SharedLockFunctionAttr>(A))
+ else if (SharedLockFunctionAttr *SLF
+ = dyn_cast<SharedLockFunctionAttr>(*A))
Args = ArrayRef<Expr *>(SLF->args_begin(), SLF->args_size());
- else if (auto ETLF = dyn_cast<ExclusiveTrylockFunctionAttr>(A)) {
+ else if (ExclusiveTrylockFunctionAttr *ETLF
+ = dyn_cast<ExclusiveTrylockFunctionAttr>(*A)) {
Arg = ETLF->getSuccessValue();
Args = ArrayRef<Expr *>(ETLF->args_begin(), ETLF->args_size());
- } else if (auto STLF = dyn_cast<SharedTrylockFunctionAttr>(A)) {
+ } else if (SharedTrylockFunctionAttr *STLF
+ = dyn_cast<SharedTrylockFunctionAttr>(*A)) {
Arg = STLF->getSuccessValue();
Args = ArrayRef<Expr *>(STLF->args_begin(), STLF->args_size());
- } else if (auto UF = dyn_cast<UnlockFunctionAttr>(A))
+ } else if (UnlockFunctionAttr *UF = dyn_cast<UnlockFunctionAttr>(*A))
Args = ArrayRef<Expr *>(UF->args_begin(), UF->args_size());
- else if (auto LR = dyn_cast<LockReturnedAttr>(A))
+ else if (LockReturnedAttr *LR = dyn_cast<LockReturnedAttr>(*A))
Arg = LR->getArg();
- else if (auto LE = dyn_cast<LocksExcludedAttr>(A))
+ else if (LocksExcludedAttr *LE = dyn_cast<LocksExcludedAttr>(*A))
Args = ArrayRef<Expr *>(LE->args_begin(), LE->args_size());
- else if (auto RC = dyn_cast<RequiresCapabilityAttr>(A))
+ else if (RequiresCapabilityAttr *RC
+ = dyn_cast<RequiresCapabilityAttr>(*A))
Args = ArrayRef<Expr *>(RC->args_begin(), RC->args_size());
- else if (auto AC = dyn_cast<AcquireCapabilityAttr>(A))
+ else if (AcquireCapabilityAttr *AC = dyn_cast<AcquireCapabilityAttr>(*A))
Args = ArrayRef<Expr *>(AC->args_begin(), AC->args_size());
- else if (auto AC = dyn_cast<TryAcquireCapabilityAttr>(A))
- Args = ArrayRef<Expr *>(AC->args_begin(), AC->args_size());
- else if (auto RC = dyn_cast<ReleaseCapabilityAttr>(A))
+ else if (TryAcquireCapabilityAttr *AC
+ = dyn_cast<TryAcquireCapabilityAttr>(*A))
+ Args = ArrayRef<Expr *>(AC->args_begin(), AC->args_size());
+ else if (ReleaseCapabilityAttr *RC = dyn_cast<ReleaseCapabilityAttr>(*A))
Args = ArrayRef<Expr *>(RC->args_begin(), RC->args_size());
if (Arg && !Finder.TraverseStmt(Arg))
Modified: cfe/trunk/lib/Sema/SemaObjCProperty.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaObjCProperty.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaObjCProperty.cpp (original)
+++ cfe/trunk/lib/Sema/SemaObjCProperty.cpp Fri Mar 7 07:13:38 2014
@@ -1940,11 +1940,13 @@ void Sema::DiagnoseMissingDesignatedInit
static void AddPropertyAttrs(Sema &S, ObjCMethodDecl *PropertyMethod,
ObjCPropertyDecl *Property) {
// Should we just clone all attributes over?
- for (auto A : Property->attrs()) {
- if (isa<DeprecatedAttr>(A) ||
- isa<UnavailableAttr>(A) ||
- isa<AvailabilityAttr>(A))
- PropertyMethod->addAttr(A->clone(S.Context));
+ for (Decl::attr_iterator A = Property->attr_begin(),
+ AEnd = Property->attr_end();
+ A != AEnd; ++A) {
+ if (isa<DeprecatedAttr>(*A) ||
+ isa<UnavailableAttr>(*A) ||
+ isa<AvailabilityAttr>(*A))
+ PropertyMethod->addAttr((*A)->clone(S.Context));
}
}
Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiateDecl.cpp Fri Mar 7 07:13:38 2014
@@ -168,7 +168,10 @@ void Sema::InstantiateAttrs(const MultiL
const Decl *Tmpl, Decl *New,
LateInstantiatedAttrVec *LateAttrs,
LocalInstantiationScope *OuterMostScope) {
- for (auto TmplAttr : Tmpl->attrs()) {
+ for (AttrVec::const_iterator i = Tmpl->attr_begin(), e = Tmpl->attr_end();
+ i != e; ++i) {
+ const Attr *TmplAttr = *i;
+
// FIXME: This should be generalized to more than just the AlignedAttr.
const AlignedAttr *Aligned = dyn_cast<AlignedAttr>(TmplAttr);
if (Aligned && Aligned->isAlignmentDependent()) {
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Fri Mar 7 07:13:38 2014
@@ -1675,8 +1675,9 @@ bool CursorVisitor::VisitCXXRecordDecl(C
}
bool CursorVisitor::VisitAttributes(Decl *D) {
- for (auto I : D->attrs())
- if (Visit(MakeCXCursor(I, D, TU)))
+ for (AttrVec::const_iterator i = D->attr_begin(), e = D->attr_end();
+ i != e; ++i)
+ if (Visit(MakeCXCursor(*i, D, TU)))
return true;
return false;
@@ -6040,8 +6041,9 @@ static int getCursorPlatformAvailability
int availability_size) {
bool HadAvailAttr = false;
int N = 0;
- for (auto A : D->attrs()) {
- if (DeprecatedAttr *Deprecated = dyn_cast<DeprecatedAttr>(A)) {
+ for (Decl::attr_iterator A = D->attr_begin(), AEnd = D->attr_end(); A != AEnd;
+ ++A) {
+ if (DeprecatedAttr *Deprecated = dyn_cast<DeprecatedAttr>(*A)) {
HadAvailAttr = true;
if (always_deprecated)
*always_deprecated = 1;
@@ -6050,7 +6052,7 @@ static int getCursorPlatformAvailability
continue;
}
- if (UnavailableAttr *Unavailable = dyn_cast<UnavailableAttr>(A)) {
+ if (UnavailableAttr *Unavailable = dyn_cast<UnavailableAttr>(*A)) {
HadAvailAttr = true;
if (always_unavailable)
*always_unavailable = 1;
@@ -6060,7 +6062,7 @@ static int getCursorPlatformAvailability
continue;
}
- if (AvailabilityAttr *Avail = dyn_cast<AvailabilityAttr>(A)) {
+ if (AvailabilityAttr *Avail = dyn_cast<AvailabilityAttr>(*A)) {
HadAvailAttr = true;
if (N < availability_size) {
availability[N].Platform
Modified: cfe/trunk/tools/libclang/IndexingContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexingContext.cpp?rev=203237&r1=203236&r2=203237&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexingContext.cpp (original)
+++ cfe/trunk/tools/libclang/IndexingContext.cpp Fri Mar 7 07:13:38 2014
@@ -67,7 +67,9 @@ AttrListInfo::AttrListInfo(const Decl *D
if (!D->hasAttrs())
return;
- for (auto A : D->attrs()) {
+ for (AttrVec::const_iterator AttrI = D->attr_begin(), AttrE = D->attr_end();
+ AttrI != AttrE; ++AttrI) {
+ const Attr *A = *AttrI;
CXCursor C = MakeCXCursor(A, D, IdxCtx.CXTU);
CXIdxLoc Loc = IdxCtx.getIndexLoc(A->getLocation());
switch (C.kind) {
More information about the cfe-commits
mailing list