Skip to content

Commit

Permalink
[AST] Use DenseMapBase::lookup (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Jun 18, 2023
1 parent 4f7680c commit 9932eb0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
5 changes: 1 addition & 4 deletions clang/lib/AST/DeclCXX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1659,10 +1659,7 @@ void CXXRecordDecl::setLambdaNumbering(LambdaNumbering Numbering) {

unsigned CXXRecordDecl::getDeviceLambdaManglingNumber() const {
assert(isLambda() && "Not a lambda closure type!");
auto I = getASTContext().DeviceLambdaManglingNumbers.find(this);
if (I != getASTContext().DeviceLambdaManglingNumbers.end())
return I->second;
return 0;
return getASTContext().DeviceLambdaManglingNumbers.lookup(this);
}

static CanQualType GetConversionType(ASTContext &Context, NamedDecl *Conv) {
Expand Down
6 changes: 1 addition & 5 deletions clang/lib/AST/MicrosoftMangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,12 +290,8 @@ class MicrosoftMangleContextImpl : public MicrosoftMangleContext {
assert(!RD->isExternallyVisible() && "RD must not be visible!");
assert(RD->getLambdaManglingNumber() == 0 &&
"RD must not have a mangling number!");
llvm::DenseMap<const CXXRecordDecl *, unsigned>::iterator Result =
LambdaIds.find(RD);
// The lambda should exist, but return 0 in case it doesn't.
if (Result == LambdaIds.end())
return 0;
return Result->second;
return LambdaIds.lookup(RD);
}

/// Return a character sequence that is (somewhat) unique to the TU suitable
Expand Down

0 comments on commit 9932eb0

Please sign in to comment.