Implementation of gcc mode attribute; this is significant because 
it fixes PR2204.  Not too much to say about the implementation; it works 
in a similar way to the vector size attribute.

At some point, we need to modify the targets to provide information 
about the appropriate types.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51577 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 38dbb9b..8b89045 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -2384,6 +2384,17 @@
       vDecl->setType(newType);
     }
     break;
+  case AttributeList::AT_mode:
+    if (TypedefDecl *tDecl = dyn_cast<TypedefDecl>(New)) {
+      QualType newType = HandleModeTypeAttribute(tDecl->getUnderlyingType(),
+                                                 Attr);
+      tDecl->setUnderlyingType(newType);
+    } else if (ValueDecl *vDecl = dyn_cast<ValueDecl>(New)) {
+      QualType newType = HandleModeTypeAttribute(vDecl->getType(), Attr);
+      vDecl->setType(newType);
+    }
+    // FIXME: Diagnostic?
+    break;
   case AttributeList::AT_deprecated:
     HandleDeprecatedAttribute(New, Attr);
     break;