diff options
Diffstat (limited to 'clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp')
| -rw-r--r-- | clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp index 5174f56..4225c3e 100644 --- a/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp +++ b/clang-tools-extra/clang-tidy/portability/RestrictSystemIncludesCheck.cpp @@ -43,8 +43,9 @@ void RestrictedIncludesPPCallbacks::EndOfMainFile() { for (const auto &Include : FileDirectives) { // Fetch the length of the include statement from the start to just after // the newline, for finding the end (including the newline). - unsigned ToLen = std::strcspn(SM.getCharacterData(Include.Loc), "\n") + 1; - CharSourceRange ToRange = CharSourceRange::getCharRange( + const unsigned ToLen = + std::strcspn(SM.getCharacterData(Include.Loc), "\n") + 1; + const CharSourceRange ToRange = CharSourceRange::getCharRange( Include.Loc, Include.Loc.getLocWithOffset(ToLen)); if (!Include.IsInMainFile) { |
