From 1e41456b13bf099eaf342803c2d3ab15be4c698c Mon Sep 17 00:00:00 2001 From: Adrian Prantl Date: Thu, 19 Dec 2013 01:38:47 +0000 Subject: [PATCH] Debug info: (Bugfix) emit CRV qualifiers for pointers to member functions. rdar://problem/15678916. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@197641 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CGDebugInfo.cpp | 10 ++++++---- test/CodeGenCXX/debug-info-qualifiers.cpp | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 13 deletions(-) diff --git a/lib/CodeGen/CGDebugInfo.cpp b/lib/CodeGen/CGDebugInfo.cpp index 5483e27693..2aa3753a59 100644 --- a/lib/CodeGen/CGDebugInfo.cpp +++ b/lib/CodeGen/CGDebugInfo.cpp @@ -1839,11 +1839,13 @@ llvm::DIType CGDebugInfo::CreateType(const MemberPointerType *Ty, if (!Ty->getPointeeType()->isFunctionType()) return DBuilder.createMemberPointerType( getOrCreateType(Ty->getPointeeType(), U), ClassType); + + const FunctionProtoType *FPT = + Ty->getPointeeType()->getAs(); return DBuilder.createMemberPointerType(getOrCreateInstanceMethodType( - CGM.getContext().getPointerType( - QualType(Ty->getClass(), Ty->getPointeeType().getCVRQualifiers())), - Ty->getPointeeType()->getAs(), U), - ClassType); + CGM.getContext().getPointerType(QualType(Ty->getClass(), + FPT->getTypeQuals())), + FPT, U), ClassType); } llvm::DIType CGDebugInfo::CreateType(const AtomicType *Ty, diff --git a/test/CodeGenCXX/debug-info-qualifiers.cpp b/test/CodeGenCXX/debug-info-qualifiers.cpp index 9139b1d2ff..c6b935f903 100644 --- a/test/CodeGenCXX/debug-info-qualifiers.cpp +++ b/test/CodeGenCXX/debug-info-qualifiers.cpp @@ -1,23 +1,26 @@ // RUN: %clang_cc1 -std=c++11 -emit-llvm -g -triple x86_64-apple-darwin %s -o - | FileCheck %s -// Test (r)value qualifiers on C++11 non-static member functions. +// Test (r)value and CVR qualifiers on C++11 non-static member functions. class A { public: - // CHECK: [ DW_TAG_subprogram ] [line [[@LINE+1]]] [reference] [l] + // CHECK: i32 [[@LINE+2]], metadata ![[PLSR:[0-9]+]], {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+2]]] [reference] [l] + // CHECK: ![[PLSR]] ={{.*}}[ DW_TAG_subroutine_type ]{{.*}}[reference] void l() const &; - // CHECK: [ DW_TAG_subprogram ] [line [[@LINE+1]]] [rvalue reference] [r] + // CHECK: ![[ARGS:[0-9]+]] = metadata !{null, metadata ![[THIS:[0-9]+]]} + // CHECK: ![[THIS]] = {{.*}} metadata ![[CONST_A:.*]]} ; [ DW_TAG_pointer_type ] + // CHECK: ![[CONST_A]] = {{.*}} [ DW_TAG_const_type ] + // CHECK: i32 [[@LINE+2]], metadata ![[PRSR:[0-9]+]], {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+2]]] [rvalue reference] [r] + // CHECK: ![[PRSR]] ={{.*}}metadata ![[ARGS]], i32 0, null, null, null}{{.*}}[ DW_TAG_subroutine_type ]{{.*}}[rvalue reference] void r() const &&; }; void g() { A a; // The type of pl is "void (A::*)() const &". - // CHECK: metadata ![[PL:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pl] [line [[@LINE+3]]] - // CHECK: metadata ![[PLSR:[0-9]+]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ] - // CHECK: ![[PLSR]] ={{.*}}[ DW_TAG_subroutine_type ]{{.*}}[reference] + // CHECK: metadata ![[PL:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pl] [line [[@LINE+2]]] + // CHECK: metadata ![[PLSR]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ] auto pl = &A::l; - // CHECK: metadata ![[PR:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pr] [line [[@LINE+3]]] - // CHECK: metadata ![[PRSR:[0-9]+]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ] - // CHECK: ![[PRSR]] ={{.*}}[ DW_TAG_subroutine_type ]{{.*}}[rvalue reference] + // CHECK: metadata ![[PR:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [pr] [line [[@LINE+2]]] + // CHECK: metadata ![[PRSR]], metadata !"{{.*}}"} ; [ DW_TAG_ptr_to_member_type ] auto pr = &A::r; } -- 2.40.0