Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions clang/lib/AST/DeclBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,8 +1924,7 @@ DeclContext::lookupImpl(DeclarationName Name,
Map = CreateStoredDeclsMap(getParentASTContext());

// If we have a lookup result with no external decls, we are done.
std::pair<StoredDeclsMap::iterator, bool> R =
Map->insert(std::make_pair(Name, StoredDeclsList()));
std::pair<StoredDeclsMap::iterator, bool> R = Map->try_emplace(Name);
if (!R.second && !R.first->second.hasExternalDecls())
return R.first->second.getLookupResult();

Expand Down
3 changes: 1 addition & 2 deletions clang/lib/Basic/Diagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,7 @@ void DiagnosticsEngine::Reset(bool soft /*=false*/) {

DiagnosticMapping &
DiagnosticsEngine::DiagState::getOrAddMapping(diag::kind Diag) {
std::pair<iterator, bool> Result =
DiagMap.insert(std::make_pair(Diag, DiagnosticMapping()));
std::pair<iterator, bool> Result = DiagMap.try_emplace(Diag);

// Initialize the entry if we added it.
if (Result.second) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Basic/SourceManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1726,7 +1726,7 @@ void SourceManager::computeMacroArgsCache(MacroArgsMap &MacroArgsCache,
assert(FID.isValid());

// Initially no macro argument chunk is present.
MacroArgsCache.insert(std::make_pair(0, SourceLocation()));
MacroArgsCache.try_emplace(0);

int ID = FID.ID;
while (true) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CodeGen/CGOpenMPRuntime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11350,7 +11350,7 @@ CGOpenMPRuntime::LastprivateConditionalRAII::LastprivateConditionalRAII(
LastprivateConditionalData &Data =
CGM.getOpenMPRuntime().LastprivateConditionalStack.emplace_back();
for (const Decl *VD : NeedToAddForLPCsAsDisabled)
Data.DeclToUniqueName.insert(std::make_pair(VD, SmallString<16>()));
Data.DeclToUniqueName.try_emplace(VD);
Data.Fn = CGF.CurFn;
Data.Disabled = true;
}
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CodeGen/CGOpenMPRuntimeGPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,7 @@ llvm::Function *CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction(
for (const auto &Pair : MappedDeclsFields) {
assert(Pair.getFirst()->isCanonicalDecl() &&
"Expected canonical declaration");
Data.insert(std::make_pair(Pair.getFirst(), MappedVarData()));
Data.try_emplace(Pair.getFirst());
}
}
Rt.emitGenericVarsProlog(CGF, Loc);
Expand Down Expand Up @@ -2025,7 +2025,7 @@ void CGOpenMPRuntimeGPU::emitFunctionProlog(CodeGenFunction &CGF,
DeclToAddrMapTy &Data = I->getSecond().LocalVarData;
for (const ValueDecl *VD : VarChecker.getEscapedDecls()) {
assert(VD->isCanonicalDecl() && "Expected canonical declaration");
Data.insert(std::make_pair(VD, MappedVarData()));
Data.try_emplace(VD);
}
if (!NeedToDelayGlobalization) {
emitGenericVarsProlog(CGF, D->getBeginLoc());
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/PPLexerChange.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ void Preprocessor::EnterSubmodule(Module *M, SourceLocation ImportLoc,
ModMap.resolveConflicts(M, /*Complain=*/false);

// If this is the first time we've entered this module, set up its state.
auto R = Submodules.insert(std::make_pair(M, SubmoduleState()));
auto R = Submodules.try_emplace(M);
auto &State = R.first->second;
bool FirstTime = R.second;
if (FirstTime) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Lex/Preprocessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ Preprocessor::macro_begin(bool IncludeExternalMacros) const {

// Make sure we cover all macros in visible modules.
for (const ModuleMacro &Macro : ModuleMacros)
CurSubmoduleState->Macros.insert(std::make_pair(Macro.II, MacroState()));
CurSubmoduleState->Macros.try_emplace(Macro.II);

return CurSubmoduleState->Macros.begin();
}
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Sema/SemaDecl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20342,7 +20342,7 @@ bool Sema::IsValueInFlagEnum(const EnumDecl *ED, const llvm::APInt &Val,
assert(ED->isClosedFlag() && "looking for value in non-flag or open enum");
assert(ED->isCompleteDefinition() && "expected enum definition");

auto R = FlagBitsCache.insert(std::make_pair(ED, llvm::APInt()));
auto R = FlagBitsCache.try_emplace(ED);
llvm::APInt &FlagBits = R.first->second;

if (R.second) {
Expand Down