This revision was automatically updated to reflect the committed changes.
Closed by commit rG16f9451b0761: [clang] Redefine some AVR specific macros 
(authored by benshi001).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D141598

Files:
  clang/lib/Basic/Targets/AVR.cpp
  clang/test/Preprocessor/predefined-arch-macros.c


Index: clang/test/Preprocessor/predefined-arch-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-arch-macros.c
+++ clang/test/Preprocessor/predefined-arch-macros.c
@@ -4319,6 +4319,22 @@
 // CHECK_R600_FP64-DAG: #define __R600__ 1
 // CHECK_R600_FP64-DAG: #define __HAS_FMAF__ 1
 
+// Begin avr tests ----------------
+
+// RUN: %clang --target=avr -mmcu=atmega328 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK-AVR0
+// CHECK-AVR0: #define __AVR_ARCH__ 5
+// CHECK-AVR0: #define __AVR_ATmega328__ 1
+// CHECK-AVR0: #define __flash __attribute__((__address_space__(1)))
+// RUN: %clang --target=avr -mmcu=atmega2560 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK-AVR1
+// CHECK-AVR1: #define __AVR_ARCH__ 6
+// CHECK-AVR1: #define __AVR_ATmega2560__ 1
+// CHECK-AVR1: #define __flash  __attribute__((__address_space__(1)))
+// CHECK-AVR1: #define __flash1 __attribute__((__address_space__(2)))
+// CHECK-AVR1: #define __flash2 __attribute__((__address_space__(3)))
+// CHECK-AVR1: #define __flash3 __attribute__((__address_space__(4)))
+
 // Begin M68k tests ----------------
 
 // RUN: %clang -mcpu=68000 -E -dM %s -o - 2>&1 \
Index: clang/lib/Basic/Targets/AVR.cpp
===================================================================
--- clang/lib/Basic/Targets/AVR.cpp
+++ clang/lib/Basic/Targets/AVR.cpp
@@ -468,15 +468,15 @@
   }
 
   if (NumFlashBanks >= 1)
-    Builder.defineMacro("__flash", "__attribute__((address_space(1)))");
+    Builder.defineMacro("__flash", "__attribute__((__address_space__(1)))");
   if (NumFlashBanks >= 2)
-    Builder.defineMacro("__flash1", "__attribute__((address_space(2)))");
+    Builder.defineMacro("__flash1", "__attribute__((__address_space__(2)))");
   if (NumFlashBanks >= 3)
-    Builder.defineMacro("__flash2", "__attribute__((address_space(3)))");
+    Builder.defineMacro("__flash2", "__attribute__((__address_space__(3)))");
   if (NumFlashBanks >= 4)
-    Builder.defineMacro("__flash3", "__attribute__((address_space(4)))");
+    Builder.defineMacro("__flash3", "__attribute__((__address_space__(4)))");
   if (NumFlashBanks >= 5)
-    Builder.defineMacro("__flash4", "__attribute__((address_space(5)))");
+    Builder.defineMacro("__flash4", "__attribute__((__address_space__(5)))");
   if (NumFlashBanks >= 6)
-    Builder.defineMacro("__flash5", "__attribute__((address_space(6)))");
+    Builder.defineMacro("__flash5", "__attribute__((__address_space__(6)))");
 }


Index: clang/test/Preprocessor/predefined-arch-macros.c
===================================================================
--- clang/test/Preprocessor/predefined-arch-macros.c
+++ clang/test/Preprocessor/predefined-arch-macros.c
@@ -4319,6 +4319,22 @@
 // CHECK_R600_FP64-DAG: #define __R600__ 1
 // CHECK_R600_FP64-DAG: #define __HAS_FMAF__ 1
 
+// Begin avr tests ----------------
+
+// RUN: %clang --target=avr -mmcu=atmega328 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK-AVR0
+// CHECK-AVR0: #define __AVR_ARCH__ 5
+// CHECK-AVR0: #define __AVR_ATmega328__ 1
+// CHECK-AVR0: #define __flash __attribute__((__address_space__(1)))
+// RUN: %clang --target=avr -mmcu=atmega2560 -E -dM %s -o - 2>&1 \
+// RUN:   | FileCheck -match-full-lines %s -check-prefix=CHECK-AVR1
+// CHECK-AVR1: #define __AVR_ARCH__ 6
+// CHECK-AVR1: #define __AVR_ATmega2560__ 1
+// CHECK-AVR1: #define __flash  __attribute__((__address_space__(1)))
+// CHECK-AVR1: #define __flash1 __attribute__((__address_space__(2)))
+// CHECK-AVR1: #define __flash2 __attribute__((__address_space__(3)))
+// CHECK-AVR1: #define __flash3 __attribute__((__address_space__(4)))
+
 // Begin M68k tests ----------------
 
 // RUN: %clang -mcpu=68000 -E -dM %s -o - 2>&1 \
Index: clang/lib/Basic/Targets/AVR.cpp
===================================================================
--- clang/lib/Basic/Targets/AVR.cpp
+++ clang/lib/Basic/Targets/AVR.cpp
@@ -468,15 +468,15 @@
   }
 
   if (NumFlashBanks >= 1)
-    Builder.defineMacro("__flash", "__attribute__((address_space(1)))");
+    Builder.defineMacro("__flash", "__attribute__((__address_space__(1)))");
   if (NumFlashBanks >= 2)
-    Builder.defineMacro("__flash1", "__attribute__((address_space(2)))");
+    Builder.defineMacro("__flash1", "__attribute__((__address_space__(2)))");
   if (NumFlashBanks >= 3)
-    Builder.defineMacro("__flash2", "__attribute__((address_space(3)))");
+    Builder.defineMacro("__flash2", "__attribute__((__address_space__(3)))");
   if (NumFlashBanks >= 4)
-    Builder.defineMacro("__flash3", "__attribute__((address_space(4)))");
+    Builder.defineMacro("__flash3", "__attribute__((__address_space__(4)))");
   if (NumFlashBanks >= 5)
-    Builder.defineMacro("__flash4", "__attribute__((address_space(5)))");
+    Builder.defineMacro("__flash4", "__attribute__((__address_space__(5)))");
   if (NumFlashBanks >= 6)
-    Builder.defineMacro("__flash5", "__attribute__((address_space(6)))");
+    Builder.defineMacro("__flash5", "__attribute__((__address_space__(6)))");
 }
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to