summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* *** This commit represents a complete reformatting of the LLDB source codeKate Stone2016-09-061-841/+798
| | | | | | | | | | | | | | | | | | | | | | | *** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
* Fixed the location of a conditional to make the following code clearer.Sean Callanan2016-08-271-7/+7
| | | | llvm-svn: 279896
* The error stream in IRForTarget is never null, so use it instead of the log.Sean Callanan2016-08-271-3/+2
| | | | llvm-svn: 279894
* Fixed a bad lldbassert() condition.Sean Callanan2016-08-261-1/+1
| | | | llvm-svn: 279884
* Don't crash when trying to capture persistent variables in a block.Sean Callanan2016-08-261-1/+1
| | | | | | | | | Reports an error instead. We can fix this later to make persistent variables work, but right now we hit an LLVM assertion if we get this wrong. <rdar://problem/27770298> llvm-svn: 279850
* Allow runtimes to execute custom LLVM ModulePasses over the expression IRLuke Drummond2016-06-151-1/+35
| | | | | | | | | | | | | | | | During expression evaluation, the ClangExpressionParser preforms a number of hard-coded fixups on the expression's IR before the module is assembled and dispatched to be run in a ThreadPlan. This patch allows the runtimes to register LLVM passes to be run over the generated IR, that they may perform language or architecture-specfic fixups or analyses over the generated expression. This makes expression evaluation for plugins more flexible and allows language-specific fixes to reside in their own module, rather than littering the expression evaluator itself with language-specific fixes. llvm-svn: 272800
* [LLDB] Adding lldb_private namespace to DiagnosticSeverity. NFC.Renato Golin2016-05-141-1/+1
| | | | | | | | This is a fix due to the addition of the new DiagnosticSeverity in LLVMContext.h. This may warrant a change in name to be LLDB specific but I leave that to the LLDB experts to refactor. llvm-svn: 269562
* Remove unused variableEd Maste2016-05-131-2/+1
| | | | llvm-svn: 269421
* [LLDB][MIPS] Provide ABI string to compiler for appropriate code generation ↵Sagar Thakur2016-05-131-1/+30
| | | | | | | | | | | | | for MIPS Patch by Nitesh Jain. Summary: These patch will set clang::TargetOptions::ABI and accordingly code will be generated for MIPS target. Reviewers: ovyalov, clayborg Subscribers: lldb-commits, mohit.bhakkad, sagar, jaydeep, bhushan Differential: D18638 llvm-svn: 269407
* Expressions can run without a process.Jim Ingham2016-04-211-17/+30
| | | | | | | | | | | Code was added in ClangExpressionParser::ClangExpressionParser that was calling through the process w/o checking that it was good. Also, we were pretending that we could do something reasonable if we had no target, but that's actually not true, so I check for a target at the beginning of the constructor and don't make a compiler in that case. <rdar://problem/25841198> llvm-svn: 266944
* Fix warning in ClangExpressionParserPavel Labath2016-03-301-1/+1
| | | | llvm-svn: 264847
* Removed LoggingDiagnosticConsumer, an unused class.Sean Callanan2016-03-251-50/+0
| | | | llvm-svn: 264478
* Fix now-ambiguous references to Error.Lang Hames2016-03-251-5/+5
| | | | llvm-svn: 264449
* Use Clang's FixItHints to correct expressions with "trivial" mistakes (e.g. ↵Jim Ingham2016-03-251-5/+115
| | | | | | | | | | | | | | | "." for "->".) This feature is controlled by an expression command option, a target property and the SBExpressionOptions setting. FixIt's are only applied to UserExpressions, not UtilityFunctions, those you have to get right when you make them. This is just a first stage. At present the fixits are applied silently. The next step is to tell the user about the applied fixit. <rdar://problem/25351938> llvm-svn: 264379
* Ignore global constructor warning in clang.Greg Clayton2016-03-241-0/+4
| | | | llvm-svn: 264361
* Backend support for top-level Clang epxressionsSean Callanan2016-03-221-25/+47
| | | | | | | | | | | | | | | | | | This patch adds a new ExecutionPolicy, eExecutionPolicyTopLevel, which tells the expression parser that the expression should be JITted as top level code but nothing (except static initializers) should be run. I have modified the Clang expression parser to recognize this execution policy. On top of the existing patches that support storing IR and maintaining a map of arbitrary Decls, this is mainly just patching up a few places in the expression parser. I intend to submit a patch for review that exposes this functionality through the "expression" command and through the SB API. That patch also includes a testcase for all of this. <rdar://problem/22864976> llvm-svn: 264095
* Collect IRExecutionUnits as part of persistent expression state.Sean Callanan2016-03-211-0/+99
| | | | | | | | | | | | | IRExecutionUnits contain code and data that persistent declarations can depend on. In order to keep them alive and provide for lookup of these symbols, we now allow any PersistentExpressionState to keep a list of execution units. Then, when doing symbol lookup on behalf of an expression, any IRExecutionUnit can consult the persistent expression states on a particular Target to find the appropriate symbol. <rdar://problem/22864976> llvm-svn: 263995
* Add a DiagnosticManager replace error streams in the expression parser.Sean Callanan2016-03-191-25/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to do a better job presenting errors that occur when evaluating expressions. Key to this effort is getting away from a model where all errors are spat out onto a stream where the client has to take or leave all of them. To this end, this patch adds a new class, DiagnosticManager, which contains errors produced by the compiler or by LLDB as an expression is created. The DiagnosticManager can dump itself to a log as well as to a string. Clients will (in the future) be able to filter out the errors they're interested in by ID or present subsets of these errors to the user. This patch is not intended to change the *users* of errors - only to thread DiagnosticManagers to all the places where streams are used. I also attempt to standardize our use of errors a bit, removing trailing newlines and making clients omit 'error:', 'warning:' etc. and instead pass the Severity flag. The patch is testsuite-neutral, with modifications to one part of the MI tests because it relied on "error: error:" being erroneously printed. This patch fixes the MI variable handling and the testcase. <rdar://problem/22864976> llvm-svn: 263859
* Revert "Track expression language from one place in ClangExpressionParser"Ewan Crawford2016-03-101-7/+9
| | | | | | r263099 seems to have broken some OSX tests llvm-svn: 263107
* Track expression language from one place in ClangExpressionParserEwan Crawford2016-03-101-9/+7
| | | | | | | | | | The current expression language is currently tracked in a few places within the ClangExpressionParser constructor. This patch adds a private lldb::LanguageType attribute to the ClangExpressionParser class and tracks the expression language from that one place. Author: Luke Drummond <luke.drummond@codeplay.com> Differential Revision: http://reviews.llvm.org/D17719 llvm-svn: 263099
* Update after r262737 in clang changed the accessor.James Y Knight2016-03-041-1/+1
| | | | llvm-svn: 262739
* Improve readability and performance of ↵Aidan Dodds2016-02-251-5/+4
| | | | | | | | | | ClangExpressionParser::FindFunctionInModule Committed on behalf of: Luke Drummond Differential Revision: http://reviews.llvm.org/D17274 llvm-svn: 261861
* refactor/cleanup ClangExpressionParser::ParseEwan Crawford2016-02-191-33/+20
| | | | | | | | | | | | | | | This patches does the following: + fix return type: ClangExpressionParser::Parse returns unsigned, but was actually returning a signed value, num_errors. + use helper clang::TextDiagnosticBuffer::getNumErrors() instead of counting the errors ourself. + limit scoping of block-level automatic variables as much as practical. + remove reused multipurpose TextDiagnosticBuffer::const_iterator in favour of loop-scoped err, warn, and note variables in the diagnostic printing code. + refactor diagnostic printing loops to use a proper loop invariant. Author: Luke Drummond <luke.drummond@codeplay.com> Differential Revision: http://reviews.llvm.org/D17273 llvm-svn: 261345
* Delete unused function in ClangExpressionParserEwan Crawford2016-02-191-15/+0
| | | | | | | | | | | | [git 65dafa83] introduced the GetBuiltinIncludePath function copied from cfe/lib/Driver/CC1Options.cpp This function is no longer used in lldb's expression parser and I believe it is safe to remove it. Author: Luke Drummond <luke.drummond@codeplay.com> Differential Revision: http://reviews.llvm.org/D17266 llvm-svn: 261328
* [LLDB][MIPS] Provide CPU string to compiler for appropriate code generation ↵Bhushan D. Attarde2016-02-181-4/+14
| | | | | | | | | | | | | | | for MIPS SUMMARY: This patch implements ArchSpec::GetClangTargetCPU() that provides string representing current architecture as a target CPU. This string is then passed to tools like clang so that they generate correct code for that target. Reviewers: clayborg, zturner Subscribers: mohit.bhakkad, sagar, jaydeep, lldb-commits Differential Revision: http://reviews.llvm.org/D17022 llvm-svn: 261206
* Add -Wimplicit-fallthrough command line option to clang inJason Molenda2016-02-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | the xcode project file to catch switch statements that have a case that falls through unintentionally. Define LLVM_FALLTHROUGH to indicate instances where a case has code and intends to fall through. This should be in llvm/Support/Compiler.h; Peter Collingbourne originally checked in there (r237766), then reverted (r237941) because he didn't have time to mark up all the 'case' statements that were intended to fall through. I put together a patch to get this back in llvm http://reviews.llvm.org/D17063 but it hasn't been approved in the past week. I added a new lldb-private-defines.h to hold the definition for now. Every place in lldb where there is a comment that the fall-through is intentional, I added LLVM_FALLTHROUGH to silence the warning. I haven't tried to identify whether the fallthrough is a bug or not in the other places. I haven't tried to add this to the cmake option build flags. This warning will only work for clang. This build cleanly (with some new warnings) on macosx with clang under xcodebuild, but if this causes problems for people on other configurations, I'll back it out. llvm-svn: 260930
* Centralized symbol lookup in IRExecutionUnit, and fixed the code model.Sean Callanan2016-02-121-0/+12
| | | | | | | | | | | | | I'm preparing to remove symbol lookup from IRForTarget, where it constitutes a dreadful hack working around no-longer-existing JIT bugs. Thanks to our contributors, IRForTarget has a lot of smarts that IRExecutionUnit doesn't have, so I've cleaned them up a bit and moved them over to IRExecutionUnit. Also for historical reasons, IRExecutionUnit used the "Small" code model on non- ELF platforms (namely, OS X). That's no longer necessary, and we can use the same code model as everyone else on OS X. I've fixed that. llvm-svn: 260734
* Add ability to override JIT expr compiler options.Aidan Dodds2016-02-031-25/+78
| | | | | | | | | Runtimes should be able to pass custom compilation options to the JIT for their stack frame. This patch adds a custom expression options member class to LanguageOptions, and modifies the clang expression evaluator to check the current runtime for those options. If those options are available on the runtime, they are passed to the clang compiler. Committed for Luke Drummond. Differential Revision: http://reviews.llvm.org/D15527 llvm-svn: 259644
* Fix build after clang interface change in r259489Pavel Labath2016-02-021-3/+3
| | | | llvm-svn: 259494
* Add IRExecutionUnitSP to lldb-forward and use it instead of hand-rolling in ↵Jim Ingham2015-11-051-1/+1
| | | | | | place. llvm-svn: 252129
* Fix Clang-tidy modernize-use-override warnings in some files in ↵Eugene Zelenko2015-10-211-33/+39
| | | | | | | | source/Plugins; other minor fixes. Differential Revision: http://reviews.llvm.org/D13916 llvm-svn: 250872
* Reduce header inclusion in Expression.Bruce Mitchener2015-10-071-0/+1
| | | | | | | | | | Reviewers: spyffe Subscribers: lldb-commits Differential Revision: http://reviews.llvm.org/D13333 llvm-svn: 249570
* Made Target hold a map of languages to TypeSystems, and added some accessors.Sean Callanan2015-10-011-1/+1
| | | | | | | | Also added some target-level search functions so that persistent variables and symbols can be searched for without hand-iterating across the map of TypeSystems. llvm-svn: 249027
* Now persistent expression data no longer lives with the Target, but rather withSean Callanan2015-09-301-1/+2
| | | | | | | | | | the corresponding TypeSystem. This makes sense because what kind of data there is -- and how it can be looked up -- depends on the language. Functionality that is common to all type systems is factored out into PersistentExpressionState. llvm-svn: 248934
* Moved more Clang-specific parts of the expression parser into the Clang plugin.Sean Callanan2015-09-251-0/+649
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
OpenPOWER on IntegriCloud