r232537 - WIP
David Majnemer
david.majnemer at gmail.com
Tue Mar 17 13:59:12 PDT 2015
For reference, it should have been squashed into r232538.
On Tue, Mar 17, 2015 at 1:58 PM, David Majnemer <david.majnemer at gmail.com>
wrote:
> Yeah, I forgot to fold this into my final commit.
>
> On Tue, Mar 17, 2015 at 1:52 PM, Sean Silva <chisophugis at gmail.com> wrote:
>
>> Accidental WIP commit?
>>
>> On Tue, Mar 17, 2015 at 1:35 PM, David Majnemer <david.majnemer at gmail.com
>> > wrote:
>>
>>> Author: majnemer
>>> Date: Tue Mar 17 15:35:00 2015
>>> New Revision: 232537
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=232537&view=rev
>>> Log:
>>> WIP
>>>
>>> Modified:
>>> cfe/trunk/lib/CodeGen/CGCXXABI.h
>>> cfe/trunk/lib/CodeGen/CGException.cpp
>>> cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>> cfe/trunk/lib/CodeGen/CodeGenModule.h
>>> cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>>> cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGCXXABI.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCXXABI.h?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGCXXABI.h (original)
>>> +++ cfe/trunk/lib/CodeGen/CGCXXABI.h Tue Mar 17 15:35:00 2015
>>> @@ -224,7 +224,8 @@ public:
>>> emitTerminateForUnexpectedException(CodeGenFunction &CGF,
>>> llvm::Value *Exn);
>>>
>>> - virtual llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty, bool
>>> ForEH) = 0;
>>> + virtual llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) = 0;
>>> + virtual llvm::Constant *getAddrOfCXXCatchDescriptor(QualType Ty) = 0;
>>>
>>> virtual bool shouldTypeidBeNullChecked(bool IsDeref,
>>> QualType SrcRecordTy) = 0;
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CGException.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGException.cpp?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CGException.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CGException.cpp Tue Mar 17 15:35:00 2015
>>> @@ -567,7 +567,7 @@ void CodeGenFunction::EnterCXXTryStmt(co
>>> if (CaughtType->isObjCObjectPointerType())
>>> TypeInfo = CGM.getObjCRuntime().GetEHType(CaughtType);
>>> else
>>> - TypeInfo = CGM.GetAddrOfRTTIDescriptor(CaughtType,
>>> /*ForEH=*/true);
>>> + TypeInfo = CGM.getAddrOfCXXCatchDescriptor(CaughtType);
>>> CatchScope->setHandler(I, TypeInfo, Handler);
>>> } else {
>>> // No exception decl indicates '...', a catch-all.
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Mar 17 15:35:00 2015
>>> @@ -3644,6 +3644,10 @@ llvm::Constant *CodeGenModule::EmitUuido
>>> return llvm::ConstantStruct::getAnon(Fields);
>>> }
>>>
>>> +llvm::Constant *CodeGenModule::getAddrOfCXXCatchDescriptor(QualType Ty)
>>> {
>>> + return getCXXABI().getAddrOfCXXCatchDescriptor(Ty);
>>> +}
>>> +
>>> llvm::Constant *CodeGenModule::GetAddrOfRTTIDescriptor(QualType Ty,
>>> bool ForEH) {
>>> // Return a bogus pointer if RTTI is disabled, unless it's for EH.
>>> @@ -3656,7 +3660,7 @@ llvm::Constant *CodeGenModule::GetAddrOf
>>> LangOpts.ObjCRuntime.isGNUFamily())
>>> return ObjCRuntime->GetEHType(Ty);
>>>
>>> - return getCXXABI().getAddrOfRTTIDescriptor(Ty, ForEH);
>>> + return getCXXABI().getAddrOfRTTIDescriptor(Ty);
>>> }
>>>
>>> void CodeGenModule::EmitOMPThreadPrivateDecl(const OMPThreadPrivateDecl
>>> *D) {
>>>
>>> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
>>> +++ cfe/trunk/lib/CodeGen/CodeGenModule.h Tue Mar 17 15:35:00 2015
>>> @@ -719,6 +719,8 @@ public:
>>> /// Get the address of the RTTI descriptor for the given type.
>>> llvm::Constant *GetAddrOfRTTIDescriptor(QualType Ty, bool ForEH =
>>> false);
>>>
>>> + llvm::Constant *getAddrOfCXXCatchDescriptor(QualType Ty);
>>> +
>>> /// Get the address of a uuid descriptor .
>>> llvm::Constant *GetAddrOfUuidDescriptor(const CXXUuidofExpr* E);
>>>
>>>
>>> Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Tue Mar 17 15:35:00 2015
>>> @@ -125,7 +125,10 @@ public:
>>>
>>> void EmitFundamentalRTTIDescriptor(QualType Type);
>>> void EmitFundamentalRTTIDescriptors();
>>> - llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty, bool ForEH)
>>> override;
>>> + llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override;
>>> + llvm::Constant *getAddrOfCXXCatchDescriptor(QualType Ty) {
>>> + return getAddrOfRTTIDescriptor(Ty);
>>> + }
>>>
>>> bool shouldTypeidBeNullChecked(bool IsDeref, QualType SrcRecordTy)
>>> override;
>>> void EmitBadTypeidCall(CodeGenFunction &CGF) override;
>>> @@ -3101,8 +3104,7 @@ ItaniumRTTIBuilder::BuildPointerToMember
>>> ItaniumRTTIBuilder(CXXABI).BuildTypeInfo(QualType(ClassType, 0)));
>>> }
>>>
>>> -llvm::Constant *ItaniumCXXABI::getAddrOfRTTIDescriptor(QualType Ty,
>>> - bool ForEH) {
>>> +llvm::Constant *ItaniumCXXABI::getAddrOfRTTIDescriptor(QualType Ty) {
>>> return ItaniumRTTIBuilder(*this).BuildTypeInfo(Ty);
>>> }
>>>
>>>
>>> Modified: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp?rev=232537&r1=232536&r2=232537&view=diff
>>>
>>> ==============================================================================
>>> --- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp (original)
>>> +++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp Tue Mar 17 15:35:00 2015
>>> @@ -83,7 +83,8 @@ public:
>>> llvm::GlobalVariable *getMSCompleteObjectLocator(const CXXRecordDecl
>>> *RD,
>>> const VPtrInfo
>>> *Info);
>>>
>>> - llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty, bool ForEH)
>>> override;
>>> + llvm::Constant *getAddrOfRTTIDescriptor(QualType Ty) override;
>>> + llvm::Constant *getAddrOfCXXCatchDescriptor(QualType Ty) override;
>>>
>>> bool shouldTypeidBeNullChecked(bool IsDeref, QualType SrcRecordTy)
>>> override;
>>> void EmitBadTypeidCall(CodeGenFunction &CGF) override;
>>> @@ -3094,8 +3095,7 @@ MSRTTIBuilder::getBaseClassDescriptor(co
>>> // Initialize the BaseClassDescriptor.
>>> llvm::Constant *Fields[] = {
>>> ABI.getImageRelativeConstant(
>>> - ABI.getAddrOfRTTIDescriptor(Context.getTypeDeclType(Class.RD),
>>> - /*ForEH=*/false)),
>>> +
>>> ABI.getAddrOfRTTIDescriptor(Context.getTypeDeclType(Class.RD))),
>>> llvm::ConstantInt::get(CGM.IntTy, Class.NumBases),
>>> llvm::ConstantInt::get(CGM.IntTy, Class.OffsetInVBase),
>>> llvm::ConstantInt::get(CGM.IntTy, VBPtrOffset),
>>> @@ -3186,22 +3186,21 @@ static QualType decomposeTypeForEH(ASTCo
>>> return T;
>>> }
>>>
>>> -/// \brief Gets a TypeDescriptor. Returns a llvm::Constant * rather
>>> than a
>>> -/// llvm::GlobalVariable * because different type descriptors have
>>> different
>>> -/// types, and need to be abstracted. They are abstracting by casting
>>> the
>>> -/// address to an Int8PtrTy.
>>> -llvm::Constant *MicrosoftCXXABI::getAddrOfRTTIDescriptor(QualType Type,
>>> - bool ForEH) {
>>> +llvm::Constant *MicrosoftCXXABI::getAddrOfCXXCatchDescriptor(QualType
>>> Type) {
>>> // TypeDescriptors for exceptions never has qualified pointer types,
>>> // qualifiers are stored seperately in order to support qualification
>>> // conversions.
>>> - if (ForEH) {
>>> - // FIXME: This is only a 50% solution, we need to actually do
>>> something with
>>> - // these qualifiers.
>>> - bool IsConst, IsVolatile;
>>> - Type = decomposeTypeForEH(getContext(), Type, IsConst, IsVolatile);
>>> - }
>>> + bool IsConst, IsVolatile;
>>> + Type = decomposeTypeForEH(getContext(), Type, IsConst, IsVolatile);
>>>
>>> + return getAddrOfRTTIDescriptor(Type);
>>> +}
>>> +
>>> +/// \brief Gets a TypeDescriptor. Returns a llvm::Constant * rather
>>> than a
>>> +/// llvm::GlobalVariable * because different type descriptors have
>>> different
>>> +/// types, and need to be abstracted. They are abstracting by casting
>>> the
>>> +/// address to an Int8PtrTy.
>>> +llvm::Constant *MicrosoftCXXABI::getAddrOfRTTIDescriptor(QualType Type)
>>> {
>>> SmallString<256> MangledName, TypeInfoString;
>>> {
>>> llvm::raw_svector_ostream Out(MangledName);
>>> @@ -3419,8 +3418,7 @@ llvm::Constant *MicrosoftCXXABI::getCatc
>>>
>>> // The TypeDescriptor is used by the runtime to determine if a catch
>>> handler
>>> // is appropriate for the exception object.
>>> - llvm::Constant *TD =
>>> - getImageRelativeConstant(getAddrOfRTTIDescriptor(T,
>>> /*ForEH=*/true));
>>> + llvm::Constant *TD =
>>> getImageRelativeConstant(getAddrOfRTTIDescriptor(T));
>>>
>>> // The runtime is responsible for calling the copy constructor if the
>>> // exception is caught by value.
>>>
>>>
>>> _______________________________________________
>>> 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/20150317/ebde9ea4/attachment.html>
More information about the cfe-commits
mailing list