From bbf4a3588f00b667f5012138b841582b30462ea6 Mon Sep 17 00:00:00 2001 From: Axel Naumann Date: Mon, 31 Mar 2014 15:09:55 +0200 Subject: [PATCH] Update to XCode 5.1; e.g. ignore type of std::string::c_str(). --- test/Lookup/scope.C | 8 +-- test/Lookup/template.C | 6 +-- test/Lookup/type.C | 10 ++-- test/Recursion/RecursiveClingInstances.C | 2 +- test/Utils/Transform.C | 65 +++++++++++++----------- 5 files changed, 47 insertions(+), 44 deletions(-) diff --git a/test/Lookup/scope.C b/test/Lookup/scope.C index bc591598..db0097f1 100644 --- a/test/Lookup/scope.C +++ b/test/Lookup/scope.C @@ -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(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(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(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", diags, &resType); //resType->dump(); clang::QualType(resType,0).getAsString().c_str() -//CHECK-NEXT: ({{const char [*]|const_pointer}}) "W" +//CHECK-NEXT: ({{[^)]+}}) "W" diff --git a/test/Lookup/template.C b/test/Lookup/template.C index c30e50bc..75186a52 100644 --- a/test/Lookup/template.C +++ b/test/Lookup/template.C @@ -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" diff --git a/test/Lookup/type.C b/test/Lookup/type.C index 247b6a66..5fa6f536 100644 --- a/test/Lookup/type.C +++ b/test/Lookup/type.C @@ -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 diff --git a/test/Recursion/RecursiveClingInstances.C b/test/Recursion/RecursiveClingInstances.C index 3bc1979e..dd36761b 100644 --- a/test/Recursion/RecursiveClingInstances.C +++ b/test/Recursion/RecursiveClingInstances.C @@ -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 diff --git a/test/Utils/Transform.C b/test/Utils/Transform.C index 1a79f20d..df96545c 100644 --- a/test/Utils/Transform.C +++ b/test/Utils/Transform.C @@ -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 ::InsideAnonymous" +// CHECK: ({{[^)]+}}) "class ::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 >", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK:({{const char [*]|const_pointer}}) "A >" +// CHECK:({{[^)]+}}) "A >" lookup.findScope("A >", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK:({{const char [*]|const_pointer}}) "A >" +// CHECK:({{[^)]+}}) "A >" lookup.findScope("CTD", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "C >, Double32_t>" +// CHECK: ({{[^)]+}}) "C >, 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 >, Double32_t>" +// CHECK: ({{[^)]+}}) "C >, Double32_t>" lookup.findScope("std::pair", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "std::pair" +// CHECK: ({{[^)]+}}) "std::pair" lookup.findScope("NS::Array >", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Array >" +// CHECK: ({{[^)]+}}) "NS::Array >" lookup.findScope("NS::Array >", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Array >" +// CHECK: ({{[^)]+}}) "NS::Array >" lookup.findScope("NS::Container::Content", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Container::Content" +// CHECK: ({{[^)]+}}) "NS::Container::Content" QT = lookup.findType("NS::Container::Value_t", diags); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "long" +// CHECK: ({{[^)]+}}) "long" lookup.findScope("NS::Container::Content_t", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Container::Content" +// CHECK: ({{[^)]+}}) "NS::Container::Content" lookup.findScope("NS::Container::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::Content", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Container::Content" +// CHECK: ({{[^)]+}}) "NS::Container::Content" QT = lookup.findType("NS::Container::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::Content_t", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::Container::Content" +// CHECK: ({{[^)]+}}) "NS::Container::Content" lookup.findScope("NS::Container::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" +// CHECK: ({{[^)]+}}) "NS::TDataPoint" 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" +// CHECK: ({{[^)]+}}) "NS::TDataPoint" lookup.findScope("NS::ArrayType", diags, &t); QT = clang::QualType(t, 0); Transform::GetPartiallyDesugaredType(Ctx, QT, transConfig).getAsString().c_str() -// CHECK: ({{const char [*]|const_pointer}}) "NS::ArrayType" +// CHECK: ({{[^)]+}}) "NS::ArrayType" 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" +// CHECK: ({{[^)]+}}) "NS::ArrayType" 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::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) {