Commit Graph

310 Commits

Author SHA1 Message Date
NAKAMURA Takumi 6e256873e4 clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
llvm-svn: 301619
2017-04-28 05:02:52 +00:00
Argyrios Kyrtzidis 5312b667a8 [ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals' functionality of EditedSource
'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one.
But it is not useful when the edits are character precise, as is the case with the remap files.

llvm-svn: 301602
2017-04-28 00:25:06 +00:00
Michal Gorny 638ac70a92 [test] Port clang tests to canonicalized booleans
Use the new llvm_canonicalize_cmake_booleans() function to canonicalize
booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables
used to hold canonicalized values with in-place canonicalization. Use
implicit logic in Python code to avoid overrelying on exact 0/1 values.

Differential Revision: https://reviews.llvm.org/D28529

llvm-svn: 293052
2017-01-25 13:11:45 +00:00
Argyrios Kyrtzidis 4278047f64 [test/objcmt] Add a follow-up test case for r275600.
llvm-svn: 275609
2016-07-15 20:40:24 +00:00
Argyrios Kyrtzidis 88737a5aa5 [objcmt] Fix a buffer overflow crash than can occur while modernizing enums.
Note that due to the nature of the crash it requires libgmalloc or asan for it to crash consistently.

rdar://19932927

llvm-svn: 275600
2016-07-15 19:22:34 +00:00
Argyrios Kyrtzidis e59b770518 [objcmt] Don't add an #import of Foundation unnecessarily, if the NS_ENUM macro is already defined.
llvm-svn: 275589
2016-07-15 18:11:27 +00:00
Argyrios Kyrtzidis 6f10b74be0 [arcmt/objcmt] Fix ParentMap crash with invalid code.
rdar://22489560

llvm-svn: 275466
2016-07-14 20:21:16 +00:00
Justin Bogner 2a15ffa2bf Re-apply "test: Use add_lit_testsuites so that subsets of tests can be specified"
This version should actually remove the empty directories I removed
all of the files from. Thanks to tstellar for pointing out git-svn's
--rmdir flag.

Original message:

This creates make/ninja targets like check-clang-codegen and
check-clang-unit, much like LLVM already has. I had to move some input
files into Input directories so they weren't picked up as test
directories.

llvm-svn: 274565
2016-07-05 17:54:40 +00:00
Justin Bogner a73e81c53b Revert "test: Use add_lit_testsuites so that subsets of tests can be specified"
This reverts r274560. It's breaking a bunch of bots due to a directory
with a space in the name. Doesn't repro locally for some reason.

llvm-svn: 274562
2016-07-05 16:14:58 +00:00
Justin Bogner 2976e014fc test: Use add_lit_testsuites so that subsets of tests can be specified
This creates make/ninja targets like check-clang-codegen and
check-clang-unit, much like LLVM already has. I had to move some input
files into Input directories so they weren't picked up as test
directories.

llvm-svn: 274560
2016-07-05 16:06:12 +00:00
John McCall 460ce58fa6 Define weak and __weak to mean ARC-style weak references, even in MRC.
Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously.  Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references.  The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)

If you like, you can enable this feature with
  -Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.

This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC.  Unlike __weak, this is being enabled immediately.  Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.

As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers.  I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.

rdar://9674298

llvm-svn: 251041
2015-10-22 18:38:17 +00:00
John McCall 039f2bbd02 Some minor ARC diagnostic improvements.
llvm-svn: 250917
2015-10-21 18:06:38 +00:00
Douglas Gregor d2a713e41b Don't inherit availability information when implementing a protocol requirement.
When an Objective-C method implements a protocol requirement, do not
inherit any availability information from the protocol
requirement. Rather, check that the implementation is not less
available than the protocol requirement, as we do when overriding a
method that has availability. Fixes rdar://problem/22734745.

llvm-svn: 248949
2015-09-30 21:27:42 +00:00
Argyrios Kyrtzidis 822e2887b9 [Edit] Fix issue with tracking what macro argument inputs have been edited.
This was not working correctly, leading to erroneously rejecting valid edits.

llvm-svn: 247462
2015-09-11 20:09:11 +00:00
Adrian Prantl bc068586ac Revert "Revert r241620 and follow-up commits" and move the initialization
of the llvm targets from clang/CodeGen into ClangCheck.cpp and CIndex.cpp.

llvm-svn: 241653
2015-07-08 01:00:30 +00:00
Adrian Prantl 142ec39739 Revert r241620 and follow-up commits while investigating linux buildbot failures.
llvm-svn: 241642
2015-07-07 23:19:46 +00:00
Adrian Prantl e50371b948 Wrap clang modules and pch files in an object file container.
This patch adds ObjectFilePCHContainerOperations uses the LLVM backend
to put the contents of a PCH into a __clangast section inside a COFF, ELF,
or Mach-O object file container.

This is done to facilitate module debugging by makeing it possible to
store the debug info for the types defined by a module alongside the AST.

rdar://problem/20091852

llvm-svn: 241620
2015-07-07 20:11:29 +00:00
Richard Smith 3d8fceafe6 Commit some test changes somehow missed in r239789.
llvm-svn: 239791
2015-06-16 00:19:29 +00:00
Fariborz Jahanian e1b9843375 [Objective-C SDK modernizer]. Patch to convert setter/getter
methods in protocols to their respective property
declarations. rdar://19372798

llvm-svn: 233977
2015-04-02 21:36:03 +00:00
Fariborz Jahanian 98253306f3 [SDK modernizer PATCH]. Fixes a bug whereby a call to super
was not converted to property-dot syntax by removing an unused
code. rdar://19140267

llvm-svn: 233019
2015-03-23 20:52:26 +00:00
Daniel Jasper 34d761d893 Revert r231008 (and dependent r231019).
As Chandler responded on the initial commit, just directly setting the
triple through -Xclang option to the driver creates havoc on other
platforms. The driver test should specifically go into test/Driver and
test the cc1 commandline itself.

llvm-svn: 231063
2015-03-03 10:02:53 +00:00
Fariborz Jahanian 7b012d3728 [SDK modernizer] Patch to fix type of the typed enums when
migrating to NS_ENUM typedef. rdar://19994496

llvm-svn: 231036
2015-03-02 23:58:02 +00:00
Fariborz Jahanian 6d2cd611bb Attempt to fix buildbot.
llvm-svn: 231019
2015-03-02 21:46:17 +00:00
Fariborz Jahanian 4c616d4df5 [SDK modernizer]. Patch fixes driver's lack of
recognition of mernizer's -objcmt-migrate-property-dot-syntax
option. rdar://19994452

llvm-svn: 231008
2015-03-02 20:43:32 +00:00
Ben Langmuir 443aa4b4b0 Allow (Object *)kMyGlobalCFObj casts without bridging
Previously we allowed these casts only for constants declared in system
headers, which we assume are retain/release-neutral. Now also allow them
for constants in user headers, treating them as +0.  Practically, this
means that we will now allow:
id x = (id)kMyGlobalConst;

But unlike with system headers we cannot mix them with +1 values:
id y = (id)(b ? kMyGlobalConst : [Obj newValAtPlusOne]); // error
id z = (id)(b ? kSystemGlobalConst: [Obj newValAtPlusOne]); // OK

Thanks to John for suggesting this improvement.

llvm-svn: 230534
2015-02-25 20:09:06 +00:00
Adrian Prantl cbc368c5b5 Revert "Wrap clang module files in a Mach-O, ELF, or COFF container."
llvm-svn: 230454
2015-02-25 02:44:04 +00:00
Adrian Prantl 8bf7af3de8 Wrap clang module files in a Mach-O, ELF, or COFF container.
This is a necessary prerequisite for debugging with modules.
The .pcm files become containers that hold the serialized AST which allows
us to store debug information in the module file that can be shared by all
object files that were built importing the module.

This reapplies r230044 with a fixed configure+make build and updated
dependencies and testcase requirements. Over the last iteration this
version adds
- missing target requirements for testcases that specify an x86 triple,
- a missing clangCodeGen.a dependency to libClang.a in the make build.

rdar://problem/19104245

llvm-svn: 230423
2015-02-25 01:31:45 +00:00
Fariborz Jahanian 4732d43cc2 Objective-C SDK modernizer to use NS_ENUM/NS_OPTIONS macros
with typed enums. rdar://19352510

llvm-svn: 227104
2015-01-26 17:41:03 +00:00
Fariborz Jahanian f9317f1586 Objective-C moderinzer [qoi], add space on rhs when needed when
converting to property-dot syntax for setters.
rdar://19381786

llvm-svn: 226944
2015-01-23 21:58:46 +00:00
Fariborz Jahanian 30609b8a78 Objective-C modernizer. Avoid using property-dot syntax when
receiver type is not valid for property-dot syntz use.
rdar://19381786

llvm-svn: 226927
2015-01-23 19:23:42 +00:00
Jordan Rose 16ba553f75 ObjC getters with names like "newItem" should still be linked to the @property.
Two years ago I added a compile-time "optimization" to
ObjCMethodDecl::findPropertyDecl: exit early if the current method is part
of a special Objective-C method family (like 'new' or 'init'). However, if a
property (declared with @property) has a name that matches a method family,
the getter picks up that family despite being declared by the property. The
early exit then made ObjCMethodDecl::findPropertyDecl decide that there
was no associated property, despite the method itself being marked as an
accessor. This corrects that by removing the early exit.

This does /not/ change the fact that such a getter is considered to return a
value with a +1 retain count. The best way to eliminate this is by adding the
objc_method_family(none) attribute to the getter, but unlike the existing
ns_returns_not_retained that can't be applied directly to the property -- you
have to redeclare the getter instead.

(It'd be nice if @property just implied objc_method_family(none) for its
getter, but that would be a backwards-incompatible change.)

rdar://problem/19038838

llvm-svn: 226338
2015-01-16 23:04:26 +00:00
Fariborz Jahanian 1406c878cb Objective-C SDK modernizer. When modernizing an enum to
NS_ENUM/NS_OPTIONS use the underlying type if there is 
no associated type. rdar://19198042

llvm-svn: 223934
2014-12-10 18:25:24 +00:00
Fariborz Jahanian df833a4918 Objective-C SDK modernizer. Modernize to use
property-dot-syntax when receiver is 'super'. 
rdar://19140267

llvm-svn: 223846
2014-12-09 22:36:47 +00:00
Fariborz Jahanian c62d16f304 Objective-C. Fixes a regression caused by implementation
of new warning for deprecated method call for receiver
of type 'id'. This addresses rdar://18960378 where
unintended warnings being issued.

llvm-svn: 221933
2014-11-13 22:27:05 +00:00
Fariborz Jahanian 05e77f8349 [Objective-C Sema]. Issue availability/deprecated warning when
there is a uinque method found when message is sent to receiver 
of 'id' type. // rdar://18848183

llvm-svn: 221562
2014-11-07 23:51:15 +00:00
Fariborz Jahanian a6556f7295 Objective-C SDK modernization tool. Use its own option
,-objcmt-migrate-property-dot-syntax, when migarting to use
property-dot syntax in place of messaging expression.
rdar://18839124

llvm-svn: 221001
2014-10-31 21:19:45 +00:00
Fariborz Jahanian d2241bf561 Objective-C SDK modernization. import Foundation even
when a previous definition of NS_OPTION is available
; e.g. from a pch. enhancement to rdar://18498550

llvm-svn: 219448
2014-10-09 22:04:27 +00:00
Fariborz Jahanian ed6de56c77 Objective-C SDK modernization. convert message expression
to Objective-C dot-syntax. rdar://18498572

llvm-svn: 219424
2014-10-09 18:30:56 +00:00
Fariborz Jahanian 80ebf8da7e Objective-C SDK modernization. When modernizing to
use NS_ENUM/NS_OPTIONS macros, add an import of
Foundation.h (or its module) as necessary.
rdar://18498550

llvm-svn: 219225
2014-10-07 19:01:46 +00:00
Fariborz Jahanian 35ee87debe Objective-C SDK modernizer. Patch to support modernization
to NS_ENUM/NS_OPTION macros when typedef names are other
than NSInteger/NSUInteger (int8_t, etc.).
rdar://18532199

llvm-svn: 219173
2014-10-06 23:50:37 +00:00
Fariborz Jahanian 77a835bf56 Objective-C Modernizer. Patch to remove dangling space
before the semicolon wahen modernizing to use 
NS_ENUM/NS_OPTIONS macros. rdar://18498539

llvm-svn: 218809
2014-10-01 20:46:32 +00:00
Fariborz Jahanian 18625ee75c Objective-C SDK modernizer. Do not modernize an enum
which already has the underlying interger type specification.
// rdar://1826225

llvm-svn: 217783
2014-09-15 16:41:47 +00:00
Richard Smith 091405d7e3 Reword switch/goto diagnostics "protected scope" diagnostics. Making up a term
"protected scope" is very unhelpful here and actively confuses users. Instead,
simply state the nature of the problem in the diagnostic: we cannot jump from
here to there. The notes explain nicely why not.

llvm-svn: 217293
2014-09-06 00:24:58 +00:00
Fariborz Jahanian be7bf7285b Objective-C modernization. Convert -initWithUTF8String messaging
with auto-boxing syntax for literals. rdar://18080352

llvm-svn: 216405
2014-08-25 20:22:25 +00:00
Jordan Rose e3f310f3bd [analyzer] Check for NULL passed to CFAutorelease.
Patch by Sean McBride, tests adjusted by me.

llvm-svn: 211453
2014-06-21 23:50:40 +00:00
Fariborz Jahanian 1ad83a35b1 Objective-C. Revert my patch in r211234.
llvm-svn: 211237
2014-06-18 23:22:38 +00:00
Fariborz Jahanian 62aeb8b653 Objective-C ARC. Allow conversion of (void*) pointers to
retainable ObjC pointers without requiring a bridge-cast
by recognizing this as a +0 context. // rdar://16627903

llvm-svn: 211234
2014-06-18 22:50:40 +00:00
Argyrios Kyrtzidis c02a0dbe41 [objcmt] Make sure we don't edit the return type to add 'instancetype' if the return type is already that.
rdar://16961577

llvm-svn: 209264
2014-05-21 00:24:20 +00:00
Alp Toker 57cccec446 ARCMT/GC-check-warn-nsalloc.m: don't provide a diag group
This diagnostic is now controlled solely by -no-ns-alloc-error thus matching
the original intended behaviour.

llvm-svn: 209184
2014-05-19 23:48:49 +00:00
Alp Toker 97b084f528 Improve test verification from r209172
llvm-svn: 209175
2014-05-19 22:56:13 +00:00