diff options
author | Leonard Chan <leonardchan@google.com> | 2022-09-22 22:37:12 +0000 |
---|---|---|
committer | Leonard Chan <leonardchan@google.com> | 2022-09-22 22:38:02 +0000 |
commit | f7d674910d2dadae209f4a93373481c450f089f7 (patch) | |
tree | 04fa5b34b082969e41036909d9d44b360aa5604a /clang/lib/Frontend/CompilerInvocation.cpp | |
parent | 1c530500ab86f823df8d5ec1ec9f97ec4772418b (diff) | |
download | llvm-f7d674910d2dadae209f4a93373481c450f089f7.zip llvm-f7d674910d2dadae209f4a93373481c450f089f7.tar.gz llvm-f7d674910d2dadae209f4a93373481c450f089f7.tar.bz2 |
[llvm] Assert two ValIDs are the same kind before comparing
I suspect the reason for why D134234 was failing sometimes is because
"operator<" for a ValID could compare ValIDs of different kinds but have
the same non-active values and return an incorrect result. This is an
issue if I attempt to store ValIDs of different kinds in an std::map but
we compare different "active" values. For example, if I create an
std::map and store some ValIDs of kind t_GlobalName, then I insert a
ValID of kind t_GlobalID, the current "operator<" will see that one of
the operands is a t_GlobalID and compare it against the UIntVal of other
items in the map, but the other items in the map don't set UIntVal
because they're not t_GlobalIDs, so I compare against a
dummy/uninitialized value.
It seems pretty easy to add mixed ValID kinds into an std::map in
LLParser, so this just asserts that when doing the comparison that both
ValIDs are the same kind.
Differential Revision: https://reviews.llvm.org/D134488
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions