Index: include/clang/Basic/Attr.td =================================================================== --- include/clang/Basic/Attr.td +++ include/clang/Basic/Attr.td @@ -296,6 +296,9 @@ // Specifies Object Formats for which the target applies, based off the // ObjectFormatType enumeration in Triple.h list ObjectFormats; + // It indicates that a certain attribute is not supported on a specific + // platform, turn on support for this attribute by default + bit Negated = 0; } class TargetArch arches> : TargetSpec { @@ -318,6 +321,13 @@ let ObjectFormats = ["ELF"]; } +// We do not support the alias attribute on Apple platforms, +// so I define a platform other than the Apple platform. +def TargetDarwinNegative : TargetArch<["x86", "x86_64"]> { + let OSes = ["MacOSX"]; + let Negated = 1; +} + // Attribute subject match rules that are used for #pragma clang attribute. // // A instance of AttrSubjectMatcherRule represents an individual match rule. @@ -553,7 +563,8 @@ let Documentation = [Undocumented]; } -def Alias : Attr { +// We do not support alias attribute on Apple platform, so we exclude the platform. +def Alias : Attr, TargetSpecificAttr { let Spellings = [GCC<"alias">]; let Args = [StringArgument<"Aliasee">]; let Subjects = SubjectList<[Function, GlobalVar], ErrorDiag>; Index: utils/TableGen/ClangAttrEmitter.cpp =================================================================== --- utils/TableGen/ClangAttrEmitter.cpp +++ utils/TableGen/ClangAttrEmitter.cpp @@ -2784,6 +2784,11 @@ GenerateTargetSpecificAttrCheck(R, Test, FnName, "OSes", "T.getOS()", "llvm::Triple::"); + // If the Negated is 1 in specific, it indicates that the attribute + // is not supported on this platform + if(R->getValueAsBit("Negated")) + Test = "!(" + Test + ")"; + // If one or more CXX ABIs are specified, check those as well. GenerateTargetSpecificAttrCheck(R, Test, FnName, "CXXABIs", "Target.getCXXABI().getKind()",