<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/144332>144332</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] Improve ABI version handling in clang
</td>
</tr>
<tr>
<th>Labels</th>
<td>
enhancement,
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Fznamznon
</td>
</tr>
</table>
<pre>
We have a language option for ABI-compatibility. The user may choose clang release version to generate code compatible with using flag `-fclang-abi-compat=` . Currently to bring a new version of known ABI, at least 3 different places need to be modified:
1. Add new value to the langopt enum:
https://github.com/llvm/llvm-project/blob/299a55a88fae4fc423c440436b2632d2a6bd800a/clang/include/clang/Basic/LangOptions.h#L171
2. Make sure it is handled here
https://github.com/llvm/llvm-project/blob/299a55a88fae4fc423c440436b2632d2a6bd800a/clang/lib/Frontend/CompilerInvocation.cpp#L3925
3. Make sure it is parsed correctly here
https://github.com/llvm/llvm-project/blob/299a55a88fae4fc423c440436b2632d2a6bd800a/clang/lib/Frontend/CompilerInvocation.cpp#L4479
So, it is at least 3 places that need to be updated every ~6 months when new release is branched. Some of the places are super easy to forget which will cause build fails like the bug resolved by https://github.com/llvm/llvm-project/pull/144109 several months after ClangABI::Ver20 was introduced.
It would be great to improve this.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJzMVLuO5DYQ_BpO0liBol6rQMHsHgQscIaDM-y4RbYkeilS4GMGc4G_3aBm9ryAo0sMJ5IgsItV1dWNIejFEg2seWHNlxOmuDo_jN8tbt-ts6fJqdvwB8GKFwIEg3ZJuBC4PWpnYXYezi9vT9JtO0Y9aaPjrYDfVoIUyMOGN5Crc4FA5lrwZAgDwYV8yADRwUKWPEYC6VR-3JEMwVXHFVLQdoHZ4AKs5U_zAfOEk37cyaovrOVQwGvynmw0t4w5-VyFYOn64yo3w7t1V5sJM_EKGCFziVCB0vNMuRp2g5ICWCJ14BBsTulZk2LVm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