Move the static DeclAttrs map into ASTContext. Fixes <rdar://problem/6983177>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73702 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index 672e487..7e82783 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -39,7 +39,7 @@
 /// referenced), false otherwise.
 bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc) {
   // See if the decl is deprecated.
-  if (D->getAttr<DeprecatedAttr>()) {
+  if (D->getAttr<DeprecatedAttr>(Context)) {
     // Implementing deprecated stuff requires referencing deprecated
     // stuff. Don't warn if we are implementing a deprecated
     // construct.
@@ -48,7 +48,7 @@
     if (NamedDecl *ND = getCurFunctionOrMethodDecl()) {
       // If this reference happens *in* a deprecated function or method, don't
       // warn.
-      isSilenced = ND->getAttr<DeprecatedAttr>();
+      isSilenced = ND->getAttr<DeprecatedAttr>(Context);
       
       // If this is an Objective-C method implementation, check to see if the
       // method was deprecated on the declaration, not the definition.
@@ -61,7 +61,7 @@
           MD = Impl->getClassInterface()->getMethod(Context, 
                                                     MD->getSelector(),
                                                     MD->isInstanceMethod());
-          isSilenced |= MD && MD->getAttr<DeprecatedAttr>();
+          isSilenced |= MD && MD->getAttr<DeprecatedAttr>(Context);
         }
       }
     }
@@ -80,7 +80,7 @@
   }
 
   // See if the decl is unavailable
-  if (D->getAttr<UnavailableAttr>()) {
+  if (D->getAttr<UnavailableAttr>(Context)) {
     Diag(Loc, diag::warn_unavailable) << D->getDeclName();
     Diag(D->getLocation(), diag::note_unavailable_here) << 0;
   }
@@ -95,7 +95,7 @@
 void Sema::DiagnoseSentinelCalls(NamedDecl *D, SourceLocation Loc,
                                  Expr **Args, unsigned NumArgs)
 {
-  const SentinelAttr *attr = D->getAttr<SentinelAttr>();
+  const SentinelAttr *attr = D->getAttr<SentinelAttr>(Context);
   if (!attr) 
     return;
   int sentinelPos = attr->getSentinel();
@@ -1127,7 +1127,7 @@
   if (CurBlock && ShouldSnapshotBlockValueReference(CurBlock, VD)) {
     QualType ExprTy = VD->getType().getNonReferenceType();
     // The BlocksAttr indicates the variable is bound by-reference.
-    if (VD->getAttr<BlocksAttr>())
+    if (VD->getAttr<BlocksAttr>(Context))
       return Owned(new (Context) BlockDeclRefExpr(VD, ExprTy, Loc, true));
 
     // Variable will be bound by-copy, make it const within the closure.
@@ -3408,7 +3408,7 @@
   // If the ArgType is a Union type, we want to handle a potential 
   // transparent_union GCC extension.
   const RecordType *UT = ArgType->getAsUnionType();
-  if (!UT || !UT->getDecl()->hasAttr<TransparentUnionAttr>())
+  if (!UT || !UT->getDecl()->hasAttr<TransparentUnionAttr>(Context))
     return Incompatible;
 
   // The field to initialize within the transparent union.
@@ -5142,7 +5142,7 @@
     CurBlock->hasPrototype = true;
     CurBlock->isVariadic = false;
     // Check for a valid sentinel attribute on this block.
-    if (CurBlock->TheDecl->getAttr<SentinelAttr>()) {
+    if (CurBlock->TheDecl->getAttr<SentinelAttr>(Context)) {
       Diag(ParamInfo.getAttributes()->getLoc(), 
            diag::warn_attribute_sentinel_not_variadic) << 1;
       // FIXME: remove the attribute.
@@ -5190,7 +5190,8 @@
       PushOnScopeChains(*AI, CurBlock->TheScope);
 
   // Check for a valid sentinel attribute on this block.
-  if (!CurBlock->isVariadic && CurBlock->TheDecl->getAttr<SentinelAttr>()) {
+  if (!CurBlock->isVariadic && 
+      CurBlock->TheDecl->getAttr<SentinelAttr>(Context)) {
     Diag(ParamInfo.getAttributes()->getLoc(), 
          diag::warn_attribute_sentinel_not_variadic) << 1;
     // FIXME: remove the attribute.