Commit Graph

259 Commits

Author SHA1 Message Date
Argyrios Kyrtzidis e6e67deeed Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.

llvm-svn: 140057
2011-09-19 20:40:19 +00:00
Francois Pichet 0706d203cf Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.
Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.

llvm-svn: 139987
2011-09-17 17:15:52 +00:00
Fariborz Jahanian 9f0bc5757c objc rewriter - more fixes to support compiling the rewritten
test case having instancetype. Fix in rewriter is unrelated to
using of instancetype. Test case uses other feature not yet
supported in the rewriter. There is more work to do, but this
is an ongoing task and not urgent at this time.

llvm-svn: 139473
2011-09-10 17:01:56 +00:00
Fariborz Jahanian e1378a4313 objc rewriter - Add rewriter test for new instancetype
along with minor rewriter fix to handle that. This
test is still incomplete due to rewriter issues
unrelated to instancetype.

llvm-svn: 139403
2011-09-09 20:35:22 +00:00
John McCall 9320b87cff Give conversions of block pointers to ObjC pointers a different cast kind
than conversions of C pointers to ObjC pointers.  In order to ensure that
we've caught every case, add asserts to CastExpr that strictly determine
which cast kind is used for which kind of bit cast.

llvm-svn: 139352
2011-09-09 05:25:32 +00:00
Fariborz Jahanian abc11aa3bc Fix a rewriter bug caused by recent changes in objc's
group decls.

llvm-svn: 138772
2011-08-29 22:21:46 +00:00
Fariborz Jahanian 3a039e339f objective-c: Treat top-level objective-c declarations
, such as list of forward @class decls, in a DeclGroup
node. Deal with its consequence throught clang. This
is in preparation for more Sema work ahead. // rdar://8843851.
Feel free to reverse if it breaks something important
and I am unavailable.

llvm-svn: 138709
2011-08-27 20:50:59 +00:00
Fariborz Jahanian 9e7dbd1cc6 objc rewriter: Fixes a rewriting of implicit casting of an integral
argument to bool. // rdar://9899834

llvm-svn: 136946
2011-08-04 23:58:03 +00:00
Fariborz Jahanian c7c346fd13 objective-c rewrite: Fixes rewriting of objective-c collection
statement inside a block. // rdar://9878420

llvm-svn: 136717
2011-08-02 20:28:46 +00:00
Fariborz Jahanian d560ed7f1b objc rewriter - my last patch was not quite right.
Fixed again. // rdar://9846759

llvm-svn: 136550
2011-07-30 01:21:41 +00:00
Fariborz Jahanian bce9ee2ae6 objc rewriter - set the flag passed to _Block_object_assign/_Block_object_dispose correctly
for copying a captured block object. // rdar://9846759

llvm-svn: 136549
2011-07-30 01:07:55 +00:00
Douglas Gregor fb65e592e0 Add support for C++0x unicode string and character literals, from Craig Topper!
llvm-svn: 136210
2011-07-27 05:40:30 +00:00
Chandler Carruth d48db2115a Rename getInstantiationLineNumber to getExpansionLineNumber in both
SourceManager and FullSourceLoc.

llvm-svn: 135969
2011-07-25 21:09:52 +00:00
Chandler Carruth 6d28d7f2a3 Rename SourceManager::getInstantiationRange to getExpansionRange.
llvm-svn: 135915
2011-07-25 16:56:02 +00:00
Chandler Carruth 35f5320d8e Mechanically rename SourceManager::getInstantiationLoc and
FullSourceLoc::getInstantiationLoc to ...::getExpansionLoc. This is part
of the API and documentation update from 'instantiation' as the term for
macros to 'expansion'.

llvm-svn: 135914
2011-07-25 16:49:02 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chandler Carruth 5d4aff0c4d Switch a comment in Rewrite from 'instantiation' to 'expansion'.
llvm-svn: 135226
2011-07-15 00:04:40 +00:00
Jay Foad 9a6b09874d Make more use of llvm::StringRef in various APIs. In particular, don't
use the deprecated forms of llvm::StringMap::GetOrCreateValue().

llvm-svn: 133515
2011-06-21 15:13:30 +00:00
John McCall 31168b077c Automatic Reference Counting.
Language-design credit goes to a lot of people, but I particularly want
to single out Blaine Garst and Patrick Beard for their contributions.

Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself,
in no particular order.

llvm-svn: 133103
2011-06-15 23:02:42 +00:00
Richard Smith 938f40b5aa Implement support for C++11 in-class initialization of non-static data members.
llvm-svn: 132878
2011-06-11 17:19:42 +00:00
Ken Dyck d9c83e6cdf Replace a literal 8 with Context->getCharWidth() in
SynthesizeByrefCopyDestroyHelper(). No change in functionality intended.

llvm-svn: 130608
2011-04-30 16:08:27 +00:00
Fariborz Jahanian 5b72ed9798 Use S.str() to force a flush.
llvm-svn: 129856
2011-04-20 16:38:37 +00:00
Douglas Gregor 3719d3455a Be sure to flush raw_string_ostream objects in the Objective-C
rewriter, from Eric Niebler!

llvm-svn: 129849
2011-04-20 13:35:54 +00:00
Argyrios Kyrtzidis 0e993c3249 Introduce Rewriter::IncreaseIndentation() which increase indentations for the lines between the given source range.
To determine what the indentation should be, a SourceLocation 'parentIndent' parameter is used that should be at
a source location with an indentation one degree lower than the given range.

llvm-svn: 129628
2011-04-16 01:03:33 +00:00
Richard Smith dda56e4b4a Support for C++11 (non-template) alias declarations.
llvm-svn: 129567
2011-04-15 14:24:37 +00:00
Chris Lattner 57540c5be0 fix a bunch of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129559
2011-04-15 05:22:18 +00:00
Anders Carlsson 752454092c Add a flag to StringLiteral to keep track of whether the string is a pascal string or not.
llvm-svn: 129488
2011-04-14 00:40:03 +00:00
Argyrios Kyrtzidis 71c58f3d59 Collect the options applicable to the Rewriter methods into a RewriterOptions struct.
llvm-svn: 129430
2011-04-13 07:15:11 +00:00
Fariborz Jahanian fae2e8df37 Fixup more objc rwriter bug having to do with
rewriting of blocks which have objective-c
stuff which need be rewritten as well. // rdar://9254348

llvm-svn: 129300
2011-04-11 21:17:02 +00:00
Fariborz Jahanian eae9c0e3df Fixes a rewrting bug of a property-dot syntax expression inside
a block. First part of // rdar://9254348

llvm-svn: 129171
2011-04-08 23:48:29 +00:00
Argyrios Kyrtzidis 2f8165b685 Enhance the Rewriter.
-Allow removing a line completely if it ends up empty
-Provide more control on what should be removed.

llvm-svn: 129085
2011-04-07 18:10:12 +00:00
Fariborz Jahanian c6078c87d1 Fixes a rewriter bug rewriting call to a byref
block pointer nested inside a block. // rdar:// 9204669

llvm-svn: 128747
2011-04-01 23:08:13 +00:00
Fariborz Jahanian 5bba75f1a7 ANother rewrite bug, rewriting a call of
__byref block. // rdar://9204669

llvm-svn: 128726
2011-04-01 19:19:28 +00:00
Fariborz Jahanian ff51d4e559 Fix couple of rewriter bugs related to rewriting a
__block block declaration. //rdar://9204669

llvm-svn: 128682
2011-03-31 22:49:32 +00:00
Peter Collingbourne e190dee7a5 Add support for the OpenCL vec_step operator, by generalising and
extending the existing support for sizeof and alignof.  Original
patch by Guy Benyei.

llvm-svn: 127475
2011-03-11 19:24:49 +00:00
Abramo Bagnara 29c2d46786 Fixed InnerLocStart.
llvm-svn: 127330
2011-03-09 14:09:51 +00:00
Abramo Bagnara dff1930bf7 Fixed source range for all DeclaratorDecl's.
llvm-svn: 127225
2011-03-08 08:55:46 +00:00
Abramo Bagnara b3185b00c5 Fixed TypedefDecl and TemplateTypeParameter source range.
llvm-svn: 127119
2011-03-06 15:48:19 +00:00
Fariborz Jahanian 8f4903397d Fix objc rewriting bug casting to qualified objective-c pointetr.
// rdar://9056351

llvm-svn: 126536
2011-02-26 01:31:36 +00:00
Fariborz Jahanian f2890fc93f Fix a rewriter bug involving call to property's
block. // rdar://9055596

llvm-svn: 126535
2011-02-26 00:33:41 +00:00
Fariborz Jahanian 74405b02f9 Fix a rewrite bug. // rdar://9039342
llvm-svn: 126435
2011-02-24 21:29:21 +00:00
John McCall c07a0c7e48 Change the representation of GNU ?: expressions to use a different expression
class and to bind the shared value using OpaqueValueExpr.  This fixes an
unnoticed problem with deserialization of these expressions where the
deserialized form would lose the vital pointer-equality trait;  or rather,
it fixes it because this patch also does the right thing for deserializing
OVEs.

Change OVEs to not be a "temporary object" in the sense that copy elision is
permitted.

This new representation is not totally unawkward to work with, but I think
that's really part and parcel with the semantics we're modelling here.  In
particular, it's much easier to fix things like the copy elision bug and to
make the CFG look right.

I've tried to update the analyzer to deal with this in at least some          
obvious cases, and I think we get a much better CFG out, but the printing
of OpaqueValueExprs probably needs some work.

llvm-svn: 125744
2011-02-17 10:25:35 +00:00
Fariborz Jahanian 9cd649d376 Block rewriting bug. Don't take address of captured
byref variables again when passing them to inner blocks. 
// rdar://9006279

llvm-svn: 125690
2011-02-16 22:37:10 +00:00
John McCall 8322c3a197 Give some convenient idiomatic accessors to Stmt::child_range and
Stmt::const_child_range, then make a bunch of places use them instead
of the individual iterator accessors.

llvm-svn: 125450
2011-02-13 04:07:26 +00:00
NAKAMURA Takumi 98dd73d66c CMake: LLVM_NO_RTTI must be obsolete now!
llvm-svn: 125275
2011-02-10 09:15:32 +00:00
John McCall 351762cda2 A few more tweaks to the blocks AST representation:
- BlockDeclRefExprs always store VarDecls
  - BDREs no longer store copy expressions
  - BlockDecls now store a list of captured variables, information about
    how they're captured, and a copy expression if necessary
    
With that in hand, change IR generation to use the captures data in       
blocks instead of walking the block independently.        

Additionally, optimize block layout by emitting fields in descending
alignment order, with a heuristic for filling in words when alignment
of the end of the block header is insufficient for the most aligned
field.

llvm-svn: 125005
2011-02-07 10:33:21 +00:00
Fariborz Jahanian ee504a0881 Fix an objective-c rewriter bug rewriting a __block
variable declaration of a struct declared type.
// rdar://8918702

llvm-svn: 124451
2011-01-27 23:18:15 +00:00
John McCall 424cec97bd Change QualType::getTypePtr() to return a const pointer, then change a
thousand other things which were (generally inadvertantly) relying on that.

llvm-svn: 123814
2011-01-19 06:33:43 +00:00
Jeffrey Yasskin 8dfa5f1776 Fix warnings found by gcc-4.6, from -Wunused-but-set-variable and
-Wint-to-pointer-cast.

llvm-svn: 123719
2011-01-18 02:00:16 +00:00
Jakob Stoklund Olesen 4072e59189 Clang should not warn on code in clang that is only there to remove warnings.
llvm-svn: 122941
2011-01-06 01:37:28 +00:00