Update to XCode 5.1; e.g. ignore type of std::string::c_str().

This commit is contained in:
Axel Naumann 2014-03-31 15:09:55 +02:00 committed by sftnight
parent 700a647a2a
commit bbf4a3588f
5 changed files with 47 additions and 44 deletions

View File

@ -31,7 +31,7 @@ const clang::Decl* cl_A = lookup.findScope("A", diags);
printf("cl_A: 0x%lx\n", (unsigned long) cl_A);
//CHECK: cl_A: 0x{{[1-9a-f][0-9a-f]*$}}
cast<clang::NamedDecl>(cl_A)->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "A"
//CHECK-NEXT: ({{[^)]+}}) "A"
.rawInput 1
namespace N {
@ -44,7 +44,7 @@ const clang::Decl* cl_A_in_N = lookup.findScope("N::A", diags);
printf("cl_A_in_N: 0x%lx\n", (unsigned long) cl_A_in_N);
//CHECK: cl_A_in_N: 0x{{[1-9a-f][0-9a-f]*$}}
cast<clang::NamedDecl>(cl_A_in_N)->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "N::A"
//CHECK-NEXT: ({{[^)]+}}) "N::A"
.rawInput 1
@ -61,7 +61,7 @@ const clang::Decl* cl_A_in_NMP = lookup.findScope("N::M::P::A", diags);
cl_A_in_NMP
//CHECK: (const clang::Decl *) 0x{{[1-9a-f][0-9a-f]*$}}
cast<clang::NamedDecl>(cl_A_in_NMP)->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "N::M::P::A"
//CHECK-NEXT: ({{[^)]+}}) "N::M::P::A"
.rawInput 1
@ -88,5 +88,5 @@ const clang::Type* resType = 0;
lookup.findScope("W<Int_t>", diags, &resType);
//resType->dump();
clang::QualType(resType,0).getAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "W<Int_t>"
//CHECK-NEXT: ({{[^)]+}}) "W<Int_t>"

View File

@ -38,7 +38,7 @@ const clang::ClassTemplateDecl* tmplt_out = lookup.findClassTemplate("TmpltOutsi
printf("tmplt_out: 0x%lx\n", (unsigned long) tmplt_out);
//CHECK: tmplt_out: 0x{{[1-9a-f][0-9a-f]*$}}
tmplt_out->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "TmpltOutside"
//CHECK-NEXT: ({{[^)]+}}) "TmpltOutside"
const clang::ClassTemplateDecl* tmplt_inside = lookup.findClassTemplate("OuterClass::TmpltInside", diags);
@ -46,7 +46,7 @@ const clang::ClassTemplateDecl* tmplt_inside = lookup.findClassTemplate("OuterCl
printf("tmplt_inside: 0x%lx\n", (unsigned long) tmplt_out);
//CHECK: tmplt_inside: 0x{{[1-9a-f][0-9a-f]*$}}
tmplt_inside->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "OuterClass::TmpltInside"
//CHECK-NEXT: ({{[^)]+}}) "OuterClass::TmpltInside"
const clang::ClassTemplateDecl* tmplt_vec = lookup.findClassTemplate("std::vector", diags);
@ -54,5 +54,5 @@ const clang::ClassTemplateDecl* tmplt_vec = lookup.findClassTemplate("std::vecto
printf("tmplt_vec: 0x%lx\n", (unsigned long) tmplt_vec);
//CHECK: tmplt_vec: 0x{{[1-9a-f][0-9a-f]*$}}
tmplt_vec->getQualifiedNameAsString().c_str()
//CHECK-NEXT: ({{const char [*]|const_pointer}}) "std::{{(__1::)?}}vector"
//CHECK-NEXT: ({{[^)]+}}) "std::{{(__1::)?}}vector"

View File

@ -37,22 +37,22 @@ const LookupHelper& lookup = gCling->getLookupHelper();
QualType cl_A = lookup.findType("A", LookupHelper::WithDiagnostics);
cl_A.getAsString().c_str()
//CHECK: ({{const char [*]|const_pointer}}) "class A"
//CHECK: ({{[^)]+}}) "class A"
QualType cl_B_in_N = lookup.findType("N::B", LookupHelper::WithDiagnostics);
cl_B_in_N.getAsString().c_str()
//CHECK: ({{const char [*]|const_pointer}}) "N::B"
//CHECK: ({{[^)]+}}) "N::B"
QualType cl_C_in_M = lookup.findType("N::M::C", LookupHelper::WithDiagnostics);
cl_C_in_M.getAsString().c_str()
//CHECK: ({{const char [*]|const_pointer}}) "N::M::C"
//CHECK: ({{[^)]+}}) "N::M::C"
QualType builtin_int = lookup.findType("int", LookupHelper::WithDiagnostics);
builtin_int.getAsString().c_str()
//CHECK: ({{const char [*]|const_pointer}}) "int"
//CHECK: ({{[^)]+}}) "int"
QualType typedef_my_int = lookup.findType("my_int", LookupHelper::WithDiagnostics);
typedef_my_int.getAsString().c_str()
//CHECK: ({{const char [*]|const_pointer}}) "my_int"
//CHECK: ({{[^)]+}}) "my_int"
.q

View File

@ -20,5 +20,5 @@ gCling->process("cling::Interpreter *DefaultInterp;");
gCling->process("DefaultInterp = new cling::Interpreter(1, &argV);");
gCling->process("DefaultInterp->process(\"#include \\\"cling/Interpreter/Interpreter.h\\\"\");");
gCling->process("DefaultInterp->process(\"std::string s; gCling->createUniqueName(s); s.c_str()\");");
// CHECK: ({{const char [*]|const_pointer}}) "__cling_Un1Qu31"
// CHECK: ({{[^)]+}}) "__cling_Un1Qu31"
.q

View File

@ -174,14 +174,14 @@ lookup.findScope("Details::Impl", diags, &t);
QT = clang::QualType(t, 0);
//QT.getAsString().c_str()
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "Details::Impl"
// CHECK: ({{[^)]+}}) "Details::Impl"
// Test the behavior for a class inside an anonymous namespace
lookup.findScope("InsideAnonymous", diags, &t);
QT = clang::QualType(t, 0);
//QT.getAsString().c_str()c
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "class <anonymous namespace>::InsideAnonymous"
// CHECK: ({{[^)]+}}) "class <anonymous namespace>::InsideAnonymous"
// The above result is not quite want we want, so the client must using
// the following:
@ -194,22 +194,22 @@ Policy.SuppressScope = true; // Force the scope to be coming from a clang::
std::string name;
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsStringInternal(name,Policy);
name.c_str()
// CHECK: ({{const char [*]|const_pointer}}) "InsideAnonymous"
// CHECK: ({{[^)]+}}) "InsideAnonymous"
// Test desugaring pointers types:
QT = lookup.findType("Int_t*", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "int *"
// CHECK:({{[^)]+}}) "int *"
QT = lookup.findType("const IntPtr_t*", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "int *const *"
// CHECK:({{[^)]+}}) "int *const *"
// Test desugaring reference (both r- or l- value) types:
QT = lookup.findType("const IntPtr_t&", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "int *const &"
// CHECK:({{[^)]+}}) "int *const &"
//TODO: QT = lookup.findType("IntPtr_t[32], diags");
@ -217,7 +217,7 @@ Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// Test desugaring reference (both r- or l- value) types:
// QT = lookup.findType("const IntRef_t", diags);
// Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// should print:({{const char [*]|const_pointer}}) "int &const"
// should print:({{[^)]+}}) "int &const"
// but this is actually an illegal type:
// C++ [dcl.ref]p1:
@ -228,119 +228,122 @@ Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// So the following is the right behavior:
QT = lookup.findType("const IntRef_t", diags);
// Will issue
// "'const' qualifier on reference type 'IntRef_t' (aka 'int &') has no effect"
// thus suppress diagnostics
QT = lookup.findType("const IntRef_t", cling::LookupHelper::NoDiagnostics);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "int &"
// CHECK: ({{[^)]+}}) "int &"
// Test desugaring reference (both r- or l- value) types:
QT = lookup.findType("IntRef_t", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "int &"
// CHECK:({{[^)]+}}) "int &"
//Desugar template parameters:
lookup.findScope("A<B<Double32_t, Int_t*> >", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "A<B<Double32_t, int *> >"
// CHECK:({{[^)]+}}) "A<B<Double32_t, int *> >"
lookup.findScope("A<B<Double32_t, std::size_t*> >", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK:({{const char [*]|const_pointer}}) "A<B<Double32_t, unsigned {{long|int}} *> >"
// CHECK:({{[^)]+}}) "A<B<Double32_t, unsigned {{long|int}} *> >"
lookup.findScope("CTD", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "C<A<B<Double32_t, int> >, Double32_t>"
// CHECK: ({{[^)]+}}) "C<A<B<Double32_t, int> >, Double32_t>"
lookup.findScope("CTDConst", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "C<A<B<const Double32_t, const int> >, Double32_t>"
// CHECK: ({{[^)]+}}) "C<A<B<const Double32_t, const int> >, Double32_t>"
lookup.findScope("std::pair<const std::string,int>", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "std::pair<const std::string, int>"
// CHECK: ({{[^)]+}}) "std::pair<const std::string, int>"
lookup.findScope("NS::Array<NS::ArrayType<double> >", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Array<NS::ArrayType<double> >"
// CHECK: ({{[^)]+}}) "NS::Array<NS::ArrayType<double> >"
lookup.findScope("NS::Array<NS::ArrayType<Double32_t> >", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Array<NS::ArrayType<Double32_t> >"
// CHECK: ({{[^)]+}}) "NS::Array<NS::ArrayType<Double32_t> >"
lookup.findScope("NS::Container<Long_t>::Content", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Container<long>::Content"
// CHECK: ({{[^)]+}}) "NS::Container<long>::Content"
QT = lookup.findType("NS::Container<Long_t>::Value_t", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "long"
// CHECK: ({{[^)]+}}) "long"
lookup.findScope("NS::Container<Long_t>::Content_t", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Container<long>::Content"
// CHECK: ({{[^)]+}}) "NS::Container<long>::Content"
lookup.findScope("NS::Container<Long_t>::Impl_t", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "Details::Impl"
// CHECK: ({{[^)]+}}) "Details::Impl"
lookup.findScope("NS::Container<Double32_t>::Content", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Container<Double32_t>::Content"
// CHECK: ({{[^)]+}}) "NS::Container<Double32_t>::Content"
QT = lookup.findType("NS::Container<Double32_t>::Value_t", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "double"
// CHECK: ({{[^)]+}}) "double"
// Really we would want it to say Double32_t but oh well.
lookup.findScope("NS::Container<Double32_t>::Content_t", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::Container<Double32_t>::Content"
// CHECK: ({{[^)]+}}) "NS::Container<Double32_t>::Content"
lookup.findScope("NS::Container<Double32_t>::Impl_t", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "Details::Impl"
// CHECK: ({{[^)]+}}) "Details::Impl"
lookup.findScope("NS::TDataPointF", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::TDataPoint<float>"
// CHECK: ({{[^)]+}}) "NS::TDataPoint<float>"
lookup.findScope("NS::TDataPointD32", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::TDataPoint<Double32_t>"
// CHECK: ({{[^)]+}}) "NS::TDataPoint<Double32_t>"
lookup.findScope("NS::ArrayType<float,1>", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::ArrayType<float, 1>"
// CHECK: ({{[^)]+}}) "NS::ArrayType<float, 1>"
lookup.findScope("NS::FArray", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "NS::ArrayType<float, 2>"
// CHECK: ({{[^)]+}}) "NS::ArrayType<float, 2>"
QT = lookup.findType("const NS::IntNS_t", diags);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "const int"
// CHECK: ({{[^)]+}}) "const int"
lookup.findScope("vector<Details::Impl>::value_type", diags, &t);
QT = clang::QualType(t, 0);
Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str()
// CHECK: ({{const char [*]|const_pointer}}) "Details::Impl"
// CHECK: ({{[^)]+}}) "Details::Impl"
const clang::Decl*decl=lookup.findScope("Embedded_objects", diags,&t);
if (decl) {