Don't append "const" for rvalues for increased CINT compatibility.

Might re-introduce later.


git-svn-id: http://root.cern.ch/svn/root/trunk@47171 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
Axel Naumann 2012-11-11 16:15:35 +00:00
parent 909bc42884
commit 716729e5eb
11 changed files with 24 additions and 26 deletions

View File

@ -227,8 +227,6 @@ namespace cling {
const clang::Expr* E = VPI.getExpr();
o << "(";
o << E->getType().getAsString();
if (E->isRValue()) // show the user that the var cannot be changed
o << " const";
o << ") ";
StreamValue(o, p, VPI, VPI.getExpr()->getType());
}

View File

@ -9,7 +9,7 @@ namespace Outer { struct Inner { enum E{i = 2}; }; };
.rawInput
Outer::Inner::i
// CHECK: (enum Outer::Inner::E const) @0x{{[0-9A-Fa-f]{7,12}.}}
// CHECK: (enum Outer::Inner::E) @0x{{[0-9A-Fa-f]{7,12}.}}
// CHECK: (Outer::Inner::E::i) : (int) 2
enum A{a}; //

View File

@ -22,6 +22,6 @@ my_int
// CHECK: (int) 20
my_funct()
// CHECK: (int const) 20
// CHECK: (int) 20
.q

View File

@ -20,8 +20,8 @@ int OverloadedF(int i) { return i + 100;}
int __my_i = 10
// CHECK: (int) 10
OverloadedF(__my_i)
// CHECK: (int const) 110
// CHECK: (int) 110
TemplatedF(__my_i)
// CHECK: (int const) 110
// CHECK: (int) 110
.q

View File

@ -16,9 +16,9 @@
gCling->setCallbacks(new cling::test::SymbolResolverCallback(gCling));
jksghdgsjdf->getVersion() // CHECK: {{.*Interpreter.*}}
hsdghfjagsp->Draw() // CHECK: (int const) 12
hsdghfjagsp->Draw() // CHECK: (int) 12
h->Add10(h->Add10(h->Add10(0))) // CHECK: (int const) 30
h->Add10(h->Add10(h->Add10(0))) // CHECK: (int) 30
h->PrintString(std::string("test")); // CHECK: test
int a[5] = {1,2,3,4,5};
h->PrintArray(a, 5); // CHECK: 12345

View File

@ -7,7 +7,7 @@
gCling->setCallbacks(new cling::test::SymbolResolverCallback(gCling));
jksghdgsjdf->getVersion() // CHECK: {{.*Interpreter.*}}
hsdghfjagsp->Draw() // CHECK: (int const) 12
hsdghfjagsp->Draw() // CHECK: (int) 12
h->PrintString(std::string("test")); // CHECK: test
int a[5] = {1,2,3,4,5};

View File

@ -21,7 +21,7 @@ const clang::Decl* cl_A = lookup.findScope("A");
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) "A"
//CHECK-NEXT: (const char *) "A"
.rawInput 1
namespace N {
@ -34,7 +34,7 @@ const clang::Decl* cl_A_in_N = lookup.findScope("N::A");
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) "N::A"
//CHECK-NEXT: (const char *) "N::A"
.rawInput 1
@ -51,7 +51,7 @@ const clang::Decl* cl_A_in_NMP = lookup.findScope("N::M::P::A");
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) "N::M::P::A"
//CHECK-NEXT: (const char *) "N::M::P::A"
.rawInput 1
@ -78,5 +78,5 @@ const clang::Type* resType = 0;
lookup.findScope("W<Int_t>", &resType);
//resType->dump();
clang::QualType(resType,0).getAsString().c_str()
//CHECK-NEXT: (const char * const) "W<Int_t>"
//CHECK-NEXT: (const char *) "W<Int_t>"

View File

@ -27,22 +27,22 @@ const cling::LookupHelper& lookup = gCling->getLookupHelper();
clang::QualType cl_A = lookup.findType("A");
cl_A.getAsString().c_str()
//CHECK: (const char * const) "class A"
//CHECK: (const char *) "class A"
clang::QualType cl_B_in_N = lookup.findType("N::B");
cl_B_in_N.getAsString().c_str()
//CHECK: (const char * const) "N::B"
//CHECK: (const char *) "N::B"
clang::QualType cl_C_in_M = lookup.findType("N::M::C");
cl_C_in_M.getAsString().c_str()
//CHECK: (const char * const) "N::M::C"
//CHECK: (const char *) "N::M::C"
clang::QualType builtin_int = lookup.findType("int");
builtin_int.getAsString().c_str()
//CHECK: (const char * const) "int"
//CHECK: (const char *) "int"
clang::QualType typedef_my_int = lookup.findType("my_int");
typedef_my_int.getAsString().c_str()
//CHECK: (const char * const) "my_int"
//CHECK: (const char *) "my_int"
.q

View File

@ -26,10 +26,10 @@ public:
};
};
Outer::Inner::C
// CHECK: (enum Outer::Inner::E const) @0x{{[0-9A-Fa-f]{6,12}.}}
// CHECK: (enum Outer::Inner::E) @0x{{[0-9A-Fa-f]{6,12}.}}
// CHECK: (Outer::Inner::E::B) ? (Outer::Inner::E::C) : (int) 2
Outer::Inner::D
// CHECK: (enum Outer::Inner::E const) @0x{{[0-9A-Fa-f]{6,12}.}}
// CHECK: (enum Outer::Inner::E) @0x{{[0-9A-Fa-f]{6,12}.}}
// CHECK: (Outer::Inner::E::D) : (int) -{{[0-9].*}}
// Put an enum on the global scope

View File

@ -12,5 +12,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) "__cling_Un1Qu32"
// CHECK: (const char *) "__cling_Un1Qu32"
.q

View File

@ -70,14 +70,14 @@ lookup.findScope("Details::Impl", &t);
QT = clang::QualType(t, 0);
//QT.getAsString().c_str()
Transform::GetPartiallyDesugaredType(Ctx, QT, skip).getAsString().c_str()
// CHECK: (const char * const) "Details::Impl"
// CHECK: (const char *) "Details::Impl"
// Test the behavior for a class inside an anonymous namespace
lookup.findScope("InsideAnonymous", &t);
QT = clang::QualType(t, 0);
//QT.getAsString().c_str()c
Transform::GetPartiallyDesugaredType(Ctx, QT, skip).getAsString().c_str()
// CHECK: (const char * const) "class <anonymous>::InsideAnonymous"
// CHECK: (const char *) "class <anonymous>::InsideAnonymous"
// The above result is not quite want we want, so the client must using
// the following:
@ -90,16 +90,16 @@ Policy.SuppressScope = true; // Force the scope to be coming from a clang::
std::string name;
Transform::GetPartiallyDesugaredType(Ctx, QT, skip).getAsStringInternal(name,Policy);
name.c_str()
// CHECK: (const char * const) "InsideAnonymous"
// CHECK: (const char *) "InsideAnonymous"
// Test desugaring pointers types:
QT = lookup.findType("Int_t*");
Transform::GetPartiallyDesugaredType(Ctx, QT, skip).getAsString().c_str()
// CHECK:(const char * const) "int *"
// CHECK:(const char *) "int *"
QT = lookup.findType("const IntPtr_t*");
Transform::GetPartiallyDesugaredType(Ctx, QT, skip).getAsString().c_str()
// CHECK:(const char * const) "int *const *"
// CHECK:(const char *) "int *const *"
// Test desugaring reference (both r- or l- value) types: