[clang] [clang][Builtins] Parse clang extended vectors types. (PR #83584)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 4 11:25:48 PST 2024
================
@@ -85,6 +123,23 @@ class PrototypeParser {
if (Substitution.empty())
PrintFatalError(Loc, "Not a template");
ParseType(Substitution);
+ } else if (T.consume_front("_ExtVector")) {
+ // Clang extended vector types are mangled as follows:
+ //
+ // '_ExtVector<' <lanes> ',' <scalar type> '>'
+ if (!T.consume_front("<"))
+ PrintFatalError(Loc, "Expected '<' after '_ExtVector'");
+ unsigned long long Lanes;
+ if (llvm::consumeUnsignedInteger(T, 10, Lanes))
+ PrintFatalError(Loc, "Expected number of lanes after '_ExtVector<'");
+ Type += "E" + std::to_string(Lanes);
+ if (!T.consume_front(","))
+ PrintFatalError(Loc,
+ "Expected ',' after number of lanes in '_ExtVector<'");
+ if (!T.consume_back(">"))
+ PrintFatalError(
+ Loc, "Expected '>' after scalar type in '_ExtVector<N, type>'");
+ ParseType(T);
----------------
AaronBallman wrote:
Ahhh I see the logic now, thank you! I think it might help other readers to leave a comment near here reminding folks as to why the code is written this way.
https://github.com/llvm/llvm-project/pull/83584
More information about the cfe-commits
mailing list