forked from OSchip/llvm-project
ADT/Triple: Switch to using .isOSDarwin() predicate.
llvm-svn: 129823
This commit is contained in:
parent
2b059998f7
commit
14ad22f09d
|
@ -51,7 +51,7 @@ static llvm::Optional<Visibility> getVisibilityOf(const Decl *D) {
|
|||
|
||||
// If we're on Mac OS X, an 'availability' for Mac OS X attribute
|
||||
// implies visibility(default).
|
||||
if (D->getASTContext().Target.getTriple().getOS() == llvm::Triple::Darwin) {
|
||||
if (D->getASTContext().Target.getTriple().isOSDarwin()) {
|
||||
for (specific_attr_iterator<AvailabilityAttr>
|
||||
A = D->specific_attr_begin<AvailabilityAttr>(),
|
||||
AEnd = D->specific_attr_end<AvailabilityAttr>();
|
||||
|
|
|
@ -2615,11 +2615,12 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
|
||||
case llvm::Triple::arm:
|
||||
case llvm::Triple::thumb:
|
||||
if (Triple.isOSDarwin())
|
||||
return new DarwinARMTargetInfo(T);
|
||||
|
||||
switch (os) {
|
||||
case llvm::Triple::Linux:
|
||||
return new LinuxTargetInfo<ARMTargetInfo>(T);
|
||||
case llvm::Triple::Darwin:
|
||||
return new DarwinARMTargetInfo(T);
|
||||
case llvm::Triple::FreeBSD:
|
||||
return new FreeBSDTargetInfo<ARMTargetInfo>(T);
|
||||
default:
|
||||
|
@ -2647,14 +2648,14 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
return new MipselTargetInfo(T);
|
||||
|
||||
case llvm::Triple::ppc:
|
||||
if (os == llvm::Triple::Darwin)
|
||||
if (Triple.isOSDarwin())
|
||||
return new DarwinPPC32TargetInfo(T);
|
||||
else if (os == llvm::Triple::FreeBSD)
|
||||
return new FreeBSDTargetInfo<PPC32TargetInfo>(T);
|
||||
return new PPC32TargetInfo(T);
|
||||
|
||||
case llvm::Triple::ppc64:
|
||||
if (os == llvm::Triple::Darwin)
|
||||
if (Triple.isOSDarwin())
|
||||
return new DarwinPPC64TargetInfo(T);
|
||||
else if (os == llvm::Triple::Lv2)
|
||||
return new PS3PPUTargetInfo<PPC64TargetInfo>(T);
|
||||
|
@ -2683,11 +2684,12 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
return new TCETargetInfo(T);
|
||||
|
||||
case llvm::Triple::x86:
|
||||
if (Triple.isOSDarwin())
|
||||
return new DarwinI386TargetInfo(T);
|
||||
|
||||
switch (os) {
|
||||
case llvm::Triple::AuroraUX:
|
||||
return new AuroraUXTargetInfo<X86_32TargetInfo>(T);
|
||||
case llvm::Triple::Darwin:
|
||||
return new DarwinI386TargetInfo(T);
|
||||
case llvm::Triple::Linux:
|
||||
return new LinuxTargetInfo<X86_32TargetInfo>(T);
|
||||
case llvm::Triple::DragonFly:
|
||||
|
@ -2715,11 +2717,12 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
}
|
||||
|
||||
case llvm::Triple::x86_64:
|
||||
if (Triple.isOSDarwin() || Triple.getEnvironment() == llvm::Triple::MachO)
|
||||
return new DarwinX86_64TargetInfo(T);
|
||||
|
||||
switch (os) {
|
||||
case llvm::Triple::AuroraUX:
|
||||
return new AuroraUXTargetInfo<X86_64TargetInfo>(T);
|
||||
case llvm::Triple::Darwin:
|
||||
return new DarwinX86_64TargetInfo(T);
|
||||
case llvm::Triple::Linux:
|
||||
return new LinuxTargetInfo<X86_64TargetInfo>(T);
|
||||
case llvm::Triple::DragonFly:
|
||||
|
@ -2735,10 +2738,7 @@ static TargetInfo *AllocateTarget(const std::string &T) {
|
|||
case llvm::Triple::MinGW32:
|
||||
return new MinGWX86_64TargetInfo(T);
|
||||
case llvm::Triple::Win32: // This is what Triple.h supports now.
|
||||
if (Triple.getEnvironment() == llvm::Triple::MachO)
|
||||
return new DarwinX86_64TargetInfo(T);
|
||||
else
|
||||
return new VisualStudioWindowsX86_64TargetInfo(T);
|
||||
return new VisualStudioWindowsX86_64TargetInfo(T);
|
||||
default:
|
||||
return new X86_64TargetInfo(T);
|
||||
}
|
||||
|
|
|
@ -266,7 +266,7 @@ static bool PersonalityHasOnlyCXXUses(llvm::Constant *Fn) {
|
|||
/// when it really needs it.
|
||||
void CodeGenModule::SimplifyPersonality() {
|
||||
// For now, this is really a Darwin-specific operation.
|
||||
if (Context.Target.getTriple().getOS() != llvm::Triple::Darwin)
|
||||
if (Context.Target.getTriple().isOSDarwin())
|
||||
return;
|
||||
|
||||
// If we're not in ObjC++ -fexceptions, there's nothing to do.
|
||||
|
|
|
@ -150,7 +150,7 @@ void CodeGenModule::DecorateInstruction(llvm::Instruction *Inst,
|
|||
}
|
||||
|
||||
bool CodeGenModule::isTargetDarwin() const {
|
||||
return getContext().Target.getTriple().getOS() == llvm::Triple::Darwin;
|
||||
return getContext().Target.getTriple().isOSDarwin();
|
||||
}
|
||||
|
||||
void CodeGenModule::Error(SourceLocation loc, llvm::StringRef error) {
|
||||
|
|
|
@ -2845,10 +2845,11 @@ const TargetCodeGenInfo &CodeGenModule::getTargetCodeGenInfo() {
|
|||
return *(TheTargetCodeGenInfo = new MSP430TargetCodeGenInfo(Types));
|
||||
|
||||
case llvm::Triple::x86:
|
||||
switch (Triple.getOS()) {
|
||||
case llvm::Triple::Darwin:
|
||||
if (Triple.isOSDarwin())
|
||||
return *(TheTargetCodeGenInfo =
|
||||
new X86_32TargetCodeGenInfo(Types, true, true));
|
||||
|
||||
switch (Triple.getOS()) {
|
||||
case llvm::Triple::Cygwin:
|
||||
case llvm::Triple::MinGW32:
|
||||
case llvm::Triple::AuroraUX:
|
||||
|
|
|
@ -578,33 +578,8 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
|
|||
return;
|
||||
}
|
||||
// FIXME: temporary hack: hard-coded paths.
|
||||
switch (os) {
|
||||
case llvm::Triple::Cygwin:
|
||||
// Cygwin-1.7
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
|
||||
// g++-4 / Cygwin-1.5
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
|
||||
// FIXME: Do we support g++-3.4.4?
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
|
||||
break;
|
||||
case llvm::Triple::MinGW32:
|
||||
// FIXME: We should be aware of i686-w64-mingw32.
|
||||
if (triple.getArch() == llvm::Triple::x86_64) {
|
||||
// mingw-w64-20110207
|
||||
AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.3");
|
||||
// mingw-w64-20101129
|
||||
AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.2");
|
||||
}
|
||||
// Try gcc 4.5.2 (MSYS)
|
||||
AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2");
|
||||
// Try gcc 4.5.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
|
||||
// Try gcc 4.4.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
|
||||
// Try gcc 4.3.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
|
||||
break;
|
||||
case llvm::Triple::Darwin:
|
||||
|
||||
if (triple.isOSDarwin()) {
|
||||
switch (triple.getArch()) {
|
||||
default: break;
|
||||
|
||||
|
@ -634,6 +609,34 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) {
|
|||
"arm-apple-darwin10", "v6", "", triple);
|
||||
break;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
switch (os) {
|
||||
case llvm::Triple::Cygwin:
|
||||
// Cygwin-1.7
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.4");
|
||||
// g++-4 / Cygwin-1.5
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "4.3.2");
|
||||
// FIXME: Do we support g++-3.4.4?
|
||||
AddMinGWCPlusPlusIncludePaths("/usr/lib/gcc", "i686-pc-cygwin", "3.4.4");
|
||||
break;
|
||||
case llvm::Triple::MinGW32:
|
||||
// FIXME: We should be aware of i686-w64-mingw32.
|
||||
if (triple.getArch() == llvm::Triple::x86_64) {
|
||||
// mingw-w64-20110207
|
||||
AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.3");
|
||||
// mingw-w64-20101129
|
||||
AddMinGW64CXXPaths("c:/mingw/x86_64-w64-mingw32/include/c++/4.5.2");
|
||||
}
|
||||
// Try gcc 4.5.2 (MSYS)
|
||||
AddMinGWCPlusPlusIncludePaths("/mingw/lib/gcc", "mingw32", "4.5.2");
|
||||
// Try gcc 4.5.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.5.0");
|
||||
// Try gcc 4.4.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.4.0");
|
||||
// Try gcc 4.3.0
|
||||
AddMinGWCPlusPlusIncludePaths("c:/MinGW/lib/gcc", "mingw32", "4.3.0");
|
||||
break;
|
||||
case llvm::Triple::DragonFly:
|
||||
AddPath("/usr/include/c++/4.1", CXXSystem, true, false, false);
|
||||
|
@ -863,7 +866,7 @@ void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang,
|
|||
AddDefaultCIncludePaths(triple, HSOpts);
|
||||
|
||||
// Add the default framework include paths on Darwin.
|
||||
if (triple.getOS() == llvm::Triple::Darwin) {
|
||||
if (triple.isOSDarwin()) {
|
||||
AddPath("/System/Library/Frameworks", System, true, false, true);
|
||||
AddPath("/Library/Frameworks", System, true, false, true);
|
||||
}
|
||||
|
|
|
@ -4649,8 +4649,7 @@ void Sema::CheckMain(FunctionDecl* FD) {
|
|||
// Darwin passes an undocumented fourth argument of type char**. If
|
||||
// other platforms start sprouting these, the logic below will start
|
||||
// getting shifty.
|
||||
if (nparams == 4 &&
|
||||
Context.Target.getTriple().getOS() == llvm::Triple::Darwin)
|
||||
if (nparams == 4 && Context.Target.getTriple().isOSDarwin())
|
||||
HasExtraParameters = false;
|
||||
|
||||
if (HasExtraParameters) {
|
||||
|
|
|
@ -721,7 +721,7 @@ static void HandleAliasAttr(Decl *d, const AttributeList &Attr, Sema &S) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (S.Context.Target.getTriple().getOS() == llvm::Triple::Darwin) {
|
||||
if (S.Context.Target.getTriple().isOSDarwin()) {
|
||||
S.Diag(Attr.getLoc(), diag::err_alias_not_supported_on_darwin);
|
||||
return;
|
||||
}
|
||||
|
@ -1439,7 +1439,7 @@ static void HandleWeakImportAttr(Decl *D, const AttributeList &Attr, Sema &S) {
|
|||
diag::warn_attribute_weak_import_invalid_on_definition)
|
||||
<< "weak_import" << 2 /*variable and function*/;
|
||||
else if (isa<ObjCPropertyDecl>(D) || isa<ObjCMethodDecl>(D) ||
|
||||
(S.Context.Target.getTriple().getOS() == llvm::Triple::Darwin &&
|
||||
(S.Context.Target.getTriple().isOSDarwin() &&
|
||||
isa<ObjCInterfaceDecl>(D))) {
|
||||
// Nothing to warn about here.
|
||||
} else
|
||||
|
|
Loading…
Reference in New Issue