Commit Graph

703 Commits

Author SHA1 Message Date
ferdymercury
42d2fb1493 Remove references to Python2
copy-pasted from pitkajuh. See https://github.com/root-project/cling/pull/519
2024-07-26 09:59:04 +02:00
Yong Gyu Lee
a462500c3a Add non-common_range test to Regression.C 2024-05-30 14:14:03 +02:00
Devajith Valaparambil Sreeramaswamy
aa6d4924b5 Add test for std::filesystem::path 2024-02-16 15:59:04 +01:00
Axel Naumann
e5b63c66a6 Support bare # in input line: (#14109)
fixes #11190.

Co-authored-by: Devajith Valaparambil Sreeramaswamy <devajith.valaparambil.sreeramaswamy@cern.ch>
2024-01-25 15:29:08 +01:00
Devajth Valaparambil Sreeramaswamy
67a415356d Add source_location test 2024-01-17 16:29:04 +01:00
Jonas Hahnfeld
174d4529ab Expect additional error in Prompt/BlockComments.C 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
25ebd992ac Update expected types in output checks 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
a7dd6fde7e Update expected error messages in tests 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
5fda6d38d2 Remove elaborated keyword from output checks
LLVM 16 honors how the declarations were written, without the class
or struct keywords.
2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
fc12e238fc Remove expected space before array brackets in tests 2023-12-11 08:59:21 +01:00
Jonas Hahnfeld
fae810094c Misc renamings and type changes 2023-12-11 08:59:20 +01:00
Axel Naumann
cbd1dcf8da test/Driver/CommandHistory.C: env -u also works on macOS. 2023-12-05 15:44:05 +01:00
Vassil Vassilev
93153b9971 Correctly infer the SDKROOT.
This fixes the -lSystem issues we saw on recent osx platforms.
2023-12-05 14:14:03 +01:00
Jonas Hahnfeld
5cf51d53dd Handle variable templates in DeclUnloader
Fixes #13815
2023-11-30 09:29:02 +01:00
Javier Lopez-Gomez
d3e42235c1 DeclUnloader: do not delete instantiated member functions
The body of member functions of a templated class only gets instantiated
when the function is used.  These `CXXMethodDecl` should not be deleted
from the AST; instead return them to the 'instantiation pending' state.
2023-11-30 08:59:08 +01:00
Jonas Hahnfeld
41e07b3b23 Handle length modifiers in IsClassOrFunction
This expands the handling introduced in commit 31e46a65f6 to include
the length modifiers 'short' and 'long' as mentioned back then. It
still doesn't handle the cases of multiple modifiers such as "unsigned
long long int" and "long int unsigned long" (being the same type).

Fixes https://github.com/root-project/root/issues/13288
2023-10-13 10:14:07 +02:00
Jonas Hahnfeld
a3fa6e22a1 Emit const variables only once (#13614)
Otherwise they are emitted as internal and we get double-construction
and -destruction on the same memory address due to the way we promote
internal declarations in KeepLocalGVPass.

According to upstream tests, the de-duplication doesn't work on Windows
(yet), but I think this problem is severe enough to fix it on the other
platforms sooner rather than later.

Fixes #13429
2023-10-03 17:14:07 +02:00
Jonas Hahnfeld
76e87e6686 Remove REQUIRES: not_system-windows
Replace it by the standard UNSUPPORTED: system-windows.
2023-08-14 18:44:02 +02:00
Jonas Hahnfeld
bb45512ff6 Stop using triple substrings in UNSUPPORTED
With LLVM 16 and https://reviews.llvm.org/D141007, this will not be
supported anymore. As a replacement, use system-{darwin,linux,windows}.
2023-08-14 18:44:02 +02:00
Jonas Hahnfeld
c1574685cb Automatically adjust C++ version of PCH in Cling's test
This fixes test/CodeUnloading/PCH/VTables.C with C++17 and later.
2023-07-20 08:44:03 +02:00
Jonas Hahnfeld
a9ebc3862c Remove unused tools from Cling's lit.cfg 2023-07-20 08:44:03 +02:00
Jonas Hahnfeld
ebd3404baa Fix void Value across Interpreters
They have different ASTContexts, so the VoidTy is different.
2023-07-20 08:44:03 +02:00
Jonas Hahnfeld
6466a6dfe9 Only execute void expression in MultipleInterpreters.C
It was probably an accident and currently leads to an assertion (that
will be fixed in the next commit).
2023-07-20 08:44:03 +02:00
Jiang Yi
b9e8886af7 Extend test/Prompt/decls.C to test ctor, dtor and operator 2023-07-18 20:14:07 +02:00
Jonas Hahnfeld
95cdce8055 Adopt upstream llvm-project monorepo directory layout (#13049)
This will be required for future LLVM upgrades that rely on a common
cmake/ directory next to clang/ and llvm/.

The bulk of this change is the result of the following commands:
 $ mkdir interpreter/llvm-project/
 $ git mv interpreter/llvm/src/tools/clang/ interpreter/llvm-project/clang/
 $ git mv interpreter/llvm/src/ interpreter/llvm-project/llvm/
 $ git mv interpreter/llvm/llvm-project.tag interpreter/llvm-project/llvm-project.tag
2023-06-25 13:44:07 +02:00
Jiang Yi
a1b1c875fd startup script support
Before showing command promt or executing scripts from argv,
enumerate .C files in the directory ${CLING_HOME}/.cling.d/ in alphabetic
order then .x them.

Search order of ${CLING_HOME}:

1. ${CLING_HOME} envvar
2. ${XDG_CONFIG_HOME}/cling/
3. ${HOME}/.config/cling/
4. ${HOME}/
2023-06-16 16:29:08 +02:00
Javier Lopez-Gomez
5ca904dabd Fix DynamicLibraryManager/cached_realpath.C test
Fetching the value of `errno` only makes sense after a failed call to
`realpath()`, i.e. if the return value of the function is NULL.
2023-05-19 23:29:06 +02:00
Javier Lopez-Gomez
4d49306895 Fix DynamicLibraryManager/callable_lib_L_AB_order1.C test
`--enable-new-dtags` is needed in some toolchains to emit the new ELF dynamic
tags, i.e. RUNPATH.
Per ld(1) manual page: `By default, the new dynamic tags are not created.`
2023-05-19 23:29:06 +02:00
Javier Lopez-Gomez
e635331e85 Fix CodeUnloading/Macros.C test
Clang diagnostic verification was unhappy with the previous state of
affairs. Move affected `expected-(warning|note)` markers to `Macros.h`.

Apparently, as Jonas Hahnfeld found, this failure originated in commit
8deb57c04a5ceea96533d095092fcd4f71d1df94, but is not to be reverted
per discussion in https://github.com/root-project/root/pull/12454.
2023-05-19 23:29:06 +02:00
Javier Lopez-Gomez
5f576a2ba8 DefinitionShadower: fix crash with C++20 concepts
In principle, for a TemplateDecl, `isDefinition()` issues a recursive
call passing the templated decl as a parameter.  A `ConceptDecl` is
derived from `TemplateDecl`, however, it should always be considered
a definition.

Also, update the DeclShadowing test incorporating a C++20 concept.

Fixes #12779.
2023-05-08 00:14:05 +02:00
Javier Lopez-Gomez
a0d186073b Ignore -Wunused-result in wrapped code
Make `FilteringDiagConsumer` also ignore -Wunused-result. Whether or not
such diagnostic is filtered depends on `CompilationOptions::IgnorePromptDiags`.

In particular, `IgnorePromptDiags` should _only_ be enabled for code parsed
via `Interpreter::EvaluateInternal()`.  Thus, as of this commit `IgnorePromptDiags`
defaults to 0 in `makeDefaultCompilationOpts()`

The observable effect of this change is ignoring `-Wunused-result` for
wrapped code, e.g.
```c++
[[nodiscard]] int f() { return 0; }

// This yields `warning: ignoring return value of function declared with 'nodiscard' attribute [-Wunused-result]`
void g() { f(); }

f(); // but this should not
```
2023-04-20 15:14:04 +02:00
Vassil Vassilev
5add0d7732 Rename simplisticCast to castAs. 2023-02-03 07:29:07 +01:00
Jiang Yi
1d5536fd0b Test cmd history support 2023-01-25 13:59:06 +01:00
Simeon Ehrig
0ee3ebcb5b Fixed bug in symbol linking for CUDA kernel registration with LLVM 13.
Since cling was ported to LLVM 13, it is required that the
`__cuda_register_globals` function and the `__cuda_fatbin_wrapper` and
`__cuda_gpubin_handle` variables are unique when defining a CUDA kernel.
Otherwise, the JIT is lazy and reuses the compiled version of
`__cuda_register_globals`, `__cuda_fatbin_wrapper` and `__cuda_gpubin_handle`
from the first CUDA kernel definition for all subsequent CUDA kernel
definitions, which in practice means that the PTX code from the first kernel is
re-registered each time.

Increase the default CUDA SM level to 35 because SM 20 is deprecated or
removed in the current CUDA SDK versions.
2022-12-09 08:44:19 +01:00
Jonas Hahnfeld
b721467e15 Fix emission of vtables
It is (again) necessary to call DefineUsedVTables() to enable (at
least) the emission of implicitly defined destructors overriding
the virtual destructor in a base class, see the added test.
2022-12-09 08:44:19 +01:00
Vassil Vassilev
6656a92d22 Diagnostic text changed 2022-12-09 08:44:18 +01:00
Vassil Vassilev
a656f18868 Print a<b<c> >' rather than 'a<b<c>>' in the Transform.C test.
See llvm/llvm-project@159a9f7e76
2022-12-09 08:44:18 +01:00
Axel Naumann
cf44b102bf Fix cached_realpath.C test by removing stale test dir. 2022-05-31 15:44:05 +02:00
Jonas Hahnfeld
35b71f2d93 Fix test/DynamicLibraryManager/callable_lib_L_AB_abs.C (#10542)
Just pass the absolute path, do not prefix with -l which confuses ld.
2022-05-11 09:44:06 +02:00
Javier Lopez-Gomez
9d09611d77 TransactionUnloader: ensure function instantiations are processed only once
Implicit instantiation of a function template calls
`DeclCollector::HandleCXXImplicitFunctionInstantiation()`, which appends the
FunctionDecl to the transaction.  According to clang documentation, the body of
the function has not yet been instantiated. `HandleTopLevelDecl()` will be
called again for this decl at the end of the TU, which will append it
again to the transaction - same `Decl *`, different ConsumerCallInfo.

This is by design. However, unloading of decls in the transaction should
not process the same `Decl *` twice. In particular, entries with ConsumerCallInfo
== `kCCIHandleCXXImplicitFunctionInstantiation` will omitted.

Fixes issue #9850.
2022-03-03 18:29:03 +01:00
Javier Lopez-Gomez
2ec73dd62a DeclUnloader: reset the anonymous namespace in the enclosing DC
From SemaDeclCXX.cpp:
```
C++ [namespace.unnamed]p1.  An unnamed-namespace-definition behaves as if it
were replaced by
     namespace unique { /* empty body */ }
     using namespace unique;
     namespace unique { namespace-body }
where all occurrences of 'unique' in a translation unit are replaced by the same
identifier and this identifier differs from all other identifiers in the entire
program.
```

Thus, the first declaration of an unnamed namespace creates an implicit
UsingDirectiveDecl that makes the names available in the parent DC.

If we are reverting such first declaration, make sure we reset the anonymous
namespace for the parent DeclContext so that the implicit UsingDirectiveDecl
is created again when parsing the next anonymous namespace.

Fixes issue #7483.
2022-03-01 12:59:03 +01:00
Javier Lopez-Gomez
970b844364 Add test against ROOT-9687 2022-02-22 17:59:04 +01:00
Vassil Vassilev
abe65b3bed Add forgotten comment as part of d7da914fa0 2022-02-22 15:59:06 +01:00
Vassil Vassilev
96fccb8e76 Do not alter the llvm::Module when running the static inits.
This change was from MCJIT times and now is not needed anymore. Moreover, the
orcv2 jit infrastructure considers the llvm::Module immutable after it takes
control of it via emitModule. This change will allow us to migrate easier to
orcv2.
2022-02-18 10:14:08 +01:00
Javier Lopez-Gomez
acfb998188 Improve DeclShadowing.C test
Check also the declaration context, which should be an inline namespace if the
DefinitionShadower is enabled or the TU otherwise.
2022-02-05 03:59:07 +01:00
Javier Lopez-Gomez
2766ad8421 Add test against ROOT-6095 2022-02-03 09:29:03 +01:00
Axel Naumann
52266ba5eb Turn on prtcheck for the ptrcheck tests. 2022-01-11 18:29:04 +01:00
Vassil Vassilev
884df027c3 Fix bugs in cling's tests.
Patch by Alexander Penev (@alexander-penev).
2022-01-07 16:29:03 +01:00
Vassil Vassilev
4fa39ba82f Do not resolve symbols from executables compiled with -fPIE.
Executables that are compiled with fPIE means they are compiled in a position
independent manner and are almost indistinguishable from the shared objects. A
reasonably reliable way to find if this was a `pie executable` is to check the
`DF_1_PIE` in the dynamic section of ELF.

The pseudo-code is:
```
if DT_FLAGS_1 dynamic section entry is present
  if DF_1_PIE is set in DT_FLAGS_1:
    print pie executable
  else
    print shared object
```

See https://stackoverflow.com/questions/34519521/why-does-gcc-create-a-shared-object-instead-of-an-executable-binary-according-to/34522357#34522357

Fixes root-project/root#7366

Patch by Alexander Penev (@alexander-penev)
2022-01-07 16:29:03 +01:00
Javier Lopez-Gomez
8d98340299 InputValidator::validate(): add test against ROOT-9202 2021-09-08 19:14:06 +02:00