summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorSean Callanan <scallanan@apple.com>2012-02-04 01:29:37 +0000
committerSean Callanan <scallanan@apple.com>2012-02-04 01:29:37 +0000
commit1ce3a6b650fde29a608f7a5664ddf8eddd82826b (patch)
tree255bedec4873ab83a273ef8833ff2b2f96167af9 /clang/lib
parenta21bbb24237c5672eb42ff3a07d4b18760992ecb (diff)
downloadbcm5719-llvm-1ce3a6b650fde29a608f7a5664ddf8eddd82826b.tar.gz
bcm5719-llvm-1ce3a6b650fde29a608f7a5664ddf8eddd82826b.zip
Clang has existing support for debuggers that
want to provide "po"-like functionality which treats the result of an expression implicitly as "id" (if it is not otherwise known) and prints it as an Objective-C object. This has in the past been gated by the "DebuggerSupport" language option, but that is too general. Debuggers also provide other commands like "print" that do not make any assumptions about whether the object is an Objective-C object. This patch makes the assumption conditional on a new language option: DebuggerCastResultToId. I have also made corresponding modifications to the testsuite. llvm-svn: 149735
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/CompilerInvocation.cpp3
-rw-r--r--clang/lib/Sema/SemaExprCXX.cpp2
2 files changed, 4 insertions, 1 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp
index 23fe830a035..7fd22479078 100644
--- a/clang/lib/Frontend/CompilerInvocation.cpp
+++ b/clang/lib/Frontend/CompilerInvocation.cpp
@@ -826,6 +826,8 @@ static void LangOptsToArgs(const LangOptions &Opts,
Res.push_back("-funknown-anytype");
if (Opts.DebuggerSupport)
Res.push_back("-fdebugger-support");
+ if (Opts.DebuggerCastResultToId)
+ Res.push_back("-fdebugger-cast-result-to-id");
if (Opts.DelayedTemplateParsing)
Res.push_back("-fdelayed-template-parsing");
if (Opts.Deprecated)
@@ -1885,6 +1887,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
Opts.FakeAddressSpaceMap = Args.hasArg(OPT_ffake_address_space_map);
Opts.ParseUnknownAnytype = Args.hasArg(OPT_funknown_anytype);
Opts.DebuggerSupport = Args.hasArg(OPT_fdebugger_support);
+ Opts.DebuggerCastResultToId = Args.hasArg(OPT_fdebugger_cast_result_to_id);
Opts.AddressSanitizer = Args.hasArg(OPT_faddress_sanitizer);
Opts.ApplePragmaPack = Args.hasArg(OPT_fapple_pragma_pack);
Opts.CurrentModule = Args.getLastArgValue(OPT_fmodule_name);
diff --git a/clang/lib/Sema/SemaExprCXX.cpp b/clang/lib/Sema/SemaExprCXX.cpp
index b35ea802e56..d0e40ba2713 100644
--- a/clang/lib/Sema/SemaExprCXX.cpp
+++ b/clang/lib/Sema/SemaExprCXX.cpp
@@ -4767,7 +4767,7 @@ ExprResult Sema::ActOnFinishFullExpr(Expr *FE) {
return ExprError();
// Top-level message sends default to 'id' when we're in a debugger.
- if (getLangOptions().DebuggerSupport &&
+ if (getLangOptions().DebuggerCastResultToId &&
FullExpr.get()->getType() == Context.UnknownAnyTy &&
isa<ObjCMessageExpr>(FullExpr.get())) {
FullExpr = forceUnknownAnyToType(FullExpr.take(), Context.getObjCIdType());
OpenPOWER on IntegriCloud