Skip to content

Commit 73b279c

Browse files
committed
chore: Use std::span for include paths in preprocessor
Signed-off-by: Roberto Raggi <[email protected]>
1 parent 0629fbe commit 73b279c

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

src/parser/cxx/preprocessor.cc

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1019,8 +1019,9 @@ struct Preprocessor::Private {
10191019
Resolve(const Resolve &other) = delete;
10201020
auto operator=(const Resolve &other) -> Resolve & = delete;
10211021

1022-
Resolve(const Private *d, bool next)
1023-
: d(d), wantNextInlude(next), currentPaths{{d->currentPath_}} {}
1022+
Resolve(const Private *d, bool next) : d(d), wantNextInlude(next) {
1023+
currentPaths[0] = d->currentPath_.string();
1024+
}
10241025

10251026
using SearchPaths = std::vector<std::span<const std::string>>;
10261027

@@ -1050,15 +1051,15 @@ struct Preprocessor::Private {
10501051

10511052
[[nodiscard]] auto userHeaderSearchPaths() -> SearchPaths {
10521053
std::vector<std::span<const std::string>> paths;
1053-
paths.push_back(currentPaths);
1054-
paths.push_back(d->quoteIncludePaths_);
1055-
paths.push_back(d->systemIncludePaths_);
1054+
paths.push_back(std::span<const std::string>(currentPaths));
1055+
paths.push_back(std::span<const std::string>(d->quoteIncludePaths_));
1056+
paths.push_back(std::span<const std::string>(d->systemIncludePaths_));
10561057
return paths;
10571058
}
10581059

10591060
[[nodiscard]] auto systemHeaderSearchPaths() -> SearchPaths {
10601061
std::vector<std::span<const std::string>> paths;
1061-
paths.push_back(d->systemIncludePaths_);
1062+
paths.push_back(std::span<const std::string>(d->systemIncludePaths_));
10621063
return paths;
10631064
}
10641065

0 commit comments

Comments
 (0)