diff options
| author | Adrian Prantl <aprantl@apple.com> | 2013-12-18 21:48:18 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2013-12-18 21:48:18 +0000 |
| commit | 0630eb70949d748ba2661f12935584504deaec2b (patch) | |
| tree | 9849238dce23ef2e91f8a91435e0c6fccf3ddb9b | |
| parent | 31631e4a4702a34131b4fb8632c1a61d23298e66 (diff) | |
| download | bcm5719-llvm-0630eb70949d748ba2661f12935584504deaec2b.tar.gz bcm5719-llvm-0630eb70949d748ba2661f12935584504deaec2b.zip | |
Debug info: Implement (rvalue) reference qualifiers for C++11 non-static
member functions. Paired commit with LLVM.
rdar://problem/15356637
llvm-svn: 197612
| -rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 14 | ||||
| -rw-r--r-- | clang/test/CodeGenCXX/debug-info-qualifiers.cpp | 23 |
2 files changed, 35 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index df6868ab1a5..5483e27693c 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -37,7 +37,7 @@ #include "llvm/IR/Module.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/FileSystem.h" -#include "llvm/Support/Path.h"
+#include "llvm/Support/Path.h" using namespace clang; using namespace clang::CodeGen; @@ -1005,7 +1005,13 @@ llvm::DICompositeType CGDebugInfo::getOrCreateInstanceMethodType( llvm::DIArray EltTypeArray = DBuilder.getOrCreateArray(Elts); - return DBuilder.createSubroutineType(Unit, EltTypeArray); + unsigned Flags = 0; + if (Func->getExtProtoInfo().RefQualifier == RQ_LValue) + Flags |= llvm::DIDescriptor::FlagLValueReference; + if (Func->getExtProtoInfo().RefQualifier == RQ_RValue) + Flags |= llvm::DIDescriptor::FlagRValueReference; + + return DBuilder.createSubroutineType(Unit, EltTypeArray, Flags); } /// isFunctionLocalClass - Return true if CXXRecordDecl is defined @@ -1084,6 +1090,10 @@ CGDebugInfo::CreateCXXMemberFunction(const CXXMethodDecl *Method, } if (Method->hasPrototype()) Flags |= llvm::DIDescriptor::FlagPrototyped; + if (Method->getRefQualifier() == RQ_LValue) + Flags |= llvm::DIDescriptor::FlagLValueReference; + if (Method->getRefQualifier() == RQ_RValue) + Flags |= llvm::DIDescriptor::FlagRValueReference; llvm::DIArray TParamsArray = CollectFunctionTemplateParams(Method, Unit); llvm::DISubprogram SP = diff --git a/clang/test/CodeGenCXX/debug-info-qualifiers.cpp b/clang/test/CodeGenCXX/debug-info-qualifiers.cpp new file mode 100644 index 00000000000..9139b1d2ff9 --- /dev/null +++ b/clang/test/CodeGenCXX/debug-info-qualifiers.cpp @@ -0,0 +1,23 @@ +// 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. +class A { +public: + // CHECK: [ DW_TAG_subprogram ] [line [[@LINE+1]]] [reference] [l] + void l() const &; + // CHECK: [ DW_TAG_subprogram ] [line [[@LINE+1]]] [rvalue reference] [r] + 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] + 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] + auto pr = &A::r; +} |

