Skip to content

Commit acc40ed

Browse files
authored
[Clang][NFC] Use const auto & to avoid copy (#138069)
Static analysis flagged this code as causing a copy when we never modify ModName and therefore we can use const auto & and avoid copying.
1 parent dadd91e commit acc40ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang/lib/Lex/ModuleMap.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1959,7 +1959,7 @@ void ModuleMapLoader::handleExportDecl(const modulemap::ExportDecl &ED) {
19591959
}
19601960

19611961
void ModuleMapLoader::handleExportAsDecl(const modulemap::ExportAsDecl &EAD) {
1962-
auto ModName = EAD.Id.front();
1962+
const auto &ModName = EAD.Id.front();
19631963

19641964
if (!ActiveModule->ExportAsModule.empty()) {
19651965
if (ActiveModule->ExportAsModule == ModName.first) {

0 commit comments

Comments
 (0)