llvm-project/clang/test/Sema/vector-ast.cpp
Joseph Huber 0a41fb71f1
[Clang] Treat ext_vector_type as a regular type attribute (#130177)
Summary:
This attribute is mostly borrowed from OpenCL, but is useful in general
for accessing the LLVM vector types. Previously the only way to use it
was through typedefs. This patch changes that to allow use as a regular
type attribute, similar to address spaces.
2025-03-07 10:09:06 -06:00

16 lines
708 B
C++

// RUN: %clang_cc1 %s -verify -ast-dump | FileCheck %s
// expected-no-diagnostics
// CHECK: ExtVectorType {{.*}} 'int __attribute__((ext_vector_type(4)))' 4
// CHECK-NEXT: BuiltinType {{.*}} 'int'
int x __attribute__((ext_vector_type(4)));
using ExtVecType = decltype(x);
// CHECK: FunctionDecl {{.*}} 'int () __attribute__((ext_vector_type(4)))'
int __attribute__((ext_vector_type(4))) foo() { return x; }
// CHECK: CompoundStmt
// CHECK-NEXT: ReturnStmt
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int __attribute__((ext_vector_type(4)))' <LValueToRValue>
// CHECK-NEXT: DeclRefExpr {{.*}} 'int __attribute__((ext_vector_type(4)))' lvalue Var {{.*}} 'x' 'int __attribute__((ext_vector_type(4)))'