Commit Graph

285 Commits

Author SHA1 Message Date
Fariborz Jahanian a4b2a86353 objc, objc rewriter. Fixes couple of bugs one
because of recent refactoring and one in the
rewriter.

llvm-svn: 147070
2011-12-21 19:48:07 +00:00
Douglas Gregor 16408325af Move ObjCInterfaceDecl's "EndLoc" into DefinitionData, since it only
applies to an actual definition. Plus, clarify the purpose of this
field and give the accessor a different name, since getLocEnd() is
supposed to be the same as getSourceRange().getEnd().

llvm-svn: 146694
2011-12-15 22:34:59 +00:00
Douglas Gregor dc9166c8e1 Keep track of all declarations of an Objective-C class (both forward
declarations and definitions) as ObjCInterfaceDecls within the same
redeclaration chain. This new representation matches what we do for
C/C++ variables/functions/classes/templates/etc., and makes it
possible to answer the query "where are all of the declarations of
this class?"

llvm-svn: 146679
2011-12-15 20:29:51 +00:00
Douglas Gregor 0b144e160a Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.

llvm-svn: 146618
2011-12-15 00:29:59 +00:00
Fariborz Jahanian 8307742d18 More refactoring of objective-C rewriter.
llvm-svn: 146160
2011-12-08 18:25:15 +00:00
Fariborz Jahanian 7b1866930e More refactoring of objc rewriter.
llvm-svn: 145867
2011-12-05 22:59:54 +00:00
Fariborz Jahanian 8efef60f69 More objc rewriter refactoring.
llvm-svn: 145841
2011-12-05 19:50:04 +00:00
Fariborz Jahanian 68e628e51f Some early refactoring of objective-c rewriter.
llvm-svn: 145824
2011-12-05 18:43:13 +00:00
Argyrios Kyrtzidis 841dd8861a Change ASTConsumer::HandleTopLevelDecl to return true for the parser to continue
parsing or false to abort parsing.

llvm-svn: 144943
2011-11-18 00:26:59 +00:00
Fariborz Jahanian e0e6505660 objc rewriter: use a more specific name for local variable used
in fast enumeration rewrite. // rdar://10415026

llvm-svn: 144191
2011-11-09 17:41:43 +00:00
John McCall fe96e0b6be Change the AST representation of operations on Objective-C
property references to use a new PseudoObjectExpr
expression which pairs a syntactic form of the expression
with a set of semantic expressions implementing it.
This should significantly reduce the complexity required
elsewhere in the compiler to deal with these kinds of
expressions (e.g. IR generation's special l-value kind,
the static analyzer's Message abstraction), at the lower
cost of specifically dealing with the odd AST structure
of these expressions.  It should also greatly simplify
efforts to implement similar language features in the
future, most notably Managed C++'s properties and indexed
properties.

Most of the effort here is in dealing with the various
clients of the AST.  I've gone ahead and simplified the
ObjC rewriter's use of properties;  other clients, like
IR-gen and the static analyzer, have all the old
complexity *and* all the new complexity, at least
temporarily.  Many thanks to Ted for writing and advising
on the necessary changes to the static analyzer.

I've xfailed a small diagnostics regression in the static
analyzer at Ted's request.

llvm-svn: 143867
2011-11-06 09:01:30 +00:00
John McCall 526ab47a55 Restore r142914 and r142915, now with missing file and apparent
GCC compiler workaround.

llvm-svn: 142931
2011-10-25 17:37:35 +00:00
NAKAMURA Takumi 9a8f13961c Revert r142914 and r142915, due to possibly missing file.
r142914: "Introduce a placeholder type for "pseudo object""
r142915: "Pull the pseudo-object stuff into its own file."
llvm-svn: 142921
2011-10-25 14:32:25 +00:00
John McCall c4a2d3259f Introduce a placeholder type for "pseudo object"
expressions: expressions which refer to a logical rather
than a physical l-value, where the logical object is
actually accessed via custom getter/setter code.
A subsequent patch will generalize the AST for these
so that arbitrary "implementing" sub-expressions can
be provided.

Right now the only client is ObjC properties, but
this should be generalizable to similar language
features, e.g. Managed C++'s __property methods.

llvm-svn: 142914
2011-10-25 07:27:56 +00:00
Fariborz Jahanian ff4d5e4c20 objc rewriter: Restore objc_msgSend_stret/objc_msgSendSuper_stret declaration
to their fragile-abi representation.

llvm-svn: 141735
2011-10-11 23:02:37 +00:00
Fariborz Jahanian 942bbcea25 objc rewriter. Fix declaration of objc_msgSend_stret/objc_msgSendSuper_stret.
Fix an assert crash when casting a CF type to 'id'.
// rdar://10250911

llvm-svn: 141369
2011-10-07 17:17:45 +00:00
John McCall f937c023bf Rename TagDecl::isDefinition -> isCompleteDefinition
for better self-documenting code, since the semantics
are subtly different from getDefinition().

llvm-svn: 141355
2011-10-07 06:10:15 +00:00
Argyrios Kyrtzidis 52f53fb303 Improve location fidelity of objc decls.
-Add the location of the class name to all objc container decls, not just ObjCInterfaceDecl.
-Make objc decls consistent with the rest of the NamedDecls and have getLocation() point to the
 class name, not the location of '@'.

llvm-svn: 141061
2011-10-04 04:48:02 +00:00
Argyrios Kyrtzidis 59ad1e3f57 ArrayRef'ize ObjCMessageExpr
llvm-svn: 140986
2011-10-03 06:36:45 +00:00
Douglas Gregor d0e9e3a6a5 Introduce a pure virtual clone() method to DiagnosticConsumer, so that
we have the ability to create a new, distict diagnostic consumer when
we go off and build a module. This avoids the currently horribleness
where the same diagnostic consumer sees diagnostics for multiple
translation units (and multiple SourceManagers!) causing all sorts of havok.

llvm-svn: 140743
2011-09-29 00:38:00 +00:00
Douglas Gregor c0b07286cf When 'bool' is not a built-in type but is defined as a macro, print
'bool' rather than '_Bool' within types, to make things a bit more
readable. Fixes <rdar://problem/10063263>.

llvm-svn: 140650
2011-09-27 22:38:19 +00:00
David Blaikie b5784324b3 Rename DiagnosticInfo to Diagnostic as per issue 5397
llvm-svn: 140493
2011-09-26 01:18:08 +00:00
David Blaikie 2cb2a836eb Rename IgnoringDiagClient to IgnoringDiagConsumer as per issue 5397
llvm-svn: 140480
2011-09-25 23:44:35 +00:00
David Blaikie e2eefaecc8 Rename DiagnosticClient to DiagnosticConsumer as per issue 5397
llvm-svn: 140479
2011-09-25 23:39:51 +00:00
David Blaikie 9c902b5502 Rename Diagnostic to DiagnosticsEngine as per issue 5397
llvm-svn: 140478
2011-09-25 23:23:43 +00:00
David Blaikie 83d382b1ca Switch assert(0/false) llvm_unreachable.
llvm-svn: 140367
2011-09-23 05:06:16 +00:00
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