Re: r339428 - Add Windows support for the GNUstep Objective-C ABI V2.
Hello David, This commit broke the following test on the expensive check builder: CodeGenObjC/2007-04-03-ObjcEH.m The last green build is for r339427 - http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/11726 r339428 makes it red - http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/11723 Could you take care of this, please? Thanks Galina On Fri, Aug 10, 2018 at 5:53 AM, David Chisnall via cfe-commits < cfe-commits@lists.llvm.org> wrote: > Author: theraven > Date: Fri Aug 10 05:53:13 2018 > New Revision: 339428 > > URL: http://llvm.org/viewvc/llvm-project?rev=339428=rev > Log: > Add Windows support for the GNUstep Objective-C ABI V2. > > Summary: > Introduces funclet-based unwinding for Objective-C and fixes an issue > where global blocks can't have their isa pointers initialised on > Windows. > > After discussion with Dustin, this changes the name mangling of > Objective-C types to prevent a C++ catch statement of type struct X* > from catching an Objective-C object of type X*. > > Reviewers: rjmccall, DHowett-MSFT > > Reviewed By: rjmccall, DHowett-MSFT > > Subscribers: mgrang, mstorsjo, smeenai, cfe-commits > > Differential Revision: https://reviews.llvm.org/D50144 > > Modified: > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/lib/AST/MicrosoftMangle.cpp > cfe/trunk/lib/CodeGen/CGException.cpp > cfe/trunk/lib/CodeGen/CGObjCGNU.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.h > cfe/trunk/lib/CodeGen/CodeGenFunction.h > cfe/trunk/lib/Driver/ToolChains/Clang.cpp > cfe/trunk/test/CodeGenObjC/gnu-init.m > cfe/trunk/test/CodeGenObjC/gnustep2-proto.m > cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm > cfe/trunk/test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-types.mm > > Modified: cfe/trunk/include/clang/Driver/Options.td > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/ > clang/Driver/Options.td?rev=339428=339427=339428=diff > > == > --- cfe/trunk/include/clang/Driver/Options.td (original) > +++ cfe/trunk/include/clang/Driver/Options.td Fri Aug 10 05:53:13 2018 > @@ -1488,7 +1488,7 @@ def fobjc_weak : Flag<["-"], "fobjc-weak >HelpText<"Enable ARC-style weak references in Objective-C">; > > // Objective-C ABI options. > -def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, > Flags<[CC1Option]>, > +def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, > Flags<[CC1Option, CoreOption]>, >HelpText<"Specify the target Objective-C runtime kind and version">; > def fobjc_abi_version_EQ : Joined<["-"], "fobjc-abi-version=">, > Group; > def fobjc_nonfragile_abi_version_EQ : Joined<["-"], > "fobjc-nonfragile-abi-version=">, Group; > > Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp > URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ > MicrosoftMangle.cpp?rev=339428=339427=339428=diff > > == > --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) > +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Aug 10 05:53:13 2018 > @@ -445,7 +445,7 @@ void MicrosoftCXXNameMangler::mangle(con > mangleFunctionEncoding(FD, Context.shouldMangleDeclName(FD)); >else if (const VarDecl *VD = dyn_cast(D)) > mangleVariableEncoding(VD); > - else > + else if (!isa(D)) > llvm_unreachable("Tried to mangle unexpected NamedDecl!"); > } > > @@ -1884,13 +1884,13 @@ void MicrosoftCXXNameMangler::mangleType > llvm_unreachable("placeholder types shouldn't get to name mangling"); > >case BuiltinType::ObjCId: > -mangleArtificalTagType(TTK_Struct, "objc_object"); > +mangleArtificalTagType(TTK_Struct, ".objc_object"); > break; >case BuiltinType::ObjCClass: > -mangleArtificalTagType(TTK_Struct, "objc_class"); > +mangleArtificalTagType(TTK_Struct, ".objc_class"); > break; >case BuiltinType::ObjCSel: > -mangleArtificalTagType(TTK_Struct, "objc_selector"); > +mangleArtificalTagType(TTK_Struct, ".objc_selector"); > break; > > #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ > @@ -2570,9 +2570,10 @@ void MicrosoftCXXNameMangler::mangleType > > void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T, > Qualifiers, > SourceRange) { > - // ObjC interfaces have structs underlying them. > + // ObjC interfaces are mangled as if they were structs with a name that > is > + // not a valid C/C++ identifier >mangleTagTypeKind(TTK_Struct); > - mangleName(T->getDecl()); > + mangle(T->getDecl(), ".objc_cls_"); > } > > void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T, > Qualifiers, > @@ -2590,11 +2591,11 @@ void
Re: r339428 - Add Windows support for the GNUstep Objective-C ABI V2.
Merged both of these to 7.0 in r339538. On Sat, Aug 11, 2018 at 10:34 AM, David Chisnall via cfe-commits wrote: > Thanks, > > That fix looks exactly what is needed - and is something I didn’t realise > FileCheck could do! The order of those matters in the linked binary, but not > in the IR - the linker will arrange them sensibly based on the subsection > name. > > Thanks again, > > David > >> On 11 Aug 2018, at 04:12, >> wrote: >> >> Hi David, >> >> I made an attempt to fix the Windows bot test failures in r339494 by making >> the checks for the section boundaries not depend on the order they were >> emitted. >> >> It seems that when using Visual Studio to build clang, the compiler that is >> generated emits the __stop_ section boundaries before the __start_ ones, >> thus causing your checks to fail. For example, you were checking for the >> following: >> >> @__start___objc_selectors = linkonce_odr hidden global >> %.objc_section_sentinel zeroinitializer, section "__objc_selectors$a", >> comdat, align 1 >> @__stop__objc_selectors = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_selectors$z", comdat, align 1 >> @__start___objc_classes = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_classes$a", comdat, align 1 >> @__stop__objc_classes = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_classes$z", comdat, align 1 >> >> However the Visual Studio built clang was producing the following output: >> >> @__stop__objc_selectors = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_selectors$z", comdat, align 1 >> @__start___objc_selectors = linkonce_odr hidden global >> %.objc_section_sentinel zeroinitializer, section "__objc_selectors$a", >> comdat, align 1 >> @__stop__objc_classes = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_classes$z", comdat, align 1 >> @__start___objc_classes = linkonce_odr hidden global %.objc_section_sentinel >> zeroinitializer, section "__objc_classes$a", comdat, align 1 >> >> I don’t think that the order matters, only that they are actually emitted, >> but if I am wrong, I apologize, and please revert my change and look into >> the problem. >> >> Douglas Yung >> >> From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of >> Tom Weaver via cfe-commits >> Sent: Friday, August 10, 2018 10:01 >> To: David Chisnall >> Cc: cfe-commits@lists.llvm.org >> Subject: Re: r339428 - Add Windows support for the GNUstep Objective-C ABI >> V2. >> >> Hi David, >> >> revision 339428 seems to have caused failing tests on a couple of windows >> build bots, any chance you can take a look please? >> >> http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18985 >> >> >> Failing Tests (1): >> Clang :: CodeGenObjC/gnu-init.m >> >> Expected Passes: 30627 >> Expected Failures : 65 >> Unsupported Tests : 12223 >> Unexpected Failures: 1 >> >> Thanks >> >> Tom Weaver >> >> On 10 August 2018 at 13:53, David Chisnall via cfe-commits >> wrote: >> Author: theraven >> Date: Fri Aug 10 05:53:13 2018 >> New Revision: 339428 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=339428=rev >> Log: >> Add Windows support for the GNUstep Objective-C ABI V2. >> >> Summary: >> Introduces funclet-based unwinding for Objective-C and fixes an issue >> where global blocks can't have their isa pointers initialised on >> Windows. >> >> After discussion with Dustin, this changes the name mangling of >> Objective-C types to prevent a C++ catch statement of type struct X* >> from catching an Objective-C object of type X*. >> >> Reviewers: rjmccall, DHowett-MSFT >> >> Reviewed By: rjmccall, DHowett-MSFT >> >> Subscribers: mgrang, mstorsjo, smeenai, cfe-commits >> >> Differential Revision: https://reviews.llvm.org/D50144 >> >> Modified: >> cfe/trunk/include/clang/Driver/Options.td >> cfe/trunk/lib/AST/MicrosoftMangle.cpp >> cfe/trunk/lib/CodeGen/CGException.cpp >> cfe/trunk/lib/CodeGen/CGObjCGNU.cpp >> cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp >> cfe/trunk/lib/CodeGen/CGObjCRuntim
Re: r339428 - Add Windows support for the GNUstep Objective-C ABI V2.
Thanks, That fix looks exactly what is needed - and is something I didn’t realise FileCheck could do! The order of those matters in the linked binary, but not in the IR - the linker will arrange them sensibly based on the subsection name. Thanks again, David > On 11 Aug 2018, at 04:12, > wrote: > > Hi David, > > I made an attempt to fix the Windows bot test failures in r339494 by making > the checks for the section boundaries not depend on the order they were > emitted. > > It seems that when using Visual Studio to build clang, the compiler that is > generated emits the __stop_ section boundaries before the __start_ ones, thus > causing your checks to fail. For example, you were checking for the following: > > @__start___objc_selectors = linkonce_odr hidden global > %.objc_section_sentinel zeroinitializer, section "__objc_selectors$a", > comdat, align 1 > @__stop__objc_selectors = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_selectors$z", comdat, align 1 > @__start___objc_classes = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_classes$a", comdat, align 1 > @__stop__objc_classes = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_classes$z", comdat, align 1 > > However the Visual Studio built clang was producing the following output: > > @__stop__objc_selectors = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_selectors$z", comdat, align 1 > @__start___objc_selectors = linkonce_odr hidden global > %.objc_section_sentinel zeroinitializer, section "__objc_selectors$a", > comdat, align 1 > @__stop__objc_classes = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_classes$z", comdat, align 1 > @__start___objc_classes = linkonce_odr hidden global %.objc_section_sentinel > zeroinitializer, section "__objc_classes$a", comdat, align 1 > > I don’t think that the order matters, only that they are actually emitted, > but if I am wrong, I apologize, and please revert my change and look into the > problem. > > Douglas Yung > > From: cfe-commits [mailto:cfe-commits-boun...@lists.llvm.org] On Behalf Of > Tom Weaver via cfe-commits > Sent: Friday, August 10, 2018 10:01 > To: David Chisnall > Cc: cfe-commits@lists.llvm.org > Subject: Re: r339428 - Add Windows support for the GNUstep Objective-C ABI V2. > > Hi David, > > revision 339428 seems to have caused failing tests on a couple of windows > build bots, any chance you can take a look please? > > http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18985 > > > Failing Tests (1): > Clang :: CodeGenObjC/gnu-init.m > > Expected Passes: 30627 > Expected Failures : 65 > Unsupported Tests : 12223 > Unexpected Failures: 1 > > Thanks > > Tom Weaver > > On 10 August 2018 at 13:53, David Chisnall via cfe-commits > wrote: > Author: theraven > Date: Fri Aug 10 05:53:13 2018 > New Revision: 339428 > > URL: http://llvm.org/viewvc/llvm-project?rev=339428=rev > Log: > Add Windows support for the GNUstep Objective-C ABI V2. > > Summary: > Introduces funclet-based unwinding for Objective-C and fixes an issue > where global blocks can't have their isa pointers initialised on > Windows. > > After discussion with Dustin, this changes the name mangling of > Objective-C types to prevent a C++ catch statement of type struct X* > from catching an Objective-C object of type X*. > > Reviewers: rjmccall, DHowett-MSFT > > Reviewed By: rjmccall, DHowett-MSFT > > Subscribers: mgrang, mstorsjo, smeenai, cfe-commits > > Differential Revision: https://reviews.llvm.org/D50144 > > Modified: > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/lib/AST/MicrosoftMangle.cpp > cfe/trunk/lib/CodeGen/CGException.cpp > cfe/trunk/lib/CodeGen/CGObjCGNU.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.h > cfe/trunk/lib/CodeGen/CodeGenFunction.h > cfe/trunk/lib/Driver/ToolChains/Clang.cpp > cfe/trunk/test/CodeGenObjC/gnu-init.m > cfe/trunk/test/CodeGenObjC/gnustep2-proto.m > cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm > cfe/trunk/test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-types.mm > > Modified: cfe/trunk/include/clang/Driver/Options.td > URL: > http://llvm
Re: r339428 - Add Windows support for the GNUstep Objective-C ABI V2.
Hi Tom, I’ll take a look over the weekend and see if I can reproduce locally. It’s odd that a test for a Windows triple would be behaving differently on a Windows host. David > On 10 Aug 2018, at 18:01, Tom Weaver wrote: > > Hi David, > > revision 339428 seems to have caused failing tests on a couple of windows > build bots, any chance you can take a look please? > > http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/18985 > > > Failing Tests (1): > Clang :: CodeGenObjC/gnu-init.m > > Expected Passes: 30627 > Expected Failures : 65 > Unsupported Tests : 12223 > Unexpected Failures: 1 > > > Thanks > > Tom Weaver > > On 10 August 2018 at 13:53, David Chisnall via cfe-commits > wrote: > Author: theraven > Date: Fri Aug 10 05:53:13 2018 > New Revision: 339428 > > URL: http://llvm.org/viewvc/llvm-project?rev=339428=rev > Log: > Add Windows support for the GNUstep Objective-C ABI V2. > > Summary: > Introduces funclet-based unwinding for Objective-C and fixes an issue > where global blocks can't have their isa pointers initialised on > Windows. > > After discussion with Dustin, this changes the name mangling of > Objective-C types to prevent a C++ catch statement of type struct X* > from catching an Objective-C object of type X*. > > Reviewers: rjmccall, DHowett-MSFT > > Reviewed By: rjmccall, DHowett-MSFT > > Subscribers: mgrang, mstorsjo, smeenai, cfe-commits > > Differential Revision: https://reviews.llvm.org/D50144 > > Modified: > cfe/trunk/include/clang/Driver/Options.td > cfe/trunk/lib/AST/MicrosoftMangle.cpp > cfe/trunk/lib/CodeGen/CGException.cpp > cfe/trunk/lib/CodeGen/CGObjCGNU.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp > cfe/trunk/lib/CodeGen/CGObjCRuntime.h > cfe/trunk/lib/CodeGen/CodeGenFunction.h > cfe/trunk/lib/Driver/ToolChains/Clang.cpp > cfe/trunk/test/CodeGenObjC/gnu-init.m > cfe/trunk/test/CodeGenObjC/gnustep2-proto.m > cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm > cfe/trunk/test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm > cfe/trunk/test/CodeGenObjCXX/msabi-objc-types.mm > > Modified: cfe/trunk/include/clang/Driver/Options.td > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=339428=339427=339428=diff > == > --- cfe/trunk/include/clang/Driver/Options.td (original) > +++ cfe/trunk/include/clang/Driver/Options.td Fri Aug 10 05:53:13 2018 > @@ -1488,7 +1488,7 @@ def fobjc_weak : Flag<["-"], "fobjc-weak >HelpText<"Enable ARC-style weak references in Objective-C">; > > // Objective-C ABI options. > -def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, > Flags<[CC1Option]>, > +def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, > Flags<[CC1Option, CoreOption]>, >HelpText<"Specify the target Objective-C runtime kind and version">; > def fobjc_abi_version_EQ : Joined<["-"], "fobjc-abi-version=">, > Group; > def fobjc_nonfragile_abi_version_EQ : Joined<["-"], > "fobjc-nonfragile-abi-version=">, Group; > > Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp > URL: > http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=339428=339427=339428=diff > == > --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) > +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Aug 10 05:53:13 2018 > @@ -445,7 +445,7 @@ void MicrosoftCXXNameMangler::mangle(con > mangleFunctionEncoding(FD, Context.shouldMangleDeclName(FD)); >else if (const VarDecl *VD = dyn_cast(D)) > mangleVariableEncoding(VD); > - else > + else if (!isa(D)) > llvm_unreachable("Tried to mangle unexpected NamedDecl!"); > } > > @@ -1884,13 +1884,13 @@ void MicrosoftCXXNameMangler::mangleType > llvm_unreachable("placeholder types shouldn't get to name mangling"); > >case BuiltinType::ObjCId: > -mangleArtificalTagType(TTK_Struct, "objc_object"); > +mangleArtificalTagType(TTK_Struct, ".objc_object"); > break; >case BuiltinType::ObjCClass: > -mangleArtificalTagType(TTK_Struct, "objc_class"); > +mangleArtificalTagType(TTK_Struct, ".objc_class"); > break; >case BuiltinType::ObjCSel: > -mangleArtificalTagType(TTK_Struct, "objc_selector"); > +mangleArtificalTagType(TTK_Struct, ".objc_selector"); > break; > > #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ > @@ -2570,9 +2570,10 @@ void MicrosoftCXXNameMangler::mangleType > > void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T, > Qualifiers, > SourceRange) { > - // ObjC interfaces have structs underlying them. > + // ObjC interfaces are mangled as if they were structs with a name that is > +
r339428 - Add Windows support for the GNUstep Objective-C ABI V2.
Author: theraven Date: Fri Aug 10 05:53:13 2018 New Revision: 339428 URL: http://llvm.org/viewvc/llvm-project?rev=339428=rev Log: Add Windows support for the GNUstep Objective-C ABI V2. Summary: Introduces funclet-based unwinding for Objective-C and fixes an issue where global blocks can't have their isa pointers initialised on Windows. After discussion with Dustin, this changes the name mangling of Objective-C types to prevent a C++ catch statement of type struct X* from catching an Objective-C object of type X*. Reviewers: rjmccall, DHowett-MSFT Reviewed By: rjmccall, DHowett-MSFT Subscribers: mgrang, mstorsjo, smeenai, cfe-commits Differential Revision: https://reviews.llvm.org/D50144 Modified: cfe/trunk/include/clang/Driver/Options.td cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/lib/CodeGen/CGException.cpp cfe/trunk/lib/CodeGen/CGObjCGNU.cpp cfe/trunk/lib/CodeGen/CGObjCRuntime.cpp cfe/trunk/lib/CodeGen/CGObjCRuntime.h cfe/trunk/lib/CodeGen/CodeGenFunction.h cfe/trunk/lib/Driver/ToolChains/Clang.cpp cfe/trunk/test/CodeGenObjC/gnu-init.m cfe/trunk/test/CodeGenObjC/gnustep2-proto.m cfe/trunk/test/CodeGenObjCXX/arc-marker-funclet.mm cfe/trunk/test/CodeGenObjCXX/microsoft-abi-arc-param-order.mm cfe/trunk/test/CodeGenObjCXX/msabi-objc-extensions.mm cfe/trunk/test/CodeGenObjCXX/msabi-objc-types.mm Modified: cfe/trunk/include/clang/Driver/Options.td URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=339428=339427=339428=diff == --- cfe/trunk/include/clang/Driver/Options.td (original) +++ cfe/trunk/include/clang/Driver/Options.td Fri Aug 10 05:53:13 2018 @@ -1488,7 +1488,7 @@ def fobjc_weak : Flag<["-"], "fobjc-weak HelpText<"Enable ARC-style weak references in Objective-C">; // Objective-C ABI options. -def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, Flags<[CC1Option]>, +def fobjc_runtime_EQ : Joined<["-"], "fobjc-runtime=">, Group, Flags<[CC1Option, CoreOption]>, HelpText<"Specify the target Objective-C runtime kind and version">; def fobjc_abi_version_EQ : Joined<["-"], "fobjc-abi-version=">, Group; def fobjc_nonfragile_abi_version_EQ : Joined<["-"], "fobjc-nonfragile-abi-version=">, Group; Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=339428=339427=339428=diff == --- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original) +++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Fri Aug 10 05:53:13 2018 @@ -445,7 +445,7 @@ void MicrosoftCXXNameMangler::mangle(con mangleFunctionEncoding(FD, Context.shouldMangleDeclName(FD)); else if (const VarDecl *VD = dyn_cast(D)) mangleVariableEncoding(VD); - else + else if (!isa(D)) llvm_unreachable("Tried to mangle unexpected NamedDecl!"); } @@ -1884,13 +1884,13 @@ void MicrosoftCXXNameMangler::mangleType llvm_unreachable("placeholder types shouldn't get to name mangling"); case BuiltinType::ObjCId: -mangleArtificalTagType(TTK_Struct, "objc_object"); +mangleArtificalTagType(TTK_Struct, ".objc_object"); break; case BuiltinType::ObjCClass: -mangleArtificalTagType(TTK_Struct, "objc_class"); +mangleArtificalTagType(TTK_Struct, ".objc_class"); break; case BuiltinType::ObjCSel: -mangleArtificalTagType(TTK_Struct, "objc_selector"); +mangleArtificalTagType(TTK_Struct, ".objc_selector"); break; #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \ @@ -2570,9 +2570,10 @@ void MicrosoftCXXNameMangler::mangleType void MicrosoftCXXNameMangler::mangleType(const ObjCInterfaceType *T, Qualifiers, SourceRange) { - // ObjC interfaces have structs underlying them. + // ObjC interfaces are mangled as if they were structs with a name that is + // not a valid C/C++ identifier mangleTagTypeKind(TTK_Struct); - mangleName(T->getDecl()); + mangle(T->getDecl(), ".objc_cls_"); } void MicrosoftCXXNameMangler::mangleType(const ObjCObjectType *T, Qualifiers, @@ -2590,11 +2591,11 @@ void MicrosoftCXXNameMangler::mangleType Out << "?$"; if (T->isObjCId()) -mangleSourceName("objc_object"); +mangleSourceName(".objc_object"); else if (T->isObjCClass()) -mangleSourceName("objc_class"); +mangleSourceName(".objc_class"); else -mangleSourceName(T->getInterface()->getName()); +mangleSourceName((".objc_cls_" + T->getInterface()->getName()).str()); for (const auto : T->quals()) mangleObjCProtocol(Q); Modified: cfe/trunk/lib/CodeGen/CGException.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=339428=339427=339428=diff == --- cfe/trunk/lib/CodeGen/CGException.cpp