[SPIR] Simplified target checking.
Switched to Triple::isSPIR() helper to simplify code.
Patch by kpet (Kevin Petit)!
Differential revision: https://reviews.llvm.org/D61639
llvm-svn: 360325
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 12846b1..ca95dec 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -3349,10 +3349,8 @@
Res.getFrontendOpts().ProgramAction);
// Turn on -Wspir-compat for SPIR target.
- auto Arch = T.getArch();
- if (Arch == llvm::Triple::spir || Arch == llvm::Triple::spir64) {
+ if (T.isSPIR())
Res.getDiagnosticOpts().Warnings.push_back("spir-compat");
- }
// If sanitizer is enabled, disable OPT_ffine_grained_bitfield_accesses.
if (Res.getCodeGenOpts().FineGrainedBitfieldAccesses &&
diff --git a/clang/lib/Frontend/InitPreprocessor.cpp b/clang/lib/Frontend/InitPreprocessor.cpp
index 5aa2ea3..cc479dd 100644
--- a/clang/lib/Frontend/InitPreprocessor.cpp
+++ b/clang/lib/Frontend/InitPreprocessor.cpp
@@ -1072,8 +1072,7 @@
Builder.defineMacro(#Ext);
#include "clang/Basic/OpenCLExtensions.def"
- auto Arch = TI.getTriple().getArch();
- if (Arch == llvm::Triple::spir || Arch == llvm::Triple::spir64)
+ if (TI.getTriple().isSPIR())
Builder.defineMacro("__IMAGE_SUPPORT__");
}