aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CommandFlags.cpp
diff options
context:
space:
mode:
authorSimon Tatham <simon.tatham@arm.com>2024-07-11 10:28:05 +0100
committerGitHub <noreply@github.com>2024-07-11 10:28:05 +0100
commit55c00485eb05dfa75d4a20efff2131edd111066d (patch)
tree3c118cf42c5205b7828547212658557efdbaebcd /llvm/lib/CodeGen/CommandFlags.cpp
parenteb61956d1a039d9cb03e0d041f33ab2ecc80519e (diff)
downloadllvm-55c00485eb05dfa75d4a20efff2131edd111066d.zip
llvm-55c00485eb05dfa75d4a20efff2131edd111066d.tar.gz
llvm-55c00485eb05dfa75d4a20efff2131edd111066d.tar.bz2
[Clang][Driver] Skip empty strings in getAArch64MultilibFlags (#97827)
In a multilib setting, if you compile with a command line such as `clang --target=aarch64-none-elf -march=armv8.9-a+rcpc3`, `getAArch64MultilibFlags` returns an ill-formed string containing two consecutive `+` signs, of the form `...+rcpc++rcpc3+...`, causing later stages of multilib selection to get confused. The `++` arises from the entry in `AArch64::Extensions` for the SubtargetFeature `rcpc-immo`, which is a dependency of the `rcpc3` SubtargetFeature, but doesn't have an _extension_ name for the purposes of the `-march=foo+bar` option. So its `UserVisibleName` field is the empty string. To fix this, I've excluded extensions from consideration in `getAArch64MultilibFlags` if they have an empty `UserVisibleName`. Since the input to this function is not derived from a completely general set of SubtargetFeatures, but from a set that has only just been converted _from_ a clang driver command line, the only extensions skipped by this check should be cases like this one, where the anonymous extension was only included because it was a dependency of one mentioned explicitly. I've also made the analogous change in `getARMMultilibFlags`. I don't think it's necessary right now, because the architecture extensions for ARM (defined in `ARMTargetParser.def` rather than Tablegen) don't include any anonymous ones. But it seems sensible to add the check anyway, in case future refactoring introduces anonymous array elements in the same way that AArch64 did, and also in case someone writes a function for another platform by using either of these as example code.
Diffstat (limited to 'llvm/lib/CodeGen/CommandFlags.cpp')
0 files changed, 0 insertions, 0 deletions