Commit Graph

166 Commits

Author SHA1 Message Date
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
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
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
Jiang Yi
b9e8886af7 Extend test/Prompt/decls.C to test ctor, dtor and operator 2023-07-18 20:14:07 +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
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
8d98340299 InputValidator::validate(): add test against ROOT-9202 2021-09-08 19:14:06 +02:00
Vassil Vassilev
401fbfdf90 Check for the expected diagnostics. 2021-02-25 20:44:17 +01:00
Vassil Vassilev
3f8a2221ed llvm9 fixes the printing of unscoped enums.
See llvm-mirror/llvm@2f52311
2021-02-25 20:44:17 +01:00
Vassil Vassilev
c32df9ba67 auto func requires c++14 2021-02-25 20:44:17 +01:00
Jonas Hahnfeld
c7558a2c0d Reset function sections before JITting
This makes all functions end up in the same text section, which is
important for TCling on macOS to catch exceptions from constructors:
Stack unwinding requires information about program addresses to find
out which objects to destroy and what code should be called to handle
the exception. These addresses are relocated against a single __text
section when loading the produced MachO binary, which breaks if the
call sites of global constructors end up in a separate init section.

Fixes ROOT-10703 and ROOT-10962
2021-02-10 15:18:14 +01:00
Jonas Hahnfeld
173de1db30 Enable test for exceptions 2021-02-10 15:18:14 +01:00
Axel Naumann
dfb84fe995 Support GCC10 type name:
(std::pair<std::__strip_reference_wrapper<const char *>::__type, std::__strip_reference_wrapper<int>::__type>) { "s", 10 }
i.e. the array size is not part of the type.
2020-08-20 17:29:08 +02:00
Jonas Hahnfeld
f2b3a8408e IsClassOrFunction: Handle signedness modifiers
When using these modifiers, a type can consist of multiple tokens
as for example "unsigned int". However the keyword "int" can also
be omitted, making "unsigned" itself also a valid type.

Note that this only handles the most basic case for the modifiers.
The size modifiers "short", "long", and "long long" would need
similar treatment. Moreover the standard permits any order for the
type specifiers, ie "unsigned long long int" and "long int unsigned
long" are both valid (and actually the same type).
2020-07-01 22:44:08 +02:00
Philippe Canal
4a92ac82a9 Don't use make_unique to be runnable in C++11 2019-10-05 14:59:03 +02:00
Philippe Canal
8339e5498e print the value of the pointer when value printing smart pointers.
This fixes ROOT-10333.

Since the printValue set of functions always takes a pointer and dereferences it without any checks,
the previous implementation was attempting to valuePrint the pointee (rather than the pointer value)
but this lead to a segmentation fault whenever the smart pointer was set to nullptr.

Now, the valuePrinting for the smart pointers behaves the same as for regular pointer.
2019-10-05 13:59:26 +02:00
Axel Naumann
ba4cc7641e Add test for ROOT-10221. 2019-07-16 00:14:07 +02:00
Axel Naumann
be780f4812 Fix initialization of array, fixes test. 2019-07-15 21:14:05 +02:00
Axel Naumann
4fef27091e Add storage to test types, to trigger dtor call. 2019-07-15 17:29:08 +02:00
Vassil Vassilev
daeaa6d9fb Fix failing test. 2019-03-17 08:15:02 +01:00
Vassil Vassilev
0b9abc1e14 Force flush cout after execution
The user might use utilities which print on cout and expects the output
to be shown immediately.

This patch automatically flushes std::cout after each execution of a wrapper.
2019-03-16 14:29:29 +01:00
Axel Naumann
5e0ff39cd8 Test printValue on unutterable types. 2018-06-27 08:45:21 +02:00
Axel Naumann
855d7224ae cling can now print lamda-dependent types! 2018-04-30 16:29:42 +02:00
Axel Naumann
e39e1baf94 Do not rely on value printer to side-#include <string>. 2018-04-30 16:29:42 +02:00
Vassil Vassilev
c2ce10091f Fix the expected fully qualified type. 2018-04-21 16:14:23 +02:00
Vassil Vassilev
4a226ee47a Desugar auto types allowing to print the full qualification of a type. 2018-04-19 17:59:08 +02:00
Vassil Vassilev
7b70052776 Add forgotten to commit protection and check clause.
This should have landed in 7554be9571.
2018-03-10 10:29:05 +01:00
Vassil Vassilev
01dbb6d9d5 Use a stable way to determine the address of printed objects.
Using unary operator address of (eg. MyClass m; &m) takes into account
overloaded operators which may not give us the precide address of the
allocated storage.

This patch teaches cling to use std::addressof instead.
2018-03-08 22:44:16 +01:00
Axel Naumann
1ac9f65512 Update to new output format. Use CHECK-NEXT. 2017-12-05 15:40:37 +01:00
Axel Naumann
25849d68c4 Update ref to include <invalid memory address> 2017-12-05 15:40:37 +01:00
Axel Naumann
a662db9c4c Adapt to new=old value printer: "1.000000" for a double 1 instead of "1".
Revert "Adapt to format changes in floating point value printing."

This reverts commit a15ef54fb4c5152eeff740cc1f3be6249ede26e6.
2017-12-05 15:40:37 +01:00
Axel Naumann
315dfad70e Adapt to new default opt level.
As the default opt level decides which user-set opt levels cling will complain about, "control flow" changes were needed for the tests.
2017-11-07 19:44:33 +01:00
Axel Naumann
a9808afd40 Adapt to format changes in floating point value printing. 2017-11-07 19:44:33 +01:00
Vassil Vassilev
c912c9437d Switch back to O0.
We have a suboptimal behavior in the way cling optimizes code in O2 mode.
Disable it until the issue is understood and fixed.
2017-11-03 16:19:32 +01:00
Axel Naumann
9f6e4d0ba0 Add test for "Also recognize templates as identifier." 2017-09-13 18:38:18 +02:00
Roman Zulak
4a8d300bb1 When looking for the end of a block comment, really don’t bother with nesting. Finding the first end is good enough, the real parser can warn about any balancing issues. 2017-07-13 10:21:58 +02:00
Roman Zulak
6f5594ab4d Fix block comments greedily looking for the next asterisk. 2017-07-13 10:21:58 +02:00
Axel Naumann
6ec2c42b3c Reflect updated function name in error message. 2017-06-26 17:44:07 +02:00
Axel Naumann
bef7762723 Remove outdated comment.
clang does warn about backslash-followed-by-tab.
2017-06-23 15:14:10 +02:00
Frederich Munch
df4aea2fb0 Add continuation support for comma and backslash characters. 2017-06-23 15:14:10 +02:00
Roman Zulak
6a8632d451 Fix trying to destruct C structs after printing on prompt. Don't bother destructing C++ objects who have trivial destructors.
Signed-off-by: Vassil Vassilev <vvasilev@cern.ch>
2017-06-12 18:14:30 +02:00
Vassil Vassilev
8f257e74d3 Create a virtual file entry for each input line.
This is the only way not to confuse the diagnostics engine of upgraded clang.

Also, this gives us a few advantages:
  * We can compare more precisely the source locations of diagnostics;
  * We can merge the code completion code path which works with file entries;
  * We can rely better when specifying //expected-note-s in different files.
2017-06-08 10:29:13 +02:00
Axel Naumann
a3b7f8b2b5 Fix C comments with slash. By Roman Zulak! 2017-05-11 09:00:00 +02:00