Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 23 additions & 31 deletions interpreter/cling/lib/Utils/AST.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,21 +560,20 @@ namespace utils {
} else {

Decl* decl = nullptr;
const TypedefType* typedeftype =
dyn_cast_or_null<TypedefType>(&(*desugared));
const UsingType* usingtype =
dyn_cast_or_null<UsingType>(&(*desugared));
if (typedeftype) {
decl = typedeftype->getDecl();
} else if (usingtype) {
decl = usingtype->getFoundDecl();
} else {
// There are probably other cases ...
const TagType* tagdecltype = dyn_cast_or_null<TagType>(&(*desugared));
if (tagdecltype) {
decl = tagdecltype->getDecl();
} else {
decl = desugared->getAsCXXRecordDecl();
if (!desugared.isNull()) {
const Type* desugaredTy = desugared.getTypePtr();
switch (desugaredTy->getTypeClass()) {
case Type::Typedef:
decl = cast<TypedefType>(desugaredTy)->getDecl();
break;
case Type::Using:
decl = cast<UsingType>(desugaredTy)->getFoundDecl();
break;
case Type::Record:
case Type::Enum:
decl = cast<TagType>(desugaredTy)->getDecl();
break;
default: decl = desugared->getAsCXXRecordDecl(); break;
}
}
if (decl) {
Expand Down Expand Up @@ -1142,22 +1141,15 @@ namespace utils {
// in which case we want to add it ... but we can't really preserve
// the typedef in this case ...

Decl *decl = nullptr;
const TypedefType* typedeftype =
dyn_cast_or_null<TypedefType>(QT.getTypePtr());
const UsingType* usingtype =
dyn_cast_or_null<UsingType>(QT.getTypePtr());
if (typedeftype) {
decl = typedeftype->getDecl();
} else if (usingtype) {
decl = usingtype->getFoundDecl();
} else {
// There are probably other cases ...
const TagType* tagdecltype = dyn_cast_or_null<TagType>(QT.getTypePtr());
if (tagdecltype) {
decl = tagdecltype->getDecl();
} else {
decl = QT->getAsCXXRecordDecl();
Decl* decl = nullptr;
if (!QT.isNull()) {
const Type* QTTy = QT.getTypePtr();
switch (QTTy->getTypeClass()) {
case Type::Typedef: decl = cast<TypedefType>(QTTy)->getDecl(); break;
case Type::Using: decl = cast<UsingType>(QTTy)->getFoundDecl(); break;
case Type::Record:
case Type::Enum: decl = cast<TagType>(QTTy)->getDecl(); break;
default: decl = QT->getAsCXXRecordDecl(); break;
}
}
if (decl) {
Expand Down
5 changes: 3 additions & 2 deletions interpreter/cling/test/CodeGeneration/Symbols.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: clang -shared %fPIC -DCLING_EXPORT=%dllexport -DBUILD_SHARED %s -o%T/libSymbols%shlibext
// RUN: %cling --nologo -L%T -lSymbols %s | FileCheck %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: clang -shared %fPIC -DCLING_EXPORT=%dllexport -DBUILD_SHARED %s -o%t.dir/libSymbols%shlibext
// RUN: %cling --nologo -L%t.dir -lSymbols %s | FileCheck %s

// Check that weak symbols do not get re-emitted (ROOT-6124)
extern "C" int printf(const char*,...);
Expand Down
9 changes: 5 additions & 4 deletions interpreter/cling/test/CodeUnloading/PCH/VTables.C
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
// RUN: %mkdir "%T/Rel/Path" || true
// RUN: %rm "CompGen.h.pch" && %rm "%T/Rel/Path/Relative.pch"
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: %mkdir "%t.dir/Rel/Path" || true
// RUN: %rm "CompGen.h.pch" && %rm "%t.dir/Rel/Path/Relative.pch"
// RUN: clang -x c++-header -fexceptions -fcxx-exceptions -std=%std_cxx -pthread %S/Inputs/CompGen.h -o CompGen.h.pch
// RUN: clang -x c++-header -fexceptions -fcxx-exceptions -std=%std_cxx -pthread %S/Inputs/CompGen.h -o %T/Rel/Path/Relative.pch
// RUN: clang -x c++-header -fexceptions -fcxx-exceptions -std=%std_cxx -pthread %S/Inputs/CompGen.h -o %t.dir/Rel/Path/Relative.pch
// RUN: cat %s | %cling -I%p -Xclang -include-pch -Xclang CompGen.h.pch 2>&1 | FileCheck %s
// RUN: cat %s | %cling -I%p -I%T/Rel/Path -include-pch Relative.pch 2>&1 | FileCheck %s
// RUN: cat %s | %cling -I%p -I%t.dir/Rel/Path -include-pch Relative.pch 2>&1 | FileCheck %s

//.storeState "a"
.x TriggerCompGen.h
Expand Down
7 changes: 4 additions & 3 deletions interpreter/cling/test/Driver/CurrentDirRm.C
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
//------------------------------------------------------------------------------

// Removing the cwd on Unix works but on Windows cannot be done.
// RUN: %mkdir "%T/Remove"
// RUN: cd "%T/Remove"
// RUN: %rmdir "%T/Remove"
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: %mkdir "%t.dir/Remove"
// RUN: cd "%t.dir/Remove"
// RUN: %rmdir "%t.dir/Remove"
// RUN: %cling %s -Xclang -verify 2>&1 | FileCheck %s
// UNSUPPORTED: system-windows

Expand Down
5 changes: 3 additions & 2 deletions interpreter/cling/test/LibraryCall/call.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib2%shlibext
// RUN: cat %s | %cling -L%T | FileCheck %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%t.dir/libcall_lib2%shlibext
// RUN: cat %s | %cling -L%t.dir | FileCheck %s

.L libcall_lib2
extern "C" int cling_testlibrary_function();
Expand Down
5 changes: 3 additions & 2 deletions interpreter/cling/test/LibraryCall/callable_lib.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib%shlibext
// RUN: cat %s | %cling -L%T | FileCheck %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%t.dir/libcall_lib%shlibext
// RUN: cat %s | %cling -L%t.dir | FileCheck %s

.L libcall_lib
extern "C" int cling_testlibrary_function();
Expand Down
9 changes: 5 additions & 4 deletions interpreter/cling/test/Pragmas/add_env_path.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: %mkdir "%T/subdir" || true
// RUN: %rm "%T/subdir/libtest%shlibext"
// RUN: clang -DCLING_EXPORT=%dllexport -shared %S/call_lib.c -o %T/subdir/libtest%shlibext
// RUN: cat %s | %cling -I %S -DENVVAR_LIB="\"%/T/subdir\"" -DENVVAR_INC="\"%/p/subdir\"" -Xclang -verify 2>&1 | FileCheck %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: %mkdir "%t.dir/subdir" || true
// RUN: %rm "%t.dir/subdir/libtest%shlibext"
// RUN: clang -DCLING_EXPORT=%dllexport -shared %S/call_lib.c -o %t.dir/subdir/libtest%shlibext
// RUN: cat %s | %cling -I %S -DENVVAR_LIB="\"%/t.dir/subdir\"" -DENVVAR_INC="\"%/p/subdir\"" -Xclang -verify 2>&1 | FileCheck %s

extern "C" int cling_testlibrary_function();

Expand Down
5 changes: 3 additions & 2 deletions interpreter/cling/test/Pragmas/load.C
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// LICENSE.TXT for details.
//------------------------------------------------------------------------------

// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%T/libcall_lib%shlibext
// RUN: cat %s | %cling -L %T -Xclang -verify 2>&1 | FileCheck %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: clang -shared -DCLING_EXPORT=%dllexport %S/call_lib.c -o%t.dir/libcall_lib%shlibext
// RUN: cat %s | %cling -L %t.dir -Xclang -verify 2>&1 | FileCheck %s

#pragma cling load("DoesNotExistPleaseRecover")
// expected-error@input_line_12:1{{'DoesNotExistPleaseRecover' file not found}}
Expand Down
17 changes: 9 additions & 8 deletions interpreter/cling/test/Prompt/OutputRedirect.C
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" | FileCheck --check-prefix=CHECKOUT %s
// RUN: cat %T/outfile.txt | FileCheck --check-prefix=CHECK-REDIRECTOUT %s
// RUN: cat %T/errfile.txt | FileCheck --check-prefix=CHECK-REDIRECTERR %s
// RUN: cat %T/bothfile.txt | FileCheck --check-prefix=CHECK-REDIRECTBOTH %s
// RUN: cat %T/anotheroutfile.txt | FileCheck --check-prefix=CHECK-REDIRECTANOTHER %s
// RUN: cat %T/nospace.txt | FileCheck --check-prefix=CHECK-NOSPACE %s
// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2> %T/stderr.txt && cat %T/stderr.txt | FileCheck --check-prefix=CHECKERR %s
// RUN: cat %s | %cling -DCLING_TMP="\"%/T\"" 2>&1 | FileCheck --check-prefix=CHECKERR --check-prefix=CHECKOUT %s
// RUN: rm -rf %t.dir && mkdir -p %t.dir
// RUN: cat %s | %cling -DCLING_TMP="\"%/t.dir\"" | FileCheck --check-prefix=CHECKOUT %s
// RUN: cat %t.dir/outfile.txt | FileCheck --check-prefix=CHECK-REDIRECTOUT %s
// RUN: cat %t.dir/errfile.txt | FileCheck --check-prefix=CHECK-REDIRECTERR %s
// RUN: cat %t.dir/bothfile.txt | FileCheck --check-prefix=CHECK-REDIRECTBOTH %s
// RUN: cat %t.dir/anotheroutfile.txt | FileCheck --check-prefix=CHECK-REDIRECTANOTHER %s
// RUN: cat %t.dir/nospace.txt | FileCheck --check-prefix=CHECK-NOSPACE %s
// RUN: cat %s | %cling -DCLING_TMP="\"%/t.dir\"" 2> %t.dir/stderr.txt && cat %t.dir/stderr.txt | FileCheck --check-prefix=CHECKERR %s
// RUN: cat %s | %cling -DCLING_TMP="\"%/t.dir\"" 2>&1 | FileCheck --check-prefix=CHECKERR --check-prefix=CHECKOUT %s

#include <iostream>

Expand Down
Loading