[libclang] Reflect in USR generation that 'signed char' and 'unsigned char' can overload a 'char' in C++, by giving them distinct encodings.

llvm-svn: 223629
This commit is contained in:
Argyrios Kyrtzidis 2014-12-08 08:48:17 +00:00
parent d06ce400c2
commit ca044547d2
2 changed files with 11 additions and 1 deletions

View File

@ -569,8 +569,9 @@ void USRGenerator::VisitType(QualType T) {
case BuiltinType::UInt128:
c = 'j'; break;
case BuiltinType::Char_S:
case BuiltinType::SChar:
c = 'C'; break;
case BuiltinType::SChar:
c = 'r'; break;
case BuiltinType::WChar_S:
case BuiltinType::WChar_U:
c = 'W'; break;

View File

@ -83,6 +83,10 @@ template <class T> typename T::A someTemplFn() {}
template <class T> typename T::B someTemplFn() {}
template <class T> int someTemplFn() {}
void funWithChar(char c) {}
void funWithChar(unsigned char c) {}
void funWithChar(signed char c) {}
// RUN: c-index-test -test-load-source-usrs all %s | FileCheck %s
// CHECK: usrs.cpp c:@N@foo Extent=[1:1 - 4:2]
// CHECK: usrs.cpp c:@N@foo@x Extent=[2:3 - 2:8]
@ -147,6 +151,11 @@ template <class T> int someTemplFn() {}
// CHECK: usrs.cpp c:usrs.cpp@aN@C@RDar9371763_Foo@F@bar# Extent=[75:1 - 75:31]
// CHECK: usrs.cpp c:@F@rdar9371763# Extent=[77:1 - 80:2]
// CHECK: usrs.cpp c:usrs.cpp@1204@F@rdar9371763#@foo Extent=[78:3 - 78:22]
// CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#^type-parameter-0-0:::A# Extent=[82:1 - 82:50]
// CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#^type-parameter-0-0:::B# Extent=[83:1 - 83:50]
// CHECK: usrs.cpp c:@FT@>1#TsomeTemplFn#I# Extent=[84:1 - 84:40]
// CHECK: usrs.cpp c:@F@funWithChar#C# Extent=[86:1 - 86:28]
// CHECK: usrs.cpp c:@F@funWithChar#c# Extent=[87:1 - 87:37]
// CHECK: usrs.cpp c:@F@funWithChar#r# Extent=[88:1 - 88:35]