OpaquePtr: Support i32** with --force-opaque-pointers
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 29 Jun 2021 19:49:57 +0000 (12:49 -0700)
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>
Tue, 29 Jun 2021 21:10:29 +0000 (14:10 -0700)
commitac2bec5addd2f96e976242bc8e0d93725fe3d2fd
tree9a0c4d167f29da77c2eb667974843f57f683cab1
parent6d72845a8517eea6a69a493351fb4f03f3c10c21
OpaquePtr: Support i32** with --force-opaque-pointers

4506f614cb6983a16d117cf77a968608e66d7a5c fixed parsing of textual IR to
reject `ptr*`, but broke the auto-conversion of `i32**` to `ptr` with
`--force-opaque-pointers`.

Get that working again by refactoring LLParser::parseType to only send
`ptr`-spelled pointers into the type suffix logic when it's the return
of a function type. This also rejects `ptr addrspace(3) addrspace(2)`,
which 1e6303e60ca5af4fbe7ca728572fd65666a98271 invadvertently started
accepting. Just the default top-level error message for the
double-addrspace since I had trouble thinking of something nice;
probably it's fine as is (it doesn't look valid the way that `ptr*`
does).

Differential Revision: https://reviews.llvm.org/D105146
llvm/lib/AsmParser/LLParser.cpp
llvm/test/Assembler/invalid-opaque-ptr-double-addrspace.ll [new file with mode: 0644]
llvm/test/Assembler/opaque-ptr.ll
llvm/test/Other/force-opaque-ptrs.ll