llvm-project/clang/test/Index/Core/index-source.cpp
Argyrios Kyrtzidis f12918d218 [index] Fix assertion hit when handling a declaration of C++'s 'operator new' function.
Part of this is to allow creating a USR for the canonical decl of that which is implicit and does
not have a source location.

rdar://28978992

llvm-svn: 285868
2016-11-02 23:42:33 +00:00

28 lines
932 B
C++

// RUN: c-index-test core -print-source-symbols -- %s -target x86_64-apple-macosx10.7 | FileCheck %s
template <typename TemplArg>
class TemplCls {
// CHECK: [[@LINE-1]]:7 | class/C++ | TemplCls | c:@ST>1#T@TemplCls | <no-cgname> | Def | rel: 0
TemplCls(int x);
// CHECK: [[@LINE-1]]:3 | constructor/C++ | TemplCls | c:@ST>1#T@TemplCls@F@TemplCls#I# | <no-cgname> | Decl,RelChild | rel: 1
// CHECK-NEXT: RelChild | TemplCls | c:@ST>1#T@TemplCls
};
template <typename T>
class BT {
struct KLR {
int idx;
};
// CHECK: [[@LINE+1]]:7 | instance-method/C++ | foo |
KLR foo() {
return { .idx = 0 }; // Make sure this doesn't trigger a crash.
}
};
// CHECK: [[@LINE+1]]:23 | type-alias/C | size_t |
typedef unsigned long size_t;
// CHECK: [[@LINE+2]]:7 | function/C | operator new | c:@F@operator new#l# | __Znwm |
// CHECK: [[@LINE+1]]:20 | type-alias/C | size_t | {{.*}} | Ref |
void* operator new(size_t sz);