Skip to content

Commit

Permalink
[clang][Interp][NFC] Clean up getOrCreateDummy()
Browse files Browse the repository at this point in the history
  • Loading branch information
tbaederr committed Jul 23, 2023
1 parent 25b7417 commit 0d91cb5
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions clang/lib/AST/Interp/Program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,17 @@ std::optional<unsigned> Program::getOrCreateGlobal(const ValueDecl *VD,
}

std::optional<unsigned> Program::getOrCreateDummy(const ParmVarDecl *PD) {
auto &ASTCtx = Ctx.getASTContext();

// Dedup blocks since they are immutable and pointers cannot be compared.
if (auto It = DummyParams.find(PD);
It != DummyParams.end())
return It->second;

auto &ASTCtx = Ctx.getASTContext();
// Create a pointer to an incomplete array of the specified elements.
QualType ElemTy = PD->getType()->castAs<PointerType>()->getPointeeType();
QualType Ty = ASTCtx.getIncompleteArrayType(ElemTy, ArrayType::Normal, 0);

// Dedup blocks since they are immutable and pointers cannot be compared.
auto It = DummyParams.find(PD);
if (It != DummyParams.end())
return It->second;

if (auto Idx = createGlobal(PD, Ty, /*isStatic=*/true, /*isExtern=*/true)) {
DummyParams[PD] = *Idx;
return Idx;
Expand Down

0 comments on commit 0d91cb5

Please sign in to comment.