[cfe-commits] r96961 - in /cfe/trunk: lib/CodeGen/Mangle.cpp test/CodeGenCXX/mangle-subst-std.cpp
Eli Friedman
eli.friedman at gmail.com
Tue Feb 23 10:20:18 PST 2010
Author: efriedma
Date: Tue Feb 23 12:20:18 2010
New Revision: 96961
URL: http://llvm.org/viewvc/llvm-project?rev=96961&view=rev
Log:
PR6400: Handle an extreme edge case in mangling correctly.
Modified:
cfe/trunk/lib/CodeGen/Mangle.cpp
cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp
Modified: cfe/trunk/lib/CodeGen/Mangle.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/Mangle.cpp?rev=96961&r1=96960&r2=96961&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/Mangle.cpp (original)
+++ cfe/trunk/lib/CodeGen/Mangle.cpp Tue Feb 23 12:20:18 2010
@@ -1652,6 +1652,9 @@
// ::std::char_traits<char>,
// ::std::allocator<char> >
if (SD->getIdentifier()->isStr("basic_string")) {
+ if (!isStdNamespace(SD->getDeclContext()))
+ return false;
+
const TemplateArgumentList &TemplateArgs = SD->getTemplateArgs();
if (TemplateArgs.size() != 3)
Modified: cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp?rev=96961&r1=96960&r2=96961&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mangle-subst-std.cpp Tue Feb 23 12:20:18 2010
@@ -55,3 +55,9 @@
terminate_handler set_terminate(terminate_handler) { return 0; }
}
}
+
+// Make sure we don't treat the following like std::string
+// CHECK: define void @_Z1f12basic_stringIcSt11char_traitsIcESaIcEE
+template<typename, typename, typename> struct basic_string { };
+typedef basic_string<char, std::char_traits<char>, std::allocator<char> > not_string;
+void f(not_string) { }
More information about the cfe-commits
mailing list