Fully reverting r203236 -- it seems the only bots that are happy are the MSVC bots.
llvm-svn: 203237
diff --git a/clang/lib/Sema/SemaCodeComplete.cpp b/clang/lib/Sema/SemaCodeComplete.cpp
index 887b93a..28f85d7 100644
--- a/clang/lib/Sema/SemaCodeComplete.cpp
+++ b/clang/lib/Sema/SemaCodeComplete.cpp
@@ -2638,11 +2638,12 @@
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)) {
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index f0a2430..9840d1e 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -1791,16 +1791,16 @@
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 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;
}
diff --git a/clang/lib/Sema/SemaDeclCXX.cpp b/clang/lib/Sema/SemaDeclCXX.cpp
index 0b83427..2d35d5c 100644
--- a/clang/lib/Sema/SemaDeclCXX.cpp
+++ b/clang/lib/Sema/SemaDeclCXX.cpp
@@ -12723,41 +12723,48 @@
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))
diff --git a/clang/lib/Sema/SemaObjCProperty.cpp b/clang/lib/Sema/SemaObjCProperty.cpp
index 785aa6a..c96fcbe 100644
--- a/clang/lib/Sema/SemaObjCProperty.cpp
+++ b/clang/lib/Sema/SemaObjCProperty.cpp
@@ -1940,11 +1940,13 @@
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));
}
}
diff --git a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
index 2909768..a912f34 100644
--- a/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
+++ b/clang/lib/Sema/SemaTemplateInstantiateDecl.cpp
@@ -168,7 +168,10 @@
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()) {