summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix clang-3.8 buildPavel Labath2018-03-131-1/+1
| | | | | | | | clang-3.8 complains that constructor for '...' must explicitly initialize the const member. Newer clangs and gcc seem to be fine with this, but explicitly initializing the member does not hurt. llvm-svn: 327380
* [ExpressionParser] Fix crash when evaluating invalid expresssions.Davide Italiano2018-03-131-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Typical example, illformed comparisons (operator== where LHS and RHS are not compatible). If a symbol matched `operator==` in any of the object files lldb inserted a generic function declaration in the ASTContext on which Sema operates. Maintaining the AST context invariants is fairly tricky and sometimes resulted in crashes inside clang (or assertions hit). The real reason why this feature exists in the first place is that of allowing users to do something like: (lldb) call printf("patatino") even if the debug informations for printf() is not available. Eventually, we might reconsider this feature in its entirety, but for now we can't remove it as it would break a bunch of users. Instead, try to limit it to non-C++ symbols, where getting the invariants right is hopefully easier. Now you can't do in lldb anymore (lldb) call _Zsomethingsomething(1,2,3) but that doesn't seem to be such a big loss. <rdar://problem/35645893> llvm-svn: 327356
* Make the clang module cache setting available without a targetAdrian Prantl2018-03-021-6/+5
| | | | | | | | | | | | | | | It turns out that setting the clang module cache after LLDB has a Target can be too late. In particular, the Swift language plugin needs to know the setting without having access to a Target. This patch moves the setting into the *LLDB* module cache, where it is a global setting that is available before any Target is created and more importantly, is shared between all Targets. rdar://problem/37944432 Differential Revision: https://reviews.llvm.org/D43984 llvm-svn: 326628
* Make LLDB's clang module cache path customizableAdrian Prantl2018-02-092-7/+7
| | | | | | | | | | | This patch makes LLDB's clang module cache path customizable via settings set target.clang-modules-cache-path <path> and uses it in the LLDB testsuite to reuse the same location inside the build directory for LLDB and clang. Differential Revision: https://reviews.llvm.org/D43099 llvm-svn: 324775
* Fix memory leaks in GoParserRaphael Isemann2018-01-231-1/+5
| | | | | | | | | | | | | | Summary: The GoParser is leaking memory in the tests due to not freeing allocated nodes when encountering some parsing errors. With this patch all GoParser tests are passing with enabled memory sanitizers/ubsan. Reviewers: labath, davide Reviewed By: labath Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D42409 llvm-svn: 323197
* Fix uninitialized variable in GoParserRaphael Isemann2018-01-221-1/+3
| | | | | | | | | | | | | | | | | | | | Summary: `m_last_tok` isn't initialized anywhere before it's used the first time (most likely in the `GoParser::Rule::error` method), which causes most of the GoParser tests to fail with sanitizers enabled with errors like this: ``` GoParser.cpp:52:21: runtime error: load of value <random value>, which is not a valid value for type 'GoLexer::TokenType' UndefinedBehaviorSanitizer: undefined-behavior GoParser.cpp:52:21 ``` Reviewers: ribrdb, davide, labath Reviewed By: labath Subscribers: labath, lldb-commits Differential Revision: https://reviews.llvm.org/D42339 llvm-svn: 323119
* [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.Davide Italiano2017-12-151-0/+8
| | | | | | | | | | | | | | | | | | | | | | | Clang recently switched to C++14 (with GNU extensions) as the default dialect, but LLDB didn't catch up. This causes failures as LLDB still evaluates ObjectiveC expressions as Objective C++ using C++98 as standard. There are things not available in C++98, including, e.g. nullptr. In some cases Objective-C `nil` is defined as `nullptr` so this causes an evaluation failure. Switch the default to overcome this issue (actually, currently lldb evaluates both C++11 and C++14 as C++11, but that seems a larger change and definitely could be re-evaluated in the future). No test as this is currently failing on the LLDB bots after the clang switch (so, de facto, there's a test already for it). This is a recommit, with a thinko fixed (the code was previously placed incorrectly). <rdar://problem/36011995> llvm-svn: 320778
* [ExpressionParser] Rollback C++98 as the standard for evaluating.Davide Italiano2017-12-151-8/+0
| | | | | | | Some ubuntu bots are failing with this patch in, let me unblock while I investigate. llvm-svn: 320769
* [ExpressionParser] Fix evaluation failures due to mismatch in C++ versions.Davide Italiano2017-12-141-0/+8
| | | | | | | | | | | | | | | | | | | | Clang recently switched to C++14 (with GNU extensions) as the default dialect, but LLDB didn't catch up. This causes failures as LLDB still evaluates ObjectiveC expressions as Objective C++ using C++98 as standard. There are things not available in C++98, including, e.g. nullptr. In some cases Objective-C `nil` is defined as `nullptr` so this causes an evaluation failure. Switch the default to overcome this issue (actually, currently lldb evaluates both C++11 and C++14 as C++11, but that seems a larger change and definitely could be re-evaluated in the future). No test as this is currently failing on the LLDB bots after the clang switch (so, de facto, there's a test already for it). <rdar://problem/36011995> llvm-svn: 320761
* [Expression parser] Remove logging of field that is no longer in clang's ↵Craig Topper2017-11-201-1/+0
| | | | | | | | TargetOptions struct. The Reciprocals field was moved to CodeGenOptions. I don't think lldb was really using this field so I'm just removing the mention. llvm-svn: 318664
* Move ArchSpec to the Utility modulePavel Labath2017-11-134-4/+1
| | | | | | | | | | | | | The rationale here is that ArchSpec is used throughout the codebase, including in places which should not depend on the rest of the code in the Core module. This commit touches many files, but most of it is just renaming of #include lines. In a couple of cases, I removed the #include ArchSpec line altogether, as the file was not using it. In one or two places, this necessitated adding other #includes like lldb-private-defines.h. llvm-svn: 318048
* [ExpressionParser] Garbage-collect dead code. NFCI.Davide Italiano2017-10-241-9/+0
| | | | llvm-svn: 316529
* Remove some unused function calls from ClangUserExpression.cppStephane Sezer2017-10-241-1/+0
| | | | llvm-svn: 316527
* Remove some dead code from ClangExpressionDeclMap.cppStephane Sezer2017-10-241-47/+3
| | | | llvm-svn: 316526
* Silence some "implicit conversion of string literal" warningsPavel Labath2017-10-172-7/+7
| | | | llvm-svn: 316038
* [ExpressionParser] Prefer isa<> to dyn_cast<>. NFCI.Davide Italiano2017-09-301-2/+1
| | | | | | The result type is unused anyway. llvm-svn: 314602
* Fix compilation errorEugene Zemtsov2017-09-291-13/+13
| | | | llvm-svn: 314487
* [Expression parser] Setting to enable use of ExternalASTMergerSean Callanan2017-09-286-112/+529
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This setting can be enabled like this at the target level: (lldb) settings set target.experimental.use-modern-type-lookup true This causes several new behaviors in the Clang expression parser: - It completely disables use of ClangASTImporter. None are created at all, and all users of it are now conditionalized on its presence. - It instead constructs a per-expression ExternalASTMerger, which exists inside Clang and contains much of the type completion logic that hitherto lived in ExternalASTSource, ClangExpressionDeclMap, and ClangASTImporter. - The expression parser uses this Merger as a backend for copying and completing types. - It also constructs a persistent ExternalASTMerger which is connected to the Target's persistent AST context. This is a major chunk of LLDB functionality moved into Clang. It can be tested in two ways: 1. For an individual debug session, enable the setting before running a target. 2. For the testsuite, change the option to be default-true. This is done in Target.cpp's g_experimental_properties. The testsuite is not yet clean with this, so I have not committed that switch. I have filed a Bugzilla for extending the testsuite to allow custom settings for all tests: https://bugs.llvm.org/show_bug.cgi?id=34771 I have also filed a Bugzilla for fixing the remaining testsuite failures with this setting enabled: https://bugs.llvm.org/show_bug.cgi?id=34772 llvm-svn: 314458
* [Expression Parser] Inhibit global lookups for symbols in the IR dynamic checksSean Callanan2017-09-263-27/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The IR dynamic checks are self-contained functions whose job is to - verify that pointers referenced in an expression are valid at runtime; and - verify that selectors sent to Objective-C objects by an expression are actually supported by that object. These dynamic checks forward-declare all the functions they use and should not require any external debug information. The way they ensure this is by marking all the names they use with a dollar sign ($). The expression parser recognizes such symbols and perform no lookups for them. This patch fixes three issues surrounding the use of the dollar sign: - to fix a MIPS issue, the name of the pointer checker was changed from starting with $ to starting with _$, but this was not properly ignored; and - the Objective-C object checker used a temporary variable that did not start with $. - the Objective-C object checker used an externally-defined struct (struct objc_selector) but didn't need to. The patch also implements some cleanup in the area: - it reformats the string containing the Objective-C object checker, which was mangled horribly when the code was transformed to a uniform width of 80 columns, and - it factors out the logic for ignoring global $-symbols into common code shared between ClangASTSource and ClangExpressionDeclMap. Differential Revision: https://reviews.llvm.org/D38153 llvm-svn: 314225
* Fixing LLDB build after refactoring of clang's MacroInfoEugene Zemtsov2017-07-171-4/+4
| | | | llvm-svn: 308219
* [Expression parser] Look up module symbols before hunting globallySean Callanan2017-05-162-118/+12
| | | | | | | | | | | | | | | | | | | When it resolves symbol-only variables, the expression parser currently looks only in the global module list. It should prefer the current module. I've fixed that behavior by making it search the current module first, and only search globally if it finds nothing. I've also added a test case. After review, I moved the core of the lookup algorithm into SymbolContext for use by other code that needs it. Thanks to Greg Clayton and Pavel Labath for their help. Differential Revision: https://reviews.llvm.org/D33083 llvm-svn: 303223
* Rename Error -> Status.Zachary Turner2017-05-1211-28/+28
| | | | | | | | | | | | | | | This renames the LLDB error class to Status, as discussed on the lldb-dev mailing list. A change of this magnitude cannot easily be done without find and replace, but that has potential to catch unwanted occurrences of common strings such as "Error". Every effort was made to find all the obvious things such as the word "Error" appearing in a string, etc, but it's possible there are still some lingering occurences left around. Hopefully nothing too serious. llvm-svn: 302872
* [DWARF parser] Produce correct template parameter packsSean Callanan2017-05-111-2/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Templates can end in parameter packs, like this template <class T...> struct MyStruct { /*...*/ }; LLDB does not currently support these parameter packs; it does not emit them into the template argument list at all. This causes problems when you specialize, e.g.: template <> struct MyStruct<int> { /*...*/ }; template <> struct MyStruct<int, int> : MyStruct<int> { /*...*/ }; LLDB generates two template specializations, each with no template arguments, and then when they are imported by the ASTImporter into a parser's AST context we get a single specialization that inherits from itself, causing Clang's record layout mechanism to smash its stack. This patch fixes the problem for classes and adds tests. The tests for functions fail because Clang's ASTImporter can't import them at the moment, so I've xfailed that test. Differential Revision: https://reviews.llvm.org/D33025 llvm-svn: 302833
* Fixed a bug where we did not properly use the complete versions of ↵Sean Callanan2017-05-031-2/+2
| | | | | | | | | | Objective-C classes. Also added a test case, thanks to Greg Clayton. <rdar://problem/18913551> llvm-svn: 301993
* [Expression parser] Return both types and variablesSean Callanan2017-04-241-256/+249
| | | | | | | | | | | | | | | | | | | | | Many times a user wants to access a type when there's a variable of the same name, or a variable when there's a type of the same name. Depending on the precise context, currently the expression parser can fail to resolve one or the other. This is because ClangExpressionDeclMap has logic to limit the amount of information it searches, and that logic sometimes cuts down the search prematurely. This patch removes some of those early exits. In that sense, this patch trades performance (early exit is faster) for correctness. I've also included two new test cases showing examples of this behavior – as well as modifying an existing test case that gets it wrong. llvm-svn: 301273
* Move FileSpec from Host -> Utility.Zachary Turner2017-03-221-1/+1
| | | | llvm-svn: 298536
* Move StringList from Core -> Utility.Zachary Turner2017-03-211-1/+1
| | | | llvm-svn: 298412
* Update for LLVM API removal of Function::getArgumentList()Reid Kleckner2017-03-161-5/+5
| | | | llvm-svn: 298011
* Resubmit FileSystem changes.Zachary Turner2017-03-081-1/+2
| | | | | | | | | | This was originall reverted due to some test failures in ModuleCache and TestCompDirSymlink. These issues have all been resolved and the code now passes all tests. Differential Revision: https://reviews.llvm.org/D30698 llvm-svn: 297300
* Revert "Use LLVM for all stat-related functionality."Pavel Labath2017-03-071-2/+1
| | | | | | | | | | | | | | | this reverts r297116 because it breaks the unittests and TestCompDirSymlink. The ModuleCache unit test is trivially fixable, but the CompDirSymlink failure is a symptom of a deeper problem: llvm's stat functionality is not a drop-in replacement for lldb's. The former is based on stat(2) (which does symlink resolution), while the latter is based on lstat(2) (which does not). This also reverts subsequent build fixes (r297128, r297120, 297117) and r297119 (Remove FileSpec dependency on FileSystem) which builds on top of this. llvm-svn: 297139
* Use LLVM for all stat-related functionality.Zachary Turner2017-03-071-1/+2
| | | | | | | | | | This deletes LLDB's FileType enumeration and replaces all users, and all calls to functions that check whether a file exists etc with corresponding calls to LLVM. Differential Revision: https://reviews.llvm.org/D30624 llvm-svn: 297116
* Move DataBuffer / DataExtractor and friends from Core -> Utility.Zachary Turner2017-03-046-8/+8
| | | | llvm-svn: 296943
* Move Log from Core -> Utility.Zachary Turner2017-03-0313-13/+13
| | | | | | | | | All references to Host and Core have been removed, so this class can now safely be lowered into Utility. Differential Revision: https://reviews.llvm.org/D30559 llvm-svn: 296909
* Fix spelling mistake.Jason Molenda2017-02-211-1/+1
| | | | llvm-svn: 295694
* Fix compiler warnings for missing switch cases in lldb.Pavel Labath2017-02-171-0/+1
| | | | | | | | | | | | | | | | | | | Summary: There have been a few new values added to a few LLVM enums this change makes sure that LLDB code handles them correctly. Reviewers: labath Reviewed By: labath Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D30005 Author: Eugene Zemtsov <ezemtsov@google.com> llvm-svn: 295445
* Remove dependencies from Utility to Core and Target.Zachary Turner2017-02-142-2/+2
| | | | | | | | | | With this patch, the only dependency left is from Utility to Host. After this is broken, Utility will finally be standalone. Differential Revision: https://reviews.llvm.org/D29909 llvm-svn: 295088
* Clean up debug loggingPavel Labath2017-02-131-8/+8
| | | | | | | | | | | | | | | | | | | | | Summary: We've had two ways to print a "debug" log message. - Log::GetDebug() was testing a Stream flag which was never set. - Log::Debug() was checking for the presence of "log enable --debug" flag. Given that these two were used very rarely and we already have a different way to specify "I want a more verbose log", I propose to remove these two functions and migrate the callers to LLDB_LOGV. This commit does that. Reviewers: clayborg, zturner Subscribers: lldb-commits Differential Revision: https://reviews.llvm.org/D29823 llvm-svn: 294939
* Switch std::call_once to llvm::call_onceKamil Rytarowski2017-02-061-2/+3
| | | | | | | | | | | | | | | | | | | | | Summary: The std::call_once implementation in libstdc++ has problems on few systems: NetBSD, OpenBSD and Linux PPC. LLVM ships with a homegrown implementation llvm::call_once to help on these platforms. This change is required in the NetBSD LLDB port. std::call_once with libstdc++ results with crashing the debugger. Sponsored by <The NetBSD Foundation> Reviewers: labath, joerg, emaste, mehdi_amini, clayborg Reviewed By: labath, clayborg Subscribers: #lldb Tags: #lldb Differential Revision: https://reviews.llvm.org/D29288 llvm-svn: 294202
* Move classes from Core -> Utility.Zachary Turner2017-02-0214-23/+23
| | | | | | | | | | | | | | | | | | | | | | | This moves the following classes from Core -> Utility. ConstString Error RegularExpression Stream StreamString The goal here is to get lldbUtility into a state where it has no dependendencies except on itself and LLVM, so it can be the starting point at which to start untangling LLDB's dependencies. These are all low level and very widely used classes, and previously lldbUtility had dependencies up to lldbCore in order to use these classes. So moving then down to lldbUtility makes sense from both the short term and long term perspective in solving this problem. Differential Revision: https://reviews.llvm.org/D29427 llvm-svn: 293941
* [CMake] [1/4] Update a batch of pluginsChris Bieneman2017-01-312-2/+36
| | | | | | This is extending the updates from r293696 to more LLDB plugins. llvm-svn: 293698
* NFC. Remove unused header include.Chris Bieneman2017-01-311-1/+0
| | | | llvm-svn: 293646
* Add a more succinct logging syntaxPavel Labath2017-01-181-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This adds the LLDB_LOG macro, which enables one to write more succinct log statements. if (log) log->Printf("log something: %d", var); becomes LLDB_LOG(log, "log something: {0}, var); The macro still internally does the "if(log)" dance, so the arguments are only evaluated if logging is enabled, meaning it has the same overhead as the previous syntax. Additionally, the log statements will be automatically prefixed with the file and function generating the log (if the corresponding new argument to the "log enable" command is enabled), so one does not need to manually specify this in the log statement. It also uses the new llvm formatv syntax, which means we don't have to worry about PRIx64 macros and similar, and we can log complex object (llvm::StringRef, lldb_private::Error, ...) more easily. Differential Revision: https://reviews.llvm.org/D27459 llvm-svn: 292360
* Update to match clang r291737.Richard Smith2017-01-121-3/+2
| | | | llvm-svn: 291738
* Reapply "Fixes for Clang API changes to use std::shared_ptr"David Blaikie2017-01-061-16/+17
| | | | | | | | | Aleksey Shlyapnikov found the memory leak I introduced, recommitted the Clang change with a fix for this. This reapplies r291200 reverted in r291250 llvm-svn: 291271
* Revert "Fixes for Clang API changes to use std::shared_ptr"David Blaikie2017-01-061-17/+16
| | | | | | | | | The original Clang change caused a memory leak detected by asan. Reverting while I investigate. This reverts commit r291200. llvm-svn: 291250
* Fixes for Clang API changes to use std::shared_ptrDavid Blaikie2017-01-061-16/+17
| | | | llvm-svn: 291200
* Silence some -Wstring-conversion warningsPavel Labath2017-01-051-1/+1
| | | | | | | | lldbassert(!"foo") -> lldbassert(0 && "foo") In one case, this actually detected a logic error in the assertion (missing !). llvm-svn: 291102
* Fix a couple of incorrect format string warningsLuke Drummond2016-12-221-2/+2
| | | | | | | | | | | This patch fixes use of incorrect `%zi` to format a plain `int`, and using `%llu` to format a `uint64_t`. The fix is to use the new typesafe `llvm::Formatv` based API. Differential Revision: https://reviews.llvm.org/D28028 Subscribers: lldb-commits llvm-svn: 290359
* Expression evaluation for overloaded C functions (redux)Luke Drummond2016-12-191-5/+6
| | | | | | | | | | | | | | | | | | | This is a redux of [Ewan's patch](https://reviews.llvm.org/D17957) , refactored to properly substitute primitive types using a hook in the itanium demangler, and updated after the previous patch went stale The new `SubsPrimitiveParmItanium` function takes a symbol name and replacement primitive type parameter as before but parses it using the FastDemangler, which has been modified to be able to notify clients of parse events (primitive types at this point). Additionally, we now use a `set` of `ConstStrings` instead of a `vector` so that we don't try and resolve the same invalid candidate multiple times. Differential Revision: https://reviews.llvm.org/D27223 Subscribers: lldb-commits llvm-svn: 290117
* Handle empty strings when looking for a CFString's encoding.Sean Callanan2016-12-011-1/+1
| | | | | | Should fix the bots. llvm-svn: 288403
OpenPOWER on IntegriCloud