[cfe-commits] r77678 - in /cfe/trunk: lib/AST/StmtProfile.cpp test/SemaTemplate/canonical-expr-type.cpp

Douglas Gregor dgregor at apple.com
Fri Jul 31 09:07:32 PDT 2009


Author: dgregor
Date: Fri Jul 31 11:07:31 2009
New Revision: 77678

URL: http://llvm.org/viewvc/llvm-project?rev=77678&view=rev
Log:
Make canonicalization of overloaded function declarations match the
Itanium C++ ABI's name mangling, since both are related to the notion
of "equivalent" function templates.

Modified:
    cfe/trunk/lib/AST/StmtProfile.cpp
    cfe/trunk/test/SemaTemplate/canonical-expr-type.cpp

Modified: cfe/trunk/lib/AST/StmtProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/StmtProfile.cpp?rev=77678&r1=77677&r2=77678&view=diff

==============================================================================
--- cfe/trunk/lib/AST/StmtProfile.cpp (original)
+++ cfe/trunk/lib/AST/StmtProfile.cpp Fri Jul 31 11:07:31 2009
@@ -629,25 +629,9 @@
     }
     
     if (OverloadedFunctionDecl *Ovl = dyn_cast<OverloadedFunctionDecl>(D)) {
-      // Canonicalize all of the function declarations within the overload
-      // set.
-      llvm::SmallVector<Decl *, 4> Functions;
-      for (OverloadedFunctionDecl::function_iterator F = Ovl->function_begin(),
-                                                  FEnd = Ovl->function_end();
-           F != FEnd; ++F)
-        Functions.push_back(F->get()->getCanonicalDecl());
-      
-      // Sorting the functions based on the point means that the ID generated
-      // will be different from one execution of the compiler to another.
-      // Since these IDs don't persist over time, the change in ordering will
-      // not affect compilation.
-      std::sort(Functions.begin(), Functions.end());
-      
-      for (llvm::SmallVector<Decl *, 4>::iterator F = Functions.begin(),
-                                               FEnd = Functions.end();
-           F != FEnd; ++F)
-        VisitDecl(*F);
-
+      // The Itanium C++ ABI mangles references to a set of overloaded 
+      // functions using just the function name, so we do the same here.
+      VisitName(Ovl->getDeclName());
       return;
     }
   }

Modified: cfe/trunk/test/SemaTemplate/canonical-expr-type.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/canonical-expr-type.cpp?rev=77678&r1=77677&r2=77678&view=diff

==============================================================================
--- cfe/trunk/test/SemaTemplate/canonical-expr-type.cpp (original)
+++ cfe/trunk/test/SemaTemplate/canonical-expr-type.cpp Fri Jul 31 11:07:31 2009
@@ -22,12 +22,13 @@
 void f(int);
 
 template<typename T, T N>
-void f0a(T x, __typeof__(f(N)) y) { } // expected-error{{redefinition}}
+void f0a(T x, __typeof__(f(N)) y) { } // expected-error{{redefinition}} \
+                                      // expected-note{{previous}}
 
 void f(float);
 
 template<typename T, T N>
-void f0a(T x, __typeof__(f(N)) y) { }
+void f0a(T x, __typeof__(f(N)) y) { } // expected-error{{redefinition}}
 
 // Test dependently-sized array canonicalization
 template<typename T, int N, int M>





More information about the cfe-commits mailing list