Commit Graph

3063 Commits

Author SHA1 Message Date
Anders Carlsson 8e1d8cf241 Implement __builtin_ia32_mulps.
llvm-svn: 44745
2007-12-09 21:51:19 +00:00
Anders Carlsson a020c43034 Generate code for target specific intrinsics.
llvm-svn: 44744
2007-12-09 21:20:04 +00:00
Chris Lattner 3ed83c1c0f The flags on tokens indicate whether they are the start of a *physical* line,
not the start of a logical line.  Be careful about this distinction, which 
affects when newlines are printed and when paste-avoidance happens, etc.  
This fixes PR1848, thanks to Neil for noticing this!

llvm-svn: 44743
2007-12-09 21:11:08 +00:00
Chris Lattner 84f450789a Fix a pretty big but subtle bug counting the number of newlines to emit.
This would cause us to emit different code (in -E mode) for these two files:

---
#define t(x) x

t(a
3)
---
#define t(x) x
t(a
3)
---

In one case, -E would print "a\n3", in the other it printed "a3".  Now
it prints "a3" for both.

This is part of PR1848.

llvm-svn: 44742
2007-12-09 20:45:43 +00:00
Chris Lattner 615315f307 Add dumping support for locations, make -dumptokens print out the location
info of each token.

llvm-svn: 44741
2007-12-09 20:31:55 +00:00
Chris Lattner 93cd101e5c Fix typo noticed by Nico Weber
llvm-svn: 44739
2007-12-09 17:50:14 +00:00
Chris Lattner 7566350b74 many edits to the main page, add a prominant 'status' section.
llvm-svn: 44737
2007-12-09 09:05:23 +00:00
Chris Lattner d93d0fc79a unindent, don't zap whitespace before/after paragraphs.
llvm-svn: 44736
2007-12-09 08:40:26 +00:00
Chris Lattner dffc79530a simplify the menu css, make it a bit more attractive.
llvm-svn: 44735
2007-12-09 08:38:01 +00:00
Chris Lattner fc3b9bfea8 cleanup some markup, e.g. & -> &
llvm-svn: 44734
2007-12-09 08:17:09 +00:00
Chris Lattner 9c4aad2dba avoid ///usr/include/foo.h, patch by Sean Middleditch
llvm-svn: 44731
2007-12-09 00:39:55 +00:00
Chris Lattner 283d094b75 implement support for functions that initialize globals.
llvm-svn: 44730
2007-12-09 00:36:01 +00:00
Anders Carlsson 050f494f66 Add getTargetPrefix to TargetInfo, to be used with target specific intrinsics.
llvm-svn: 44712
2007-12-08 19:32:57 +00:00
Fariborz Jahanian 8ea0779624 Test case for my last patch for implementation of static protocoled type
used as reciver type of a message expression.

llvm-svn: 44693
2007-12-08 01:00:55 +00:00
Steve Naroff 1f6ed92dbb Omit the field name when including the super class structure template.
This allows us to access a superclasses ivars without deriving the absolute path.

The comments below say a bit more...

llvm-svn: 44688
2007-12-07 22:15:58 +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
Steve Naroff 2c20c38ced Have Sema::CheckConstantInitList skip semantic analysis when the element type is a record (until we implement the FIXME). This removes a bogus error for the following code...
snarofflocal% cat bug.m

#import <Foundation/NSGeometry.h>

#define NUMHELICOPTERRECTS 5

static NSRect helicopterRects[NUMHELICOPTERRECTS] = {
    {{27, 0}, {18, 11}},	// Bottom
    {{0, 8}, {4, 11}},		// Tail
    {{0, 16}, {50, 1}},
    {{22, 5}, {18, 12}},	// Body
    {{0, 10}, {42, 3}}
};

llvm-svn: 44684
2007-12-07 21:12:53 +00:00
Steve Naroff 888f33cc44 Lookup methods in the global pool even when a statically typed object's class interface isn't in scope!
As the comment in the code indicates, I'm not fond of this. Nevertheless, gcc compat is a goal.

Here is the case I'm talking about...

#import <Foundation/Foundation.h>

@interface AnyClass : NSObject
- (NSRect)rect;
@end

@class Helicopter;

static void func(Helicopter *obj) {
  NSRect r = [obj rect];
}

...before this patch, we would warn/error. With this patch, everything "just works".

llvm-svn: 44682
2007-12-07 20:41:14 +00:00
Fariborz Jahanian 33c0e815f3 Patch for rewriting of @protocol.
llvm-svn: 44681
2007-12-07 18:47:10 +00:00
Steve Naroff b2f8ff153d Rewrite 'super' within a class method. This required some minor tweaks to the front-end.
llvm-svn: 44673
2007-12-07 03:50:46 +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
Anders Carlsson 10c6110fca Add workaround to get test/Parser/compound_literal.c working again.
llvm-svn: 44666
2007-12-06 20:10:20 +00:00
Fariborz Jahanian 227c0d13bc On Steve's suggestion, moved handling of use of undeclared method in a message
to rewriter (my previous patch).

llvm-svn: 44665
2007-12-06 19:49:56 +00:00
Devang Patel 65a2288eef More struct bitfields layout work. Now handle,
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4} stb2;

llvm-svn: 44664
2007-12-06 19:16:05 +00:00
Fariborz Jahanian 6b644a6e05 test case for my very last patch.
llvm-svn: 44662
2007-12-06 17:43:04 +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
Fariborz Jahanian c277f6f351 A missing method in a messaging expression issues a warning, clients must not
crash because of this.

llvm-svn: 44648
2007-12-06 01:37:55 +00:00
Ted Kremenek 260d01d6e6 Subdivided the function InitializeBaseLanguage into InitializeBaseLanguage,
GetLanguage, and InitializeLangOptions.  The goal is to break up this logic
into atomic units of functionality that can later be refactored into better
driver logic that is capable of handling a mixture of source files of
different languages.

llvm-svn: 44642
2007-12-05 23:49:08 +00:00
Chris Lattner 2ed8f31f2f Avoid passing Diags into InitializeIncludePaths.
llvm-svn: 44639
2007-12-05 23:24:17 +00:00
Steve Naroff 152dd812b2 Make sure Parser::ParseObjCSelectorExpression() handles unary selectors (with no arguments) properly.
llvm-svn: 44636
2007-12-05 22:21:29 +00:00
Ted Kremenek cdcf6dcbcb Removed dependence on including iostream (use llvm/Support/Streams.h instead).
llvm-svn: 44635
2007-12-05 22:21:13 +00:00
Ted Kremenek e095881856 Converted SerializationTest (--test-pickling) to use the new TranslationUnit
class to serialize and deserialize translation units.

llvm-svn: 44634
2007-12-05 22:08:43 +00:00
Steve Naroff ff9f8efe4d Make sure the class methods get attached to the metaclass object.
Need to query the implementation, not the interface...

llvm-svn: 44633
2007-12-05 21:49:40 +00:00
Ted Kremenek 68d232b477 Added Driver/TranslationUnit.h and Driver/TranslationUnit.cpp to the
XCode project.

llvm-svn: 44632
2007-12-05 21:36:57 +00:00
Ted Kremenek 62f4302ec7 Added "TranslationUnit" class that will be used to provide an interface
for serializing/deserializing ASTs that is decoupled from the logic
in SerializationTest (which will soon be rewritten to use this interface).

llvm-svn: 44631
2007-12-05 21:36:08 +00:00
Ted Kremenek dd1a7aade5 Modified: CreateTargetInfo(). Now takes Diagnostic* instead of Diagnostic&.
Modified: ctor of SerializationTest: Now takes LangOptions argument.  We
          will eventually serialize this as well.

llvm-svn: 44630
2007-12-05 21:34:36 +00:00
Ted Kremenek 2968476c2d Added Basic/LangOptions.cpp to XCode project.
llvm-svn: 44625
2007-12-05 19:07:32 +00:00
Ted Kremenek ae492c4f0c Implemented serialization of LangOptions.
llvm-svn: 44624
2007-12-05 19:06:15 +00:00
Chris Lattner 36021a9cc1 I'm apparently the only sad lonely ppc user left :)
llvm-svn: 44622
2007-12-05 18:41:05 +00:00
Ted Kremenek a4c13bd94b Moved creation of ASTConsumers that can operate on both freshly-parsed and
deserialized ASTs into the function CreateASTConsumer().  This function
is called by ProcessInputFile, and soon the logic that processes deserialized
ASTs.

llvm-svn: 44618
2007-12-05 18:27:04 +00:00
Fariborz Jahanian b31a2f2a47 Patch to prevent crash on use of objc2 syntax.
llvm-svn: 44617
2007-12-05 18:16:33 +00:00
Fariborz Jahanian d5db92ba97 Changed type-cast of "struct objc_super"'s 2nd initializer to match definition of
"struct objc_super".

llvm-svn: 44616
2007-12-05 17:29:46 +00:00
Chris Lattner 6eed001371 fix some bogus code noticed by Kevin Andre
llvm-svn: 44615
2007-12-05 17:21:34 +00:00
Anders Carlsson a297e7a888 Implement CodeGen for vectors. Don't create unnecessary conversion instructions if the value to be converted is a constant.
llvm-svn: 44606
2007-12-05 07:36:10 +00:00
Anders Carlsson 2c1ec6d5f7 Add sema checking for compound literal expressions.
llvm-svn: 44605
2007-12-05 07:24:19 +00:00
Anders Carlsson e8ee04c0bc Implement codegen for builtin infinity functions.
llvm-svn: 44604
2007-12-05 07:22:48 +00:00
Anders Carlsson cbdb6f5b5d Revert DidWarn change - It won't catch all cases anyway and GCC warns for every excess element. Maybe later we can add back the limit and make it smarter.
llvm-svn: 44603
2007-12-05 04:57:06 +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 166e505d27 Added serialization support of SourceManager to the clang driver.
llvm-svn: 44592
2007-12-05 00:26:13 +00:00
Ted Kremenek e634142388 Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with
the deserializer.

llvm-svn: 44591
2007-12-05 00:19:51 +00:00
Ted Kremenek 57f4c00241 Implemented initial serialization support for SourceManager.
llvm-svn: 44590
2007-12-05 00:14:18 +00:00
Steve Naroff 0317aeb4b6 Add the definition of objc_super...
llvm-svn: 44588
2007-12-04 23:59:30 +00:00
Ted Kremenek 6ca076cb7a Removed serialization of FileEntry and DirectoryEntry. This objects will
now be lazily recreated upon deserialization.

llvm-svn: 44585
2007-12-04 22:42:20 +00:00
Fariborz Jahanian 1e34ce1045 Type-cast initializers for "struct objc_super" parameter to avoid warning.
llvm-svn: 44583
2007-12-04 22:32:58 +00:00
Fariborz Jahanian 22c278a216 Test case for my last patch.
llvm-svn: 44581
2007-12-04 21:48:54 +00:00
Fariborz Jahanian 31e1850694 Don't assert if objc.h not declared when rewriting.
llvm-svn: 44580
2007-12-04 21:47:40 +00:00
Ted Kremenek c638952f59 Implemented serialization of SrcMgr::ContentCache.
llvm-svn: 44578
2007-12-04 19:39:02 +00:00
Fariborz Jahanian f256b48bc7 Removed a "TODO" comment as objc1 runtime does not need to do the "TODO".
llvm-svn: 44577
2007-12-04 19:31:56 +00:00
Fariborz Jahanian 1f606a999e Simplified setting up Method's scope before generating AST for its nody.
llvm-svn: 44576
2007-12-04 19:20:11 +00:00
Ted Kremenek c6593c2c2e Fixed a few more comments to change "FileInfo" to "ContentCache."
llvm-svn: 44574
2007-12-04 18:59:28 +00:00
Ted Kremenek f7260b191c Implemented serialization of FileEntry and DirectoryEntry.
llvm-svn: 44573
2007-12-04 18:21:35 +00:00
Ted Kremenek 0c2bea2909 Removed searching for "darwin" keyword in target triple. We don't really support
any alternative targets at this point other than "darwin," so we now default to
Darwin targets (for now).

llvm-svn: 44572
2007-12-04 17:07:35 +00:00
Ted Kremenek bce8b49973 Removed IntrusiveSPtr. There are no clients of this class anymore, so it is
not needed, and it was never extensively tested.  If we need an intrusive
reference-counting smart pointer, we can always import intrusive_ptr from
boost.

llvm-svn: 44571
2007-12-04 16:54:09 +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
Ted Kremenek 9c26202c76 Fixed order of operands to strstr call.
llvm-svn: 44561
2007-12-03 23:25:59 +00:00
Ted Kremenek eead4052e9 For target processing, on non-Darwin systems instead of using the host triple,
we default to "i386-apple-darwin".  This is an interim solution.

Removed processing of "linux" triples from Targets.cpp, since we don't have
any sensical Linux target support (yet).

Cleaned up error processing of targets; added better diagnostics.

llvm-svn: 44560
2007-12-03 23:23:21 +00:00
Fariborz Jahanian 68c06b2d2c Change <Objc/objc.h> to <objc/objc.h>
llvm-svn: 44556
2007-12-03 23:04:29 +00:00
Ted Kremenek 8e3a2a93aa Implemented serialization of TargetInfo.
SerializationTest (subclass of ASTConsumer) now takes Diagnostics& in its ctor.

llvm-svn: 44555
2007-12-03 22:48:14 +00:00
Ted Kremenek 8cdc08ea49 Added some notes on the -triple and -arch options.
llvm-svn: 44554
2007-12-03 22:26:16 +00:00
Fariborz Jahanian d0d2bd5089 Fixed a bug exposed by referencing an ivar field using component reference syntax.
llvm-svn: 44553
2007-12-03 22:25:42 +00:00
Ted Kremenek 68fcff9bfa Few cleanups to patch 44551:
http://llvm.org/viewvc/llvm-project?view=rev&revision=44551

Removed debugging fprintfs for printing targets.
Implemented error messages when processing invalid targets.

llvm-svn: 44552
2007-12-03 22:11:31 +00:00
Ted Kremenek b061554caa Implemented initial support for "-triple" option to the clang driver. This
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).

The new behavior is as follows:

(1) If the user does not specify -triple:

   (a) If no -arch options are specified, the target triple used is the host
   triple (in llvm/Config/config.h).
   
   (b) If one or more -arch's are specified (and no -triple), then there is
       one triple for each -arch, where the specified arch is substituted
       for the arch in the host triple.  Example:
          host triple = i686-apple-darwin9
          command: clang  -arch ppc -arch ppc64 ...
          triples used: ppc-apple-darwin9  ppc64-apple-darwin9
          
(2) The user does specify a -triple (only one allowed):

  (a) If no -arch options are specified, the triple specified by -triple
      is used.  E.g clang -triple i686-apple-darwin9
      
  (b) If one or more -arch options are specified, then the triple specified
      by -triple is used as the primary target, and the arch's specified
      by -arch are used to create secondary targets.  For example:
      
      clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
      
      has the following targets:
         i686-apple-darwin9  (primary target)
         ppc-apple-darwin9
         ppc64-apple-darwin9


Other changes related to the changes to the driver:

- TargetInfoImpl now includes the triple string.

- TargetInfo::getTargetTriple returns the triple for its primary target.

- test case test/Parser/portability.c has been updated because "-arch linux" is
  no longer valid ("linux" is an OS, not an arch); instead we use a bogus
  architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.

llvm-svn: 44551
2007-12-03 22:06:55 +00:00
Chris Lattner e5a91b4924 Fix an ast-print/ast-dump bug.
llvm-svn: 44550
2007-12-03 21:43:25 +00:00
Fariborz Jahanian 4f76f22975 Support for rewriteing of messaging of methods which return float.
llvm-svn: 44548
2007-12-03 21:26:48 +00:00
Fariborz Jahanian 9e7b848ac8 Added support for messagings which return a structure-value.
(Also fixed a regression caused by recent changes to synthesis of structs).

llvm-svn: 44540
2007-12-03 19:17:29 +00:00
Ted Kremenek d85026d925 Added getTrueExpr() and getFalseExpr() to ConditionalOperator. These methods
provide handy accessors to the subexpressions of ConditionalOperator that
automatically take into account the GCC extension where the "LHS" expression is
omitted: e.g x ?: y;. When the LHS expression is available, getTrueExpr() is the
same as getLHS(); when LHS is NULL, getTrueExpr() returns the condition expression.

llvm-svn: 44536
2007-12-03 17:09:21 +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 3d072bea09 Ignore typedefs in pointer arithmetic codegen.
llvm-svn: 44529
2007-12-03 06:23:43 +00:00
Anders Carlsson 5dd106b212 Handle initializing vector elements correctly. Emit just one warning if there are excess initializers, instead of one per initializer.
llvm-svn: 44525
2007-12-03 01:01:28 +00:00
Chris Lattner 6e4f047422 add a fixme
llvm-svn: 44523
2007-12-02 23:05:46 +00:00
Anders Carlsson ef93b9d011 Implement __builtin_bswap32 and __builtin_bswap64.
llvm-svn: 44521
2007-12-02 21:58:10 +00:00
Chris Lattner 4e4186b2de fix logic for member expr codegen.
llvm-svn: 44520
2007-12-02 18:52:07 +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
Christopher Lamb 0cbd8723f3 Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
llvm-svn: 44518
2007-12-02 08:49:54 +00:00
Chris Lattner 310369fb84 restore these lines, which fixes some regtest failures.
llvm-svn: 44516
2007-12-02 07:50:03 +00:00
Chris Lattner 6311b58000 all filevar's have static storage. Previously a global with
extern storage class was returning false from hasStaticStorage.
Ted, please review this.

llvm-svn: 44515
2007-12-02 07:47:49 +00:00
Christopher Lamb 39aeb4069b Commit test for CL 44440.
llvm-svn: 44514
2007-12-02 07:47:19 +00:00
Chris Lattner e4f0feb534 Fix buggy test
llvm-svn: 44513
2007-12-02 07:46:00 +00:00
Chris Lattner 0475c8178f globals can't be vla's
llvm-svn: 44512
2007-12-02 07:32:25 +00:00
Chris Lattner d8d18d561e add codegen support for global inits that require array decay.
llvm-svn: 44511
2007-12-02 07:30:13 +00:00
Chris Lattner d45aa2a03b warn about unhandled initializers instead of crashing on them.
llvm-svn: 44510
2007-12-02 07:19:18 +00:00
Chris Lattner 5bcdf24a50 Handle global variable definitions which change the type of a definition, such as:
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }

llvm-svn: 44509
2007-12-02 07:09:19 +00:00
Chris Lattner c48023bd5b remove the alloca insertion point inst, which is an internal helper.
llvm-svn: 44508
2007-12-02 06:32:24 +00:00
Chris Lattner 6d27513f6e merge the llvm global variable when there are multiple C decls.
llvm-svn: 44507
2007-12-02 06:30:46 +00:00
Chris Lattner 41af8182d8 implement codegen for functions whose function body type don't match
their prototype.

llvm-svn: 44506
2007-12-02 06:27:33 +00:00
Chris Lattner c5b3aab66b merge functions with multiple function decls if they have the same name.
llvm-svn: 44505
2007-12-02 05:56:05 +00:00
Chris Lattner e15d0dd63f Teach clang the prototype for __builtin_alloca.
llvm-svn: 44504
2007-12-02 05:42:36 +00:00
Chris Lattner f0780fae43 convert the rest of the stderr users in codegen to use diagnostics.
llvm-svn: 44503
2007-12-02 01:49:16 +00:00
Chris Lattner fc94434faf move unsupported warning into a centralized place.
llvm-svn: 44502
2007-12-02 01:43:38 +00:00
Chris Lattner c8dbe1e5d6 Warn about unsupported codegen with the diags machinery, giving us:
t.c:3322:5: warning: cannot codegen this yet
    __asm__ ("bswap   %0" : "+r" (_data));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

instead of:

Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)

llvm-svn: 44501
2007-12-02 01:40:18 +00:00
Chris Lattner 963540dc28 register clz and ctz builtins.
llvm-svn: 44500
2007-12-02 01:20:23 +00:00
Chris Lattner f3a59a1fb8 fix a crash when the rewriter would scan off the beginning of the file.
llvm-svn: 44499
2007-12-02 01:13:47 +00:00
Chris Lattner e6535cfdd2 add support for custom client-specific diagnostics. As a testcase, make the
rewriter emit this error if it fails to rewrite an @encode:

t.m:17:9: error: rewriter could not replace sub-expression due to macros
    c = ENC(char *)[2] + 4;
        ^~~~~~~~~~~

... where ENC is: #define ENC @encode

llvm-svn: 44498
2007-12-02 01:09:57 +00:00
Oliver Hunt a96fe8d5c5 Add support for __builtin_expect which is needed for assert,
among other things.

Also change a codegen warning to dump to stderr so it doesn't
mess with -emit-llvm output

llvm-svn: 44497
2007-12-02 01:03:24 +00:00
Chris Lattner 9724ce12f9 improve VC++ compatibility, patch by Cédric Venet.
llvm-svn: 44496
2007-12-02 00:47:03 +00:00
Oliver Hunt aefc8fd415 Support initalisers for more than just int-typed static variables.
We now use the CodeGenModule logic for generating the constant 
initialiser expression, so happily further initialiser fixes should 
automatically work for statics as well.

llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Fariborz Jahanian 9fac54d881 Compute side-effect for conditional expression.
llvm-svn: 44492
2007-12-01 19:58:28 +00:00
Chris Lattner 53efb14795 Add #include, patch by Cédric Venet
llvm-svn: 44491
2007-12-01 18:59:50 +00:00
Christopher Lamb 7d303b2a20 Better match llvm-gcc's behavior for CodeGen naming of anonymous structs and unions.
llvm-svn: 44490
2007-12-01 09:20:34 +00:00
Christopher Lamb b0e6094a22 When generating the CodeGen type name of a struct, union, enum use the typedef
name if a tag type name is not available for the type. This matches how llvm-gcc 
chooses CodeGen type names.

This means that "typedef struct {...} foo" now results in a CodeGen name of 
"struct.foo" rather than "struct."

llvm-svn: 44489
2007-12-01 09:08:41 +00:00
Seo Sanghyeon 34f92ace1f Test commit
llvm-svn: 44488
2007-12-01 08:06:07 +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
Chris Lattner 9e137aad78 fix a couple switch codegen problems Oliver reported.
llvm-svn: 44484
2007-12-01 05:27:33 +00:00
Ted Kremenek 3e14c152c6 Fixed bug in the serialization of SelectorTable where we did not register the
pointer of MultiKeywordSelectors.

Added optimization to the serialization of SelectorTable where we only serialize
out MultiKeywordSelectors that are ever referenced by an object other than the
SelectorTable.

llvm-svn: 44483
2007-12-01 04:43:17 +00:00
Chris Lattner 4431a1b19b start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't.  This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.

llvm-svn: 44473
2007-11-30 22:53:43 +00:00
Anders Carlsson 7a9a38abe0 String literals are always valid LValues.
llvm-svn: 44472
2007-11-30 22:47:59 +00:00
Ted Kremenek c9bcda94ae Implemented serialization of SelectorTable and Selectors.
Modified serialization of IdentifierTable to self-register itself with
the Deserializer.

llvm-svn: 44471
2007-11-30 22:46:56 +00:00
Chris Lattner e9c810c87c pass diagnostics into the rewrite test client.
llvm-svn: 44468
2007-11-30 22:25:36 +00:00
Anders Carlsson 3b754452eb Initialize CurMethodDecl to 0.
llvm-svn: 44463
2007-11-30 20:01:38 +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
Anders Carlsson 452815a6b2 Initialize LaxVectorConversions.
llvm-svn: 44459
2007-11-30 18:29:41 +00:00
Chris Lattner 1386de8757 fix a bug handling typedefs in member expr codegen. Patch
by Seo Sanghyeon

llvm-svn: 44455
2007-11-30 18:02:19 +00:00
Chris Lattner b6a7b582ee Fix a codegen crash on void ?: reported by Oliver
llvm-svn: 44454
2007-11-30 17:56:23 +00:00
Chris Lattner aa0b570dfb Support fully general case expressions, patch by Sanghyeon Seo!
llvm-svn: 44453
2007-11-30 17:44:57 +00:00
Christopher Lamb 0112f62bb9 Doh! Check in this long overdue test fix.
llvm-svn: 44450
2007-11-30 06:35:48 +00:00
Anders Carlsson e1af1d20ef Support lax vector conversions.
llvm-svn: 44449
2007-11-30 04:21:22 +00:00
Steve Naroff 205ec3d07a Yesterday, I simplified how we stream top-level decls.
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).

TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...
llvm-svn: 44445
2007-11-29 23:05:20 +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
Christopher Lamb 2ed9afd777 Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it.
llvm-svn: 44440
2007-11-29 19:09:19 +00:00
Ted Kremenek 22a0d616f6 Added "complex.c" (a copy of test/Codegen/complex.) to the serialization
test suite.

llvm-svn: 44439
2007-11-29 19:05:51 +00:00
Ted Kremenek 870600d625 Only serialize top-level decls that appear at the head of a decl chain.
llvm-svn: 44438
2007-11-29 19:04:54 +00:00
Christopher Lamb 42e69f219d Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.
llvm-svn: 44431
2007-11-29 06:06:27 +00:00
Ted Kremenek 1150e25901 Enhanced serialization testing by also pretty-printing CFGs constructed from ASTs
both before and after serialization/deserialization. If the CFGs between the pre-
and post- serialized/deserialized ASTs differ, the serialization has failed.

llvm-svn: 44429
2007-11-29 01:24:25 +00:00
Ted Kremenek 2501c8294f Fixed test case to not expect a warning when one should not be emitted.
Removed redundant test case.

llvm-svn: 44426
2007-11-29 01:03:21 +00:00
Ted Kremenek 0865d8a5d0 Added test cases for -Wfloat-equal to test comparisons against literals that can be
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.

llvm-svn: 44425
2007-11-29 01:00:11 +00:00
Ted Kremenek eda40e273e Enhanced implementation of -Wfloat-equal to check for comparisons against
floating-point literals that are represented exactly by the APFloat in
FloatingLiteral. For such literals, we do not emit a warning since such checks are
often performed in real code to see if a variable has changed from its original
value. This heuristic clearly can lead to false negatives, but the hope is it will
significantly reduce false positives to help make the compiler flag more useful.

llvm-svn: 44424
2007-11-29 00:59:04 +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
Ted Kremenek 9924ca2e14 Removed potential buffer overrun (spotted by Neil Booth) when NumericLiteralParser
converts a parsed literal into an APFloat. We are still performing a copy of the
string, which hopefully will be removed eventually for performance reasons. This
version now is at least safe.

Changed rounding in APFloat construction in NumericLiteralParser from rmTowardsZero
to rmNearestTiesToEven.

llvm-svn: 44422
2007-11-29 00:54:29 +00:00
Steve Naroff 197616c3a8 Several fixes/simplifications surrounding how we stream top-level decl AST's.
The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D; 

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'

llvm-svn: 44421
2007-11-28 22:54:11 +00:00
Ted Kremenek 5933768bec Converted AST Pretty-Printer to use iostreams instead of FILE*. This fixes
a bug where the statement pretty-printer used iostreams but the AST printer
did not.  This was an issue when dumping ASTs to something other than stderr.

Updated SerializationTest to use the new iostreams interface for the AST printer.

llvm-svn: 44417
2007-11-28 21:32:21 +00:00
Ted Kremenek 5d169cf285 Inlined test case to make it independent of the stmt_exprs test case in test/Sema.
llvm-svn: 44416
2007-11-28 21:29:54 +00:00
Ted Kremenek 31540ed8fe Added the "Serialization" test directory to the set of tests executed.
Introduced a few line breaks to make the Makefile easier to read.

llvm-svn: 44413
2007-11-28 19:24:15 +00:00
Ted Kremenek 46cfdb9625 Added initial test case for testing serialization of ASTs. This test
case simply performs --test-pickling on the code found in Sema/stmt_exprs.c.

llvm-svn: 44412
2007-11-28 19:23:15 +00:00
Ted Kremenek ac76a41717 Modified --test-pickling to perform an actual cross-check of serialized ASTs:
(1) Parsed ASTs are pretty-printed to a text file.
(2) The ASTs are serialized to disk.
(3) The ASTs are deserialized from disk.
(4) The deserialized ASTs are pretty-printed to a text file.
(5) The two pretty-printed files are compared. If they are different, the test
    fails.

llvm-svn: 44411
2007-11-28 19:21:47 +00:00
Ted Kremenek 44d5166cdb Changed TestRunner.sh to dump the output and generated script files in
subdirectories mirroring where the test case file is located

For example, for the test case "Sema/stmt_exprs.c", instead of the files
"Output/stmt_exprs.c.out" and "Output/stmt_exprs.c.out.script" being created, the
files "Output/Sema/stmt_exprs.c.out" and "Output/Sema/stmt_exprs.c.out.script" are
created. This prevents any collisions from different test directories that have the
same file name for a test case, and also makes it clear where the test case was
drawn from.

llvm-svn: 44410
2007-11-28 19:16:54 +00:00
Ted Kremenek ab18e6d7fd Added missing "RUN:" to comment for test case file. This fixed a bug where the test
case testing the frontend's support of statement expressions was not being
executed.

llvm-svn: 44409
2007-11-28 19:05:11 +00:00
Chris Lattner db2a6ef881 Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Bug pointed out by Michael Zolda, thanks!

llvm-svn: 44408
2007-11-28 18:51:29 +00:00
Oliver Hunt 93c4ce650c Fix typo in writable string test
llvm-svn: 44398
2007-11-28 06:52:03 +00:00
Oliver Hunt a951571941 Adding code gen tests for writable and shared string literals.
llvm-svn: 44397
2007-11-28 06:27:12 +00:00
Anders Carlsson 0e136ec1d3 Add correct types for the last remaining intrinsics.
llvm-svn: 44396
2007-11-28 06:09:44 +00:00
Chris Lattner fb30009465 Implement support for -fwritable-strings and make the code generator
merge string literals when it is not provided.

llvm-svn: 44394
2007-11-28 05:34:05 +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
Ted Kremenek 7c81bdd4e7 Migrated static functions that print decls into a DeclPrinter class,
which is now used (or subclasssed) by the ASTConsumers.  This new class
stores a FILE* that is used for writing, instead of just hardwiring output
to stderr (it defaults to stderr if no FILE* is provided).

Modified CreateASTPrinter() to accept a FILE* for printing.

llvm-svn: 44377
2007-11-27 21:46:50 +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 1a6bb70ad0 Set loc earlier in CheckSingleInitializer to avoid emitting a
diagnostic without a location.  This produces:

simpleTest.c:2:18: error: initializer element is not constant
int *myPointer = &(myArray[2]);
                 ^~~~~~~~~~~~~

instead of:

error: initializer element is not constant
llvm-svn: 44375
2007-11-27 21:21:35 +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 1cfe02c38b update to match change in mainline llvm.
llvm-svn: 44367
2007-11-27 18:20:52 +00:00
Steve Naroff 0ee0b0ab8c Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.
Thanks to Seo Sanghyeon for the bug, follow-through, and patch!

llvm-svn: 44366
2007-11-27 17:58:44 +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
Anders Carlsson 24c59958f4 Add comment to CheckVectorCast.h
llvm-svn: 44356
2007-11-27 07:16:40 +00:00
Chris Lattner f04b69b26c take an initial stab at setting function linkage right. Handle
static and inline at least.

llvm-svn: 44355
2007-11-27 06:46:51 +00:00
Anders Carlsson de71adff60 Report errors for invalid casts from/to vectors.
llvm-svn: 44350
2007-11-27 05:51:55 +00:00
Anders Carlsson f511f646a4 Add more semantic analysis for inline asm statements.
llvm-svn: 44349
2007-11-27 04:11:28 +00:00
Ted Kremenek fbb08bc2e2 Added optional pass-by-reference argument "isExact" to
NumericLiteralParser::GetFloatValue(). Upon method return, this flag has the value
true if the returned APFloat can exactly represent the number in the parsed text,
and false otherwise.

Modified the implementation of GetFloatValue() to parse literals using APFloat's
convertFromString method (which allows us to set the value of isExact).

llvm-svn: 44339
2007-11-26 23:12:30 +00:00
Ted Kremenek 871422eca9 Removed dependence on #including iostream.
llvm-svn: 44338
2007-11-26 22:50:46 +00:00
Ted Kremenek 6eefb85ef5 Fixed #include of objc/objc.h so that it works on case-sensitive filesystems.
llvm-svn: 44337
2007-11-26 22:49:09 +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
Fariborz Jahanian 96502afb6f Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
llvm-svn: 44335
2007-11-26 20:59:57 +00:00
Kevin e01743a3a3 Removes link to status page till the info gets added. Someone put us on Reddit; Don't want it to look bad on the project. :)
http://programming.reddit.com/info/61f8g/comments/

llvm-svn: 44334
2007-11-26 20:47:14 +00:00
Fariborz Jahanian a883d6ed89 Patch to fix a regression caused by recent rewrite changes.
A potential API bug in ReplaceText pending (A FIXME is added).

llvm-svn: 44333
2007-11-26 19:52:57 +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
Bill Wendling 8da1db4f34 The checking for the delimiters of expected error/warning messages was
looking only for { and } instead of {{ and }}. Changed it to check for
this explicitly.

llvm-svn: 44326
2007-11-26 08:26:20 +00:00
Chris Lattner 2ab40a6207 Fix sema support for the gnu ?: expression with a
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right 
result type.  This fixes PR1824.

llvm-svn: 44322
2007-11-26 01:40:58 +00:00
Chris Lattner a3ee6fa84f this works.
llvm-svn: 44321
2007-11-26 01:39:17 +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
Ted Kremenek 43fb8b0799 Moved logic for -Wfloat-equal to SemaChecking.cpp.
Moved utility functions IgnoreParen and friends to be static inline functions
defined in SemaUtil.h.

Added SemaUtil.h to Xcode project.

llvm-svn: 44312
2007-11-25 00:58:00 +00:00
Anders Carlsson 290aa8560b Check that the clobber registers are valid.
llvm-svn: 44311
2007-11-25 00:25:21 +00:00
Anders Carlsson c163657f2f Forgot some X86 registers
llvm-svn: 44309
2007-11-25 00:23:10 +00:00
Anders Carlsson 5fa3f348f7 Add tables for GCC register names and aliases. This will be used for inline asm
llvm-svn: 44308
2007-11-24 23:38:12 +00:00
Ted Kremenek 0d20033c6a Added more test cases for uninitialized values checker.
llvm-svn: 44307
2007-11-24 23:06:58 +00:00
Ted Kremenek 2e04d73d83 Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y).  Thanks to Anders Carlsson for spotting this problem.

Added test cases to test suite to provide regression testing for the
uninitialized values analysis.

llvm-svn: 44306
2007-11-24 20:07:36 +00:00
Ted Kremenek 33407b3338 Moved dead-stores test cast to a new test suite subdirectory: Analysis.
llvm-svn: 44305
2007-11-24 19:49:35 +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
Chris Lattner 136449a6d7 improve codegen for global variable initializers, implementing
test/CodeGen/global-with-initialiser.c

Patch by Oliver Hunt!

llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson 80a5ea3552 Check asm input and output expressions.
llvm-svn: 44289
2007-11-23 19:43:50 +00:00
Chris Lattner 9fcdc52243 Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
Neil, please review this fix.

llvm-svn: 44285
2007-11-23 06:50:21 +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 091a059c55 GCC fails if there is a trailing colon but no clobbers.
llvm-svn: 44265
2007-11-21 23:27:34 +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 4f8eb127e1 Add __builtin_abs
llvm-svn: 44254
2007-11-20 19:05:17 +00:00
Chris Lattner 5c3f1541a7 Improve function decl merging, patch by Oliver Hunt!
llvm-svn: 44253
2007-11-20 19:04:50 +00:00
Ted Kremenek 9e823c745d Added another test case for the Dead Stores checker that tests that
block-level expressions are evaluated the same as regular expressions. Test
case provided by Nuno Lopes.

llvm-svn: 44247
2007-11-20 03:03:00 +00:00
Ted Kremenek 9d0acca967 Updated CFGStmtVisitor and CFGRecStmtVisitor to have a notion of
"block-expressions" when visiting arbitrary expressions (via calls to
"Visit()").  This results in a refactoring where a dataflow analysis no
longer needs to always special case when handling block-expressions versus
non-block expressions.

Updated LiveVariables and UninitializedValues to conform to the slightly
altered interface of these visitor classes.

Thanks to Nuno Lopes for providing a test case that illustrated some
fundamental problems in the current design of the CFGXXXStmtVisitor classes
and how they were used.

llvm-svn: 44246
2007-11-20 03:01:58 +00:00
Ted Kremenek e866e7b6fc Removed PersistentMap. It is now superseded in every way by the ImmutableMap
and ImmutableSet classes in the main LLVM libraries.

llvm-svn: 44237
2007-11-19 17:25:30 +00:00
Ted Kremenek eb8471bfa1 Added test case for dead stores checker (live variables analysis) that tests
for correct propagation/update of liveness information within subexpressions
of Block-Level expressions.  Test case provided by Nuno Lopes.

llvm-svn: 44225
2007-11-19 06:38:23 +00:00
Ted Kremenek 850f1155ad Fixed bug where LiveVariables was not properly propagating updates to liveness
state that occurred in subexpressions of Block-Level expressions. Bug and fix
provided by Nuno Lopes.

llvm-svn: 44224
2007-11-19 06:36:49 +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 094079c0dc Added test case for dead-stores checker. Test case provided by Nuno Lopes.
llvm-svn: 44221
2007-11-18 20:06:35 +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
Chris Lattner 48d52848d7 Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
This fixes a bug reported by Seo Sanghyeon.

This was meant to be committed yesterday, but the commit failed.  doh.

llvm-svn: 44190
2007-11-16 17:46:48 +00:00
Chris Lattner 0640e3ef35 Fix transient failure on Lex/c90.c due to an uninit variable.
llvm-svn: 44180
2007-11-15 19:22:40 +00:00
Chris Lattner 4dcbc2090a add header file I forgot to check in
llvm-svn: 44179
2007-11-15 19:22:18 +00:00
Chris Lattner 609d413363 fix a bug Steve noticed, where a #import of the main file itself would fail.
llvm-svn: 44178
2007-11-15 19:07:47 +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 c8fcbe09d0 No need to forward declare definition of objc_super...
llvm-svn: 44173
2007-11-15 17:06:21 +00:00
Steve Naroff e3ffc2f4a9 Finish up variadic methods/messages.
llvm-svn: 44172
2007-11-15 13:05:42 +00:00
Steve Naroff d8ea1ac576 Implement support for variadic methods (work in progress).
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Steve Naroff 05caa48fb4 Extend RewriteTest::RewriteObjCIvarRefExpr() to cope with static typing (when using -> on a type which corresponds to the implementation type).
llvm-svn: 44170
2007-11-15 11:33:00 +00:00
Steve Naroff 44864e48bd Tweak funky cast to accommodate messaging 'super'. This removes any spurious warnings.
llvm-svn: 44169
2007-11-15 10:43:57 +00:00
Steve Naroff 7fa2f040f3 Rewrite for messaging 'super'.
The code gen. results in some spurious warnings...a cast is forthcoming.

llvm-svn: 44168
2007-11-15 10:28:18 +00:00
Nate Begeman 847bfbcaf0 Break out bool/true/false support into a LangOption
llvm-svn: 44164
2007-11-15 07:30:50 +00:00
Nate Begeman 4c18c23eb3 Implement codegen of CXX Bool
llvm-svn: 44160
2007-11-15 05:40:03 +00:00
Chris Lattner bb31a42fef Handle "bool" in all places that touch _Bool.
This fixes code like "if((bool)x) {}" for example.

Patch by Nate Begeman.

llvm-svn: 44159
2007-11-15 05:25:19 +00:00
Steve Naroff f60782b8c9 - Implement ivar rewrite (patch by Fariborz).
- RewriteMessageExpr()...make implicit casts explicit with synthesizing call (removing warnings when calling objc_msgSend()).

llvm-svn: 44156
2007-11-15 02:58:25 +00:00
Steve Naroff 909d666681 Refinement to previous commit. Always cast the first argument to "id"...no need to special case self.
llvm-svn: 44149
2007-11-15 00:00:21 +00:00
Steve Naroff e7f181986a Cast implicit "self" argument to "id". This removes all warnings associated with implicit references to self. It doesn't yet deal withexplicit references to self...
llvm-svn: 44148
2007-11-14 23:54:14 +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
Steve Naroff 03f2767368 Always generate a typedef for @class. The typedef removal logic that I'm removing only made sense when we were operating on preprocess files without typedef guards. Now that we have guards, it is incorrect to ever remove one (since it may increase the likelihood that the rewritten header can't be included stand alone).
llvm-svn: 44145
2007-11-14 23:02:56 +00:00
Chris Lattner 174a825f01 Fix a rewriter bug that steve noticed. Don't skip arbitrary things
between an @ and a p, just skip whitespace.

llvm-svn: 44144
2007-11-14 22:57:51 +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
Fariborz Jahanian c6225532c3 Patch to comment out use of protocol qualifiers when rewriting ivars.
llvm-svn: 44142
2007-11-14 22:26:25 +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
Steve Naroff dde78986fb Fairly major surgery to RewriteTest::SynthesizeObjcInternalStruct().
This allows us to handle funky stuff like...

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
@interface NSLayoutManager : NSObject <NSCoding, NSGlyphStorage> {
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
@interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */

...which now rewrites to...

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
#ifndef _REWRITER_typedef_NSLayoutManager
#define _REWRITER_typedef_NSLayoutManager
typedef struct objc_object NSLayoutManager;
#endif

struct NSLayoutManager {
    struct NSObject _NSObject;

#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
// @interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */

llvm-svn: 44129
2007-11-14 19:25:57 +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 31ae973708 SourceManager, IdentifierTable, Selectors are now serialized in their own
block separate from ASTContext. This block is serialized out AFTER writing out
ASTContext, but deserialized BEFORE reading in ASTContext. This permits the
optimization of the serialization of the IdentifierTable where we only write
out identifiers that are used.

This was needed because TagDecls are owned by Types, and TagDecls contain
identifiers. Thus types need to be written out first to register with the
serializer any identifiers they refer to (and hence need to be serialized out
with IdentifierTable).

llvm-svn: 44125
2007-11-14 17:46:35 +00:00
Fariborz Jahanian 794793ec1c Removed unused variabel.
llvm-svn: 44123
2007-11-14 17:35:46 +00:00
Chris Lattner e6c7a858b0 Fix a bug handling hex floats in c90 mode, pointed out by Neil.
llvm-svn: 44120
2007-11-14 16:14:50 +00:00
Steve Naroff a509f04034 Fix yesterday's regression with rewriting @optional/@required.
llvm-svn: 44119
2007-11-14 15:03:57 +00:00
Steve Naroff 58ed6c04f2 Rewrite methods that span multiple lines.
llvm-svn: 44118
2007-11-14 14:34:23 +00:00