[all-commits] [llvm/llvm-project] aa3368: [llvm][support] Replace `std::vector<bool>` use in...
Jan Svoboda via All-commits
all-commits at lists.llvm.org
Wed Jan 26 02:20:31 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: aa33688cada423d987ce03ecbc13f2c554223d77
https://github.com/llvm/llvm-project/commit/aa33688cada423d987ce03ecbc13f2c554223d77
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2022-01-26 (Wed, 26 Jan 2022)
Changed paths:
M llvm/include/llvm/Support/YAMLTraits.h
M llvm/lib/Support/YAMLTraits.cpp
Log Message:
-----------
[llvm][support] Replace `std::vector<bool>` use in YAMLTraits
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
This patch replaces the use of `std::vector` with `llvm::BitVector` in LLVM's YAML traits and replaces the call to `Vec.insert(Vec.begin(), N, false)` on empty `Vec` with `Vec.resize(N)`, which has the same semantics but avoids using `insert` and iterators, which `llvm::BitVector` doesn't possess.
Reviewed By: dexonsmith, dblaikie
Differential Revision: https://reviews.llvm.org/D118111
Commit: 600c6714ac77915b7b656b860cf71494a7c9ec7f
https://github.com/llvm/llvm-project/commit/600c6714ac77915b7b656b860cf71494a7c9ec7f
Author: Jan Svoboda <jan_svoboda at apple.com>
Date: 2022-01-26 (Wed, 26 Jan 2022)
Changed paths:
M clang/lib/Tooling/Syntax/Tree.cpp
Log Message:
-----------
[clang][syntax] Replace `std::vector<bool>` use
LLVM Programmer’s Manual strongly discourages the use of `std::vector<bool>` and suggests `llvm::BitVector` as a possible replacement.
This patch replaces `std::vector<bool>` with `llvm::BitVector` in the Syntax library and replaces range-based for loop with regular for loop. This is necessary due to `llvm::BitVector` not having `begin()` and `end()` (D117116).
Reviewed By: dexonsmith, dblaikie
Differential Revision: https://reviews.llvm.org/D118109
Compare: https://github.com/llvm/llvm-project/compare/24a49e99f386...600c6714ac77
More information about the All-commits
mailing list