[PATCH] D96853: [clang][AVR] Support variable decorator '__flash'

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 30 20:35:33 PDT 2021


benshi001 marked 3 inline comments as done.
benshi001 added inline comments.


================
Comment at: clang/test/CodeGen/avr-flash.c:1
+// RUN: %clang_cc1 -triple avr -emit-llvm-only -verify %s
+
----------------
benshi001 wrote:
> Anastasia wrote:
> > If you are only checking the diagnostics you should pass:
> > 
> > `-emit-llvm-only` -> `-syntax-only`
> > 
> > and also it should be moved to `clang/test/Sema`.
> This test can not run with `-syntax-only`. Since the check is performed in the codegen stage.
> 
> I would like to do the check in the Sema stage, but there is no target specific code in the sema stage. And such checks are better to be put into AVRTargetCodeGenInfo.
I haved moved all `__flash` related to the CodeGen part, now it has nothing to do with `Sema/-syntax-only`.


================
Comment at: clang/test/CodeGen/avr-flash.c:4
+int foo(int i, int j) {
+  static __flash int b[] = {4, 6, 1, 2, 5}; // expected-error {{qualifier 'const' is needed for variables in address space '__flash'}}
+  return b[j] + b[i];
----------------
Anastasia wrote:
> Let's also test the `volatile` case.
I have removed the `volatile` diagnose message, since avr-gcc has no restriction on that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96853/new/

https://reviews.llvm.org/D96853



More information about the cfe-commits mailing list