David Blaikie
d5321247c4
Add a -rewrite-includes option, which is similar to -rewrite-macros, but only expands #include directives.
...
Patch contributed by Lubos Lunak (l.lunax@suse.cz ).
Review by Matt Beaumont-Gay (matthewbg@google.com ).
llvm-svn: 158093
2012-06-06 18:52:13 +00:00
Benjamin Kramer
474261af7b
Fix typos found by http://github.com/lyda/misspell-check
...
llvm-svn: 157886
2012-06-02 10:20:41 +00:00
NAKAMURA Takumi
ce6ad6748a
clang/lib/Rewrite/Rewriter.cpp: Don't try to rename opened files on Win32. Win32 doesn't allow rename/removing opened files.
...
llvm-svn: 157528
2012-05-27 12:59:58 +00:00
Fariborz Jahanian
c37a1d6e0f
cleanup some code.
...
llvm-svn: 157436
2012-05-24 22:59:56 +00:00
Fariborz Jahanian
9b43c3f0c5
modern objc translation: Add translation of @autoreleasepool
...
statement. // rdar://11474836.
llvm-svn: 157359
2012-05-23 23:47:20 +00:00
Manuel Klimek
78d084d942
Adds a method overwriteChangedFiles to the Rewriter. This is implemented by
...
first writing the changed files to a temporary location and then overwriting
the original files atomically.
Also adds a RewriterTestContext to aid unit testing rewrting logic in general.
llvm-svn: 157260
2012-05-22 17:01:35 +00:00
Fariborz Jahanian
89919ccd17
Modern objective-c translation. Translating default
...
synthesis of property getter/setters. // rdar://11374235
llvm-svn: 156447
2012-05-08 23:54:35 +00:00
Fariborz Jahanian
9c0c0501e8
modern objc translation. objc_getClass() and objc_getMetaClass()
...
prototypes should both return `struct objc_class *`.
// rdar://11375495
llvm-svn: 156418
2012-05-08 20:55:55 +00:00
Douglas Gregor
8a59a957fb
Revert r156097, which appears to be causing some breakage.
...
llvm-svn: 156304
2012-05-07 14:17:47 +00:00
Fariborz Jahanian
e9863b5c8e
objc modern translator: fix up attribute for dynamic property in a category.
...
// rdar://11095151
llvm-svn: 156127
2012-05-03 23:19:33 +00:00
Fariborz Jahanian
f687e7b2ff
modern objc translator: support for default property
...
synthesis translation. // rdar://11374235 - wip.
llvm-svn: 156125
2012-05-03 22:52:13 +00:00
Fariborz Jahanian
2e7f638b23
modern objc translator: used size_t in couple
...
of places. // rdar://11375908
llvm-svn: 156106
2012-05-03 21:44:12 +00:00
Fariborz Jahanian
3dc3669858
modern objc translation. objc_getClass() and objc_getMetaClass()
...
prototypes should both return `struct objc_class *`.
// rdar://11375495
llvm-svn: 156097
2012-05-03 20:23:37 +00:00
Fariborz Jahanian
70ef929561
modern objective-c translator: Fix destructor def.
...
for __NSContainer_literal.
llvm-svn: 156035
2012-05-02 23:53:46 +00:00
Fariborz Jahanian
d7c6777d50
Modern objective-c translation: Fixing couple of bugs
...
related to laying out ivar structs and accessing non-fragile-ivar
in more compilated cases. // rdar://11323187
llvm-svn: 156004
2012-05-02 17:34:59 +00:00
Fariborz Jahanian
144b72288a
modern objective-c translation of private ivars.
...
// rdar://11351299
llvm-svn: 155921
2012-05-01 17:46:45 +00:00
Fariborz Jahanian
faded5bb0f
modern objective-c translator. named aggregate types
...
defined inside the objc class belong to class's
decl. scope. This is to conform to objective-c
rules. // rdar://11351299
llvm-svn: 155855
2012-04-30 23:20:30 +00:00
Fariborz Jahanian
5979c31ea7
minor refactoring of modern objc translator.
...
llvm-svn: 155843
2012-04-30 19:46:53 +00:00
Fariborz Jahanian
95badad83b
modern objective-c translation: de-virtualize all
...
local rewriting functions.
llvm-svn: 155826
2012-04-30 16:57:52 +00:00
David Blaikie
2d7c57ec1d
Remove the ref/value inconsistency in filter_decl_iterator.
...
filter_decl_iterator had a weird mismatch where both op* and op-> returned T*
making it difficult to generalize this filtering behavior into a reusable
library of any kind.
This change errs on the side of value, making op-> return T* and op* return
T&.
(reviewed by Richard Smith)
llvm-svn: 155808
2012-04-30 02:36:29 +00:00
Fariborz Jahanian
bf217c8c14
objective-c modern translator: Correctly translate
...
nonfragile ivar access code when ivar type is a
locally defined struct/union type. // rdar://11323187
llvm-svn: 155740
2012-04-27 22:48:54 +00:00
Fariborz Jahanian
75f2e3c3d5
modern objective-c translator: _OBJC_PROTOCOL_REFERENCE_*
...
symbols should be static. // rdar://11337074
llvm-svn: 155736
2012-04-27 21:39:49 +00:00
Fariborz Jahanian
16d0d6c4ad
modern objective-c transltion: Fixes a translation bug
...
of writing a __block variable being initialized with
a constructed object. // rdar://11326988
llvm-svn: 155673
2012-04-26 23:20:25 +00:00
Fariborz Jahanian
e49a42cae9
modern objc rewriter: fixes a bug writing
...
a const qualified static c-function.
// rdar://11314329
llvm-svn: 155564
2012-04-25 17:56:48 +00:00
Fariborz Jahanian
847713a998
modern objc translator: Allow writing of multiple
...
declaration of __block variables on same lines
with initializers. // rdsr://7547630
llvm-svn: 155473
2012-04-24 19:38:45 +00:00
Fariborz Jahanian
32af25ea05
objc modern rewriter: allow translation of
...
multiple declaration of block variables
(with no initializer) on the same line.
llvm-svn: 155462
2012-04-24 18:16:20 +00:00
Fariborz Jahanian
3fd9bbd41e
objc modern rewriter: minor refactoring.
...
llvm-svn: 155449
2012-04-24 16:45:27 +00:00
Fariborz Jahanian
df0577de11
objective-c modern translator: Further improving the last
...
patch fixing writing a spurious 'static' into
the wrong place. // rdar://11275241
llvm-svn: 155130
2012-04-19 16:30:28 +00:00
Fariborz Jahanian
ca357d9831
modern objective-c translator: Fix writing a spurious 'static'
...
into the wrong place when rewriting a static function
which declares block literals. // rdar://11275241
llvm-svn: 155084
2012-04-19 00:50:01 +00:00
Patrick Beard
0caa39474b
Implements boxed expressions for Objective-C. <rdar://problem/10194391>
...
llvm-svn: 155082
2012-04-19 00:25:12 +00:00
Fariborz Jahanian
88773764e9
objective-c modern translation. Correct rewriting of
...
block meta-data of block literals declared inside
of extern "C" functions.
// rdar://1131490
llvm-svn: 154939
2012-04-17 18:40:53 +00:00
Fariborz Jahanian
35f6e12bf0
Modern objective-c translator:'self' used inside
...
block literal is imported. // rdar://11259664
llvm-svn: 154876
2012-04-16 23:00:57 +00:00
Fariborz Jahanian
cc1722818b
modern objective-c translator: translation of implicit
...
cast to/from block pointer types. // rdar://11202764
Also, many more modern translator tests.
llvm-svn: 154869
2012-04-16 22:14:01 +00:00
Benjamin Kramer
ccdf735e52
Actually, this tree isn't necessarily binary.
...
llvm-svn: 154762
2012-04-15 11:35:18 +00:00
Benjamin Kramer
c2a4475caa
Recursively delete rewrite rope nodes when tearing down the tree.
...
llvm-svn: 154760
2012-04-15 11:09:40 +00:00
Fariborz Jahanian
1b085428e8
objective-c modern translator: Make metadata
...
definition for protocols static. // rdar://11248048
llvm-svn: 154753
2012-04-14 17:13:08 +00:00
Fariborz Jahanian
3a5d552cd7
modern objective-c translator: Fixes translation of
...
__typeof which is a regression by reverting
r154360. // rdar://11233924
llvm-svn: 154679
2012-04-13 18:00:54 +00:00
Fariborz Jahanian
4af0e9efdd
modern objective-c translator: When translating
...
call to 'super' use __rw_objc_super as type of the
'super' meta-data instead of objc_super.
// rdar://11239894
llvm-svn: 154670
2012-04-13 16:20:05 +00:00
Fariborz Jahanian
27db0b3754
objective-c modern translator: beautify rewrite of
...
struct __rw_objc_super; no functionality change.
llvm-svn: 154632
2012-04-12 23:52:52 +00:00
Fariborz Jahanian
e1240fe743
modern objective-c translator. ifdef'out
...
__weak and __block when rewriting.
// rdar://11236342
llvm-svn: 154592
2012-04-12 16:33:31 +00:00
Fariborz Jahanian
5811fd6cc4
modern objective-c translator. Fixes a mis-translation when
...
of a __block struct object. // rdar://11230308
llvm-svn: 154566
2012-04-11 23:57:12 +00:00
Fariborz Jahanian
aaf4d69ac1
modern objective-c translator. Fixes a translation bug when
...
first ivar in the list is a bitfield.
// rdar://11229770
llvm-svn: 154534
2012-04-11 21:12:36 +00:00
Fariborz Jahanian
31176b1485
modern objective-c translation: writing container
...
subscripting. // rdar://11203853
llvm-svn: 154441
2012-04-10 22:06:54 +00:00
Fariborz Jahanian
2c00acd67f
objective-c modern translator: rewriting specific
...
implicit casts which is needed to produce good c++
code. // rdar://11202764
llvm-svn: 154360
2012-04-10 00:08:18 +00:00
Fariborz Jahanian
4460e0f805
modern objective-c translation: support for
...
dictionary literals. This concludes // rdar://10803676
llvm-svn: 154218
2012-04-06 22:29:36 +00:00
Fariborz Jahanian
e110fe4ac7
modern objective-c translator: translate array literal
...
expressions. // rdar://10803676
llvm-svn: 154196
2012-04-06 19:47:36 +00:00
Fariborz Jahanian
f264d5dc01
objective-c modern translation. Remove commenting out
...
of extern "C". // rdar://11169733
llvm-svn: 154025
2012-04-04 17:16:15 +00:00
Fariborz Jahanian
08ed8921c7
modern objective-c translator: rewriter linkage spec.
...
// rdar://11169733
llvm-svn: 153960
2012-04-03 17:35:38 +00:00
Fariborz Jahanian
991a08d35a
modern objective-c translator: writing container
...
literals. wip. // rdar://10803676
llvm-svn: 153784
2012-03-30 23:35:47 +00:00
Fariborz Jahanian
9c967fe51b
modern objective-c translator: writing numeric
...
literals. // rdar://10803676
llvm-svn: 153756
2012-03-30 16:49:36 +00:00
Fariborz Jahanian
064b5386f0
modern objc translator: avoid some duplicate declarations.
...
llvm-svn: 153674
2012-03-29 19:04:10 +00:00
Fariborz Jahanian
f35e020ef3
modern objective-c translator: fix up assortment of
...
visibility directives for a variety of exported
meta-data symbols. // rdar://11144048
llvm-svn: 153663
2012-03-29 17:51:09 +00:00
Fariborz Jahanian
307b7ad50c
modern objective-c translator: writing objc boolean literals.
...
// rdar://11124775
llvm-svn: 153535
2012-03-27 20:17:30 +00:00
Fariborz Jahanian
5ed21c3154
objective-c modern translator: move all inithooks into a single array
...
// rdar://11124354
llvm-svn: 153526
2012-03-27 18:41:05 +00:00
Fariborz Jahanian
835cabe92a
Remove few if-then-else when both branches are the
...
same. pr12357.
llvm-svn: 153515
2012-03-27 16:42:20 +00:00
Fariborz Jahanian
38c59108ad
Commit patch reverted in r153454 with the modified test
...
case that I forgot to check in.
llvm-svn: 153512
2012-03-27 16:21:30 +00:00
Daniel Dunbar
94d34ca2d9
Revert r153443 "objective-c modern translator: extern "C" exported", it fails in testing.
...
llvm-svn: 153454
2012-03-26 18:48:59 +00:00
Fariborz Jahanian
c29ebc36b1
objective-c modern translator: extern "C" exported
...
symbols. // rdar://11103982
llvm-svn: 153443
2012-03-26 16:29:49 +00:00
Fariborz Jahanian
16366da437
remove declaration of _objc_empty_vtable no longer
...
used in modern objc translator. // rdar://11105680
llvm-svn: 153386
2012-03-24 16:57:13 +00:00
Fariborz Jahanian
341348111d
moderin objc translator: remove 'const' from remaining
...
fields in _class_ro_t metadata. // rdar://11079898
llvm-svn: 153384
2012-03-24 16:53:16 +00:00
Fariborz Jahanian
e005070ccf
modern objc translation of block literal expressions
...
declared at file scope.
// rdar://11006566
llvm-svn: 153293
2012-03-23 00:00:49 +00:00
Fariborz Jahanian
bdf975ea3f
modern objc rewriter: until we can translate block literals
...
at global scope properly, issue diagnostics.
llvm-svn: 153271
2012-03-22 19:54:39 +00:00
Fariborz Jahanian
ee1db7a0fd
modern objective-c rewriter: Fix up translation of
...
property attributes. // rdar://11095151
llvm-svn: 153261
2012-03-22 17:39:35 +00:00
Fariborz Jahanian
167384d0da
modern objective-c translator: Change declaration of
...
all objc_msgSend unctions to void parameters and void return.
// rdar://11094890
llvm-svn: 153227
2012-03-21 23:41:04 +00:00
Fariborz Jahanian
eb4eb5cad9
modern objective-c rewriter: remove 'const' from
...
pointer field declarations in several meta-data.
// rdar://11079898
llvm-svn: 153196
2012-03-21 16:23:16 +00:00
Fariborz Jahanian
e9de728afc
Undo previous patch as I checked more than I intended.
...
llvm-svn: 153193
2012-03-21 16:18:21 +00:00
Fariborz Jahanian
fbe392eed6
modern objective-c rewriter: remove 'const' from
...
pointer field declarations in several meta-data.
// rdar://11079898
llvm-svn: 153192
2012-03-21 16:17:22 +00:00
NAKAMURA Takumi
3eb0edde78
RewriteModernObjC.cpp: Don't expose temporary std::string with StringRef. (StringRef)getName() can be used here.
...
llvm-svn: 153156
2012-03-21 03:21:46 +00:00
Fariborz Jahanian
69a76e98fe
Close the paren.
...
// rdar://11076938
llvm-svn: 153151
2012-03-21 00:01:15 +00:00
Fariborz Jahanian
952c3b9512
modern objective-c translator: insert couple of pragmas for optimization.
...
// rdar://11079898
llvm-svn: 153145
2012-03-20 22:24:05 +00:00
Fariborz Jahanian
cd79a49f37
modern objective-c translator: add static function to initialize
...
the class pointer in the category structure.
// rdar://11076938
llvm-svn: 153138
2012-03-20 21:41:28 +00:00
Fariborz Jahanian
3546559863
more modern objective-c meta-data stuff.
...
llvm-svn: 153127
2012-03-20 21:09:58 +00:00
Fariborz Jahanian
40ca00dc4c
modern objective-c translator: provide meta-data initialization
...
via functions for certain pointer initialization
fields. // rdar://11076938
llvm-svn: 153117
2012-03-20 19:54:33 +00:00
Fariborz Jahanian
6e60c1376f
modern objective-c translator: couple of minor
...
changes to how meta-data is declared.
// rdar://11076938
llvm-svn: 153098
2012-03-20 17:34:50 +00:00
Fariborz Jahanian
a854174a23
objective-c modern translator: Refactor intername ivar names to
...
one place and use it throughout. Also, change ivar name to avoid
name collisions. // rdar://11079366
llvm-svn: 153093
2012-03-20 17:13:39 +00:00
Fariborz Jahanian
62a5e65d54
removed unused code in the modern objc rewriter file.
...
llvm-svn: 153052
2012-03-19 20:38:08 +00:00
Fariborz Jahanian
3466059001
modern objective-c translator: fix type of objc_exception_throw
...
declaration and its siblings.
llvm-svn: 153043
2012-03-19 18:11:32 +00:00
Fariborz Jahanian
e8810768a9
modern objective-c rewriter: further improvement in
...
writing @synchronized statement; do not call locking
expression more than once and support early exits in
@synchronized's statement block (such as return).
llvm-svn: 152993
2012-03-17 17:46:02 +00:00
Matt Beaumont-Gay
6e177d3155
sink variable into assert
...
llvm-svn: 152955
2012-03-16 22:20:39 +00:00
Fariborz Jahanian
1d24a02577
Minor clean up of my last patch.
...
llvm-svn: 152950
2012-03-16 21:43:45 +00:00
Fariborz Jahanian
fe6268e34a
modern objective-c translator: write @synchronized.
...
// rdar://11063663
llvm-svn: 152949
2012-03-16 21:33:16 +00:00
Fariborz Jahanian
52fe6a0da3
modern objective-c translator: writing @throw statement.
...
llvm-svn: 152931
2012-03-16 16:52:06 +00:00
Fariborz Jahanian
b960db4427
modern objective-c translation: writing @try/@catch/@finally
...
statements.
llvm-svn: 152875
2012-03-15 23:50:33 +00:00
Fariborz Jahanian
3b71b17753
modern objective-c translator: writing @try/@finally statement.
...
llvm-svn: 152867
2012-03-15 22:42:15 +00:00
Fariborz Jahanian
f232bb421a
modern objective-c translator: rewriting of @catch-stmt.
...
llvm-svn: 152830
2012-03-15 20:11:10 +00:00
Fariborz Jahanian
b31e3af6fb
modern objective-c translator: please symbols generated
...
for @protocol expression into their own section.
llvm-svn: 152808
2012-03-15 17:05:33 +00:00
Fariborz Jahanian
07a423d652
modern objective-c translator: section info.
...
and metadata for "non-lazy" class and categories.
llvm-svn: 152751
2012-03-14 23:18:19 +00:00
Fariborz Jahanian
ddddca3e6d
objective-c modern tranaltor. More section info.
...
for misc. objc meta-data.
llvm-svn: 152743
2012-03-14 21:44:09 +00:00
Fariborz Jahanian
4548962f00
objective-c modern translator.
...
Add the _class_ro_t.reserved field for 64bit targets.
// rdar://11040024
llvm-svn: 152731
2012-03-14 18:09:23 +00:00
Fariborz Jahanian
fff69d077f
objective-c modern rewriter. Do not add _class_ro_t.reserved
...
field. // rdar://11040024
llvm-svn: 152685
2012-03-13 23:48:09 +00:00
Argyrios Kyrtzidis
e7f3ef39bf
[Sema] Prefer to use ObjCInterfaceDecl's protocol_begin()/protocol_end() iterators instead of
...
ObjCInterfaceDecl::getReferencedProtocols(), because the iterators are safe to use
even if the caller did not check that the interface is a definition.
llvm-svn: 152597
2012-03-13 01:09:41 +00:00
Fariborz Jahanian
2cc29afe48
modern objective-c translator. @try/@catch translation. wip.
...
llvm-svn: 152587
2012-03-12 23:58:28 +00:00
Fariborz Jahanian
e47bf2b991
objective-c modern translator: ivar offset symbols
...
will reside in .objc_ivar$B sections. // rdar://11023490
llvm-svn: 152563
2012-03-12 16:46:58 +00:00
Fariborz Jahanian
008dfe2fb3
objective-c modern abi rewriter: provide section pragmas for
...
statically writter metadata.
// rdar://11023490
llvm-svn: 152546
2012-03-11 19:41:56 +00:00
David Blaikie
bbafb8a745
Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
...
The member variable is always "LangOpts" and the member function is always "getLangOpts".
Reviewed by Chris Lattner
llvm-svn: 152536
2012-03-11 07:00:24 +00:00
Fariborz Jahanian
fca65102a2
objective-c modern rewriter: add __declspec(dllexport) to forward
...
declaration of class metadata when they are defined later.
llvm-svn: 152500
2012-03-10 18:25:06 +00:00
Fariborz Jahanian
b52221e941
objc modern rewriter: Define __OBJC2__ in written file.
...
// rdar://11024543
llvm-svn: 152496
2012-03-10 17:45:38 +00:00
John McCall
113bee0536
Remove BlockDeclRefExpr and introduce a bit on DeclRefExpr to
...
track whether the referenced declaration comes from an enclosing
local context. I'm amenable to suggestions about the exact meaning
of this bit.
llvm-svn: 152491
2012-03-10 09:33:50 +00:00
Fariborz Jahanian
c9295ec7d2
objc modern rewriter: don't export @package ivar symbols.
...
llvm-svn: 152469
2012-03-10 01:34:42 +00:00
Fariborz Jahanian
2677dede22
Minor change to my last rewrite patch.
...
llvm-svn: 152461
2012-03-10 00:53:02 +00:00