[clang] [clang][analyzer] Fix a crash in alpha.unix.BlockInCriticalSection (PR #90030)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Tue May 14 10:22:14 PDT 2024
================
@@ -103,9 +104,10 @@ class RAIIMutexDescriptor {
// this function is called instead of early returning it. To avoid this, a
// bool variable (IdentifierInfoInitialized) is used and the function will
// be run only once.
- Guard = &Call.getCalleeAnalysisDeclContext()->getASTContext().Idents.get(
- GuardName);
- IdentifierInfoInitialized = true;
+ if (AnalysisDeclContext *CalleCtx = Call.getCalleeAnalysisDeclContext()) {
+ Guard = &CalleCtx->getASTContext().Idents.get(GuardName);
+ IdentifierInfoInitialized = true;
+ }
----------------
steakhal wrote:
This crash happened because we failed to get an ASTContext.
Maybe, on some other access-path we could acquire the ASTContext, like via `Call.getState()->getStateManager().getContext()`.
I feel like your proposal only fixes the symptom, and not the root cause.
https://github.com/llvm/llvm-project/pull/90030
More information about the cfe-commits
mailing list