]> granicus.if.org Git - clang/commitdiff
Make canonicalization of overloaded function declarations match the
authorDouglas Gregor <dgregor@apple.com>
Fri, 31 Jul 2009 16:07:31 +0000 (16:07 +0000)
committerDouglas Gregor <dgregor@apple.com>
Fri, 31 Jul 2009 16:07:31 +0000 (16:07 +0000)
Itanium C++ ABI's name mangling, since both are related to the notion
of "equivalent" function templates.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@77678 91177308-0d34-0410-b5e6-96231b3b80d8

lib/AST/StmtProfile.cpp
test/SemaTemplate/canonical-expr-type.cpp

index 5a04df04065ace2b7ad7e654b5e67c504d51440d..d0f02ae95bc12084e7623a7d4fabfabeb39d7c22 100644 (file)
@@ -629,25 +629,9 @@ void StmtProfiler::VisitDecl(Decl *D) {
     }
     
     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;
     }
   }
index fec03c60764cf808144ce201e6cb61c226ffd6f9..0580c677e62781fd607386cab22f945a9a6d3a49 100644 (file)
@@ -22,12 +22,13 @@ void f0a(T x, __typeof__(f(N)) y) { } // expected-note{{previous}}
 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>