Commit Graph

885 Commits

Author SHA1 Message Date
Ted Kremenek 1daa3cfbae TargetInfo no longer includes a reference to SourceManager.
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:

    FullLoc.getManager().someMethod(FullLoc.getLocation());
    
instead we have:

    FullLoc.someMethod();
    
Modified TextDiagnostics (and related classes) to use this short-hand.

llvm-svn: 44957
2007-12-12 22:39:36 +00:00
Steve Naroff f44cb63859 Encode enumeral types.
llvm-svn: 44956
2007-12-12 22:30:11 +00:00
Chris Lattner 7354e6a50e fix typo
llvm-svn: 44932
2007-12-12 08:17:45 +00:00
Chris Lattner 30d23e8289 more cleanups changing things like getInstanceVariables to iterators.
llvm-svn: 44930
2007-12-12 07:56:42 +00:00
Chris Lattner 31bc07e6cf resolve some fixmes and clean up some code by eliminating the get*Vars apis to some classes and use iterators instead.
llvm-svn: 44927
2007-12-12 07:46:12 +00:00
Chris Lattner 854f3167c0 start cleaning up interfaces for objc bits and pieces by switching to an
iterator interface.

llvm-svn: 44926
2007-12-12 07:30:05 +00:00
Ted Kremenek 433a492f53 Added back VisitDeclStmt() to the StmtDumper, essentially reverting r44920:
http://llvm.org/viewvc/llvm-project?rev=44920&view=rev

Putting VisitDeclStmt() was motivated because it called DumpDeclarator(),
which printed out a little bit more information than just using the
child_iterator interface to visit the subexpressions of DeclStmt. To avoid
printing the initializers twice, DumpSubTree() now specially checks for
DeclStmts; in such cases it calls VisitDeclStmt() without using the
child_iterators to visit the subexpressions.

llvm-svn: 44924
2007-12-12 06:59:42 +00:00
Ted Kremenek ee1a988bf6 Removed VisitDeclStmt(). The initializers of a DeclStmt are now automatically
printed out by DumpSubTree() via the child_iterator interface. This fixes a
bug where the initializers were being dumped twice.

llvm-svn: 44920
2007-12-12 06:44:12 +00:00
Chris Lattner 6d513f37c9 Unbreak -stats on cocoa.h
llvm-svn: 44919
2007-12-12 06:43:05 +00:00
Fariborz Jahanian c98d956778 Implemented type checking for pointer of objects of protocol-qualified types.
Note that incompatible-protocol-qualified-types.m is currently failing. This is
unrelated to this patch and Steve is looking at the general problem of not reporting
incompitible pointer types in return stetement..

llvm-svn: 44897
2007-12-12 01:00:23 +00:00
Chris Lattner 255e1323f3 Fix a case where we'd return "is not a constant expr" without
return a location.

llvm-svn: 44889
2007-12-11 23:11:17 +00:00
Ted Kremenek c0870605be Fixed bug in CFG::PopulateBlkExprMap where the ordering
between fetching the size of the expression map (for use as
the next integer id for an Expr*) and the creation of the
entry in the map could be non-deterministic.  This could
cause the size of the map to be incremented prior to the
index being determine.

On Linux the map entry would be created first, causing the
map to the "size" to be incremented prior to it being
queried. On Mac OS X we had the reverse behavior. Now the
size is always queried prior to the new id being inserted
into the map.

This was the real cause of the bit-overrun triggered in
PR 1847:

  http://llvm.org/bugs/show_bug.cgi?id=1847
  
Also reverted the change in patch 44813, which was a bogus
fix to this problem:

  http://llvm.org/viewvc/llvm-project?rev=44813&view=rev

llvm-svn: 44822
2007-12-10 23:58:39 +00:00
Fariborz Jahanian ff6a455c12 Implemented when static typing is combined with protocols and use as receiver
type.

llvm-svn: 44685
2007-12-07 21:21:21 +00:00
Fariborz Jahanian 2bbd03a755 Patch to implement "Protocol" as a built-in type declared as
"@class Protocol;"

llvm-svn: 44670
2007-12-07 00:18:54 +00:00
Chris Lattner b36a98e9a3 Fix a bug handling typedefs of functions, patch by Nuno Lopes!
llvm-svn: 44661
2007-12-06 17:20:20 +00:00
Chris Lattner 9bc22b4838 make it more clear what 'foo' is
llvm-svn: 44653
2007-12-06 04:20:07 +00:00
Steve Naroff 2644aaf537 Recognize CompoundLiteralExpr's as valid lvalue's.
Also updated a FIXME in Sema::CheckInitializer()...

llvm-svn: 44602
2007-12-05 04:00:10 +00:00
Ted Kremenek 90a7c12bb4 Implemented serialization of: ObjCEncodeExpr, ObjCSelectorExpr.
llvm-svn: 44593
2007-12-05 00:43:08 +00:00
Ted Kremenek c8f444ff80 Implemented serialization of ObjCStringLiteral.
llvm-svn: 44568
2007-12-04 00:51:11 +00:00
Ted Kremenek b8714c8ef1 Implemented serialization for ObjcAtThrowStmt.
llvm-svn: 44567
2007-12-04 00:40:49 +00:00
Ted Kremenek 98b3a71537 Implemented serialization of ObjcAtTryStmt.
llvm-svn: 44566
2007-12-04 00:38:30 +00:00
Ted Kremenek ee695a3456 Implemented serialization for ObjcAtFinallyStmt.
llvm-svn: 44564
2007-12-04 00:32:22 +00:00
Ted Kremenek 0bf3e33dcc Implemented serialization for ObjcAtCatchStmt.
llvm-svn: 44563
2007-12-04 00:28:54 +00:00
Bill Wendling db4e34984b Fix for testcase that assigns a dereferenced reference to a pointer. The
standard says that we should adjust the "reference to T" type to "T"
before analysis.

llvm-svn: 44530
2007-12-03 07:33:35 +00:00
Seo Sanghyeon 828429fea9 Fix isStructureType and isUnionType to ignore typedefs, as stated
in the header. Patch by Cédric Venet.

llvm-svn: 44519
2007-12-02 16:57:27 +00:00
Fariborz Jahanian 9fac54d881 Compute side-effect for conditional expression.
llvm-svn: 44492
2007-12-01 19:58:28 +00:00
Chris Lattner ae7a834e74 make the unused expression warning less noisy by not warning about comma exprs whose
LHS and RHS both have side effects.

llvm-svn: 44486
2007-12-01 06:07:34 +00:00
Chris Lattner e69d662bae simplify some code, add support for functions without a proto
llvm-svn: 44485
2007-12-01 05:58:21 +00:00
Anders Carlsson 7a9a38abe0 String literals are always valid LValues.
llvm-svn: 44472
2007-11-30 22:47:59 +00:00
Anders Carlsson 801c5c7467 GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.
llvm-svn: 44462
2007-11-30 19:04:31 +00:00
Ted Kremenek bfcf8cdbd7 Added method "HandleTopLevelDeclaration" to ASTConsumer. This will eventually
be the new hook that ASTStreamer calls to feed top-level Decls to
ASTConsumers.

The difference between "HandleTopLevelDeclaration" and "HandleTopLevelDecl" is
that "HandleTopLevelDecl" is currently called by ASTStreamer for every
top-level declaration, including those that appear within a Decl chain. Using
the new interface, ASTStreamer would only call HandleTopLevelDeclaration for
Decls that appear that the beginning of a Decl chain (i.e., a group of related
decls).

To preserve the behavior that all subclasses of ASTConsumer currently expect,
the default implementation of HandleTopLevelDeclaration simply calls
HandleTopLevelDecl, and for decl chains it calls HandleTopLevelDecl for each
Decl* in a chain of Decls.

The advantage of this interface is that some subclasses of ASTConsumer only
really want the Decl chain, and not each individual Decl passed to them. This
extra level of indirection allows subclasses to override the default behavior
if they so desire.

llvm-svn: 44444
2007-11-29 23:05:17 +00:00
Ted Kremenek 3a2c950401 Added "isExact" field to FloatingLiteral. This flag indicates whether or not
the APFloat representing the parsed literal can represent the literal value
exactly.  This is useful when performing various semantic checks on the code,
and issuing appropriate warnings to users.

llvm-svn: 44423
2007-11-29 00:56:49 +00:00
Anders Carlsson 299f2fc648 Add more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without having to do -arch ppc.
llvm-svn: 44392
2007-11-28 05:19:59 +00:00
Chris Lattner d0d8d4e3b9 fix compilation error noticed by Nuno Lopes
llvm-svn: 44388
2007-11-28 04:30:09 +00:00
Chris Lattner da22eeca44 add several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt
llvm-svn: 44376
2007-11-27 21:35:27 +00:00
Chris Lattner a7944d86de sizeof is defined by bitsin(char) not by units of 8 bits.
llvm-svn: 44369
2007-11-27 18:22:04 +00:00
Chris Lattner db3467f8d4 handle __vector_size__ like vector_size
llvm-svn: 44358
2007-11-27 07:28:18 +00:00
Anders Carlsson 61d6f8d6c3 Add builtin type signature support for vector types. Add correct type signatures for a bunch of MMX builtins. We now parse all the intrinsics in mmintrin.h
llvm-svn: 44357
2007-11-27 07:22:09 +00:00
Ted Kremenek 871422eca9 Removed dependence on #including iostream.
llvm-svn: 44338
2007-11-26 22:50:46 +00:00
Ted Kremenek 2b0ce11952 Reverted changed to getTagDeclType() introduced in patch 44089:
http://llvm.org/viewvc/llvm-project?view=rev&revision=44089

"Decl" once again can no longer be NULL, so the NULL checks are not needed.

llvm-svn: 44336
2007-11-26 21:16:01 +00:00
Ted Kremenek ebb1c0ca74 Fixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
the LHS subexpression can be NULL.  Patch provided by Nuno Lopes!

llvm-svn: 44328
2007-11-26 18:27:54 +00:00
Ted Kremenek 138988765c Fixed bug in CFG construction where we did not properly handle the GCC
extension "?:" for the ternary operator, e.g.: x ?: y; This expression is
represented in the clang ASTs as a ConditionalOperator whose LHS expression is
NULL. Now we handle this special case, causing the block containing the
condition to be a predecessor to the block that "merges" the values of the
ternary operator.

Thanks to Nuno Lopes for identifying and diagnosing this bug!

llvm-svn: 44327
2007-11-26 18:20:26 +00:00
Chris Lattner 852ed06d60 sizeof() return size in bytes, not bits, patch by Nuno Lopes!
llvm-svn: 44316
2007-11-25 17:48:21 +00:00
Anders Carlsson 660bdd1c87 Keep track of whether the asm is volatile or not.
llvm-svn: 44297
2007-11-23 23:12:25 +00:00
Anders Carlsson 94ea8aab34 Store output and input operands as well as clobber information in the AsmStmt. Ted, could you please review the serialization/deserialization code?
llvm-svn: 44266
2007-11-22 01:36:19 +00:00
Anders Carlsson 81a5a69682 Store inline asm code in the AST.
llvm-svn: 44255
2007-11-20 19:21:03 +00:00
Anders Carlsson 9c1011c090 Put back the flags field in the constant CF string type.
llvm-svn: 44222
2007-11-19 00:25:30 +00:00
Ted Kremenek 7016e4d509 Fixed bug in WalkaST_VisitDeclSubExprs where we failed to properly check if
the StmtIterator referring to the initializers of a chain of Decls was equal
to the "end" iterator. The particular bug manifested when an iterator was
created on a chain of decls with no initializers.

Thanks to Nuno Lopes for reporting this bug and providing a patch.

llvm-svn: 44220
2007-11-18 20:06:01 +00:00
Steve Naroff 14f5f79bb6 Now that we are passing back "free standing decls", make sure -ast-dump works like -ast-print.
Also added a cast to be safe...

llvm-svn: 44209
2007-11-17 21:37:36 +00:00
Steve Naroff c1e6d60b14 Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
Adding basic printing to StmtPrinter::PrintRawDecl().

llvm-svn: 44208
2007-11-17 21:21:01 +00:00
Ted Kremenek f115550f6f Added assertion in serialization of DeclRefExprs. DeclRefExprs can only
own the decl they reference if it is a FunctionDecl.  Note that his
ownership property is still considered a hack, and should be fixed.

llvm-svn: 44192
2007-11-16 19:00:35 +00:00
Ted Kremenek 50d7f6f620 Fixed bug in the serialization of FunctionDecls. We would incorrectly
query for the number of parameters for FunctionDecls that had type
FunctionTypeNoProto.

llvm-svn: 44191
2007-11-16 18:11:10 +00:00
Ted Kremenek 07941e21e9 Added hack when serializing DeclRefExprs. This should probably be fixed.
Some FunctionDecls do not appear at the top-level or are owned by a DeclStmt.
In calls to implicitly defined functions, a FunctionDecl is created, but only
the DeclRefExprs reference them. Since an implicitly defined function may be
called multiple times, there is no clear ownership model for such objects.

Temporary solution: when serializing out DeclRefExprs, emit an ownership bit
for the Decl. This bit is determined by querying the serializer to see if the
Decl has already been serialized. If it hasn't, emit the Decl as an owned
pointer.

I repeat: this is a hack.  This should be fixed.

llvm-svn: 44176
2007-11-15 18:26:39 +00:00
Ted Kremenek 4791e1a7bd Started separate section for method definitions for ObjC serialization.
Added missing deserialization case in Stmt::Create() switch statement.

llvm-svn: 44175
2007-11-15 18:10:29 +00:00
Steve Naroff e3ffc2f4a9 Finish up variadic methods/messages.
llvm-svn: 44172
2007-11-15 13:05:42 +00:00
Ted Kremenek cf7a20a6c4 Fixed bug in serialization of EnumConstantDecl where we improperly
"default constructed" an APSInt.  Fixed another bug in the same method
where we did not allow the NextDeclarator to be NULL.

llvm-svn: 44147
2007-11-14 23:38:09 +00:00
Ted Kremenek c77e5a126c Fixed bug when serializing QualTypes where we were serializing in the
qualifiers as part of the pointer address.

llvm-svn: 44146
2007-11-14 23:35:01 +00:00
Ted Kremenek 83b75f5ee8 Added QualType::ReadBackpatch to allow QualType initialization with
backpatching. This original was available, but then we removed it. It is back
again to help with deserialization of FieldDecls. Because FieldDecls are
currently owned by RecordDecls, which are owned by a TagType, the type of the
FieldDecl may not be deserialized prior to deserializing the FieldDecl. Thus
backpatching solves the problem of constructing a FieldDecl that references a
type that has not yet been deserialized.

Simplified serialization of TagType to not require passing in the
SerializedPtrID. Registration of the materialized type object is done after
the CreateImpl method returns (as with other types).

llvm-svn: 44143
2007-11-14 22:51:02 +00:00
Ted Kremenek e25b79ff84 Implemented serialization of InitListExpr.
llvm-svn: 44137
2007-11-14 21:31:46 +00:00
Ted Kremenek 3db07a7016 Implemented serialization of CompoundLiteralExpr.
llvm-svn: 44134
2007-11-14 21:18:36 +00:00
Ted Kremenek fab0c76a25 Added serialization of Union decls.
llvm-svn: 44133
2007-11-14 21:15:42 +00:00
Ted Kremenek 00e0b40599 Removed assertion inserted only for temporary debugging.
llvm-svn: 44131
2007-11-14 19:36:11 +00:00
Ted Kremenek ec56081f38 Added missing break statement.
Reordered serialization methods for FunctionTypeProto and FunctionTypeNoProto
to be alphabetical by serialized type name.

llvm-svn: 44130
2007-11-14 19:33:01 +00:00
Ted Kremenek 26ba7973ea Implemented serialization of EnumDecl and EnumConstantDecl.
llvm-svn: 44127
2007-11-14 18:12:19 +00:00
Ted Kremenek 8e93ca3de5 Implemented serialization of FieldDecls.
llvm-svn: 44126
2007-11-14 17:47:01 +00:00
Ted Kremenek 3c9c7b84fe Implemented serialization of RecordDecls. Changed serialization of TagType to
have an owning pointer to the referred TagDecl. This should hopefully fix a
bug where TagDecls (including decls from structs, etc.) were not serialized.

llvm-svn: 44106
2007-11-14 08:06:37 +00:00
Ted Kremenek 164faf98f3 Implemented serialization of FunctionTypeNoProto.
llvm-svn: 44094
2007-11-14 00:38:50 +00:00
Ted Kremenek 7068cef079 Implemented serialization of VariableArrayTypes.
llvm-svn: 44093
2007-11-14 00:31:36 +00:00
Ted Kremenek eef4a6296f Implemented serialization of TypedefType.
llvm-svn: 44092
2007-11-14 00:27:46 +00:00
Ted Kremenek ea27383d68 Implemented serialization of ConstantArrayType.
llvm-svn: 44091
2007-11-14 00:17:21 +00:00
Ted Kremenek f35e589847 Implemented serialization of TagTypes.
llvm-svn: 44090
2007-11-14 00:03:56 +00:00
Ted Kremenek 919858a428 Modified ASTContext::getTagDeclType() to accept a NULL pointer for the passed
in TagDecl*. This allows the deserializer to use ASTContext to create the
TagTypes. Deserialize TagTypes then rely on pointer-backpatching to resolve
the decls.

This may not be the interface that we want, but as the implementation of
TagTypes will potentially change significantly in the future, I'm leaving this
for now. An appropriate FIXME is in place.

llvm-svn: 44089
2007-11-14 00:03:20 +00:00
Fariborz Jahanian bc92fd7542 Type encoding for structs.
llvm-svn: 44087
2007-11-13 23:21:38 +00:00
Ted Kremenek 049059a7db Implemented serialization of AsmStmt (or rather what is currently implemented
in AsmStmt).

llvm-svn: 44077
2007-11-13 22:55:51 +00:00
Ted Kremenek d86dcfe8ca Fixed bug in FunctionDecl serialization where we crashed when the
FunctionDecl had decls for its parameters but still had greater than 0
arguments.

llvm-svn: 44076
2007-11-13 22:51:08 +00:00
Ted Kremenek da551c3b1e Implemented serialization for SizeOfAlignOfTypeExpr.
llvm-svn: 44075
2007-11-13 22:30:29 +00:00
Ted Kremenek b8f51d5512 Implemented serialization for MemberExpr.
llvm-svn: 44074
2007-11-13 22:16:23 +00:00
Ted Kremenek 24726c3fc9 Rewrote type serialization to used the same methodology as we do for Decls.
Removed tons of dead code in ASTContext concerning how types use to be
serialized.
Removed serialization methods from QualType that are no longer used.

llvm-svn: 44070
2007-11-13 22:02:55 +00:00
Chris Lattner 2f72c427cf improve handling of address of global when checking for
constants and initializers.  Patch by Sanghyeon Seo, thanks!

llvm-svn: 44049
2007-11-13 18:05:45 +00:00
Ted Kremenek e9b83bbd68 Renamed all serialization "Materialize" methods to "Create" to conform with
the new serialization API.

llvm-svn: 44035
2007-11-13 00:25:37 +00:00
Ted Kremenek cd51750512 Restructured serialization code for decls to make it cleaner, easier to
understand, and batched the emission owned subobjects (using
BatchEmitOwnedPtr) to get a smaller output bitcode size.

llvm-svn: 44033
2007-11-13 00:15:39 +00:00
Fariborz Jahanian 21f54eeacf Patch to do statically typed ivar references.
llvm-svn: 44028
2007-11-12 22:29:28 +00:00
Steve Naroff fedb49771d Add category method definitions incrementally, removing a FIXME (like we do for class implementations).
llvm-svn: 44027
2007-11-12 22:05:31 +00:00
Ted Kremenek 0035bf33c4 In Stmt serialization, renamed directEmit to EmitImpl and
directMaterialize to CreateImpl.

llvm-svn: 44020
2007-11-12 18:04:32 +00:00
Steve Naroff b342361c0d Now that we can refer to instance variables, make sure they are considered lvalues.
llvm-svn: 44017
2007-11-12 14:34:27 +00:00
Steve Naroff e46504b278 Implement instance variable references.
llvm-svn: 44016
2007-11-12 14:29:37 +00:00
Steve Naroff e3d1ab29da - Minor cleanup to yesterday's changes to Sema::ObjcActOnStartOfMethodDef();
- Add Sema::CurMethodDecl, in preparation for adding ObjcIvarRefExpr.
- Add ObjcInterfaceDecl::lookupInstanceVariable(), in prep for adding ivars.
- A couple renames in ObjcInterfaceDecl, while I was in the vicinity:-)

llvm-svn: 44015
2007-11-12 13:56:41 +00:00
Steve Naroff cac26f4f5f This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).

Other details...

- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.

llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Steve Naroff 22e078e013 Teach Sema::ActOnInstanceMessage() about private methods. That is, methods declared in an implementation (but not listed in the interface).
This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late).

I will complete this later...

llvm-svn: 43989
2007-11-11 00:10:47 +00:00
Steve Naroff 8570fdec1a Recognize ObjCStringLiteral as a constant expression.
llvm-svn: 43946
2007-11-09 15:00:03 +00:00
Chris Lattner 3a21bd50e7 Fix backwards assert.
llvm-svn: 43894
2007-11-08 17:56:40 +00:00
Ted Kremenek f2d68452c6 Implemented serialization of AddrLabelExpr.
Implemented serialization of ConditionalOperator.
Implemented serialization of StmtExpr.
Fixed bug in serialization of IndirectGoto (did not properly serialize subexpression).

llvm-svn: 43891
2007-11-08 16:32:00 +00:00
Ted Kremenek a34b057762 Revised serialization of CaseStmt to emit all of the owned pointers (its
subexpressions) all together in one block at the end.

llvm-svn: 43862
2007-11-08 00:56:26 +00:00
Ted Kremenek c1cddef7c9 Implemented serialization of CompoundAssignOperator.
llvm-svn: 43860
2007-11-08 00:41:37 +00:00
Ted Kremenek 2419ac8792 Implemented serialization of UnaryOperator.
llvm-svn: 43858
2007-11-08 00:26:24 +00:00
Ted Kremenek 766fc8c14a Implemented serialization of CallExpr.
llvm-svn: 43854
2007-11-07 23:32:20 +00:00
Ted Kremenek 2c325386b8 Implemented serialization of ArraySubscriptExpr.
Added "using ..." for "Serializer" and "Deserializer" to reduce amount
of typing for serialization methods.

llvm-svn: 43849
2007-11-07 22:53:01 +00:00
Ted Kremenek e87ceeeb4a Implemented serialization of CastExpr.
llvm-svn: 43848
2007-11-07 22:42:34 +00:00
Ted Kremenek b2b5e73f89 Implemented serialization of ImplicitCastExpr.
llvm-svn: 43847
2007-11-07 22:39:17 +00:00
Ted Kremenek 9d2bf704de Modified serialization of BinaryOperator and CaseStmt to use the new
BatchEmitOwnedPtrs() and BatchReadOwnedPtrs() methods.

Modified serialization of all Stmts to start their own record in the bitstream.

llvm-svn: 43846
2007-11-07 22:32:23 +00:00
Ted Kremenek d68db575f3 Implemented serialization of StringLiteral.
llvm-svn: 43834
2007-11-07 19:08:19 +00:00
Ted Kremenek f9062be688 Implemented serialization of ImaginaryLiteral.
llvm-svn: 43833
2007-11-07 18:53:02 +00:00
Ted Kremenek 569725f827 Implemented serialization of FloatingLiteral.
llvm-svn: 43832
2007-11-07 18:45:55 +00:00
Fariborz Jahanian 8a348705a8 Fixed an array overflow bug.
llvm-svn: 43826
2007-11-07 17:43:16 +00:00
Ted Kremenek c874c6a959 Implemented serialization of CharacterLiteral.
llvm-svn: 43824
2007-11-07 17:15:49 +00:00
Ted Kremenek 3c58662411 Implemented serialiation of PreDefinedExpr.
llvm-svn: 43823
2007-11-07 17:11:58 +00:00
Ted Kremenek d47c8125a1 Implemented serialization of ContinueStmt.
llvm-svn: 43822
2007-11-07 17:05:07 +00:00
Ted Kremenek 3b4c08deae Implemented serialization of IndirectGotoStmt.
Added "FIXME" regarding the lack of source location information for IndirectGotoStmt.

llvm-svn: 43821
2007-11-07 17:02:32 +00:00
Ted Kremenek 5fd3040c57 Implemented serialization of GotoStmt.
llvm-svn: 43818
2007-11-07 08:07:46 +00:00
Ted Kremenek 35e20410aa Implemented serialization for ForStmt.
llvm-svn: 43817
2007-11-07 08:02:55 +00:00
Ted Kremenek 83e96b8d5a Implemented serialization of DoStmt.
llvm-svn: 43816
2007-11-07 07:53:55 +00:00
Ted Kremenek f6d8ce1052 Implemented serialization for WhileStmt.
llvm-svn: 43815
2007-11-07 07:50:10 +00:00
Ted Kremenek 154c790538 Implemented serialization of IfStmt.
Fixed declarations of several "directEmit" methods of classes that subclass
Stmt that were missing a "virtual" keyword.

llvm-svn: 43814
2007-11-07 07:19:30 +00:00
Steve Naroff 4d7b367652 Teach ASTContext::tagTypesAreCompatible() about the built-in ObjC types (Class and id), removing a bogus warning.
llvm-svn: 43809
2007-11-07 06:03:51 +00:00
Ted Kremenek acb9bcf22a Implemented serialization of SwitchStmt, CaseStmt, BreakStmt, DefaultStmt,
and ParenExpr.

llvm-svn: 43806
2007-11-07 05:25:31 +00:00
Fariborz Jahanian adfbbc3330 AST for objective-c's @throw statement and its pretty-printing.
llvm-svn: 43802
2007-11-07 02:00:49 +00:00
Ted Kremenek a8cdf31aa0 Implemented serialization of LabelStmts.
llvm-svn: 43800
2007-11-07 00:48:04 +00:00
Fariborz Jahanian defbf9a86c Fixed a pretty-printer bug whereby a @try statement with no @finally seg faulted.
llvm-svn: 43798
2007-11-07 00:46:42 +00:00
Ted Kremenek ad1bc400d7 Added serialization/deserialization of NullStmts.
llvm-svn: 43797
2007-11-07 00:40:53 +00:00
Ted Kremenek 80fe8904e1 Added serialization/deserialization of DeclStmts.
Reordered stmt serialization method implementations to be in alphabetical order.

llvm-svn: 43796
2007-11-07 00:37:40 +00:00
Ted Kremenek 148aa5edbc Overhauled serialization of statements. We no longer use specialized SerializeTrait<> classes,
but methods in Stmt (like other objects we are serializing).  Full serialization of all statements
is not yet complete.

llvm-svn: 43793
2007-11-07 00:17:35 +00:00
Ted Kremenek 453ab7d126 Started work on new serialization approach within ASTContext to
serialize Type objects in the order they are serialized in the Types
vector.  We also now rely on the methods within ASTContext to unique
Type objects and handle the actual creation of Type objects (these are
now called by the deserialization code).  This approach solves some
hairy issues with ownership of objects and allows us to naturally
handle recursive types.

llvm-svn: 43787
2007-11-06 22:26:16 +00:00
Ted Kremenek 7c91ccae88 QualType deserialization now requires that the underlying pointer type
must be deserialized without requiring backpatching.

llvm-svn: 43786
2007-11-06 22:23:53 +00:00
Fariborz Jahanian f76f2b0c1c Patch for objc2's property ASTs, as well as pretty-priting the ASTs.
llvm-svn: 43778
2007-11-06 22:01:00 +00:00
Ted Kremenek 77068e17d4 Misc. serialization changes to ASTContext and Decls. Serialization
for ASTContext is still rapidly evolving.

llvm-svn: 43774
2007-11-06 19:51:47 +00:00
Ted Kremenek 72f073acd4 Implemented serialization of TypedefDecls.
Fixed infinite recursion in VarDecl::InternalRead.

llvm-svn: 43739
2007-11-05 21:49:34 +00:00
Ted Kremenek 7f6e70c5c2 Added skeleton for dispatch of Decl serialization.
llvm-svn: 43737
2007-11-05 21:38:00 +00:00
Ted Kremenek 58473ab478 For serialization of ASTContext, added special-casing of serialization
of type sets when emitting complex types and pointer types that are
also considered builtins.  These types are automatically created in
the ctor of ASTContext, and thus should not be serialized (was
producing an error during deserialization).

llvm-svn: 43733
2007-11-05 20:49:23 +00:00
Steve Naroff 66697aa72f Add a method prototype slot/getter to the ObjCMessageExpr AST.
llvm-svn: 43666
2007-11-03 16:37:59 +00:00
Steve Naroff a397efd915 Implement rewrite rules for ObjC string constants.
llvm-svn: 43665
2007-11-03 11:27:19 +00:00
Fariborz Jahanian 8815795049 pretty-print @try/@catch/@finally from AST as the validation of AST.
llvm-svn: 43649
2007-11-02 18:16:07 +00:00
Ted Kremenek dda9a56975 Added most of the boilerplate code for Decl serialization. Still a few
key functions to implement.

llvm-svn: 43648
2007-11-02 18:05:11 +00:00
Fariborz Jahanian 9e63b98de7 AST build for @catch clause (this is work in progress).
llvm-svn: 43628
2007-11-01 23:59:59 +00:00
Ted Kremenek 5e2eb261af Simplified Serialization code for SourceLocation and SourceRange, and
updated it to the recently updated Serialization API.

Changed clients of SourceLocation serialization to call the
appropriate new methods.

Updated Decl serialization code to put new skeleton serialization code
in place that is much better than the older trait-specialization
approach.

llvm-svn: 43625
2007-11-01 22:25:41 +00:00
Fariborz Jahanian 65590b2504 Bunch of class declarations for objective-c's @try-catch statement.
llvm-svn: 43623
2007-11-01 21:12:44 +00:00
Devang Patel e11664a0ef Rename classes and collections that maintain record layout information.
Now, at AST level record info is maintained by ASTRecordLayout class.
Now, at code gen  level record info is maintained by CGRecordLayout class.

llvm-svn: 43619
2007-11-01 19:11:01 +00:00
Ted Kremenek 26a7f3fd56 Implemented serialization of QualTypes within ASTContext. Clarified
ownership model of some type pointers.  Added FIXMEs to serialization.

Added comments to ASTContext indicating which variables we are intentionally
*not* serializing.

llvm-svn: 43618
2007-11-01 18:11:32 +00:00
Fariborz Jahanian ac73ff8868 Remaining work to collect objective-c's type qualifiers and use them to encode
method types.

llvm-svn: 43617
2007-11-01 17:18:37 +00:00
Ted Kremenek 53155f379e Changed serialization/deserialization of BuiltinTypes to explicitly serialize
each type.  This ensures that the order in which the types are serialized
is clear and remains persistent.

llvm-svn: 43615
2007-11-01 17:10:34 +00:00
Chris Lattner b338a6b9f3 add support for vector type compatibility checking. Patch by Nate Begeman.
llvm-svn: 43604
2007-11-01 05:03:41 +00:00
Chris Lattner c3ebf29ef6 Implement test/Sema/init.c by treating functions as constants.
llvm-svn: 43599
2007-11-01 02:45:17 +00:00
Ted Kremenek 6aff871a84 Implemented more of serialization/deserialization for ASTContext. We now
(hypothetically) read in/write out most of the types.  Bugs likely exist.

llvm-svn: 43584
2007-10-31 22:44:07 +00:00
Ted Kremenek c55cd9a38a Adjusted QualType deserialization to reflect updated deserialization API.
We now serialize ivar references inside of ASTContext.

llvm-svn: 43571
2007-10-31 20:00:03 +00:00
Ted Kremenek e32c067cc4 Preliminary support for serializing statements.
llvm-svn: 43566
2007-10-31 18:41:19 +00:00
Ted Kremenek 9cc9335bdf Implemented serialization of Variable Array Types (VLAs).
llvm-svn: 43561
2007-10-31 17:50:23 +00:00
Ted Kremenek fc581a9a89 Renamed ivar "ArrayTypes" in ASTContext to "ComplexArrayTypes".
Added skeleton code for serialization of ASTContext.

llvm-svn: 43558
2007-10-31 17:10:13 +00:00
Anders Carlsson f56a7aee2f Encode Class, SEL and Objective-C objects.
llvm-svn: 43540
2007-10-31 02:53:19 +00:00
Chris Lattner 595db86c9d __real__ and __imag__ can be lvalues. Add support to ast and codegen for them.
llvm-svn: 43525
2007-10-30 22:53:42 +00:00
Ted Kremenek 4c0ef37fbb Refactored CFG construction code that processes DeclStmts to use StmtIterator.
Now CFG construction transparently supports Variable Length Array declarations
with expressions for their sizes, and typedefs that include VLAs.

llvm-svn: 43520
2007-10-30 21:48:34 +00:00
Chris Lattner e0218997ab minor code cleanup
llvm-svn: 43512
2007-10-30 20:27:44 +00:00
Fariborz Jahanian 509d8d6fc6 Added type encoding for 'id' type.
llvm-svn: 43504
2007-10-30 17:06:23 +00:00
Ted Kremenek 9139310c76 Added vector to ASTContext to store references to "complete" VLA types
(VLAs with a specified size expresssion).  This vector owns the
references to these type objects.

llvm-svn: 43502
2007-10-30 16:41:53 +00:00
Steve Naroff 5448cf6d61 - Add location info to category/protocol AST's
- Rewrite categories.

llvm-svn: 43501
2007-10-30 13:30:57 +00:00
Steve Naroff c54840433f More support for rewriting ObjC intefaces. Still some edge cases to handle...
llvm-svn: 43493
2007-10-30 02:23:23 +00:00
Anders Carlsson df4cc6160f Handle function types.
llvm-svn: 43485
2007-10-30 00:06:20 +00:00
Ted Kremenek 843ebedde4 VariableArrayTypes (VLAs) without a size expression are now uniqued
and inserted into a FoldingSet owned by ASTContext.

llvm-svn: 43482
2007-10-29 23:37:31 +00:00
Fariborz Jahanian 797f24cd7e Encoding for objectiive-c methods.
llvm-svn: 43481
2007-10-29 22:57:28 +00:00
Steve Naroff 33a1e80dd1 This commit contains lot's of small tweaks to how we pass around and store SourceLocation's for interfaces/protocols/categories/implementations.
llvm-svn: 43475
2007-10-29 21:38:07 +00:00
Ted Kremenek 31974dfcdf Added support for StmtIterators to iterate over the size expressions
of VariableArrayTypes that appear in TypedefDecls.

for example:

  typedef int T[x][x];

the StmtIterator will iterate over "x" and "x" as subexpressions of
the DeclStmt for T.

llvm-svn: 43474
2007-10-29 21:38:03 +00:00
Ted Kremenek 899ef13376 Fixed deadcode bug where check for NULL decl occured within a block
where the decl would always be non-NULL.  Moved the check to after the
block to properly tidy up the iterator's state.

llvm-svn: 43473
2007-10-29 21:23:58 +00:00
Ted Kremenek 2f70e71dcc Modified StmtIterator to support iteration over the size expressions
of VariableTypeArray types that appear in DeclStmts.

Removed operator-- from StmtIterator.  operator-- added undesired
complexity, and we have no consumers of it.

llvm-svn: 43471
2007-10-29 20:50:16 +00:00
Ted Kremenek 6d845f0414 Modified CFG pretty-printing to directly use the (reverse) body
iterator of a CompountStmt instead of relying on StmtIterators.

llvm-svn: 43469
2007-10-29 20:41:04 +00:00
Ted Kremenek a80b257a21 Renamed internal variables of StmtIteratorBase to make the code
slightly more succinct.

Introduced VariableArrayType* within StmtIteratorBase to (soon)
support iteration over the size expressions of variable length arrays.

llvm-svn: 43455
2007-10-29 18:04:38 +00:00
Anders Carlsson 18acd44514 Address Chris's comments.
llvm-svn: 43445
2007-10-29 06:33:42 +00:00
Anders Carlsson 0f1cacd049 Fix logic error.
llvm-svn: 43443
2007-10-29 05:58:43 +00:00
Anders Carlsson d849982e84 Add (partial) support for @encode.
llvm-svn: 43439
2007-10-29 05:01:08 +00:00
Chris Lattner cc779571b8 Add prototype info for __builtin_memcpy, reducing #diagnostics from 37 to 34 on
PR1750

llvm-svn: 43435
2007-10-29 04:18:06 +00:00
Chris Lattner 73c56c0735 Implement *skeletal* support for representing GNU inline asm stmts in the AST,
resolving a crash on a .i file in PR1750.  We now generate 49 errors on the
.i file in that bug.

llvm-svn: 43433
2007-10-29 04:04:16 +00:00
Chris Lattner 1159f065be Fix a major bug in the Type::getAs*Type methods: they didn't strip off
typeof(type) and typeof(expr) correctly.  Now provide a single point of
contact (Type::getDesugaredType) for doing the shallow stripping we need.

llvm-svn: 43432
2007-10-29 03:41:11 +00:00
Anders Carlsson 7080597adf Add BuiltinType::Char_S to Type::isCharType
llvm-svn: 43428
2007-10-29 02:52:18 +00:00
Ted Kremenek b6fafb6bf0 Implemented serialization for TypedefType.
llvm-svn: 43423
2007-10-28 21:21:04 +00:00
Ted Kremenek 3fd831fd14 Implemented serialization of FunctionTypeProto.
llvm-svn: 43419
2007-10-28 00:59:26 +00:00
Ted Kremenek d33b4adaed Implemented serialization of FunctionTypeNoProto.
llvm-svn: 43418
2007-10-27 19:58:08 +00:00
Ted Kremenek 3e6c227f97 Implemented serialization for VectorType.
llvm-svn: 43417
2007-10-27 19:05:09 +00:00
Ted Kremenek 8e8bf5d0bf More work on type serialization: added support for serializing BuiltinTypes.
llvm-svn: 43414
2007-10-26 23:52:52 +00:00
Ted Kremenek 6698b43389 Completed serialization of ConstantArrayTypes (now that APInt serialization is in place).
llvm-svn: 43407
2007-10-26 22:00:08 +00:00
Ted Kremenek 16c7d8ce5b Added skeleton implementation of serialization for types (not complete).
llvm-svn: 43397
2007-10-26 20:24:35 +00:00
Hartmut Kaiser d57aca25fc Disambiguated variable name to comply with VC++'s archaic variable scoping rules.
llvm-svn: 43371
2007-10-25 22:59:17 +00:00
Ted Kremenek 066f60321d Modified StmtIterator to now include visiting the initialization expression for EnumConstantDecls.
llvm-svn: 43366
2007-10-25 22:24:19 +00:00
Ted Kremenek 1f1e756483 Added skeleton for Decl serialization.
llvm-svn: 43361
2007-10-25 21:37:16 +00:00
Chris Lattner 35e564ed09 Add a new ChooseExpr::isConditionTrue method to unify
some code.

llvm-svn: 43322
2007-10-25 00:29:32 +00:00
Ted Kremenek 38f87dd9d0 Modified operator* for StmtIterator to return Stmt*& instead of Stmt*.
This permits in-place replacement of the original AST statements.

llvm-svn: 43295
2007-10-24 16:52:34 +00:00
Ted Kremenek 04746ce6f9 Fixed DeclStmt::child_begin() to actually create an iterator that
visits its decls, rather than just creating an "end()" iterator.

Fixed child_end() for statements and expressions to use
child_iterator() to create the end() iterator, rather than just
returning NULL.

Fixed bug in StmtIterator where we did not correctly detect if we had
marched off the end of the ScopedDecls.

llvm-svn: 43156
2007-10-18 23:28:49 +00:00
Chris Lattner 0d466153b9 remove dead #include
llvm-svn: 43149
2007-10-18 21:23:00 +00:00
Ted Kremenek 2ba761c7b8 Refactored StmtIterator into classes StmtIteratorBase (non-templated)
and StmtIteratorImpl (templated), which StmtIterator and
ConstStmtIterator now succintly subclass.

Implemented iteration over the initializers in DeclStmts.  This is not
thoroughly tested, so there may be bugs.

llvm-svn: 43138
2007-10-18 18:19:31 +00:00
Ted Kremenek 614d84aab3 Replaced virtual method call to child_begin() in child_end() by
directly inlining its logic.

llvm-svn: 43137
2007-10-18 18:17:43 +00:00
Ted Kremenek 7aef89101d Fixed broken build.
llvm-svn: 43132
2007-10-18 16:25:40 +00:00
Chris Lattner c7f3981b27 remove extraneous space in @selector()
llvm-svn: 43110
2007-10-18 00:39:29 +00:00
Ted Kremenek 336886a344 Implemented 90% functionality of new child_iterator for Stmt objects
that will (soon) allow iteration over the initializers in
declarations.  This new iterator mechanism is implemented by the
classes StmtIterator and ConstStmtIterator.

Patched a few files to use "operator++" instead of "operator+" on
child_iterators.

Friendship added in VarDecl to StmtIterator to allow returning a
reference to the initializer within the VarDecl.  We may not wish this
as a permanent solution.

llvm-svn: 43105
2007-10-18 00:24:38 +00:00
Chris Lattner 9c0f9fe151 Make control flow in Expr::isConstantExpr more simple and
local, making the code easier to read.

llvm-svn: 43104
2007-10-18 00:20:32 +00:00
Ted Kremenek 5c84c01c8b Fixed includes of "clang/AST/DeclObjC.h" to work on case-sensitive
filesystems (was "#include "clang/AST/DeclObjc.h", which worked fine
on a case-insensitive HFS+ volume on the Mac).

llvm-svn: 43080
2007-10-17 18:36:42 +00:00
Fariborz Jahanian a32aaefadc Implementation of AST for @protocol expression.
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Anders Carlsson f94cd1ffe6 Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Chris Lattner a7c19feca2 Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.

llvm-svn: 43047
2007-10-16 22:36:42 +00:00
Fariborz Jahanian 923aebe09c Steve, pointer out that getName() is available for selectors. Made code much smaller, thanks.
llvm-svn: 43042
2007-10-16 21:07:53 +00:00
Fariborz Jahanian 81ccd88f0e Fix problem dumping/printing method names with null selector.
llvm-svn: 43039
2007-10-16 20:52:13 +00:00
Fariborz Jahanian 4bef462a3e Patch to implement AST generation for objective-c's @selector expression.
llvm-svn: 43038
2007-10-16 20:40:23 +00:00
Steve Naroff f73b784a5e Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.

I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).

llvm-svn: 43021
2007-10-15 23:35:17 +00:00
Steve Naroff 32e44c0032 Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Anders Carlsson 7e13ab88a2 Add code generation and sema checking for __builtin_va_arg.
llvm-svn: 43006
2007-10-15 20:28:48 +00:00