Commit Graph

885 Commits

Author SHA1 Message Date
Steve Naroff c6edcbdb5d Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...

llvm-svn: 45784
2008-01-09 22:43:08 +00:00
Chris Lattner 119d81a4f4 Fix isIntegerConstantExpr to compare against zero for casts to bool instead of
truncating.  This allows us to compile:
 void foo() {
  static _Bool foo = 4;
}

into:
@foo1 = internal global i8 1
instead of:
@foo1 = internal global i8 4

llvm-svn: 45779
2008-01-09 18:59:34 +00:00
Steve Naroff 66a26044f8 Teach Expr::isConstantExpr() about CompoundLiterals.
llvm-svn: 45764
2008-01-09 00:05:37 +00:00
Ted Kremenek 83ebcef8ae Added VISIBILITY_HIDDEN to classes/structs in anonymous namespace.
llvm-svn: 45749
2008-01-08 18:15:10 +00:00
Fariborz Jahanian 6917870be5 Verify/add code to make sure types passed to interfaceTypesAreCompatible
are canonical. Asst in interfaceTypesAreCompatible if they are not.

llvm-svn: 45717
2008-01-07 20:12:21 +00:00
Ted Kremenek 1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Ted Kremenek dabea046f6 Minor tweak to serialization of ObjcForCollectionStmt: the three owned pointers
are now emitted in a batch, which reduces the metadata overhead in the
serialized bitcode.

llvm-svn: 45710
2008-01-07 18:35:04 +00:00
Ted Kremenek e84b32e506 Moved serialization code for ObjcForCollectionStmt to be in alphabetical order
with the rest of the Objective-C serialization code.

llvm-svn: 45609
2008-01-05 00:57:49 +00:00
Fariborz Jahanian 3622e5954b Minor changes as suggested by Chris L.
llvm-svn: 45598
2008-01-04 23:04:08 +00:00
Fariborz Jahanian c89ea091a2 Couple more uninitialized before use warning elimination.
llvm-svn: 45547
2008-01-03 20:04:58 +00:00
Fariborz Jahanian 243c611a05 Remove cause of misc. "variable might be used uninitialized in this function" warnings.
llvm-svn: 45546
2008-01-03 20:01:35 +00:00
Fariborz Jahanian 8361552af9 New declarations/defs for Objc2's foreach-statement. This is work in progress.
llvm-svn: 45511
2008-01-02 22:54:34 +00:00
Chris Lattner 7977cca8e8 Fix PR1895: a crash on an ugly gcc extension.
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Chris Lattner 266a2ff3ac Compute the proper sourcerange for an CompoundLiteralExpr.
llvm-svn: 45504
2008-01-02 21:46:24 +00:00
Chris Lattner 5926c0ebfb remove attribution from makefiles.
llvm-svn: 45412
2007-12-29 20:02:25 +00:00
Chris Lattner 5b12ab8c93 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Christopher Lamb c5fafa211a Fix OCUVector case in struct layout code.
llvm-svn: 45396
2007-12-29 05:10:55 +00:00
Chris Lattner e4407ede20 Add accessors + iterator interface.
llvm-svn: 45378
2007-12-28 05:25:02 +00:00
Fariborz Jahanian a7c705ddca This patch implements some of the more obscure type-checking involving
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.

llvm-svn: 45294
2007-12-21 22:22:33 +00:00
Ted Kremenek 93e2031187 Fixed successor order for CFG basic blocks when handling: x && y. The bug
is best explained by illustration:

[ B2 ]
     1: x
     T: [B2.1] && ...
   Predecessors (1): B4
   Successors (2): B3 B1

Block "B3" should be the block where we evaluate "y" when "x" evaluates to
true. Previously we had the successor list reversed. Now this behavior matches
with how we handle other conditional branches.

Thanks to Nuno Lopes for reporting this problem.

llvm-svn: 45288
2007-12-21 19:49:00 +00:00
Fariborz Jahanian 56b5c96ef7 Patch to compare to objective-c static types where one or the other
(but not both) may be a protocol qualified static type.

llvm-svn: 45283
2007-12-21 17:34:43 +00:00
Fariborz Jahanian ff7d2bf255 More objective-c type analysis. This time involving objective types
of conforming protocols (or not).

llvm-svn: 45276
2007-12-21 00:33:59 +00:00
Fariborz Jahanian 4368af07a7 More objective-c type checking. This time comparing objective-c known objects.
llvm-svn: 45269
2007-12-20 22:37:58 +00:00
Ted Kremenek 71d643f8b1 Converted uses of scoped_ptr to OwningPtr.
llvm-svn: 45265
2007-12-20 19:47:16 +00:00
Fariborz Jahanian 63b19f1b6e Patch to do type-checking for objctive-c's object types.
More is yet to come.

llvm-svn: 45263
2007-12-20 19:24:10 +00:00
Steve Naroff fa5751f842 Various tweaks to the get/lookup instance/class method API's.
llvm-svn: 45224
2007-12-19 22:27:04 +00:00
Ted Kremenek 6c7807716b Removed "SourceFile" from TranslationUnit. This same information will (soon)
be available by querying the SourceManager within the ASTContext referenced by
the TranslationUnit.

llvm-svn: 45223
2007-12-19 22:24:34 +00:00
Ted Kremenek 0061aeb316 Removed storing inode and device number in TranslationUnit.
Added "SourceFile" string to TranslationUnit to record corresponding
source file.

Updated serialization of TranslationUnits and logic in the driver to
correctly pass the source file information to the serializer.

llvm-svn: 45211
2007-12-19 19:27:38 +00:00
Chris Lattner 6a4f74593c fix some crazy indentation
llvm-svn: 45210
2007-12-19 19:23:28 +00:00
Fariborz Jahanian a1e3420c49 This patch concludes implementation of dynamic objective-c type qualified by
protocol list.

llvm-svn: 45203
2007-12-19 17:45:58 +00:00
Ted Kremenek f70d24d2ae Moved ReadBitcodeFile and EmitBitcodeFile out of TranslationUnit and made them
the standalone functions ReadASTBitcodeFile and EmitASTBitcodeFile
respectively.

llvm-svn: 45180
2007-12-18 21:44:50 +00:00
Ted Kremenek 25dbd71a4c Fixed broken includes introduced by recent (incomplete) patch to
TranslationUnit.

llvm-svn: 45177
2007-12-18 21:36:21 +00:00
Ted Kremenek afb98f9c09 Moved TranslationUnit.h to include path.
llvm-svn: 45176
2007-12-18 21:34:50 +00:00
Ted Kremenek 879b75018f Moved TranslationUnit from Driver to AST library.
llvm-svn: 45175
2007-12-18 21:34:28 +00:00
Fariborz Jahanian 9f0e310861 Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Chris Lattner d4fc27e937 remove the loc argument to Type::isConstantSizeType, which isn't useful.
llvm-svn: 45155
2007-12-18 07:18:16 +00:00
Chris Lattner 20aad334c7 Fix the location we emit the "not a constant" error for this:
int foo() {
  typedef int x[foo()];
  static int y = sizeof(x);
}

previously we'd emit it on the typedef, which made not sense at all.

llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner 6d2d1b67ca Fix PR1863: an assertion due to not setting a location on return from
this method.

llvm-svn: 45153
2007-12-18 07:03:30 +00:00
Fariborz Jahanian 9b482ba9ec Fixed a comment describing a function
llvm-svn: 45125
2007-12-17 21:48:49 +00:00
Fariborz Jahanian 24cb52c9b0 Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).

llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Ted Kremenek a59e0064d3 Removed CFG.cpp's dependence on #including iostream.
llvm-svn: 45116
2007-12-17 19:35:20 +00:00
Ted Kremenek 05821322b4 Fixed another case where sizeof() returns the size in bytes, not bits.
This parallels a previous patch (duplicate logic caused the bug to appear
in multiple locations):
 
  r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev).

Patch provided by Nuno Lopes.

llvm-svn: 45098
2007-12-17 17:38:43 +00:00
Ted Kremenek 56ba5b3931 Removed "isSizeOfExpr" mode from StmtIterator. It turned out not to be
so useful and introduced a few bugs.

llvm-svn: 45051
2007-12-15 00:39:18 +00:00
Ted Kremenek 3291844bf0 Added "mode" to StmtIterator to record if the expression being iterated
over is the subexpression of a sizeof(expression).  Different clients
will wish to handle iteration over such subexpressions differently, and can
now easily query if they are iterating over such statements using the
StmtIterator's inSizeOfExpr().

llvm-svn: 45047
2007-12-14 23:40:56 +00:00
Steve Naroff 3ce37a6b8e - Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class.
- Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage.
- Various changes to convert all clients to the above API's...
 

llvm-svn: 45046
2007-12-14 23:37:57 +00:00
Ted Kremenek 85e45f278c Added support to StmtIterator to traverse the size expression of a VLA type
declared in a sizeof.  For example:

 sizeof(int[foo()]);

the expression "foo()" is an expression that is executed during the evaluation
of sizeof.

llvm-svn: 45043
2007-12-14 22:52:23 +00:00
Ted Kremenek 7d9a2e119d CFG bug fix: for sizeof(expressions), don't expand the control-flow
of "expressions", since they are not really evaluated.

llvm-svn: 45015
2007-12-13 22:44:18 +00:00
Fariborz Jahanian c47dc4f5af Patch to make ObjcQualifiedInterfaceType inherit ObjcInterfaceType
llvm-svn: 45014
2007-12-13 20:47:42 +00:00
Ted Kremenek 136a37f1eb Updated serialization of ParmVarDecl to serialize out objcDeclQualifier.
Previously this field was serialized out in VarDecl (a parent class), but
now the field belongs to ParmVarDecl.

llvm-svn: 44989
2007-12-13 06:28:13 +00:00
Fariborz Jahanian 885890a47a Moved ObjcDeclQualifier to ParmVarDecl from VarDecl.
Ted, this change necessitates (de)/serialization of ParmVarDecl.

llvm-svn: 44972
2007-12-13 00:54:18 +00:00
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