No test changes because err_module_odr_violation_mismatch_decl_unknown
is a catch-all when custom diagnostic is missing. And missing custom
diagnostic we should fix by implementing it, not by improving the
general case. But if we pass enum value not covered by 'select', clang
can crash, so protect against that.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
We emit err_module_odr_violation_mismatch_decl_unknown at
https://github.com/llvm/llvm-project/blob/0fbe3f3f486e01448121f7931a4ca29fac1504ab/clang/lib/Serialization/ASTReader.cpp#L11143-L11150
ODRMismatchDecl is defined at
https://github.com/llvm/llvm-project/blob/0fbe3f3f486e01448121f7931a4ca29fac1504ab/clang/lib/Serialization/ASTReader.cpp#L9624-L9638
We perhaps can't or don't want to add test coverage for the "unexpected decl" case here. Can we add coverage for the "function template" case?
To trigger "function template|different function template" diagnostic we need the entire "case FunctionTemplate" in "switch (FirstDiffType)" not to detect any mismatches. And I don't know any such cases.
For the record, FunctionTemplate case was added in https://reviews.llvm.org/rG9359e8f22a5403ad9524a92c4ccab4db46c9c100