diff options
Diffstat (limited to 'lib/CodeGen')
-rw-r--r-- | lib/CodeGen/CGException.cpp | 9 | ||||
-rw-r--r-- | lib/CodeGen/CGExprCXX.cpp | 6 | ||||
-rw-r--r-- | lib/CodeGen/Mangle.cpp | 1 |
3 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp index caf0668d64..30499157f1 100644 --- a/lib/CodeGen/CGException.cpp +++ b/lib/CodeGen/CGException.cpp @@ -367,7 +367,9 @@ void CodeGenFunction::EmitStartEHSpec(const Decl *D) { for (unsigned i = 0; i < Proto->getNumExceptions(); ++i) { QualType Ty = Proto->getExceptionType(i); - llvm::Value *EHType = CGM.GetAddrOfRTTIDescriptor(Ty.getNonReferenceType()); + QualType ExceptType + = Ty.getNonReferenceType().getUnqualifiedType(); + llvm::Value *EHType = CGM.GetAddrOfRTTIDescriptor(ExceptType); SelectorArgs.push_back(EHType); } if (Proto->getNumExceptions()) @@ -506,8 +508,11 @@ void CodeGenFunction::EmitCXXTryStmt(const CXXTryStmt &S) { const CXXCatchStmt *C = S.getHandler(i); VarDecl *CatchParam = C->getExceptionDecl(); if (CatchParam) { + // C++ [except.handle]p3 indicates that top-level cv-qualifiers + // are ignored. + QualType CaughtType = C->getCaughtType().getNonReferenceType(); llvm::Value *EHTypeInfo - = CGM.GetAddrOfRTTIDescriptor(C->getCaughtType().getNonReferenceType()); + = CGM.GetAddrOfRTTIDescriptor(CaughtType.getUnqualifiedType()); SelectorArgs.push_back(EHTypeInfo); } else { // null indicates catch all diff --git a/lib/CodeGen/CGExprCXX.cpp b/lib/CodeGen/CGExprCXX.cpp index bfdff985cf..54e6b0141f 100644 --- a/lib/CodeGen/CGExprCXX.cpp +++ b/lib/CodeGen/CGExprCXX.cpp @@ -548,8 +548,10 @@ llvm::Value *CodeGenFunction::EmitDynamicCast(llvm::Value *V, assert(SrcTy->isRecordType() && "Src type must be record type!"); assert(DestTy->isRecordType() && "Dest type must be record type!"); - llvm::Value *SrcArg = CGM.GetAddrOfRTTIDescriptor(SrcTy); - llvm::Value *DestArg = CGM.GetAddrOfRTTIDescriptor(DestTy); + llvm::Value *SrcArg + = CGM.GetAddrOfRTTIDescriptor(SrcTy.getUnqualifiedType()); + llvm::Value *DestArg + = CGM.GetAddrOfRTTIDescriptor(DestTy.getUnqualifiedType()); V = Builder.CreateBitCast(V, PtrToInt8Ty); V = Builder.CreateCall4(CGM.CreateRuntimeFunction(FTy, "__dynamic_cast"), diff --git a/lib/CodeGen/Mangle.cpp b/lib/CodeGen/Mangle.cpp index 687ff3e618..367c868ba9 100644 --- a/lib/CodeGen/Mangle.cpp +++ b/lib/CodeGen/Mangle.cpp @@ -1586,6 +1586,7 @@ void MangleContext::mangleCXXCtorVtable(const CXXRecordDecl *RD, int64_t Offset, void MangleContext::mangleCXXRTTI(QualType Ty, llvm::SmallVectorImpl<char> &Res) { // <special-name> ::= TI <type> # typeinfo structure + assert(!Ty.hasQualifiers() && "RTTI info cannot have top-level qualifiers"); CXXNameMangler Mangler(*this, Res); Mangler.getStream() << "_ZTI"; Mangler.mangleType(Ty); |