summaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp
AgeCommit message (Collapse)Author
2025-06-17[lldb][Expression] Don't create Objective-C IR checker for pure-C++ ↵Michael Buch
targets/frames (#144503) There's no need to create this utility function (and run it) for targets/frames that aren't Objective-C/Objective-C++.
2025-06-17[lldb][Expression] Remove IR pointer checker (#144483)Michael Buch
Currently when jitting expressions, LLDB scans the IR instructions of the `$__lldb_expr` and will insert a call to a utility function for each load/store instruction. The purpose of the utility funciton is to dereference the load/store operand. If that operand was an invalid pointer the utility function would trap and LLDB asks the IR checker whether it was responsible for the trap, in which case it prints out an error message saying the expression dereferenced an invalid pointer. This is a lot of setup for not much gain. In fact, creating/running this utility expression shows up as ~2% of the expression evaluation time (though we cache them for subsequent expressions). And the error message we get out of it is arguably less useful than if we hadn't instrumented the IR. It was also untested. Before: ``` (lldb) expr int a = *returns_invalid_ptr() error: Execution was interrupted, reason: Attempted to dereference an invalid pointer.. The process has been returned to the state before expression evaluation. ``` After: ``` (lldb) expr int a = *returns_invalid_ptr() error: Expression execution was interrupted: EXC_BAD_ACCESS (code=1, address=0x5). The process has been returned to the state before expression evaluation. ``` This patch removes this IR checker.
2025-04-01[lldb] Prefer PointerType::get with LLVMContext over Type (NFC) (#133869)Mats Jun Larsen
Part of #123569
2024-10-15[lldb] Use BasicBlock::iterator instead of InsertPosition (NFC) (#112307)Jonas Devlieghere
InsertPosition has been deprecated in favor of using BasicBlock::iterator. (See #102608)
2024-09-16[lldb] Nits on uses of llvm::raw_string_ostream (NFC) (#108745)Youngsuk Kim
As specified in the docs, 1) raw_string_ostream is always unbuffered and 2) the underlying buffer may be used directly ( 65b13610a5226b84889b923bae884ba395ad084d for further reference ) * Don't call raw_string_ostream::flush(), which is essentially a no-op. * Avoid unneeded calls to raw_string_ostream::str(), to avoid excess indirection.
2024-08-12[lldb] Avoid calling DataLayout constructor accepting Module pointer (NFC) ↵Sergei Barannikov
(#102839) The constructor initializes `*this` with a copy of `M->getDataLayout()`, which can just be spelled as `DataLayout DL = M->getDataLayout()`. In all places where the constructor is used, Module outlives DataLayout, so store a reference to it instead of cloning. Pull Request: https://github.com/llvm/llvm-project/pull/102839
2023-11-07[lldb] Fix calls to Type::getInt8PtrTy (#71561)Paulo Matos
These have been removed in 7b9d73c2f90c0ed8497339a16fc39785349d9610. This is a followup patch to apply the changes to lldb.
2023-03-21[lldb][expr] Propagate ClangDynamicCheckerFunctions::Install() errors to callerStefan Gränitz
I came accross this, because a lot of regression tests were saying: ``` (lldb) p argc error: expression failed to parse: error: couldn't install checkers, unknown error ``` With this change, error messages provide more detail: ``` (lldb) p argc error: expression failed to parse: error: couldn't install checkers: error: Couldn't lookup symbols: __objc_load ``` I didn't find a case where `Diagnostics()` is not empty. Also it looks like this isn't covered in any test (yet). Reviewed By: bulbazord, Michael137 Differential Revision: https://reviews.llvm.org/D146541
2023-03-17[LLDB] Remove some typed pointer code (NFCI)Nikita Popov
Various bitcast handling should no longer be necessary with opaque pointers.
2022-03-14[LLDB] Applying clang-tidy modernize-use-default-member-init over LLDBShafik Yaghmour
Applied modernize-use-default-member-init clang-tidy check over LLDB. It appears in many files we had already switched to in class member init but never updated the constructors to reflect that. This check is already present in the lldb/.clang-tidy config. Differential Revision: https://reviews.llvm.org/D121481
2022-02-03[lldb] Rename Logging.h to LLDBLog.h and clean up includesPavel Labath
Most of our code was including Log.h even though that is not where the "lldb" log channel is defined (Log.h defines the generic logging infrastructure). This worked because Log.h included Logging.h, even though it should. After the recent refactor, it became impossible the two files include each other in this direction (the opposite inclusion is needed), so this patch removes the workaround that was put in place and cleans up all files to include the right thing. It also renames the file to LLDBLog to better reflect its purpose.
2022-02-02[lldb] Convert "LLDB" log channel to the new APIPavel Labath
2021-12-24Use isa instead of dyn_cast (NFC)Kazu Hirata
2020-10-23[lldb] Redesign Target::GetUtilityFunctionForLanguage APIJonas Devlieghere
This patch redesigns the Target::GetUtilityFunctionForLanguage API: - Use a unique_ptr instead of a raw pointer for the return type. - Wrap the result in an llvm::Expected instead of using a Status object as an I/O parameter. - Combine the action of "getting" and "installing" the UtilityFunction as they always get called together. - Pass std::strings instead of const char* and std::move them where appropriate. There's more room for improvement but I think this tackles the most prevalent issues with the current API. Differential revision: https://reviews.llvm.org/D90011
2020-04-27[IR] Replace all uses of CallBase::getCalledValue() with getCalledOperand().Craig Topper
This method has been commented as deprecated for a while. Remove it and replace all uses with the equivalent getCalledOperand(). I also made a few cleanups in here. For example, to removes use of getElementType on a pointer when we could just use getFunctionType from the call. Differential Revision: https://reviews.llvm.org/D78882
2020-02-27[lldb][NFC] Fix several -Wdocumentation warningsRaphael Isemann
The GetOffset documentation was copied from the function above so I completely deleted that one. The rest was just outdated documentation that didn't keep up with renamed or changed function parameters/return types.
2020-01-24[lldb][NFC] Fix all formatting errors in .cpp file headersRaphael Isemann
Summary: A *.cpp file header in LLDB (and in LLDB) should like this: ``` //===-- TestUtilities.cpp -------------------------------------------------===// ``` However in LLDB most of our source files have arbitrary changes to this format and these changes are spreading through LLDB as folks usually just use the existing source files as templates for their new files (most notably the unnecessary editor language indicator `-*- C++ -*-` is spreading and in every review someone is pointing out that this is wrong, resulting in people pointing out that this is done in the same way in other files). This patch removes most of these inconsistencies including the editor language indicators, all the different missing/additional '-' characters, files that center the file name, missing trailing `===//` (mostly caused by clang-format breaking the line). Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere Reviewed By: JDevlieghere Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D73258
2019-07-24[Logging] Replace Log::Printf with LLDB_LOG macro (NFC)Jonas Devlieghere
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
2019-07-15[LanguageRuntime] Move ObjCLanguageRuntime into a pluginAlex Langford
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
2019-07-12[Expression] Move IRDynamicChecks to ClangExpressionParserAlex Langford
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