Fix compilation (#4656)

* Delete public accessor, whose only user is one unit-test

The underlying container type becomes invisible from the outside.

* Fix compilation
This commit is contained in:
Sebastien Alaiwan 2021-12-09 18:42:53 +01:00 committed by GitHub
parent d240d0db92
commit a2260d3b1f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View File

@ -97,7 +97,6 @@ struct UserEntryLess {
class DefUseManager {
public:
using IdToDefMap = std::unordered_map<uint32_t, Instruction*>;
using IdToUsersMap = std::set<UserEntry, UserEntryLess>;
// Constructs a def-use manager from the given |module|. All internal messages
// will be communicated to the outside via the given message |consumer|. This
@ -197,8 +196,6 @@ class DefUseManager {
// Returns the map from ids to their def instructions.
const IdToDefMap& id_to_defs() const { return id_to_def_; }
// Returns the map from instructions to their users.
const IdToUsersMap& id_to_users() const { return id_to_users_; }
// Clear the internal def-use record of the given instruction |inst|. This
// method will update the use information of the operand ids of |inst|. The
@ -218,6 +215,7 @@ class DefUseManager {
void UpdateDefUse(Instruction* inst);
private:
using IdToUsersMap = std::set<UserEntry, UserEntryLess>;
using InstToUsedIdsMap =
std::unordered_map<const Instruction*, std::vector<uint32_t>>;

View File

@ -66,7 +66,7 @@ Pass::Status StripReflectInfoPass::Process() {
const std::string ext_name = inst.GetInOperand(0).AsString();
if (ext_name == "SPV_GOOGLE_hlsl_functionality1") {
to_remove.push_back(&inst);
} else if (0 == std::strcmp(ext_name, "SPV_GOOGLE_user_type")) {
} else if (ext_name == "SPV_GOOGLE_user_type") {
to_remove.push_back(&inst);
} else if (!other_uses_for_decorate_string &&
ext_name == "SPV_GOOGLE_decorate_string") {

View File

@ -1707,9 +1707,10 @@ TEST_F(UpdateUsesTest, KeepOldUses) {
def->SetInOperands({{SPV_OPERAND_TYPE_ID, {25}}});
context->UpdateDefUse(def);
auto users = def_use_mgr->id_to_users();
UserEntry entry = {def, use};
EXPECT_THAT(users, Contains(entry));
auto scanUser = [&](Instruction* user) { return user != use; };
bool userFound = !def_use_mgr->WhileEachUser(def, scanUser);
EXPECT_TRUE(userFound);
}
// clang-format on