Commit Graph

530 Commits

Author SHA1 Message Date
Axel Naumann
5ff794a175 Prevent re-parse of "#include \"RuntimeUniverse.h\"". 2015-01-23 16:24:12 +01:00
Axel Naumann
7e981e541c Factor out unload point creation. 2015-01-21 16:59:05 +01:00
Axel Naumann
70d7b66616 Fix doc warning. 2014-10-21 17:52:07 +02:00
Axel Naumann
3d69da22fd Remove unneeded static member decls; mark c'tor, d'tor as deleted. 2014-10-14 09:08:06 +02:00
Axel Naumann
556ac8c3dc Use canonical Decls as key for "do not desugar"; may have dupe Type*s. 2014-10-07 22:20:06 +02:00
Axel Naumann
0bc17f63c4 Pass the .L-ed transaction to actOnxCommand; last transaction might be wrong. 2014-10-06 10:40:10 +02:00
Vassil Vassilev
8162fdd340 We do not own our ExternalSemaSource, it is ref-owned by Sema and ASTContext. 2014-10-01 14:24:13 +02:00
Vassil Vassilev
5563ab3d68 Revert "Fix cling tear down crash involving the ExternalSemaSource."
This reverts commit d320b74acf5172f62b8ac565955ea6497688d225.
2014-10-01 14:24:12 +02:00
Vassil Vassilev
122233ada6 Do not display suggestions only for ROOT. 2014-09-19 14:05:15 +02:00
Axel Naumann
fa7ce40d67 Analyze and fwd declare all dependencies (ROOT-6705 ROOT-6719 ROOT-6712 ROOT-6695). 2014-09-18 23:28:04 +02:00
Philippe Canal
2aacd83287 Introduce Lookup::Named overload taking a StringRef 2014-09-15 12:26:13 +02:00
Axel Naumann
3b078ed887 No need to be more const correct than getCI()->getSema()! 2014-09-14 13:53:10 +02:00
Axel Naumann
b7a590c40e Pass StringRef-s instead of copying strings... 2014-09-14 13:53:09 +02:00
Philippe Canal
91e924b262 Delay call to PrepareParsing until really needed 2014-09-12 05:16:06 +02:00
Philippe Canal
b8e57bce99 Fix cling tear down crash involving the ExternalSemaSource.
With the unique_ptr, we were crash due to the held over reference described
below.  Trying to move the m_ExternalSemaSource deletion after the m_IncrParser
deletion also leads to crash due to the double deletion (once by the ASTContext,
once by m_ExternalSemaSource) of the ExternalSemaSource.

If m_Callbacks is declared after m_IncrParser, it will be deleted first
and if m_ExternalSemaSource is a unique_ptr, it willbe deleted before
m_IncrParser is delete.

During the Incremental parser deletion, there is a call to
CodeGenModule::Release, then EmitTargetMetdata is called and it tries to
get the most recent decl which calls
     clang::LazyGenerationalUpdatePtr<...>::get
which has a LazyVal which has a cached pointer to the AST external
source.  So this placement is necessary to solve a tear down crash.

#0  clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::get (this=0x7fff5fbfe0e0, O=0x1069c3f90) at ExternalASTSource.h:428
428	        (LazyVal->ExternalSource->*Update)(O);
(gdb) l
423	  /// Get the value of this pointer, updating its owner if necessary.
424	  T get(Owner O) {
425	    if (LazyData *LazyVal = Value.template dyn_cast<LazyData*>()) {
426	      if (LazyVal->LastGeneration != LazyVal->ExternalSource->getGeneration()) {
427	        LazyVal->LastGeneration = LazyVal->ExternalSource->getGeneration();
428	        (LazyVal->ExternalSource->*Update)(O);
429	      }
430	      return LazyVal->LastValue;
431	    }
432	    return Value.template get<T>();

#0  clang::LazyGenerationalUpdatePtr<clang::Decl const*, clang::Decl*, &(clang::ExternalASTSource::CompleteRedeclChain(clang::Decl const*))>::get (this=0x7fff5fbfe0e0, O=0x1069c3f90) at ExternalASTSource.h:428
#1  0x000000010005ce38 in clang::Redeclarable<clang::FunctionDecl>::DeclLink::getNext (this=0x1069c3ff0, D=0x1069c3f90) at Redeclarable.h:74
#2  0x000000010005cd81 in clang::Redeclarable<clang::FunctionDecl>::getNextRedeclaration (this=0x1069c3ff0) at Redeclarable.h:119
#3  0x000000010005d0b3 in clang::Redeclarable<clang::FunctionDecl>::getMostRecentDecl (this=0x1069c3ff0) at Redeclarable.h:161
#4  0x000000010137bfdc in clang::FunctionDecl::getMostRecentDeclImpl (this=0x1069c3f90) at Decl.h:1568
#5  0x00000001004b5346 in clang::Decl::getMostRecentDecl (this=0x1069c3f90) at DeclBase.h:806
#6  0x0000000100897128 in clang::CodeGen::CodeGenModule::EmitTargetMetadata (this=0x10689aa00) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/CodeGenModule.cpp:3271
#7  0x0000000100895237 in clang::CodeGen::CodeGenModule::Release (this=0x10689aa00) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/CodeGenModule.cpp:395
#8  0x0000000100981b3c in clang::CodeGeneratorImpl::ReleaseModule (this=0x106506d70) at /Users/pcanal/root_working/code/rootcling/interpreter/llvm/src/tools/clang/lib/CodeGen/ModuleBuilder.cpp:82
#9  0x00000001001c3f88 in ~IncrementalParser (this=0x1065047e0) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/IncrementalParser.cpp:168
#10 0x00000001001c3f25 in ~IncrementalParser (this=0x1065047e0) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/IncrementalParser.cpp:166
#11 0x00000001001d8905 in std::__1::default_delete<cling::IncrementalParser>::operator() () at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory:2426
#12 0x00000001001d8905 in ~unique_ptr [inlined] () at /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1/memory:2625
#13 0x00000001001d8905 in ~Interpreter (this=0x7fff5fbff020) at memory:2593
#14 0x00000001001d8355 in ~Interpreter (this=0x7fff5fbff020) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/lib/Interpreter/Interpreter.cpp:229
#15 0x00000001002b0318 in main (argc=1, argv=0x7fff5fbff740) at /Users/pcanal/root_working/code/rootcling/interpreter/cling/tools/driver/cling.cpp:97
2014-09-11 23:24:02 +02:00
Vassil Vassilev
7887676b92 Remove the member, we inherit it. 2014-09-03 12:03:03 +02:00
Vassil Vassilev
9b28750656 Inline ctor. 2014-09-03 12:03:03 +02:00
Vassil Vassilev
7f6ff73f3c Make SetIsRuntime virtual so that the multiplexer can notify. 2014-08-23 15:26:04 +02:00
Vassil Vassilev
a3c0db36da Pass the SourceManager in. Handle cases where the parsing happens outside the current interpreter instance. 2014-08-22 15:23:06 +02:00
Vassil Vassilev
b538604dc0 Remove the non-working implementation of multiplexing callback. 2014-08-21 17:07:02 +02:00
Vassil Vassilev
0246d5f0b0 Move the multiplexing callbacks in lib. Simplify. 2014-08-21 17:07:02 +02:00
Vassil Vassilev
46d3344ca0 Add constness. 2014-08-21 17:07:02 +02:00
manasij7479
04b8928a3f Bypass short circuit evaluation 2014-08-21 17:07:02 +02:00
manasij7479
70f01ae5ed MultiplexInterpreterCallbacks 2014-08-21 17:07:02 +02:00
Vassil Vassilev
2440257f5b Split the generation of autoloading maps into parser and fwd declarer. 2014-08-20 15:27:07 +02:00
Vassil Vassilev
0aa2a31fa0 llvm::OwningPtr is now std::unique_ptr. 2014-08-14 14:56:44 +02:00
manasij7479
3c260f9e4a New log file name format, and skip function templates with default function arguments 2014-08-14 14:56:43 +02:00
Vassil Vassilev
42b28d2758 Initial work on callback chaining. We can mostly chain InterpreterCallbacks now. 2014-08-14 14:56:42 +02:00
Vassil Vassilev
bf85ae0480 Use std::unique_ptr instead of llvm::OwningPtr. 2014-08-14 14:56:42 +02:00
Vassil Vassilev
51de445b1f Remove the workaround to emphasize the problem. 2014-08-14 14:56:42 +02:00
Vassil Vassilev
bfef6b414d Add file info and authors. 2014-08-14 14:56:41 +02:00
Vassil Vassilev
835c1e3cbf Simplify code. 2014-08-14 14:56:41 +02:00
manasij7479
eb84b553e1 Print fwd decls for full class template specializations, and printStats for ForwardDeclPrinter 2014-08-14 14:56:40 +02:00
Vassil Vassilev
a1640388a4 On .x try calling the specially named function only if it exists. 2014-08-14 14:56:39 +02:00
Vassil Vassilev
f21cf69429 Use the incremental parser's source location offsets in the LookupHelper, too.
This would give us proper ordering of the source locations, useful when clang
wants to compare them.
2014-08-14 14:56:38 +02:00
Vassil Vassilev
22f891e9be llvm::OwningPtr to std::unique_ptr. 2014-08-14 14:56:38 +02:00
manasij7479
fd1d5d2290 Generate fwd decls from nested cling instance 2014-08-14 14:56:35 +02:00
Philippe Canal
576ca3ca96 Remove trailing spaces 2014-08-13 16:08:36 +02:00
manasij7479
662262e3ac Rename SetAutoloadCallback to EnableAutoloading 2014-07-22 14:52:04 +02:00
manasij7479
03e5ef7668 Prevent printing non-fixed enums Remove skipping of system headers Also, do not print default template arguments if they do not have a name. 2014-07-22 14:52:04 +02:00
manasij7479
6e642eeea8 Added options for controlling Macro printing and skipping System Headers And other modifications in ForwardDeclPrinter: HasNestedNameSpecifier function is now disabled. Because it fails for typedefs or classes not having complete definitions. Differentiating between variable initializations and function default arguments. 2014-07-22 14:52:03 +02:00
manasij7479
a812b2cd1d Added a function to attach the AutoloadCallback automatically 2014-07-22 14:52:03 +02:00
manasij7479
6b48ac6804 Default argument stripping for FunctionDecl Also, re-enabled the printing of function default arguments in ForwardDeclPrinter 2014-07-22 14:52:02 +02:00
manasij7479
ab048fa2dd Move Autoloading State information from Interpreter to Callback: Also, use the TransactionCommitted callback instead of a transformation Disable AutoloadingTransform in IncrementalParser for now. 2014-07-22 14:52:02 +02:00
manasij7479
e7a196dcbd Transformation-Callback Pipeline for Decls needing special handling (when defining after being forward declared.)
New state in Interpreter (AutoloadingStateInfo) containing a map.
AutoloadingTransform adapted to push required decls into this map.
AutoloadCallback adapted to be called when a file is included (but before being parsed)
(done by enabling PPCallbacks and overriding InclusionDirective method)
m_PPCallbacks changed from OwningPtr to a normal pointer as an workaround for double free bug.
Default template arguments as a POC example usage of this pileline.

Test:
AutoForwarding.C now passes because of this commit.

Extra:
Re-enabled the printing of class template default arguments when generating fwd declarations.
Forward declprinter now looks up the SourceManager for file name instead of directly printing the Argument.
2014-07-22 14:52:02 +02:00
Axel Naumann
df678cc870 Unused param names; trailing spaces. 2014-07-15 16:30:58 +02:00
CristinaCristescu
4cf130675f Fix const array of char*. (ROOT-5607). 2014-06-14 09:53:03 +02:00
manasij7479
f9f829c48e autoloading visitor 2014-06-10 15:24:01 +02:00
manasij7479
db964bfcfc purged ctags code and moved autoloading into interpreter 2014-06-10 15:24:01 +02:00
Vassil Vassilev
f5250400d4 Remove the junk I accidentally committed. 2014-06-05 17:38:59 +02:00
manasij7479
ebc1309b5f initial code for new approach
(cherry picked from commit fa2b32bd9281f61fd36ff1987041a9a7607ab5e7)
2014-06-04 10:06:03 +02:00
Vassil Vassilev
cd3259b39a Improve implementation of ctags. 2014-06-04 09:20:15 +02:00
manasij7479
6d1d81309d const ness updates in base class, etc 2014-06-04 09:20:15 +02:00
Vassil Vassilev
56b5dc86dd Obey coding rules and indentation. 2014-06-04 09:20:15 +02:00
Vassil Vassilev
08c26eb004 Obey coding styles and indentation. 2014-06-04 09:20:15 +02:00
manasij7479
024b16df11 Init TagsExtension Module, for extending cling to provide interactive hints
AutoloadCallback: Implementing InterpreterCallbacks to attach the module to cling
   The main focus is on overriding LookupObject so that the information about
   lookup failures are obtained from clang.
   The type of the name is not taken into consideration for now.

TagManager: To manage and lookup information from various sorts of tag files.
   Currently a TagManager object is owned by the callback system.
   This may change in future.

Wrapper: As a base class for handling particular types of tagfiles.
   The TagManager maintains a container of Wrappers.

CtagsFileWrapper: Implementing a wrapper for ctags.
   This class is responsible for generating a tagfile from a given path or list of files.
   It also performs lookups in the file generated by it.

And a few simple file system utils to complement llvm::sys::fs and path utilities
2014-06-04 09:20:14 +02:00
Vassil Vassilev
ee9fc709ab We don't need the ValuePrinter.h 2014-05-21 18:11:58 +02:00
Vassil Vassilev
d03ba0fb9f Reduce cling's runtime overhead. 2014-05-21 18:11:58 +02:00
Vassil Vassilev
e1c16dec1b Move the documentation at the accurate place. 2014-05-21 18:11:58 +02:00
Vassil Vassilev
2b9860162e Typo. 2014-05-19 16:27:54 +02:00
Vassil Vassilev
711e39e092 Pass in the transaction ptr, whoose value we print out. 2014-05-18 18:08:59 +02:00
Vassil Vassilev
74ad676363 Allow handling of ptr types by the non-specialized version. 2014-05-18 18:08:59 +02:00
Vassil Vassilev
46636a18d3 No need to pass the interpreter. We have it. 2014-05-18 18:08:59 +02:00
Vassil Vassilev
28de2c1cc2 No need to pass in the ASTContext, we have it. 2014-05-18 18:08:59 +02:00
Vassil Vassilev
47a0d9e5e8 No need of complex indirections and 'fancy' function signatures. Simplify. 2014-05-18 18:08:59 +02:00
Vassil Vassilev
3dc52b1e5f No need of 'public' StreamClingValue. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
96be4e98c5 Remove dangling comment. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
3e5af816aa No need to synthesize anything anymore. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
3dfc56637b Get rid of redundant class. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
c86fbc27b9 Rewire the dumping on cling::Value to its new implementation.
Dump cling::Value within setNoAlloc routines because this is its lifespan,
otherwise gets deleted if nobody requested it. I.e it was created only for
value printing purposes.

Dump cling::Value outside setWithAlloc because the actual value is not put inside
until the call to ::new finishes, thus we need to do it outside, i.e in EvaluateInternal.

Switch on the ValueExtraction synthesizer even when 'just' value printing. We
depend on it. Must be factored out properly in one class.

Stop attaching the value printing template magic, which didn't work in some cases.

Update the ref file, because now there is better type information.

Adapt the user-defined printout functions (TDatime).
2014-05-18 18:08:58 +02:00
Vassil Vassilev
245f098fe1 Record the outcome of VPAuto (auto detection if a value should be printed out). 2014-05-18 18:08:58 +02:00
Vassil Vassilev
e587158b03 Add the Interpreter* to the cling::Value. We can afford it, because its actual size is 24 and it anyway gets aligned to 32 (except on a few old washing machines). 2014-05-18 18:08:58 +02:00
Vassil Vassilev
b9cc758195 Allow simplisticCastAs to work on ptr types. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
ca50db4ec7 Remove the const so that the proper overload can be picked up. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
39f42b02cd Instead of passing the Expr*, which is being value printed, pass the Interpreter* and deduce the expr. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
cb29e6e529 Add printing utility functions to the cling::Value. 2014-05-18 18:08:58 +02:00
Vassil Vassilev
9b009e02a6 Hide codegen from external users. 2014-05-18 18:08:58 +02:00
Axel Naumann
4dfe5ee75a Make interpreter available to callbacks. 2014-05-14 15:32:58 +02:00
Axel Naumann
af66248191 Accessor to current transaction, useful e.g. for callbacks. 2014-05-14 15:32:58 +02:00
Lukas Vacek
ce008b07fc Fix input files processing (cling foo.c should work now) 2014-05-02 19:01:01 +02:00
Axel Naumann
8b60eaf361 Survive and signal non-unique lookup results. 2014-04-29 17:47:58 +02:00
Vassil Vassilev
f75cef233f Implement callbacks for the DynamicLibraryManager. 2014-04-14 20:58:15 +02:00
Vassil Vassilev
68a0a45eab Use normalized filenames. 2014-04-14 20:58:13 +02:00
Vassil Vassilev
59c7b7b2d7 Coding convention. 2014-04-14 09:09:00 +02:00
Vassil Vassilev
6bb29c9130 Consistent argument names. 2014-04-14 09:09:00 +02:00
Vassil Vassilev
ebad01a510 Simplify and extend the dynamic library manager.
Now it provides an interface which can lookup library names. It can unload a
library and the implementation of loading and resolving a library name is much
simpler.

The extensions are greatly used by the unloading facilities in cling its users.
2014-04-14 09:09:00 +02:00
Vassil Vassilev
0abad4f1ff Implement an interface for file/librarly lookup, given the interpreter and system inc paths. 2014-04-14 09:09:00 +02:00
Vassil Vassilev
e9b2e010a6 Style. 2014-04-14 09:08:59 +02:00
Axel Naumann
1b9910ea28 Fix destruction of array-of-structs.
Iterate over the elements, calling the dtor on each.
Requires two more fields in the AllocatedValue to track the array size and
element offset.
Note that this is only implemented for constant size arrays; all others are expected to not be returned (and thus not stored) by value.
2014-04-11 09:00:01 +02:00
Vassil Vassilev
76f9617076 Doxygen. 2014-04-09 18:36:04 +02:00
Vassil Vassilev
0314a15148 Shorten the unnecessary long interface name. 2014-04-09 11:19:00 +02:00
Vassil Vassilev
522b254345 Move the typedef definition before private section. 2014-04-09 11:19:00 +02:00
Vassil Vassilev
d4da070504 Improve doc style. 2014-04-09 11:18:59 +02:00
Vassil Vassilev
d4299217d4 Improve encapsulation. 2014-04-09 11:18:59 +02:00
Vassil Vassilev
d49c03b10c Files that are .x-ed must be unloadable too. Simplify. 2014-04-09 09:27:08 +02:00
Vassil Vassilev
c868ddfd49 In cases of cling::Value reuse we need to update its settings even if we evaluated void expression. 2014-04-02 16:56:58 +02:00
Vassil Vassilev
76c4024d1d Polish the implementation. Each pragma equivalent must use different source location. 2014-04-02 15:29:58 +02:00
Axel Naumann
d80be78891 No vector for time-critical i'faces; use SmallVectorImpl in libCling i'faces.
The use of vector forces an allocation for each call, something we don't need to
impose.

SmallVectorImpl doesn't expose the static alloc size; and our interfaces don't
care. Only the actual storage definition needs to define the size, no subsequent
reference.
2014-04-01 18:31:59 +02:00
Axel Naumann
fd71458a5f Implement cheap move ctor/op=. Member-init order. 2014-04-01 18:31:58 +02:00
Axel Naumann
d00d9e8d54 Simplify; adapt to new Value. 2014-04-01 18:31:58 +02:00