[clang] [clang] Add per-global code model attribute (PR #72078)

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 6 21:25:13 PST 2023


================
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -triple aarch64 -verify=expected,aarch64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple loongarch64 -verify=expected,loongarch64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple mips64 -verify=expected,mips64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple powerpc64 -verify=expected,powerpc64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple riscv64 -verify=expected,riscv64 -fsyntax-only %s
+// RUN: %clang_cc1 -triple x86_64 -verify=expected,x86_64 -fsyntax-only %s
+
+#if !__has_attribute(model)
+#error "Should support model attribute"
+#endif
+
+int a __attribute((model("tiny")));    // expected-error {{code_model 'tiny' is not yet supported on this target}}
+int b __attribute((model("small")));   // expected-error {{code_model 'small' is not yet supported on this target}}
+int c __attribute((model("normal")));  // aarch64-error {{code_model 'normal' is not yet supported on this target}} \
+                                       // loongarch-no-warning \
----------------
MaskRay wrote:

`loongarch-no-warning` can be omitted. If there is a diagnostic, `-verify` will complain.

https://github.com/llvm/llvm-project/pull/72078


More information about the cfe-commits mailing list