diff --git a/clang/lib/Basic/Targets/OSTargets.cpp b/clang/lib/Basic/Targets/OSTargets.cpp index b56e2c7ca9c494..d625967deb2589 100644 --- a/clang/lib/Basic/Targets/OSTargets.cpp +++ b/clang/lib/Basic/Targets/OSTargets.cpp @@ -260,6 +260,7 @@ static void addVisualCDefines(const LangOptions &Opts, MacroBuilder &Builder) { void addWindowsDefines(const llvm::Triple &Triple, const LangOptions &Opts, MacroBuilder &Builder) { Builder.defineMacro("_WIN32"); + Builder.defineMacro("__PECOFF__"); if (Triple.isArch64Bit()) Builder.defineMacro("_WIN64"); if (Triple.isWindowsGNUEnvironment()) diff --git a/clang/lib/Basic/Targets/OSTargets.h b/clang/lib/Basic/Targets/OSTargets.h index a83d6464e789d6..1ed07dfaca6781 100644 --- a/clang/lib/Basic/Targets/OSTargets.h +++ b/clang/lib/Basic/Targets/OSTargets.h @@ -783,7 +783,9 @@ template class LLVM_LIBRARY_VISIBILITY UEFITargetInfo : public OSTargetInfo { protected: void getOSDefines(const LangOptions &Opts, const llvm::Triple &Triple, - MacroBuilder &Builder) const override {} + MacroBuilder &Builder) const override { + Builder.defineMacro("__PECOFF__"); + } public: UEFITargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) diff --git a/clang/lib/Basic/Targets/X86.h b/clang/lib/Basic/Targets/X86.h index a99ae62984c7d5..de371743481144 100644 --- a/clang/lib/Basic/Targets/X86.h +++ b/clang/lib/Basic/Targets/X86.h @@ -826,11 +826,6 @@ class LLVM_LIBRARY_VISIBILITY UEFIX86_64TargetInfo "i64:64-i128:128-f80:128-n8:16:32:64-S128"); } - void getTargetDefines(const LangOptions &Opts, - MacroBuilder &Builder) const override { - getOSDefines(Opts, X86TargetInfo::getTriple(), Builder); - } - BuiltinVaListKind getBuiltinVaListKind() const override { return TargetInfo::CharPtrBuiltinVaList; } diff --git a/clang/lib/Driver/ToolChains/UEFI.cpp b/clang/lib/Driver/ToolChains/UEFI.cpp index 66cbbec59246c0..29ca7548e2d0d2 100644 --- a/clang/lib/Driver/ToolChains/UEFI.cpp +++ b/clang/lib/Driver/ToolChains/UEFI.cpp @@ -35,6 +35,14 @@ UEFI::UEFI(const Driver &D, const llvm::Triple &Triple, const ArgList &Args) Tool *UEFI::buildLinker() const { return new tools::uefi::Linker(*this); } +void UEFI::AddClangCXXStdlibIncludeArgs(const ArgList &DriverArgs, + ArgStringList &CC1Args) const { + if (DriverArgs.hasArg(options::OPT_nostdinc, options::OPT_nostdlibinc, + options::OPT_nostdincxx)) + return; +} + + void tools::uefi::Linker::ConstructJob(Compilation &C, const JobAction &JA, const InputInfo &Output, const InputInfoList &Inputs, diff --git a/clang/lib/Driver/ToolChains/UEFI.h b/clang/lib/Driver/ToolChains/UEFI.h index a126ac32db6c6c..ac2ba67e142107 100644 --- a/clang/lib/Driver/ToolChains/UEFI.h +++ b/clang/lib/Driver/ToolChains/UEFI.h @@ -51,6 +51,11 @@ class LLVM_LIBRARY_VISIBILITY UEFI : public ToolChain { return false; } bool isPICDefaultForced() const override { return true; } + + void AddClangCXXStdlibIncludeArgs( + const llvm::opt::ArgList &DriverArgs, + llvm::opt::ArgStringList &CC1Args) const override; + }; } // namespace toolchains