Skip to content

Conversation

@davidstone
Copy link
Contributor

ResourceDirectoryCache::findResourceDir uses a std::vector when a std::array would do.

`ResourceDirectoryCache::findResourceDir` uses a `std::vector` when a `std::array` would do.
@llvmbot llvmbot added the clang Clang issues not falling into any other category label Nov 25, 2025
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2025

@llvm/pr-subscribers-clang

Author: David Stone (davidstone)

Changes

ResourceDirectoryCache::findResourceDir uses a std::vector when a std::array would do.


Full diff: https://github.com/llvm/llvm-project/pull/169555.diff

1 Files Affected:

  • (modified) clang/tools/clang-scan-deps/ClangScanDeps.cpp (+3-5)
diff --git a/clang/tools/clang-scan-deps/ClangScanDeps.cpp b/clang/tools/clang-scan-deps/ClangScanDeps.cpp index 5f5bf42df5e6b..3efa28b0469c1 100644 --- a/clang/tools/clang-scan-deps/ClangScanDeps.cpp +++ b/clang/tools/clang-scan-deps/ClangScanDeps.cpp @@ -284,11 +284,9 @@ class ResourceDirectoryCache { if (CachedResourceDir != Cache.end()) return CachedResourceDir->second; - std::vector<StringRef> PrintResourceDirArgs{ClangBinaryName}; - if (ClangCLMode) - PrintResourceDirArgs.push_back("/clang:-print-resource-dir"); - else - PrintResourceDirArgs.push_back("-print-resource-dir"); + const std::array<StringRef, 2> PrintResourceDirArgs{ + ClangBinaryName, + ClangCLMode ? "/clang:-print-resource-dir" : "-print-resource-dir"}; llvm::SmallString<64> OutputFile, ErrorFile; llvm::sys::fs::createTemporaryFile("print-resource-dir-output", 
Copy link
Contributor

@qiongsiwu qiongsiwu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang Clang issues not falling into any other category

4 participants