[PATCH] D115982: [clang][AVR] Implement '__flashN' for variables on different flash banks

Ben Shi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 19 02:27:58 PST 2022

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

Comment at: clang/test/Sema/avr-flash.c:10
+  static __flash5 const int a5[] = {4, 6}; // expected-error {{unknown type name '__flash5'}}
+  // TODO: It would be better to report "'__flash5' is not supported on at908515".
+  return a0[n] + a1[n];
aykevl wrote:
> I think this can be implemented by always setting the `__flash*` defines and checking whether they are valid for the current device in `getGlobalVarAddressSpace`.
Maybe it is better to do in `getGlobalVarAddressSpace` for reporting the exact source position.

a.c:1:20: error: variable β€˜arr’ located in address space β€˜__flash5’ beyond flash of 64 KiB
 __flash5 int const arr[8];

I will try it in the next patch.



More information about the cfe-commits mailing list