There is no such thing as typeinfo for a cv-qualified type. Assert
that this is true when mangling, then fix up the various places in
Sema and/or CodeGen that need to remove qualifiers. Addresses a
linking issue when building LLVM with Clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@92064 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGException.cpp b/lib/CodeGen/CGException.cpp
index caf0668..3049915 100644
--- a/lib/CodeGen/CGException.cpp
+++ b/lib/CodeGen/CGException.cpp
@@ -367,7 +367,9 @@
 
   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 @@
     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