Revert r298491 and r298494 which changed Clang's handling of 'nonnull'
attributes.

These patches don't work because we can't currently access the parameter
information in a reliable way when building attributes. I thought this
would be relatively straightforward to fix, but it seems not to be the
case. Fixing this will requrie a substantial re-plumbing of machinery to
allow attributes to be handled in this location, and several other fixes
to the attribute machinery should probably be made at the same time. All
of this will make the patch .... substantially more complicated.

Reverting for now as there are active miscompiles caused by the current
version.

llvm-svn: 298695
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 1c1f78a..071537a 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -8499,14 +8499,13 @@
 /// to be an Integer Constant Expression.
 static QualType DecodeTypeFromStr(const char *&Str, const ASTContext &Context,
                                   ASTContext::GetBuiltinTypeError &Error,
-                                  bool &RequiresICE, bool &OverrideNonnull,
+                                  bool &RequiresICE,
                                   bool AllowTypeModifiers) {
   // Modifiers.
   int HowLong = 0;
   bool Signed = false, Unsigned = false;
   RequiresICE = false;
-  OverrideNonnull = false;
-
+  
   // Read the prefixed modifiers first.
   bool Done = false;
   while (!Done) {
@@ -8515,9 +8514,6 @@
     case 'I':
       RequiresICE = true;
       break;
-    case 'N':
-      OverrideNonnull = true;
-      break;
     case 'S':
       assert(!Unsigned && "Can't use both 'S' and 'U' modifiers!");
       assert(!Signed && "Can't use 'S' modifier multiple times!");
@@ -8652,8 +8648,8 @@
     assert(End != Str && "Missing vector size");
     Str = End;
 
-    QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE,
-                                             OverrideNonnull, false);
+    QualType ElementType = DecodeTypeFromStr(Str, Context, Error, 
+                                             RequiresICE, false);
     assert(!RequiresICE && "Can't require vector ICE");
     
     // TODO: No way to make AltiVec vectors in builtins yet.
@@ -8668,15 +8664,15 @@
     assert(End != Str && "Missing vector size");
     
     Str = End;
-
+    
     QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE,
-                                             OverrideNonnull, false);
+                                             false);
     Type = Context.getExtVectorType(ElementType, NumElements);
     break;    
   }
   case 'X': {
     QualType ElementType = DecodeTypeFromStr(Str, Context, Error, RequiresICE,
-                                             OverrideNonnull, false);
+                                             false);
     assert(!RequiresICE && "Can't require complex ICE");
     Type = Context.getComplexType(ElementType);
     break;
@@ -8758,37 +8754,27 @@
 }
 
 /// GetBuiltinType - Return the type for the specified builtin.
-QualType ASTContext::GetBuiltinType(unsigned Id, GetBuiltinTypeError &Error,
-                                    unsigned *IntegerConstantArgs,
-                                    bool *OverrideNonnullReturn,
-                                    unsigned *OverrideNonnullArgs) const {
+QualType ASTContext::GetBuiltinType(unsigned Id,
+                                    GetBuiltinTypeError &Error,
+                                    unsigned *IntegerConstantArgs) const {
   const char *TypeStr = BuiltinInfo.getTypeString(Id);
 
   SmallVector<QualType, 8> ArgTypes;
 
   bool RequiresICE = false;
-  bool OverrideNonnull = false;
   Error = GE_None;
-  QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE,
-                                       OverrideNonnull, true);
+  QualType ResType = DecodeTypeFromStr(TypeStr, *this, Error,
+                                       RequiresICE, true);
   if (Error != GE_None)
     return QualType();
-
-  if (OverrideNonnullReturn)
-    *OverrideNonnullReturn = OverrideNonnull;
+  
   assert(!RequiresICE && "Result of intrinsic cannot be required to be an ICE");
-
+  
   while (TypeStr[0] && TypeStr[0] != '.') {
-    QualType Ty = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE,
-                                    OverrideNonnull, true);
+    QualType Ty = DecodeTypeFromStr(TypeStr, *this, Error, RequiresICE, true);
     if (Error != GE_None)
       return QualType();
 
-    // If this argument should have any nonnull annotations overriden, fill in
-    // the bitmask.
-    if (OverrideNonnull && OverrideNonnullArgs)
-      *OverrideNonnullArgs |= 1 << ArgTypes.size();
-
     // If this argument is required to be an IntegerConstantExpression and the
     // caller cares, fill in the bitmask we return.
     if (RequiresICE && IntegerConstantArgs)