summaryrefslogtreecommitdiffstats
path: root/lldb/source/Expression/ClangASTSource.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Moved more Clang-specific parts of the expression parser into the Clang plugin.Sean Callanan2015-09-251-2095/+0
| | | | | | | | | There are still a bunch of dependencies on the plug-in, but this helps to identify them. There are also a few more bits we need to move (and abstract, for example the ClangPersistentVariables). llvm-svn: 248612
* Eliminate a potential crash in the struct layout code with a gracefull fallbackTamas Berghammer2015-09-251-1/+2
| | | | | | Differential revision: http://reviews.llvm.org/D12963 llvm-svn: 248571
* Rename clang_type_t to opaque_compiler_type_t.Bruce Mitchener2015-09-221-1/+1
| | | | | | | | | | | | | | Summary: This is no longer related to Clang and is just an opaque pointer to data for a compiler type. Reviewers: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13039 llvm-svn: 248288
* Search variables based on clang::DeclContext and clang::Decl treePaul Herman2015-09-151-1/+1
| | | | | | | | | | | | Summary: SymbolFileDWARF now creates VarDecl and BlockDecl and adds them to the Decl tree. Then, in ClangExpressionDeclMap it uses the Decl tree to search for a variable. This fixes lots of variable scoping problems. Reviewers: sivachandra, chaoren, spyffe, clayborg Subscribers: tberghammer, jingham, lldb-commits Differential Revision: http://reviews.llvm.org/D12658 llvm-svn: 247746
* This patch makes Clang-independent base classes for all the expression types ↵Jim Ingham2015-09-151-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | that lldb currently vends. Before we had: ClangFunction ClangUtilityFunction ClangUserExpression and code all over in lldb that explicitly made Clang-based expressions. This patch adds an Expression base class, and three pure virtual implementations for the Expression kinds: FunctionCaller UtilityFunction UserExpression You can request one of these expression types from the Target using the Get<ExpressionType>ForLanguage. The Target will then consult all the registered TypeSystem plugins, and if the type system that matches the language can make an expression of that kind, it will do so and return it. Because all of the real expression types need to communicate with their ExpressionParser in a uniform way, I also added a ExpressionTypeSystemHelper class that expressions generically can vend, and a ClangExpressionHelper that encapsulates the operations that the ClangExpressionParser needs to perform on the ClangExpression types. Then each of the Clang* expression kinds constructs the appropriate helper to do what it needs. The patch also fixes a wart in the UtilityFunction that to use it you had to create a parallel FunctionCaller to actually call the function made by the UtilityFunction. Now the UtilityFunction can be asked to vend a FunctionCaller that will run its function. This cleaned up a lot of boiler plate code using UtilityFunctions. Note, in this patch all the expression types explicitly depend on the LLVM JIT and IR, and all the common JIT running code is in the FunctionCaller etc base classes. At some point we could also abstract that dependency but I don't see us adding another back end in the near term, so I'll leave that exercise till it is actually necessary. llvm-svn: 247720
* Use LLVM casting for TypeSystem so you can cast it to subclasses.Greg Clayton2015-09-081-8/+5
| | | | | | | | | | | | | | This will keep our code cleaner and it removes the need for intrusive additions to TypeSystem like: class TypeSystem { virtual ClangASTContext * AsClangASTContext() = 0; } As you can now just use the llvm::dyn_cast and other casts. llvm-svn: 247041
* When looking up types, find the first type we can import rather than just takingSean Callanan2015-09-011-26/+33
| | | | | | the first type we find and failing if it can't be imported. llvm-svn: 246563
* Final bit of type system cleanup that abstracts declaration contexts into ↵Greg Clayton2015-08-241-30/+37
| | | | | | | | | | | | | | | | | | | | lldb_private::CompilerDeclContext and renames ClangType to CompilerType in many accessors and functions. Create a new "lldb_private::CompilerDeclContext" class that will replace all direct uses of "clang::DeclContext" when used in compiler agnostic code, yet still allow for conversion to clang::DeclContext subclasses by clang specific code. This completes the abstraction of type parsing by removing all "clang::" references from the SymbolFileDWARF. The new "lldb_private::CompilerDeclContext" class abstracts decl contexts found in compiler type systems so they can be used in internal API calls. The TypeSystem is required to support CompilerDeclContexts with new pure virtual functions that start with "DeclContext" in the member function names. Converted all code that used lldb_private::ClangNamespaceDecl over to use the new CompilerDeclContext class and removed the ClangNamespaceDecl.cpp and ClangNamespaceDecl.h files. Removed direct use of clang APIs from SBType and now use the abstract type systems to correctly explore types. Bulk renames for things that used to return a ClangASTType which is now CompilerType: "Type::GetClangFullType()" to "Type::GetFullCompilerType()" "Type::GetClangLayoutType()" to "Type::GetLayoutCompilerType()" "Type::GetClangForwardType()" to "Type::GetForwardCompilerType()" "Value::GetClangType()" to "Value::GetCompilerType()" "Value::SetClangType (const CompilerType &)" to "Value::SetCompilerType (const CompilerType &)" "ValueObject::GetClangType ()" to "ValueObject::GetCompilerType()" many more renames that are similar. llvm-svn: 245905
* Fix evaluation of global operators in C++Paul Herman2015-08-191-4/+6
| | | | llvm-svn: 245508
* ClangASTType is now CompilerType.Greg Clayton2015-08-111-13/+13
| | | | | | This is more preparation for multiple different kinds of types from different compilers (clang, Pascal, Go, RenderScript, Swift, etc). llvm-svn: 244689
* First step in getting LLDB ready to support multiple different type systems.Greg Clayton2015-08-111-8/+20
| | | | | | | | This is the work done by Ryan Brown from http://reviews.llvm.org/D8712 that makes a TypeSystem class and abstracts types to be able to use a type system. All tests pass on MacOSX and passed on linux the last time this was submitted. llvm-svn: 244679
* Update lldb's ExternalASTSources to match Clang r244161.Richard Smith2015-08-061-19/+14
| | | | llvm-svn: 244194
* Revert "Introduce a TypeSystem interface to support adding non-clang languages."Pavel Labath2015-06-081-20/+8
| | | | | | This seems to break expression evaluation on the linux build. llvm-svn: 239366
* Introduce a TypeSystem interface to support adding non-clang languages.Pavel Labath2015-06-081-8/+20
| | | | | | | | | | | | | Reviewers: clayborg Reviewed By: clayborg Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8712 Original Author: Ryan Brown <ribrdb@google.com> llvm-svn: 239360
* If we see an external function in the symbols, makeSean Callanan2015-05-281-5/+16
| | | | | | | | | | it an extern "C" function instead of a C++ function so that Clang doesn't emit a mangled function reference. Also removed the hack in ClangExpressionDeclMap that works around this. llvm-svn: 238476
* Fix resolution of certain recursive types.Stephane Sezer2015-04-081-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: If a struct type S has a member T that has a member that is a function that returns a typedef of S* the respective field would be duplicated, which caused an assert down the line in RecordLayoutBuilder. This patch adds a check that removes the possibility of trying to resolve the same type twice within the same callstack. This commit also adds unit tests for these failures. Fixes https://llvm.org/bugs/show_bug.cgi?id=20486. Patch by Cristian Hancila. Test Plan: Run unit tests. Reviewers: clayborg spyffe Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D8561 llvm-svn: 234441
* Fix build broken by missing `typename` keyword.Zachary Turner2015-03-241-2/+3
| | | | llvm-svn: 233106
* Fix error introduced by changing function signatures.Zachary Turner2015-03-241-30/+46
| | | | | | | | | | | | | | | | | Since ClangASTSource::layoutRecordType() was overriding a virtual function in the base, this was inadvertently causing a new method to be introduced rather than an override. To fix this all method signatures are changed back to taking DenseMaps, and the `override` keyword is added to make sure this type of error doesn't happen again. To keep the original fix intact, which is that fields and bases must be added in offset order, the ImportOffsetMap() function now copies the DenseMap into a vector and then sorts the vector on the value type (e.g. the offset) before iterating over the sorted vector and inserting the items. llvm-svn: 233099
* Fix record layout when synthesizing class types.Zachary Turner2015-03-241-49/+35
| | | | | | | | | | | | | | | | | Prior to this patch, we would try to synthesize class types by iterating over a DenseMap of FieldDecls and adding each one to a CXXRecordDecl. Since a DenseMap doesn't provide a deterministic ordering of the elements, this would not add the fields in FieldOffset order, but rather in some random order determined by the memory layout of the DenseMap. This patch fixes the issue by changing DenseMaps to vectors. The ability to lookup a value in the DenseMap was hardly being used, and where it is sufficient to do a vector lookup. Differential Revision: http://reviews.llvm.org/D8512 llvm-svn: 233090
* Don't #include ClangPersistentVariables.h from Process.hZachary Turner2015-03-031-0/+1
| | | | | | | Nothing from this header file was even being referenced in Process.h anyway, so it was a completely unnecessary include. llvm-svn: 231131
* Reduce header footprint of Target.hZachary Turner2015-03-031-0/+1
| | | | | | | | | | | | This continues the effort to reduce header footprint and improve build speed by removing clang and other unnecessary headers from Target.h. In one case, some headers were included solely for the purpose of declaring a nested class in Target, which was not needed by anybody outside the class. In this case the definition and implementation of the nested class were isolated in the .cpp file so the header could be removed. llvm-svn: 231107
* Don't #include ClangASTContext.h from Module.hZachary Turner2015-03-031-0/+1
| | | | | | | | | | | | This is part of a larger effort to reduce header file footprints. Combined, these patches reduce the build time of LLDB locally by over 30%. However, they touch many files and make many changes, so will be submitted in small incremental pieces. Reviewed By: Greg Clayton Differential Revision: http://reviews.llvm.org/D8022 llvm-svn: 231097
* Update for Clang API change in r230123 -- lookup_result was alwaysChandler Carruth2015-02-211-1/+1
| | | | | | | | const, there was never a need for lookup_const_result. Now that vestigal type is gone, so switch LLDB to lookup_result and to use the DeclContextLookupResult rather than the Const variant. llvm-svn: 230126
* Added support to the expression parser for findingSean Callanan2014-12-101-20/+162
| | | | | | | | | | | Objective-C types and enums in modules. We now have a three-stage fallback when looking for methods and properties: first the DWARF, second the modules, third the runtime. <rdar://problem/18782288> llvm-svn: 223939
* Additional changes required by r223433.Sean Callanan2014-12-051-34/+27
| | | | llvm-svn: 223435
* remove trailing whitespace + remove some useless commentsSylvestre Ledru2014-07-061-206/+206
| | | | llvm-svn: 212411
* sweep up -Wformat warnings from gccSaleem Abdulrasool2014-04-041-297/+291
| | | | | | | This is a purely mechanical change explicitly casting any parameters for printf style conversion. This cleans up the warnings emitted by gcc 4.8 on Linux. llvm-svn: 205607
* Fixed a problem where the expression parser wasSean Callanan2014-03-111-0/+16
| | | | | | | | | | | erroneously completing Objective-C classes sourced from the Objective-C runtime without checking if there was an authoritative version in the debug information. <rdar://problem/16065049> llvm-svn: 203600
* Removed spurious lookup of the $__lldb_exprSean Callanan2014-02-061-0/+3
| | | | | | | | | selector when compiling an expression in an Objective-C context. <rdar://problem/15797390> llvm-svn: 200950
* Build fix following clang r199686Alp Toker2014-01-201-2/+2
| | | | llvm-svn: 199689
* Fixed the AST importer to ensure that base classesSean Callanan2013-12-201-0/+4
| | | | | | | | | | | | | of Objective-C classes are completed, and that variables of Objective-C types have their types completed when the variables are reported. This fixes a long-standing issue where ivars did not show up correctly on 32-bit OS X. <rdar://problem/12184093> llvm-svn: 197775
* Report all methods in an Objective-C class thatSean Callanan2013-09-041-22/+25
| | | | | | | | | | have a certain name, not just the first. This is useful if a class method and an instance method have the same name. <rdar://problem/14872081> llvm-svn: 190008
* Huge change to clean up types.Greg Clayton2013-07-111-44/+46
| | | | | | | | A long time ago we start with clang types that were created by the symbol files and there were many functions in lldb_private::ClangASTContext that helped. Later we create ClangASTType which contains a clang::ASTContext and an opauque QualType, but we didn't switch over to fully using it. There were a lot of places where we would pass around a raw clang_type_t and also pass along a clang::ASTContext separately. This left room for error. This checkin change all type code over to use ClangASTType everywhere and I cleaned up the interfaces quite a bit. Any code that was in ClangASTContext that was type related, was moved over into ClangASTType. All code that used these types was switched over to use all of the new goodness. llvm-svn: 186130
* Missed a place where we have to pass the source location twice to ↵Jim Ingham2013-06-281-0/+1
| | | | | | FunctionDecl::Create. llvm-svn: 185233
* Default parameters are evil and should not be used. Case and point this ↵Greg Clayton2013-06-281-5/+8
| | | | | | checkin that fixes implicit conversions that were happening. llvm-svn: 185217
* Fixed a bug in ClangASTSource where we would returnSean Callanan2013-06-251-9/+9
| | | | | | the target of a typedef when asked for a typedef. llvm-svn: 184886
* Sort out a number of mismatched integer types in order to cut down the ↵Andy Gibbs2013-06-191-1/+1
| | | | | | number of compiler warnings. llvm-svn: 184333
* Add all Decls found through FindExternalLexicalDeclsSean Callanan2013-05-091-0/+12
| | | | | | | | | | | | | | to the DeclContext. This fulfils the contract that we make with Clang by returning ELR_AlreadyLoaded. This is a little aggressive in that it does not allow the ASTImporter to import the child decls with any lexical parent other than the Decl that reported them as children. <rdar://problem/13517713> llvm-svn: 181498
* Fixed a crash in ClangASTSource when logging isSean Callanan2013-04-251-1/+2
| | | | | | disabled. llvm-svn: 180563
* Fixed a problem where the expression parser wouldSean Callanan2013-04-241-0/+5
| | | | | | | | | | | | | | not find multiple functions with the same name but different types. Now we keep track of what types we've already reported for a function and only elide functions if we've already reported a conflicting one. Also added a test case. <rdar://problem/11367837> llvm-svn: 180167
* Fix build.Rafael Espindola2013-04-031-2/+0
| | | | | | This should fix the build breakage caused by the api change in 178663. llvm-svn: 178700
* <rdar://problem/13521159>Greg Clayton2013-03-271-14/+12
| | | | | | | | LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down. All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down. llvm-svn: 178191
* Fixed a potential crash if layout for a structureSean Callanan2013-03-251-1/+4
| | | | | | | | | went wrong and we tried to get layout information that wasn't there. <rdar://problem/13490170> llvm-svn: 177880
* Modified the way we report fields of records.Sean Callanan2013-03-211-5/+1
| | | | | | | | | | | | | | | Clang requires them to have complete types, but we were previously only completing them if they were of tag or Objective-C object types. I have implemented a method on the ASTImporter whose job is to complete a type. It handles not only the cases mentioned above, but also array and atomic types. <rdar://problem/13446777> llvm-svn: 177672
* Fixed a problem where we didn't return TypedefNameDeclsSean Callanan2013-03-141-0/+8
| | | | | | when clang asked for them by name. llvm-svn: 177085
* Match the new declaration of clang::ASTContext::getFunctionType introduced ↵Sylvestre Ledru2013-03-101-2/+1
| | | | | | in clang r176726. Fix the build of lldb llvm-svn: 176790
* Added very lightweight, statically-allocatedSean Callanan2013-03-081-2/+10
| | | | | | | | | | | | counters for a variety of metrics associated with expression parsing. This should give some idea of how much work the expression parser is doing on Clang's behalf, and help with hopefully reducing that load over time. <rdar://problem/13210748> Audit type search/import for expressions llvm-svn: 176714
* Fixed some problems with type deportation:Sean Callanan2013-02-281-2/+3
| | | | | | | | | | | | | | | | | - made sure we tell Clang not to try to complete the type since it can't be completed from its origin any more; and - fixed a silly bug where we tried to forget about the original decl's origins rather than the deported decl's origin. These produced some crashes in ptr_refs, especially under libgmalloc. <rdar://problem/13256150> llvm-svn: 176233
* Made LLDB build with the latest Clang. This meantSean Callanan2013-02-121-14/+32
| | | | | | | | | changing the ClangASTSource to return a bool instead of returning a list of results. Our testsuite mostly works with this change, but some minor issues may remain both on LLDB's side and on Clang's side. llvm-svn: 174949
* <rdar://problem/13069948>Greg Clayton2013-01-251-6/+2
| | | | | | | | | | | | Major fixed to allow reading files that are over 4GB. The main problems were that the DataExtractor was using 32 bit offsets as a data cursor, and since we mmap all of our object files we could run into cases where if we had a very large core file that was over 4GB, we were running into the 4GB boundary. So I defined a new "lldb::offset_t" which should be used for all file offsets. After making this change, I enabled warnings for data loss and for enexpected implicit conversions temporarily and found a ton of things that I fixed. Any functions that take an index internally, should use "size_t" for any indexes and also should return "size_t" for any sizes of collections. llvm-svn: 173463
OpenPOWER on IntegriCloud