#include "llvm/IR/Module.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Support/FileSystem.h"
-#include "llvm/Support/Path.h"\r
+#include "llvm/Support/Path.h"
using namespace clang;
using namespace clang::CodeGen;
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
}
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 =
--- /dev/null
+// 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;
+}