[clang-tidy][NFC] Use mock header instead of #define NULL in tests (#188420)
Since stddef.h in the mock headers of clang-tidy tests now provides
`#define NULL 0L`, we can migrate manual `#define NULL` in these tests
to standard `#include`s.
[LLDB] Use shared_ptr for m_current_private_state_thread (#188542)
Avoids manual memory management.
Uses `shared_ptr` instead of `unique_ptr` because we store references to
the current thread in a backup variable.
Simplifies the private thread `is_secondary` semantics by providing a
backup storage for the current thread instead of a boolean value with a
contract to manage the backup separately.
[lldb/test] Remove stale Windows expectedFailure decorators (NFC)
The @expectedFailureAll decorators for Windows (llvm.org/pr24778) are no
longer needed on test_circular_dependency_handle_command_in_init and
test_provider_receives_parent_frames.
Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>
[libunwind][Apple] Improve test coverage on Apple platforms (#186423)
Introduces a macro abstraction around capturing the bounds of a
function, which many platforms handle subtly differently (Mach-O, and
ELF, for example).
Also introduce an arm64[^-]* -> aarch64 available feature, to enable
more tests that would otherwise be excluded on Apple platforms, whose
target triples tend to take the form e.g. 'arm64-apple-macosx', rather
than 'aarch64-apple-macosx'.
Third, we implement the has-sme check using the appropriate sysctl, as
getauxval is not available on Darwin platforms.
[mlir][CAPI] Fix unused-but-set-variable warning in smt.c (NFC) (#188473)
llvm-project/mlir/test/CAPI/smt.c:37:21: warning: variable 'result' set
but not used [-Wunused-but-set-variable]
37 | MlirLogicalResult result = mlirTranslateModuleToSMTLIB(
| ^
1 warning generated.
[SSAF][PointerAssignments] Add PointerAssignments summary and extractor
Implement PointerAssignments summary and extractor, which uses
EntityPointerLevel. An assignment is extracted as a pair of
EntityPointerLevels. Extracted assignments form a directed graph
encoding abstracted pointer flow information.
rdar://172429193
[SSAF][UnsafeBufferUsage] Implement AST visitor that respects the constribution model and refactor
Previously, the UnsafeBufferUsage Extractor relied on the
`-Wunsafe-buffer-usage` API to traverse ASTs. The traversal did not
fully respect the contribution model of SSAF---RecordDecls inside
functions were not treated as contributors. Their fields were counted
as contributions of the enclosing function.
This commit adds an AST visitor that respects the contribution model
and will be shared by SSAF analyses. The UnsafeBufferUsage Extractor
still relies on `-Wunsafe-buffer-usage` to provide the unsafe pointer
matching function.
In addition, this commit
- Factors common code in analyses to 'lib/ScalableStaticAnalysisFramework/Analyses/SSAFAnalysesCommon.h'.
- Registers the UnsafeBufferUsage extractor.
- Removes 'UnsafeBufferUsageExtractor.h' since it is useless except
for the unit test. The unit test now directly uses proxy functions
defined in 'UnsafeBufferUsageExtractor.cpp'.
[ssaf][UnsafeBufferUsage] Add support for extracting unsafe pointers from all kinds of contributors (#184899)
- Generalize the `-Wunsafe-buffer-usage` API for finding unsafe pointers
in all kinds of `Decl`s
- Add support in SSAF-based UnsafeBufferUsage analysis for extracting
from various contributors
- Mock implementation of HandleTranslationUnit
rdar://171735836
This is a follow-up PR to
https://github.com/llvm/llvm-project/pull/182941
[SSAF][PointerAssignments] Add PointerAssignments summary and extractor
Implement PointerAssignments summary and extractor, which uses
EntityPointerLevel. An assignment is extracted as a pair of
EntityPointerLevels. Extracted assignments form a directed graph
encoding abstracted pointer flow information.
rdar://172429193
[Utils] Add ability to configure git-llvm-push from .gitconfig (#187398)
This lets someone set git config options at whatever scope (per-repo,
global, etc.) for the options that they care about. This provides
similar functionality to just wrapping the script in a shell script with
one's desired options without the need to do that.
We need to be careful about how when we get the flags and how to execute
the git command to get the flags. For now, we do this before normal
argument parsing and fail silently to avoid printing output if someone
passes something like --quiet through the git config. This means options
like --verbose and --dry-run don't work for this specific command, but I
think that is a reasonable tradeoff.
[lit] dealloc ApplyResult objects as they're waited on (#188642)
In _wait_for(), all async tasks are waited for. However, the objects
are held in the async_result list until the function calls complete.
This leads to about 3.6gig mem usage on my system when running
check-llvm, even though these objects aren't needed after the ar.get()
call.
Dealloc them as we go instead.
Addresses #188641
[lldb] Fix circular dependency and deadlock in scripted frame providers (#187411)
When a scripted frame provider calls back into the thread's frame
machinery (e.g. via HandleCommand or EvaluateExpression), two problems
arise:
1. GetStackFrameList() re-enters the SyntheticStackFrameList
construction, causing infinite recursion.
2. ClearStackFrames() tries to read-lock the StackFrameList's
shared_mutex that is already write-locked by GetFramesUpTo,
causing a deadlock.
This patch fixes those issues by tracking when a provider is actively
fetching frames via a per-host-thread map (m_provider_frames_by_thread)
keyed by HostThread. The map is pushed/popped in
SyntheticStackFrameList::FetchFramesUpTo before calling into the
provider. GetStackFrameList() checks it to route re-entrant calls:
- The provider's own host thread gets the parent frame list, preventing
[14 lines not shown]