Skip to content

Commit f3314e3

Browse files
committed
[clang-tidy] Pop Files only if FileChangeReason is ExitFile
enum FileChangeReason has four possible type EnterFile, ExitFile, SystemHeaderPragma and RenameFile, It should pop the back element of Files only if FileChangeReason is ExitFile.
1 parent 98db333 commit f3314e3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

clang-tools-extra/clang-tidy/readability/DuplicateIncludeCheck.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ void DuplicateIncludeCallbacks::FileChanged(SourceLocation Loc,
7171
FileID PrevFID) {
7272
if (Reason == EnterFile)
7373
Files.emplace_back();
74-
else
74+
else if (Reason == ExitFile)
7575
Files.pop_back();
7676
}
7777

0 commit comments

Comments
 (0)