Commit Graph

242 Commits

Author SHA1 Message Date
Sergey Linev
0525bca060 Use nullptr in cling
Avoid warnings when -Wzero-as-null-pointer-constant is specified
2023-01-30 08:29:07 +01:00
Vassil Vassilev
62dc043874 Qualify DestroyTemplateIdAnnotationsRAIIObj. 2022-12-09 08:44:16 +01:00
Vassil Vassilev
e209eba70b The mangler accepts GlobalDecls and we don't need special cases ctors and dtors.
See llvm/llvm-project/29e1a16be8216066d1ed733a763a749aed13ff47
2022-12-09 08:44:16 +01:00
Vassil Vassilev
2a956809bb Color handling moved from raw_fd_ostream to raw_ostream.
We do not need the wrapper which did more than needed.

See llvm/llvm-project@8744d7f25b
2022-12-09 08:44:16 +01:00
Vassil Vassilev
c8c61d7aa9 llvm::StringRef does not support automatic conversion to string anymore.
See llvm/llvm-project@777180a32b
2022-12-09 08:44:16 +01:00
Vassil Vassilev
83ff0acdd2 Add getSizeExpr parameter.
See llvm-project/llvm@772e266fbf
2022-12-09 08:44:16 +01:00
Sergey Linev
6dd621f4d3 add override qualifier for ColoredOutput methods 2022-08-31 09:14:04 +02:00
Jonas Hahnfeld
52fdb631cf Use logical operators for boolean operands (#10787)
This addresses a warning of recent Clang versions about the "use of
bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]".
2022-07-27 11:44:07 +02:00
Axel Naumann
234772da1c Prevent traling whitespace in -isystem. 2021-11-12 16:14:06 +01:00
Bertrand Bellenot
027b698255 Add the _MSC_VER value for Visual Studio 2022
Add the _MSC_VER value (between 1930 and 1940) for the coming soon `Visual Studio 2022`
2021-10-05 14:59:03 +02:00
Axel Naumann
fc5b3e6f16 Silence GCC 4.8 / CentOS7 warnings:
cling/include/cling/Interpreter/LookupHelper.h:61:69: warning: missing initializer for member ‘std::array<const clang::Type*, 4ul>::_M_elems’ [-Wmissing-field-initializers]
     std::array<const clang::Type*, kNumCachedStrings> m_StringTy = {};
                                                                     ^
2021-05-21 09:44:08 +02:00
Jonas Hahnfeld
fd2212c84e Create new CompoundStmt instead of replacing children
For the update of LLVM 9, Cling required another patch to Clang for
replacing the children of a CompoundStmt. Instead solve this by
creating a new CompoundStmt with the right Stmts attached.

Co-authored-by: Jonas Hahnfeld <Hahnfeld@itc.rwth-aachen.de>
Co-authored-by: Jonas Hahnfeld <hahnjo@hahnjo.de>
2021-04-23 09:29:06 +02:00
Vassil Vassilev
f2e5f43acf Fix warnings about the ignored quals. 2021-02-25 20:44:19 +01:00
Vassil Vassilev
a4a06e0fdf Fix warnings coming from shadowing names. 2021-02-25 20:44:18 +01:00
Vassil Vassilev
b4daff130e LLVM_ON_WIN32 was dropped.
See llvm-mirror/llvm@4833be0
2021-02-25 20:44:18 +01:00
Vassil Vassilev
60bed9429d CompoundStmt::setStmts was reimplemented to save a pointer.
Unfortunately this break external tools such as cling which alters CompoundStmts
to implement its interactive extensions.

We have implemented a patch in clang which brings the old facilities only when
the new interface CompoundStmt::replaceStmts is called.

See llvm-mirror/clang@d0ee47a
2021-02-25 20:44:16 +01:00
Vassil Vassilev
1a5b0a95f3 ForRedeclaration is split in two: {ForVisible,ForExternal}Redeclaration.
ForVisibleRedeclaration does not try to deserialize content from module files.
It should be used for efficiency and when we are sure that what we look up is
in the present TU and it does not make sense to ask the module files.

See llvm-mirror/clang@6bbe311
2021-02-25 20:44:15 +01:00
Vassil Vassilev
a16da5735b BuildDeclRefExpr returns a DeclRefExpr instead of StmtResult. 2021-02-25 20:44:15 +01:00
Axel Naumann
856f8e92f8 Survive NNS not being a namespace. 2020-10-07 17:44:10 +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
Axel Naumann
9220b498f3 Capture/reset expression eval context (ROOT-10511):
Without resetting the eval context to the Parser default (PotentiallyEvaluated),
recursive parsing can potentially assume wrong context and not emit referenced entities.
2020-02-19 11:30:36 +01:00
Sergey Linev
269608a831 Fix memory leak in cling/lib/Utils/PlatformWin.cpp
Seems to be, buffer is not released correctly.
I guess, error should be fixed in cling repository first
2020-01-30 16:29:05 +01:00
Chris Burr
500f426c2f Fix building clingutils tetss with builtin_clang=OFF for conda 2020-01-24 15:44:19 +01:00
Simeon Ehrig
65b9ee7a8c Add functionality to SourceNormalization to detect cuda kernels
- a really weak solution, which should replaced by a generic solution
2019-11-07 19:29:15 +01:00
Guilherme Amadio
111fa41390 Add assertion to ensure that page_size is a power of two 2019-08-08 18:14:03 +02:00
Nikita Ermakov
4b61a2134b Little optimization for the cling pointer check.
Use precalculated PAGE_MASK which is equals to ~(page_size - 1) at
pointer check instead of recalculate it each check.
2019-08-08 17:14:46 +02:00
Guilherme Amadio
0c6588cd0c Fix cling valid pointer check
Assuming that page_size is a power of 2, the calculation of the
base address of the page can be simplified and avoid a division.

According to POSIX, either MS_SYNC or MS_ASYNC must be specified
when calling msync(). Failure to include one of these flags will
cause msync() to fail on some systems.

When msync() returns -1, the pointer is only considered invalid
when errno is set to ENOMEM. In principle, the other possible
values for errno won't happen, but if they do, that should be
considered an error, hence the assert condition needed an update.
EBUSY shouldn't happen since we do not add MS_INVALIDATE to flags,
and EINVAL shouldn't happen because we always pass a multiple of
the page size to msync(). EFAULT is only used in Linux 2.4.18 and
earlier instead of ENOMEM.
2019-08-07 16:29:14 +02:00
Nikita Ermakov
d1faf4e905 Change pointer check method to msync.
The POSIX does not contains /dev/random [1]. Moreover the /dev/random
might not have write permissions. The better way is to use an another
solution which is based on the msync system call [2]. Also this solution
reduces the number of context switching.

[1] -- https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap10.html
[2] -- https://pubs.opengroup.org/onlinepubs/009695399/functions/msync.html
2019-08-06 19:59:22 +02:00
Vassil Vassilev
d71643dcf8 Support recursive lookup helper calls.
The implementation of class->library mapping makes a call to the
LookupHelper::findScope. This makes the recursive invocations to
LookupHelper::findScope -> ... -> LookupHelper::findScope happen more often.
2019-06-02 21:44:26 +02:00
Bertrand Bellenot
7fc4f8539c Add support for Visual Studio 2019 (16) 2019-04-15 12:29:37 +02:00
Vassil Vassilev
eab5eca3ea Optimize IsWrapper
The getNameAsString interface causes a lot of temporary allocations.
The analysis if a decl is a cling-style wrapper can work only on a
simple declarations on the global scope.

This patch filters out complex declarations (eg in namespaces) and
checks only the identifier content.

The patch reduces the memory footprint difference shown in root-project/root#3012.
2019-03-25 19:14:13 +01:00
Vassil Vassilev
04601bd1bf Add a FIXME. 2018-11-15 23:44:56 +01:00
Bertrand Bellenot
2fbb8cb0f1 Don't use VirtualQuery to check if the memory is valid
Calling VirtualQuery() is very expansive. For example, the testUnfold5a.C tutorial (interpreted) times out after 3600 seconds, and runs in about 60 seconds without calling VirtualQuery(). So just bypass it and return true for the time being
2018-10-03 17:43:41 +02:00
Axel Naumann
c23abbc88b Force the OSX SDK to be the one at build time:
Fixes builds with command line tools and macos 10.14.
2018-09-26 20:29:22 +02:00
Axel Naumann
2847412de4 Use TLS for pointer check cache:
With 16 threads, the cache is simply too small.
These are thread specific values anyway.
2018-09-26 11:44:10 +02:00
Bertrand Bellenot
4ed58df12d Fix lookup of Visual Studio directories + improve error messages
Visual Studio 2017 doesn't use the registry anymore, so no need to try to find keys. This prevent picking wrong directories in the case there is another version installed on the computer, and prevent also the following errors when starting ROOT:
  RegQueryValueEx: returned 2: The system cannot find the file specified.
  RegOpenKeyEx: returned 2: The system cannot find the file specified.
2018-09-25 15:29:09 +02:00
Danilo Piparo
7499f98cf9 Avoid symbol of helper function to be exposed, code-quality. 2018-09-22 09:14:48 +02:00
Danilo Piparo
65cea92ce8 Fix ROOT-6967: add helper functions to lookup tags
efficiently and not variables.
2018-09-22 09:14:48 +02:00
Simeon Ehrig
90454f964a Added function to detect c++ attributes at function definition.
Now, it is possible to define functions with c++ attributes without the .rawInput mode. For example functions like `[[ noreturn ]] foo() { ... }` or `[[deprecated]] [[nodiscard]] int bar(){ … }`.
2018-06-19 13:44:58 +02:00
Axel Naumann
eb9fbe9f2c Unroll the pointer-check cache loop. 2018-05-24 23:14:32 +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
Bertrand Bellenot
7c3649035f Several fixes for Windows
in CIFactory:
- Add -fno-threadsafe-statics flag (for Windows only), to prevent potential unresolved symbols at run-time

in MetaProcessor::readInputFromFile:
- add required std::ifstream::binary flag when opening the std::ifstream
- add missing backslashes

in PlatformWin:
- properly format error messages
- in IsDLL(): check and return false if the file size is 0
- fix _CxxThrowException symbol name (not fully understood - to be reviewed)
- filter out a couple of system dlls when looking for symbols
2018-02-20 13:29:03 +01:00
Vassil Vassilev
e13c60a010 Reduce extra char -> llvm::StringRef conversions. 2018-02-17 11:44:06 +01:00
Vassil Vassilev
847d280aac Use the regular lookup mechanisms in cling.
TClingClassInfo has a constructor that is supposed to be used for TU
scope lookups. However, it iterates over decls and causes lots of
deserializations. It does not respect the C++ lookup rules because it
returns the first decl with the name it finds.

This patch tries to keep the original behavior by first trying to do
a regular lookup and if the result is unambigious it returns the found
decl. If the result was ambiguous we try to disambiguate it (by turning
off the using directives) and return the found result.
2018-02-15 22:29:11 +01:00
Bertrand Bellenot
92213e719a Switch object format from ELF to COFF and fix symbols lookup
- Switch object format from ELF (Linux) to COFF (Windows)
- Fix mangled symbols lookup on Windows: remove leading '_' and use malloc to simulate __imp_ variables (that are indirection pointers)
2017-11-29 22:30:07 +01:00
Bertrand Bellenot
988e5b00f2 Fix the Visual Studio 2017 directory location (quick and dirty hack). To be reviewed
The Visual Studio 2017 path is very different than the previous versions, and even the registry entries are completely different, so for now let's try the trivial way first (using the %VCToolsInstallDir% environment variable)
2017-10-05 17:59:08 +02:00
Raphael Isemann
016c1fd372 Use clang's method for checking if we are in std::* 2017-09-27 10:24:51 +02:00
Axel Naumann
bb161feccb Also recognize templates as identifier. 2017-09-13 17:14:08 +02:00
Bertrand Bellenot
5d4a7b51a7 Add support for Visual Studio 2017 2017-08-29 15:21:36 +02:00
Frederich Munch
08178f1a46 Fix Windows exception handling for newer LLVM interfaces. Block it’s usage around CLING_WIN_SEH_EXCEPTIONS macro. 2017-07-05 09:14:09 +02:00