4371 Commits

Author SHA1 Message Date
Bertrand Bellenot
8352541d0a Remove the -DUNICODE and -D_UNICODE definitions on Windows
Don't use Unicode in the User Interface (command prompt), it has side effects (the prompt displays empty squares instead of readable characters)
2019-07-22 11:14:11 +02:00
Vassil Vassilev
a63b8f1ec7 Mark library search paths system and user accordingly.
We have user library search paths which come from LD_LIBRARY_PATH or similar;
and system library search paths which are coming from the platform.

This patch enables external users performing symbol resolution to filter out
system search paths when they know the symbol cannot be there.

Now, TClingCallbacks can merge the modules vs non-modules code paths, where
the modules prebuilt path is essentially our LD_LIBRARY_PATH.
2019-07-18 20:59:17 +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
Axel Naumann
a3f236fe36 Use canary bytes to determine whether to run dtor:
If the constructor of the contained object is not run (e.g. because
assembling its arguments triggered an exception), the dtor must not
be run when destructing the cling::Value. Detect this case by imprinting
canary bytes into the contained object bytes: if they have changed,
run the dtor, if not assume that the constructor has failed.

This will cause false positives in those cases where the constructor
is not modifying the first object bytes: in these cases, the dtor
is not run even though the ctor is run. That is still better than
the other case (where the dtor crashes because no ctor was run).
2019-07-11 14:44:14 +02:00
Vassil Vassilev
da626b392d Teach ACLiC to build modules.
ACLiC now synthesizes a modulemap with a suffix _ACLiC_dict.modulemap. The file
contains the source file to be compiled and the corresponding library.

The modulemap is then passed to rootcling via -fmodule-map-file= flag to avoid
naming clashes with possibly existing other modulemap files.

This patch teaches cling to work with the -fmodule-map-file= flag.

ACLiC supports automatic inclusion of Rtypes.h (making ClassDef macro
available). Modules are built in isolation and are resilient to #include
of Rtypes.h at rootcling startup time. We make module Core (containing Rtypes.h)
visible via a newly implemented callback.
2019-07-01 13:59:14 +02:00
Axel Naumann
70df14a1c7 Create transactions only if codegen (not rootcling):
The transactions are useful to buffer Decls before sending them to CodeGen,
to verify semantic validity before emitting. If there is no codegen,
DeclCollecting them wastes CPU cycles during PCH generation time
because all headers are in one single transaction. Of course this also
speeds up regular rootcling invocations.
2019-06-28 23:59:17 +02:00
Axel Naumann
8f20c8c6a1 Remove unnecessary include (NFC). 2019-06-28 23:59:17 +02:00
Axel Naumann
ab8fcc633a Remove default-by-tokens default ctor (NFC). 2019-06-28 23:59:17 +02:00
Vassil Vassilev
74685d3725 Store rdict files as module file extensions.
This patch moves the ROOT-specific rdict.pcm optimization in the EXTENSION_BLOCK
of a C++ module file.

This reduces the generated artifacts and simplifies the loading of a rdict pcm
file as it is now part of the C++ module file. This patch paves our way to
using the global module indexing.
2019-06-19 18:59:07 +02:00
Philippe Canal
ddffe49bea Insure that the commit callbacks don't change the 'current' transaction.
This should solve the problem we have been seeing with cmsUnload.  The problem stems from the fact that TCling::AutoParseImplRecurse
uses the address of the current transactions has an index/key when registering a class in fTransactionHeadersMap.

On some platforms TInterpreter.h is parsed late, i.e. during the compilation of:

   gInterpreter->AutoParse("SiStripCluster");

consequently (as AutoParse does not create its own transaction), the transactions that contains
the parsin of TInterpreter is the last one committed before AutoParseImplRecurse is executed.

Without the parsing of TInterpreter.h then that transaction is return by fInterpreter->getCurrentTransaction().
With the parsing of TInterpreter.h, during the commit of the transaction of the callbacks are triggered
and one of the decl is a constant (kFALSE) and thus, in TCling::HandleNewDecl, provokes the execution of

       if (gROOT->GetListOfGlobals()->FindObject(ND->getNameAsString().c_str()))
         return;

which will triggered the creation of a Transaction, however since the last top level transaction was
just switch to the state 'Committed', the new transaction will not be nested and thus
IncrementalParser::endTransaction will set the current transaction to 'nullptr'.

And this value of nullptr for the key of fTransactionHeadersMap is neither guaranteed to be unique
nor handled properly by the rest of the code.

It is unclear why this problem have surfaced recently.

On a failing machine, rebuilding with a 2 month old commit (ad9e5c42cb) still exhibits the problem.
2019-06-07 08:29:45 +02:00
Philippe Canal
0c50779a5f Transaction::clear add missing m_DeserializedDeclQueue.clear 2019-06-07 08:29:45 +02:00
Vaibhav Garg
43b3232b82 Fixing order of options 2019-06-05 09:59:31 +02:00
Vaibhav Garg
b34d634a52 Rename Cling's flag -modulemap_overlay to -includedir-loc 2019-06-05 09:59:31 +02:00
Vassil Vassilev
81e2eda009 Check if the triggerFunc is in a library.
This patch should fix an assert in the incrementals.
2019-06-03 15:44:13 +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
Vassil Vassilev
d5163b6290 Do not allow single line if statements. 2019-05-31 11:29:15 +02:00
Axel Naumann
ed64547947 Support trailing semicolon in .x foo.C(12); 2019-05-15 21:14:11 +02:00
Axel Naumann
202a2c8e89 Improve .x arg parsing (ROOT-10097):
Dropbox folders (among others) can contain parentheses.
Without this patch, ROOT and cling misinterpret those directories as arguments.
Instead, first find the end of the ".x" line.
If the previous token was a closing paren, we assume that the preceding
tokens (up to the non-nested opening paren) belong to the argument.
2019-05-15 21:14:11 +02:00
Vassil Vassilev
03c9a184ba Do not copy the FrontendOpts, we want to modify the object. 2019-05-14 08:47:27 +02:00
xloem
8acc94bfd6 Protect possibly predefined preprocessor symbol
On my systems (RHEL7 and Android Termux) PAGE_SIZE is defined to 4096 in /usr/include/sys/user.h .  The enum then produces a compile-term error.
Adding this change resolves this error for me.
2019-05-13 15:01:11 +02:00
Danilo Piparo
8b9412cb7f Add printer for std::weak_ptr 2019-04-30 20:44:23 +02:00
Danilo Piparo
6d8bac661b Beautify share/unique_ptr value printing 2019-04-30 20:44:23 +02:00
Danilo Piparo
1df678fa0c Add value printers for unique/shared_ptr 2019-04-30 20:44:22 +02:00
Vassil Vassilev
ea23e15d42 Remove workaround used for ROOT. 2019-04-22 17:14:37 +02:00
straydragon
adb1396e4f Fix cpt.py a careless mistake
Signed-off-by: Vassil Vassilev <v.g.vassilev@gmail.com>
2019-04-18 21:46:14 +02:00
Bertrand Bellenot
7fc4f8539c Add support for Visual Studio 2019 (16) 2019-04-15 12:29:37 +02:00
Aleksander Gajewski
07c30f424e Add non-interactive mode to cpt
Signed-off-by: Vassil Vassilev <v.g.vassilev@gmail.com>
2019-04-11 07:44:36 +02:00
lizhangwen
314018e6db Fix OSX where cmake version is '3.14.0-rc4' 2019-04-10 20:59:24 +02:00
Vassil Vassilev
435d2352e5 Add a note how to cite Cling. 2019-04-09 22:44:08 +02:00
Vassil Vassilev
fb5a493198 Resize the memory cache before entering the loop.
This prevents the vector to be reallocated if the size exceeds the capacity of
the vector causing invalid pointer accesses.

Fixes ROOT-7749.
2019-04-09 15:29:12 +02:00
Vassil Vassilev
6130148a58 Bump clad version to v0.5.
The new release includes some improvements in both Forward and
Reverse mode:
* Extend the way to specify a dependent variables. Consider function,
  `double f(double x, double y, double z) {...}`, `clad::differentiate(f, "z")`
  is equivalent to `clad::differentiate(f, 2)`. `clad::gradient(f, "x, y")`
  differentiates with respect to `x` and `y` but not `z`. The gradient results
  are stored in a `_result` parameter in the same order as `x` and `y` were
  specified. Namely, the result of `x` is stored in `_result[0]` and the result
  of `y` in `_result[1]`. If we invert the arguments specified in the string to
  `clad::gradient(f, "y, x")` the results will be stored inversely.
* Enable recursive differentiation.
* Support single- and multi-dimensional arrays -- works for arrays with constant
  size like `double A[] = {1, 2, 3};`, `double A[3];` or `double A[1][2][3][4];`

See more at: https://github.com/vgvassilev/clad/blob/v0.5/docs/ReleaseNotes.md
2019-04-08 20:59:15 +02:00
Oksana Shadura
4683c83c11 Missing lines from modulemap from previous revert
From V.Vasilev, it fixes:
[ 72%] Building CXX object interpreter/llvm/src/tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CodeGenModule.cpp.o
While building module 'Cling_Interpreter' imported from /.../root/core/clingutils/src/RStl.cxx:25:
In file included from <module-includes>:5:
 /.../root/interpreter/cling/include/cling/Interpreter/RuntimeUniverse.h:13:2: error: "This file must not be included by compiled programs."
 #error "This file must not be included by compiled programs."
 ^
2019-03-26 21:14:13 +01: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
b639a0d53c Finish the revert in root-project/root@533dd5e50d
Duplicating Cling_Runtime and Cling_Runtime_Extra in both module.modulemap
and module.modulemap.build causes redefinition errors if -Dbuiltin_clang=Off.
We should not duplicate the cling runtime modules in both modulemaps.
2019-03-23 10:15:28 +01:00
Vassil Vassilev
27f03abc6c Typo. 2019-03-21 23:29:11 +01:00
Vassil Vassilev
e7b7b6c247 OSX does not require overlay files. 2019-03-21 23:29:11 +01:00
Vassil Vassilev
1cb36481ba Add missing dependency. 2019-03-17 08:15:02 +01:00
Vassil Vassilev
daeaa6d9fb Fix failing test. 2019-03-17 08:15:02 +01:00
Vassil Vassilev
2a88ca8943 Constify. 2019-03-16 14:29:29 +01:00
Vassil Vassilev
9dd448d998 Order alphabetically includes. 2019-03-16 14:29:29 +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
81c8b1ed2f Prevent the overlay entry from docking to .../include/c++/backward/:
This code must be replaced by a HeaderSearch of vector, stdio.h and then
use their DirectoryEntry-s as path for buildModuleMapOverlayEntry().
2019-03-11 17:29:17 +01:00
Vassil Vassilev
78c2bbaf9a Remove obsolete interface. 2019-02-22 09:46:26 +01:00
Vassil Vassilev
94dc093259 Sink the interface for loading a module in cling.
This patch prepares the infrastructure to be able to work with a
global module index.
2019-02-20 22:29:12 +01:00
Oksana Shadura
59a46d513b Fixing compile time installation of clad in CMAKE_INSTALL_PATH
[ROOT-9924] Installing headers for clad
2019-02-05 11:44:03 +01:00
Bertrand Bellenot
5a82c65dd8 Use llvm::raw_string_ostream instead of std::stringstream (thanks Axel) 2019-02-05 08:15:06 +01:00
Bertrand Bellenot
eec58c1605 Windows: Fix formatting of Interpreter::toString(const char* type, void* obj)
Make sure hexadecimal pointer values have the correct '0x' prefix (not automatic on Windows)
2019-02-05 08:15:06 +01:00
Yuka Takahashi
bc7cca6e31 Introduce virtual modulemap overlay file (#3267)
This patch includes:
- Remove existing modulemap.overlay files
  Cling now can generate virtual overlay files on-demand.
- Implement `-modulemap_overlay` flag to Cling
  This flag is used to tell Cling the location of modulemaps to be
  overlayed. (eg. stl.modulemap, libc.modulemap)
- Generate and load virtual modulemap in Cling
  It is in Interpreter constructor, happens as part of cxxmodules
  initialization step.
- Implement an interface to Clang CompilerInvocation which can take FileSystem pointer
  Previously, Clang only took a "string of filenames" which clearly doesn't
  work for our usecase. We already discussed this new interface at
  modules meeting, so this change will land upstream.
- Add a file existence check in Clang
  When compiling a pcm and when Clang saw the #include with which pcm was available
  (or being generated implicitly), Clang was putting a notation of the full path to this pcm.
  This caused an error when build directory was deleted, because the path didn't exist anymore.

This patch enables modules to be binary distributed, and to make it
work in CMSSW enviroment.
2019-01-24 10:29:21 +01:00