summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser
Commit message (Collapse)AuthorAgeFilesLines
...
* [CompilerType] Pass an ExecutionContextScope to GetTypeBitAlign.Davide Italiano2019-08-121-1/+1
| | | | llvm-svn: 368620
* Revert "[lldb] Refactor guard variable checks in IRForTarget"Stella Stamenova2019-08-121-12/+12
| | | | | | This reverts commit 94fbbf712e906464f5f3abbeabcfcbc05d5352ec. llvm-svn: 368616
* Revert "[lldb] Fix dynamic_cast by no longer failing on variable without ↵Stella Stamenova2019-08-121-1/+7
| | | | | | | | metadata" This reverts commit b448d1bf212219febbb182d00c210bad1bd25e7f. llvm-svn: 368615
* [Symbol] GetTypeBitAlign() should return None in case of failure.Davide Italiano2019-08-121-2/+4
| | | | | | | | | | | | | | | | Summary: And not `zero`. This is the last API needed to be converted to an Optional<T>. Reviewers: xiaobai, compnerd Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D66093 llvm-svn: 368614
* [lldb] Fix dynamic_cast by no longer failing on variable without metadataRaphael Isemann2019-08-101-7/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Our IR rewriting infrastructure currently fails when it encounters a variable which has no metadata associated. This causes dynamic_cast to fail as in this case IRForTarget considers the type info pointers ('@_ZTI...') to be variables without associated metadata. As there are no variables for these internal variables, this is actually not an error and dynamic_cast would work fine if we didn't throw this error. This patch fixes this by removing this diagnostics code. In case we would actually hit a variable that has no metadata (but is supposed to have), we still have the error in the expression log so this shouldn't make it harder to diagnose any missing metadata errors. This patch should fix dynamic_cast and also adds a bunch of test coverage to that language feature. Fixes rdar://10813639 Reviewers: davide, labath Reviewed By: labath Subscribers: friss, labath, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65932 llvm-svn: 368511
* [lldb][NFC] Remove unused IRForTarget::BuildRelocationRaphael Isemann2019-08-092-36/+0
| | | | llvm-svn: 368442
* [lldb][NFC] Unify InstrList typedef in IRForTargetRaphael Isemann2019-08-091-6/+2
| | | | llvm-svn: 368425
* [lldb] Refactor guard variable checks in IRForTargetRaphael Isemann2019-08-091-12/+12
| | | | | | | | Not NFC as this will probably fix a wrong guard variable check on Windows. Not sure though what Windows test can now be safely enabled. llvm-svn: 368417
* [lldb][NFC] Clean up logging in IRForTargetRaphael Isemann2019-08-091-167/+100
| | | | llvm-svn: 368415
* [lldb][NFC] Remove last C string uses from IRForTargetRaphael Isemann2019-08-091-10/+8
| | | | llvm-svn: 368406
* [lldb][NFC] Use range-based for-loops in IRForTargetRaphael Isemann2019-08-091-108/+40
| | | | llvm-svn: 368405
* [lldb][NFC] Modernize IRForTarget::CreateResultVariableRaphael Isemann2019-08-081-21/+20
| | | | llvm-svn: 368359
* [lldb][NFC] Move to StringRef in some places in IRForTargetRaphael Isemann2019-08-081-37/+32
| | | | llvm-svn: 368353
* [lldb][NFC] Directly use StringRef instead of temporary std::stringRaphael Isemann2019-08-081-13/+12
| | | | llvm-svn: 368346
* [lldb][NFC] Simplify return in MaybeHandleVariableRaphael Isemann2019-08-081-9/+4
| | | | | | This function anyway returns true, no need to do this extra work. llvm-svn: 368309
* Detect HAVE_SYS_TYPES_H in lldbHaibo Huang2019-08-072-0/+4
| | | | | | | | | | | | | | | | Summary: After rL368069 I noticed that HAVE_SYS_TYPES_H is not defined in Platform.h, or anywhere else in lldb. This change fixes that. Reviewers: labath Subscribers: mgorny, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D65822 llvm-svn: 368125
* [lldb][NFC] Minor refactorings to (Clang)ExpressionSourceCodeRaphael Isemann2019-08-061-6/+6
| | | | llvm-svn: 368082
* SymbolVendor: Remove passthrough methodsPavel Labath2019-08-061-16/+11
| | | | | | | | | | After the recent refactorings the SymbolVendor passthrough no longer serve any purpose. This patch removes those methods, and updates all callsites to go to the symbol file directly -- in most cases that just means calling GetSymbolFile()->foo() instead of GetSymbolVendor()->foo(). llvm-svn: 368001
* [lldb][NFC] Remove unnecessary cast in ClangUserExpressionRaphael Isemann2019-08-061-5/+3
| | | | llvm-svn: 367989
* [Gardening] Remove dead code from ASTDumper (NFC)Jonas Devlieghere2019-08-061-4/+0
| | | | | | These functions are not referenced. llvm-svn: 367978
* [lldb][NFC] Document and refactor ↵Raphael Isemann2019-08-051-4/+16
| | | | | | ClangPersistentVariables::RemovePersistentVariable llvm-svn: 367936
* [lldb][NFC] Refactor ClangUserExpression::UpdateLanguageForExprRaphael Isemann2019-08-052-16/+21
| | | | | | | | | The UpdateLanguageForExpr should only update the language, but over time it started to do also do different things related to the generation of the expression source code. This patch refactors all the source code generation part into its own function. llvm-svn: 367922
* [lldb][NFC] Fix documentation for ↵Raphael Isemann2019-08-052-4/+3
| | | | | | ClangPersistentVariables::m_next_persistent_variable_id llvm-svn: 367857
* [lldb][NFC] Clang format GetNextPersistentVariableName signatureRaphael Isemann2019-08-051-1/+1
| | | | llvm-svn: 367843
* [lldb] Move redundant persistent variable counter to ClangPersistentVariablesRaphael Isemann2019-08-051-2/+12
| | | | | | | | | | | | | | | | | Currently Target::m_next_persistent_variable_index is counting up for our persistent variables ($0, $1, ...) but we also have a unused counter that is supposed to do this in ClangPersistentVariables but that stays always at 0 (because we currently increase the target counter when we should increase that unused counter). This patch removes the counter in Target and lets the documented counter in ClangPersistentVariables do the variable counting. Patch *should* be NFC, but it might unexpectedly bring LLDB to new code paths that could contain exciting new bugs to fix. llvm-svn: 367842
* [lldb][NFC] Remove unimplemented ClangExpressionSourceCode::GetNumBodyLinesRaphael Isemann2019-08-051-2/+0
| | | | llvm-svn: 367830
* [clang] Change FileManager to use llvm::ErrorOr instead of null on failureHarlan Haskins2019-08-012-6/+9
| | | | | | | | | | | | | | | | | | Summary: Currently, clang's FileManager uses NULL as an indicator that a particular file did not exist, but would not propagate errors like permission issues. Instead, teach FileManager to use llvm::ErrorOr internally and return rich errors for failures. Reviewers: arphaman, bruno, martong, shafik Subscribers: nemanjai, kbarton, MaskRay, jkorous, dexonsmith, kadircet, jsji, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D65534 llvm-svn: 367618
* [lldb][NFC] Make ClangDiagnostic::m_fixit_vec privateRaphael Isemann2019-08-011-0/+1
| | | | llvm-svn: 367542
* [Symbol] Use llvm::Expected when getting TypeSystemsAlex Langford2019-07-301-4/+9
| | | | | | | | | | | | | | | | | | Summary: This commit achieves the following: - Functions used to return a `TypeSystem *` return an `llvm::Expected<TypeSystem *>` now. This means that the result of a call is always checked, forcing clients to move more carefully. - `TypeSystemMap::GetTypeSystemForLanguage` will either return an Error or a non-null pointer to a TypeSystem. Reviewers: JDevlieghere, davide, compnerd Subscribers: jdoerfert, lldb-commits Differential Revision: https://reviews.llvm.org/D65122 llvm-svn: 367360
* [Reproducers] Pass FileCollector around as a shared_ptr (NFC)Jonas Devlieghere2019-07-291-3/+5
| | | | | | | | | | | Instead of passing the FileCollector around as a reference or raw pointer, use a shared_ptr. This change's motivation is twofold. First it adds compatibility for the newly added `FileCollectorFileSystem`. Secondly, it addresses a lifetime issue we only see when LLDB is used from Xcode, where a reference to the FileCollector outlives the reproducer instance. llvm-svn: 367258
* [FileCollector] Remove LLDB shim around llvm::FileCollector (NFC)Jonas Devlieghere2019-07-251-3/+3
| | | | | | | | The FileCollector got lifted into LLVM and a shim was introduced in LLDB to keep the old API that takes FileSpecs. This patch removes that shim and converts the arguments in place. llvm-svn: 366975
* [FileCollector] Change coding style from LLDB to LLVM (NFC)Jonas Devlieghere2019-07-251-1/+1
| | | | | | | | This patch changes the coding style of the FileCollector from the LLDB to the LLVM coding style. Alex recently lifted it into LLVM and I volunteered to do the conversion. llvm-svn: 366966
* [Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere2019-07-2410-462/+435
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch replaces explicit calls to log::Printf with the new LLDB_LOGF macro. The macro is similar to LLDB_LOG but supports printf-style format strings, instead of formatv-style format strings. So instead of writing: if (log) log->Printf("%s\n", str); You'd write: LLDB_LOG(log, "%s\n", str); This change was done mechanically with the command below. I replaced the spurious if-checks with vim, since I know how to do multi-line replacements with it. find . -type f -name '*.cpp' -exec \ sed -i '' -E 's/log->Printf\(/LLDB_LOGF\(log, /g' "{}" + Differential revision: https://reviews.llvm.org/D65128 llvm-svn: 366936
* [ExpressionParser] Handle llvm::Expected resultJonas Devlieghere2019-07-231-2/+10
| | | | | | | | | | This fixes the unchecked-error assertion at runtime. Expected<T> must be checked before access or destruction. Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed). llvm-svn: 366853
* [ExpressionParser] Fix formatting and whitespace (NFC)Jonas Devlieghere2019-07-231-32/+32
| | | | | | Fix formatting and whitespace before making changes to this file. llvm-svn: 366852
* [lldb] Fix crash when looking up type coming from the ClangModuleDeclVendorRaphael Isemann2019-07-211-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We assume in LLDB that every type comes from an ASTContext with an associated ClangASTContext. However the types inside the ClangModuleDeclVendor don't have a ClangASTContext so we end up crashing whenever we create a CompilerType for one of these types. Simplest way to trigger this bug is to just look up NSObject from a module: (lldb) expr @import Foundation (lldb) type lookup NSObject Assertion failed: (m_type_system != nullptr), function CompilerType, file /Users/teemperor/llvm1/llvm-project/lldb/source/Symbol/CompilerType.cpp, line 39. This patch just creates a ClangASTContext for the ASTContext used by ClangModuleDeclVendor. Reviewers: davide, shafik Reviewed By: davide Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64989 llvm-svn: 366653
* [lldb] Fix buildbot build fail caused by r366645Yuanfang Chen2019-07-211-2/+2
| | | | llvm-svn: 366647
* Add offsetof support to expression evaluator.Raphael Isemann2019-07-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: We currently don't support offsetof in the expression evaluator as it is implemented as a macro (which then calls __builtin_offsetof) in stddef.h. The best solution would be to include that header (or even better, import Clang's builtin module), but header-parsing and (cross-platform) importing modules is not ready yet. Until we get this working with modules I would say we add the macro to our existing macro list as we already do with other macros from stddef.h/stdint.h. We should be able to drop all of them once we can import the relevant modules by default. rdar://26040641 Reviewers: shafik, davide Reviewed By: davide Subscribers: clayborg, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64917 llvm-svn: 366476
* [lldb] Make log for ClangModulesDeclVendor's compiler flag less verboseRaphael Isemann2019-07-171-11/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently the ClangModulesDeclVendor is spamming the expression log with the compiler flags it is using, which creates a log that looks like this: ``` clang -fmodules -fimplicit-module-maps ``` This patch removes all these newlines and just prints the compiler flags in one line as you see in the command line: ``` clang -fmodules -fimplicit-module-maps [...] ``` Reviewers: shafik, davide Reviewed By: davide Subscribers: davide, abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64858 llvm-svn: 366347
* [ASTImporter] Fix LLDB lookup in transparent ctx and with ext srcGabor Marton2019-07-171-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With LLDB we use localUncachedLookup(), however, that fails to find Decls when a transparent context is involved and the given DC has external lexical storage. The solution is to use noload_lookup, which works well with transparent contexts. But, we cannot use only the noload_lookup since the slow case of localUncachedLookup is still needed in some other cases. These other cases are handled in ASTImporterLookupTable, but we cannot use that with LLDB since that traverses through the AST which initiates the load of external decls again via DC::decls(). We must avoid loading external decls during the import becuase ExternalASTSource is implemented with ASTImporter, so external loads during import results in uncontrolled and faulty import. Reviewers: shafik, teemperor, jingham, clayborg, a_sidorin, a.sidorin Subscribers: rnkovacs, dkrupp, Szelethus, gamesh411, cfe-commits, lldb-commits Tags: #clang, #lldb Differential Revision: https://reviews.llvm.org/D61333 llvm-svn: 366325
* [LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford2019-07-154-4/+7
| | | | | | | | | | | | | | Summary: Following up to my CPPLanguageRuntime change, I'm moving ObjCLanguageRuntime into a plugin as well. Reviewers: JDevlieghere, compnerd, jingham, clayborg Subscribers: mgorny, arphaman, lldb-commits Differential Revision: https://reviews.llvm.org/D64763 llvm-svn: 366148
* [LanguageRuntime] Move CPPLanguageRuntime into a pluginAlex Langford2019-07-122-1/+2
| | | | | | | | | | | | Summary: This seems better suited to be in a plugin. Reviewers: JDevlieghere, clayborg, jingham, compnerd, labath Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64599 llvm-svn: 365951
* [Expression] Move IRDynamicChecks to ClangExpressionParserAlex Langford2019-07-124-17/+746
| | | | | | | | | | | | | | | | | | Summary: IRDynamicChecks in its current form is specific to Clang since it deals with the C language family. It is possible that we may want to instrument code generated for other languages, but we can factor in a more general mechanism to do so at a later time. This decouples ObCLanguageRuntime from Expression! Reviewers: compnerd, clayborg, jingham, JDevlieghere Subscribers: mgorny, lldb-commits Differential Revision: https://reviews.llvm.org/D64591 llvm-svn: 365853
* [lldb] Don't use __FUNCTION__ as a file nameRaphael Isemann2019-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | | Summary: I saw while debugging that we call this file `ParseInternal`, which is not a very good name for our fake expression file and also adds this unnecessary link between the way we name this function and the other source location names we get from the expression parser. This patch is renaming it to `<lldb-expr>` which is closer to the way Clang names its buffers, it doesn't depend on the function name (which changes when I refactor this code) and it's easier to grep for. Reviewers: davide Reviewed By: davide Subscribers: abidh, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D64545 llvm-svn: 365812
* [lldb] Fix handling of dollar characters in expr commandRaphael Isemann2019-07-101-31/+79
| | | | llvm-svn: 365698
* Get the expression parser to handle missing weak symbols.Jim Ingham2019-06-281-6/+12
| | | | | | | | | | MachO only for this patch. Differential Revision: https://reviews.llvm.org/D63914 <rdar://problem/51463642> llvm-svn: 364686
* [C++20] add Basic consteval specifierGauthier Harnisch2019-06-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: this revision adds Lexing, Parsing and Basic Semantic for the consteval specifier as specified by http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p1073r3.html with this patch, the consteval specifier is treated as constexpr but can only be applied to function declaration. Changes: - add the consteval keyword. - add parsing of consteval specifier for normal declarations and lambdas expressions. - add the whether a declaration is constexpr is now represented by and enum everywhere except for variable because they can't be consteval. - adapt diagnostic about constexpr to print constexpr or consteval depending on the case. - add tests for basic semantic. Reviewers: rsmith, martong, shafik Reviewed By: rsmith Subscribers: eraman, efriedma, rnkovacs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D61790 llvm-svn: 363362
* [Expression] Add PersistentExpressionState::GetCompilerTypeFromPersistentDeclAlex Langford2019-06-122-0/+19
| | | | | | | | | | | | | | | | Summary: PersistentStateExpressions (e.g. ClangPersistentVariables) have the ability to define types using expressions that persist throughout the debugging session. GetCompilerTypeFromPersistentDecl is a useful operation to have if you need to use any of those persistently declared types, like in CommandObjectMemory. This decouples clang from CommandObjectMemory and decouples Plugins from Commands in general. Differential Revision: https://reviews.llvm.org/D62797 llvm-svn: 363183
* [Target] Remove Process::GetObjCLanguageRuntimeAlex Langford2019-06-103-9/+9
| | | | | | | | | | | Summary: In an effort to make Process more language agnostic, I removed GetCPPLanguageRuntime from Process. I'm following up now with an equivalent change for ObjC. Differential Revision: https://reviews.llvm.org/D63052 llvm-svn: 362981
* Fix integer literals which are cast to boolJonas Devlieghere2019-05-243-17/+19
| | | | | | | | | This change replaces built-in types that are implicitly converted to booleans. Differential revision: https://reviews.llvm.org/D62284 llvm-svn: 361580
OpenPOWER on IntegriCloud