r200869 - MS ABI: Fix mangling of static methods and function references
jahanian
fjahanian at apple.com
Thu Feb 6 09:56:20 PST 2014
On Feb 5, 2014, at 10:59 AM, Reid Kleckner <reid at kleckner.net> wrote:
> Author: rnk
> Date: Wed Feb 5 12:59:38 2014
> New Revision: 200869
>
> URL: http://llvm.org/viewvc/llvm-project?rev=200869&view=rev
> Log:
> MS ABI: Fix mangling of static methods and function references
>
> Function references always use $1? like function pointers and never $E?
> like var decl references. Static methods are mangled like function
> pointers.
>
> Modified:
> cfe/trunk/lib/AST/MicrosoftMangle.cpp
> cfe/trunk/test/CodeGenCXX/mangle-ms-template-callback.cpp
This test has been failing on Appleās public buildbots, with this diagnostic:
FAIL: Clang :: CodeGenCXX/mangle-ms-templates-memptrs.cpp (2143 of 16710)
******************** TEST 'Clang :: CodeGenCXX/mangle-ms-templates-memptrs.cpp' FAILED ********************
Script:
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/Release+Asserts/bin/clang -cc1 -internal-isystem /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang-build/Release+Asserts/bin/../lib/clang/3.5/include -Wno-microsoft -fno-rtti -std=c++11 -emit-llvm /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp -o - -triple=i386-pc-win32 | FileCheck /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp
--
Exit Code: 2
Command Output (stderr):
--
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp:31:3: error: no matching function for call to 'ReadField'
ReadField<I, &S::a>(s);
^~~~~~~~~~~~~~~~~~~
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp:21:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'F'
int ReadField(T &o) {
^
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp:36:3: error: no matching function for call to 'ReadField'
ReadField<I, &S::b>(s);
^~~~~~~~~~~~~~~~~~~
/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin11-nobootstrap-RAincremental/clang.src/test/CodeGenCXX/mangle-ms-templates-memptrs.cpp:21:5: note: candidate template ignored: invalid explicitly-specified argument for template parameter 'F'
int ReadField(T &o) {
^
2 errors generated.
FileCheck error: '-' is empty.
Please take a look.
Thanks, Fariborz
>
> Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=200869&r1=200868&r2=200869&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
> +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Wed Feb 5 12:59:38 2014
> @@ -1090,12 +1090,17 @@ void MicrosoftCXXNameMangler::mangleTemp
> }
> case TemplateArgument::Declaration: {
> const NamedDecl *ND = cast<NamedDecl>(TA.getAsDecl());
> - if (const FieldDecl *FD = dyn_cast<FieldDecl>(ND))
> + if (const FieldDecl *FD = dyn_cast<FieldDecl>(ND)) {
> mangleMemberDataPointer(cast<CXXRecordDecl>(FD->getParent()), FD);
> - else if (const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(ND))
> - mangleMemberFunctionPointer(MD->getParent(), MD);
> - else
> + } else if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(ND)) {
> + const CXXMethodDecl *MD = dyn_cast<CXXMethodDecl>(ND);
> + if (MD && MD->isInstance())
> + mangleMemberFunctionPointer(MD->getParent(), MD);
> + else
> + mangle(ND, "$1?");
> + } else {
> mangle(ND, TA.isDeclForReferenceParam() ? "$E?" : "$1?");
> + }
> break;
> }
> case TemplateArgument::Integral:
>
> Modified: cfe/trunk/test/CodeGenCXX/mangle-ms-template-callback.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-ms-template-callback.cpp?rev=200869&r1=200868&r2=200869&view=diff
> ==============================================================================
> --- cfe/trunk/test/CodeGenCXX/mangle-ms-template-callback.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/mangle-ms-template-callback.cpp Wed Feb 5 12:59:38 2014
> @@ -70,3 +70,20 @@ void call_bar() {
> // CHECK: "\01??$bar at P_EAHH@Z@@YAXP_EAHH at Z@Z"
> // FYI blocks are not present in MSVS, so we're free to choose the spec.
> }
> +
> +template <void (*Fn)()> void WrapFnPtr() { Fn(); }
> +template <void (&Fn)()> void WrapFnRef() { Fn(); }
> +struct Thing {
> + static void VoidStaticMethod();
> +};
> +void VoidFn();
> +void CallWrapper() {
> + WrapFnPtr<VoidFn>();
> + WrapFnRef<VoidFn>();
> + WrapFnPtr<Thing::VoidStaticMethod>();
> + WrapFnRef<Thing::VoidStaticMethod>();
> +}
> +// CHECK: call {{.*}} @"\01??$WrapFnPtr@$1?VoidFn@@YAXXZ@@YAXXZ"
> +// CHECK: call {{.*}} @"\01??$WrapFnRef@$1?VoidFn@@YAXXZ@@YAXXZ"
> +// CHECK: call {{.*}} @"\01??$WrapFnPtr@$1?VoidStaticMethod at Thing@@SAXXZ@@YAXXZ"
> +// CHECK: call {{.*}} @"\01??$WrapFnRef@$1?VoidStaticMethod at Thing@@SAXXZ@@YAXXZ"
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140206/cc0b4381/attachment.html>
More information about the cfe-commits
mailing list