Don't warn about function templates or function template specializations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90943 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 392360f..617adfe 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -3998,23 +3998,31 @@
   // Don't warn about invalid declarations.
   if (FD->isInvalidDecl())
     return false;
-  
+
   // Or declarations that aren't global.
   if (!FD->isGlobal())
     return false;
-  
+
   // Don't warn about C++ member functions.
   if (isa<CXXMethodDecl>(FD))
     return false;
-  
+
   // Don't warn about 'main'.
   if (FD->isMain())
     return false;
- 
+
   // Don't warn about inline functions.
   if (FD->isInlineSpecified())
     return false;
-  
+
+  // Don't warn about function templates.
+  if (FD->getDescribedFunctionTemplate())
+    return false;
+
+  // Don't warn about function template specializations.
+  if (FD->isFunctionTemplateSpecialization())
+    return false;
+
   bool MissingPrototype = true;
   for (const FunctionDecl *Prev = FD->getPreviousDeclaration();
        Prev; Prev = Prev->getPreviousDeclaration()) {
diff --git a/test/SemaCXX/warn-missing-prototypes.cpp b/test/SemaCXX/warn-missing-prototypes.cpp
index 4815470..079a837 100644
--- a/test/SemaCXX/warn-missing-prototypes.cpp
+++ b/test/SemaCXX/warn-missing-prototypes.cpp
@@ -7,13 +7,20 @@
 }
 
 namespace {
-  // Should not warn about anonymous namespaces
+  // Don't warn about functions in anonymous namespaces.
   void f() { }
 }
 
 struct A {
-  // Should not warn about member functions.
+  // Don't warn about member functions.
   void f() { }
 };
 
-inline void g() { }
\ No newline at end of file
+// Don't warn about inline functions.
+inline void g() { }
+
+// Don't warn about function templates.
+template<typename> void h() { }
+
+// Don't warn when instantiating function templates.
+template void h<int>();