Make sure we actually found a redeclaration before complaining about attributes added to a redeclaration in C++

llvm-svn: 80403
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 85b5963..d1bb6fb 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -2736,7 +2736,7 @@
   ProcessDeclAttributes(S, NewFD, D);
 
   // attributes declared post-definition are currently ignored
-  if (PrevDecl) {
+  if (Redeclaration && PrevDecl) {
     const FunctionDecl *Def, *PrevFD = dyn_cast<FunctionDecl>(PrevDecl);
     if (PrevFD && PrevFD->getBody(Def) && D.hasAttributes()) {
       Diag(NewFD->getLocation(), diag::warn_attribute_precede_definition);