Besides the warning, issue unsupported diagnostics in 
ir gen. No intended change in functionality.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67857 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 8a88051..0759abd 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -286,6 +286,9 @@
 
   if (D->getAttr<StdCallAttr>())
     F->setCallingConv(llvm::CallingConv::X86_StdCall);
+
+  if (D->getAttr<RegparmAttr>())
+    ErrorUnsupported(D, "regparm attribute");
 }
 
 /// SetFunctionAttributesForDefinition - Set function attributes
@@ -308,6 +311,9 @@
   
   if (D->getAttr<NoinlineAttr>())
     F->addFnAttr(llvm::Attribute::NoInline);
+  
+  if (D->getAttr<RegparmAttr>())
+    ErrorUnsupported(D, "regparm attribute");
 }
 
 void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD,
diff --git a/lib/Parse/AttributeList.cpp b/lib/Parse/AttributeList.cpp
index 9cee6ab..cd192c9 100644
--- a/lib/Parse/AttributeList.cpp
+++ b/lib/Parse/AttributeList.cpp
@@ -80,6 +80,7 @@
     if (!memcmp(Str, "nonnull", 7)) return AT_nonnull;
     if (!memcmp(Str, "nothrow", 7)) return AT_nothrow;
     if (!memcmp(Str, "objc_gc", 7)) return AT_objc_gc;
+    if (!memcmp(Str, "regparm", 7)) return AT_regparm;
     if (!memcmp(Str, "section", 7)) return AT_section;
     if (!memcmp(Str, "stdcall", 7)) return AT_stdcall;
     break;
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 53c86eb..c8d98cf 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -1444,6 +1444,22 @@
   d->addAttr(::new (S.Context) NoinlineAttr());
 }
 
+static void HandleRegparmAttr(Decl *d, const AttributeList &Attr, Sema &S) {
+  // check the attribute arguments.
+  if (Attr.getNumArgs() != 1) {
+    S.Diag(Attr.getLoc(), diag::err_attribute_wrong_number_arguments) << 0;
+    return;
+  }
+  
+  if (!isFunctionOrMethod(d)) {
+    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type)
+    << "regparm" << 0 /*function*/;
+    return;
+  }
+  
+  d->addAttr(::new (S.Context) RegparmAttr());
+}
+
 //===----------------------------------------------------------------------===//
 // Top Level Sema Entry Points
 //===----------------------------------------------------------------------===//
@@ -1504,6 +1520,10 @@
   case AttributeList::AT_cleanup:     HandleCleanupAttr   (D, Attr, S); break;
   case AttributeList::AT_nodebug:     HandleNodebugAttr   (D, Attr, S); break;
   case AttributeList::AT_noinline:    HandleNoinlineAttr  (D, Attr, S); break;
+  case AttributeList::AT_regparm:
+    HandleRegparmAttr  (D, Attr, S);
+    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName();
+    break;
   case AttributeList::IgnoredAttribute: 
     // Just ignore
     break;