This revision was automatically updated to reflect the committed changes. Closed by commit rL359310: [BPF] do not generate predefined macro bpf (authored by yhs, committed by ). Herald added a project: LLVM. Herald added a subscriber: llvm-commits.
Changed prior to commit: https://reviews.llvm.org/D61173?vs=196799&id=196859#toc Repository: rL LLVM CHANGES SINCE LAST ACTION https://reviews.llvm.org/D61173/new/ https://reviews.llvm.org/D61173 Files: cfe/trunk/lib/Basic/Targets/BPF.cpp cfe/trunk/test/Preprocessor/bpf-predefined-macros.c Index: cfe/trunk/test/Preprocessor/bpf-predefined-macros.c =================================================================== --- cfe/trunk/test/Preprocessor/bpf-predefined-macros.c +++ cfe/trunk/test/Preprocessor/bpf-predefined-macros.c @@ -0,0 +1,16 @@ +// RUN: %clang -E -target bpfel -x c -o - %s | FileCheck %s +// RUN: %clang -E -target bpfeb -x c -o - %s | FileCheck %s + +#ifdef __bpf__ +int b; +#endif +#ifdef __BPF__ +int c; +#endif +#ifdef bpf +int d; +#endif + +// CHECK: int b; +// CHECK: int c; +// CHECK-NOT: int d; Index: cfe/trunk/lib/Basic/Targets/BPF.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets/BPF.cpp +++ cfe/trunk/lib/Basic/Targets/BPF.cpp @@ -20,7 +20,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { - DefineStd(Builder, "bpf", Opts); + Builder.defineMacro("__bpf__"); Builder.defineMacro("__BPF__"); }
Index: cfe/trunk/test/Preprocessor/bpf-predefined-macros.c =================================================================== --- cfe/trunk/test/Preprocessor/bpf-predefined-macros.c +++ cfe/trunk/test/Preprocessor/bpf-predefined-macros.c @@ -0,0 +1,16 @@ +// RUN: %clang -E -target bpfel -x c -o - %s | FileCheck %s +// RUN: %clang -E -target bpfeb -x c -o - %s | FileCheck %s + +#ifdef __bpf__ +int b; +#endif +#ifdef __BPF__ +int c; +#endif +#ifdef bpf +int d; +#endif + +// CHECK: int b; +// CHECK: int c; +// CHECK-NOT: int d; Index: cfe/trunk/lib/Basic/Targets/BPF.cpp =================================================================== --- cfe/trunk/lib/Basic/Targets/BPF.cpp +++ cfe/trunk/lib/Basic/Targets/BPF.cpp @@ -20,7 +20,7 @@ void BPFTargetInfo::getTargetDefines(const LangOptions &Opts, MacroBuilder &Builder) const { - DefineStd(Builder, "bpf", Opts); + Builder.defineMacro("__bpf__"); Builder.defineMacro("__BPF__"); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits