mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-12-14 11:39:35 +00:00
block extended signatur option. Change previous option
to a cc1 -fencode-extended-block-signature and pass it to cc1 and recognize this option to produce extended block type signature. // rdar://12109031 llvm-svn: 168063
This commit is contained in:
parent
5259524b2f
commit
0e3043b2ed
@ -53,6 +53,8 @@ LANGOPT(ObjC1 , 1, 0, "Objective-C 1")
|
||||
LANGOPT(ObjC2 , 1, 0, "Objective-C 2")
|
||||
BENIGN_LANGOPT(ObjCDefaultSynthProperties , 1, 0,
|
||||
"Objective-C auto-synthesized properties")
|
||||
BENIGN_LANGOPT(EncodeExtendedBlockSig , 1, 0,
|
||||
"Encoding extended block type signature")
|
||||
BENIGN_LANGOPT(ObjCInferRelatedResultType , 1, 1,
|
||||
"Objective-C related result type inference")
|
||||
LANGOPT(Trigraphs , 1, 0,"trigraphs")
|
||||
@ -104,7 +106,6 @@ LANGOPT(FastMath , 1, 0, "__FAST_MATH__ predefined macro")
|
||||
LANGOPT(FiniteMathOnly , 1, 0, "__FINITE_MATH_ONLY__ predefined macro")
|
||||
|
||||
BENIGN_LANGOPT(ObjCGCBitmapPrint , 1, 0, "printing of GC's bitmap layout for __weak/__strong ivars")
|
||||
BENIGN_LANGOPT(ObjCExtendedBlockEncode , 1, 1, "Do extended encoding of block type signature")
|
||||
|
||||
BENIGN_LANGOPT(AccessControl , 1, 1, "C++ access control")
|
||||
LANGOPT(CharIsSigned , 1, 1, "signed char")
|
||||
|
@ -406,6 +406,8 @@ def fobjc_dispatch_method_EQ : Joined<["-"], "fobjc-dispatch-method=">,
|
||||
HelpText<"Objective-C dispatch method to use">;
|
||||
def fobjc_default_synthesize_properties : Flag<["-"], "fobjc-default-synthesize-properties">,
|
||||
HelpText<"enable the default synthesis of Objective-C properties">;
|
||||
def fencode_extended_block_signature : Flag<["-"], "fencode-extended-block-signature">,
|
||||
HelpText<"enable extended encoding of block type signature">;
|
||||
def pic_level : Separate<["-"], "pic-level">,
|
||||
HelpText<"Value for __PIC__">;
|
||||
def pie_level : Separate<["-"], "pie-level">,
|
||||
|
@ -929,8 +929,6 @@ def print_file_name_EQ : Joined<["-", "--"], "print-file-name=">,
|
||||
HelpText<"Print the full library path of <file>">, MetaVarName<"<file>">;
|
||||
def print_ivar_layout : Flag<["-"], "print-ivar-layout">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable Objective-C Ivar layout bitmap print trace">;
|
||||
def encode_extended_block_sig : Flag<["-"], "encode-extended-block-signature">, Flags<[CC1Option]>,
|
||||
HelpText<"Enable encoding of the extended block type signature">;
|
||||
def print_libgcc_file_name : Flag<["-", "--"], "print-libgcc-file-name">,
|
||||
HelpText<"Print the library path for \"libgcc.a\"">;
|
||||
def print_multi_directory : Flag<["-", "--"], "print-multi-directory">;
|
||||
|
@ -149,6 +149,10 @@ public:
|
||||
/// -fobjc-default-synthesize-properties by default.
|
||||
virtual bool IsObjCDefaultSynthPropertiesDefault() const { return false; }
|
||||
|
||||
/// IsEncodeExtendedBlockSignatureDefault - Does this tool chain enable
|
||||
/// -fencode-extended-block-signature by default.
|
||||
virtual bool IsEncodeExtendedBlockSignatureDefault() const { return false; }
|
||||
|
||||
/// IsObjCNonFragileABIDefault - Does this tool chain set
|
||||
/// -fobjc-nonfragile-abi by default.
|
||||
virtual bool IsObjCNonFragileABIDefault() const { return false; }
|
||||
|
@ -4511,7 +4511,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const {
|
||||
QualType BlockTy =
|
||||
Expr->getType()->getAs<BlockPointerType>()->getPointeeType();
|
||||
// Encode result type.
|
||||
if (getLangOpts().ObjCExtendedBlockEncode)
|
||||
if (getLangOpts().EncodeExtendedBlockSig)
|
||||
getObjCEncodingForMethodParameter(Decl::OBJC_TQ_None,
|
||||
BlockTy->getAs<FunctionType>()->getResultType(),
|
||||
S, true /*Extended*/);
|
||||
@ -4552,7 +4552,7 @@ std::string ASTContext::getObjCEncodingForBlock(const BlockExpr *Expr) const {
|
||||
PType = PVDecl->getType();
|
||||
} else if (PType->isFunctionType())
|
||||
PType = PVDecl->getType();
|
||||
if (getLangOpts().ObjCExtendedBlockEncode)
|
||||
if (getLangOpts().EncodeExtendedBlockSig)
|
||||
getObjCEncodingForMethodParameter(Decl::OBJC_TQ_None, PType,
|
||||
S, true /*Extended*/);
|
||||
else
|
||||
|
@ -318,6 +318,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IsEncodeExtendedBlockSignatureDefault() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool IsObjCNonFragileABIDefault() const {
|
||||
// Non-fragile ABI is default for everything but i386.
|
||||
return getTriple().getArch() != llvm::Triple::x86;
|
||||
|
@ -2727,6 +2727,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
CmdArgs.push_back("-fobjc-default-synthesize-properties");
|
||||
}
|
||||
|
||||
// -fencode-extended-block-signature=1 is default.
|
||||
if (getToolChain().IsEncodeExtendedBlockSignatureDefault()) {
|
||||
CmdArgs.push_back("-fencode-extended-block-signature");
|
||||
}
|
||||
|
||||
// Allow -fno-objc-arr to trump -fobjc-arr/-fobjc-arc.
|
||||
// NOTE: This logic is duplicated in ToolChains.cpp.
|
||||
bool ARC = isObjCAutoRefCount(Args);
|
||||
|
@ -1126,8 +1126,6 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
||||
|
||||
if (Args.hasArg(OPT_print_ivar_layout))
|
||||
Opts.ObjCGCBitmapPrint = 1;
|
||||
if (Args.hasArg(OPT_encode_extended_block_sig))
|
||||
Opts.ObjCExtendedBlockEncode = 1;
|
||||
if (Args.hasArg(OPT_fno_constant_cfstrings))
|
||||
Opts.NoConstantCFStrings = 1;
|
||||
|
||||
@ -1216,6 +1214,8 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
|
||||
Args.getLastArgValue(OPT_fconstant_string_class);
|
||||
Opts.ObjCDefaultSynthProperties =
|
||||
Args.hasArg(OPT_fobjc_default_synthesize_properties);
|
||||
Opts.EncodeExtendedBlockSig =
|
||||
Args.hasArg(OPT_fencode_extended_block_signature);
|
||||
Opts.EmitAllDecls = Args.hasArg(OPT_femit_all_decls);
|
||||
Opts.PackStruct = Args.getLastArgIntValue(OPT_fpack_struct_EQ, 0, Diags);
|
||||
Opts.PICLevel = Args.getLastArgIntValue(OPT_pic_level, 0, Diags);
|
||||
|
@ -1,5 +1,5 @@
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -encode-extended-block-signature -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s -check-prefix=EXPANDED
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fencode-extended-block-signature -emit-llvm %s -o - | FileCheck %s
|
||||
// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s -check-prefix=BRIEF
|
||||
// rdar://12109031
|
||||
|
||||
@class NSString, NSArray;
|
||||
@ -12,4 +12,4 @@ int main ()
|
||||
^(BBB arg1, double arg2){ return b1; }(0, 3.14);
|
||||
}
|
||||
// CHECK: @{{.*}} = private unnamed_addr constant [64 x i8] c"@?<@\22NSString\22@?@\22NSArray\22>24@?0@?<@\22NSString\22@?@\22NSArray\22>8d16\00"
|
||||
// CHECK-EXPANDED: @{{.*}} = private unnamed_addr constant [64 x i8] c"@?<@\22NSString\22@?@\22NSArray\22>24@?0@?<@\22NSString\22@?@\22NSArray\22>8d16\00"
|
||||
// CHECK-BRIEF: @{{.*}} = private unnamed_addr constant [14 x i8] c"@?24@?0@?8d16\00"
|
||||
|
@ -3,5 +3,5 @@
|
||||
// TEST0: clang{{.*}}" "-cc1"
|
||||
// TEST0: "-rewrite-objc"
|
||||
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
|
||||
// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
|
||||
// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx-fragile" "-fobjc-default-synthesize-properties" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
|
||||
// TEST0: rewrite-legacy-objc.m"
|
||||
|
@ -3,4 +3,4 @@
|
||||
// TEST0: clang{{.*}}" "-cc1"
|
||||
// TEST0: "-rewrite-objc"
|
||||
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
|
||||
// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
|
||||
// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime=macosx" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fencode-extended-block-signature" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
|
||||
|
Loading…
Reference in New Issue
Block a user