Skip to content

Commit

Permalink
[NFC] Initialize member pointer and avoid potential null dereference
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D158775
  • Loading branch information
schittir committed Aug 25, 2023
1 parent a5e7d16 commit bbcc7c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion clang/lib/AST/Interp/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -201,13 +201,14 @@ bool Ret(InterpState &S, CodePtr &PC, APValue &Result) {
return false;
}

assert(S.Current);
assert(S.Current->getFrameOffset() == S.Stk.size() && "Invalid frame");
if (!S.checkingPotentialConstantExpression() || S.Current->Caller) {
// Certain builtin functions are declared as func-name(...), so the
// parameters are checked in Sema and only available through the CallExpr.
// The interp::Function we create for them has 0 parameters, so we need to
// remove them from the stack by checking the CallExpr.
if (S.Current && S.Current->getFunction()->needsRuntimeArgPop(S.getCtx()))
if (S.Current->getFunction()->needsRuntimeArgPop(S.getCtx()))
popBuiltinArgs(S, PC);
else
S.Current->popArgs();
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Analysis/ThreadSafety.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ class ThreadSafetyAnalyzer {
threadSafety::SExprBuilder SxBuilder;

ThreadSafetyHandler &Handler;
const CXXMethodDecl *CurrentMethod;
const CXXMethodDecl *CurrentMethod = nullptr;
LocalVariableMap LocalVarMap;
FactManager FactMan;
std::vector<CFGBlockInfo> BlockInfo;
Expand Down

0 comments on commit bbcc7c5

Please sign in to comment.