Commit Graph

111 Commits

Author SHA1 Message Date
Chris Lattner d5a828b6bb wchar_t width is now expressed in terms of bits for uniformity.
llvm-svn: 39391
2007-04-05 06:57:57 +00:00
Chris Lattner bb73acd560 Support both tiger and leopard. Yes, this code is a hack :)
llvm-svn: 39359
2007-03-19 19:06:33 +00:00
Steve Naroff 6fbf0dcb6e Bug #:
Submitted by:
Reviewed by:
carbon.h looking good! Only 1 warning left...no parse errors!

This fixes 3 bugs...
- A couple tricky bugs with type canonicalization. Nested typedef's  weren't being
handled properly. For example, the following didn't work:

typdef int __darwin_pid_t;
typedef __darwin_pid_t pid_t;

int getpgid(pid_t);
int getpgid(int);

- The storage class wasn't being preserved. As a result, Sema was complaining
about the  following:

extern char *foo;
char *foo;

- various built-ins weren't registered...resulting in spurious warnings.

llvm-svn: 39357
2007-03-16 00:33:25 +00:00
Steve Naroff 3273c22863 Bug #:
Submitted by:
Reviewed by:
This is a "small" checkin.  #include_next wasn't working properly on
Leopard. This is because the driver has some hard coded paths that
don't work on Leopard. The real fix is to derive them, however I don't
think we need to solve this now. At this point, anyone working on clang
should be able to use Leopard. This fix removed 11 errors processing
"carbon.h". The bug that bubbles up to the top is in MergeFunctionDecl().
As part of digging into this part of Sema, I rearranged some methods
(and changed the visibility).

llvm-svn: 39356
2007-03-14 21:52:03 +00:00
Steve Naroff 2c055d2b2b Go back to having the clang driver create ASTContext explicitly, passing
it to Sema/ASTStreamer (separating the lifetime of ASTContext from
the lifetime of Sema). One day it might be useful to consider creating
a context object implicitly if one isn't provided (using default arguments in
Sema's constructor). At this point, adding this convenience isn't necessary.

llvm-svn: 39346
2007-02-28 19:32:13 +00:00
Steve Naroff 38d31b47b0 Make Sema's use of the preprocessor explicit (rather than assume
the prerocessor will be available via ASTContext).
- Removed the public data member "PP" in ASTContext.
- Changed ASTContext's contructor to take TargetInfo/IdentifierTable explicitly.
- Implicitly create an ASTContext in Sema's constructor. This simplifies
the clients job (and makes ASTContext more private).
--As a side effect, added a "PrintStats" hook to Sema.

To support this level of encapsulation, ASTContext is always dynamically
allocated (by Sema). Previously, ASTContext was being allocated on the
stack. I don't believe this should be a performance issue (since ASTContext
is fairly course grain and tied to the lifetime of Sema currently).

llvm-svn: 39345
2007-02-28 01:22:02 +00:00
Chris Lattner f82a33b487 add 3 apple-local intrinsics.
llvm-svn: 39330
2007-01-30 05:47:29 +00:00
Chris Lattner 83f1881702 Stub out the i386 SSE builtins, this eliminates nearly 300 warnings parsing
carbon.h on intel, bringing the total to 257.

llvm-svn: 39329
2007-01-30 05:34:20 +00:00
Chris Lattner 10a5b387cc Add support for target-specific builtins, including detecting nonportability
of source code.  For example:

$ clang INPUTS/carbon_h.c -arch i386 -arch ppc
prints:
...
/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/mmintrin.h:51:3: note: use of a target-specific builtin function, source is not 'portable'
  __builtin_ia32_emms ();
  ^

because carbon.h pulls in xmmintrin.h, and __builtin_ia32_emms isn't a builtin on ppc.

Though clang now supports target-specific builtins, the full table isn't implemented yet.

llvm-svn: 39328
2007-01-29 05:24:35 +00:00
Chris Lattner 739fa67f19 Revert accidental commit
llvm-svn: 39314
2007-01-27 02:20:41 +00:00
Chris Lattner baf33665fb adjust to change in SmallSet interface
llvm-svn: 39313
2007-01-27 02:14:08 +00:00
Chris Lattner 4f6a75809c fix printing of unprototyped function decls.
llvm-svn: 39310
2007-01-26 21:19:14 +00:00
Chris Lattner 4eb445d2a1 start gather stats on types processed. carbon.h currently yields:
*** AST Context Stats:
  30594 types total.
    19 builtin types
    3929 pointer types
    308 array types
    18883 function types with proto
    8 function types with no proto
    2988 typename (typedef) types
    4459 tagged types
      1476 struct types
      80 union types
      0 class types
      2903 enum types
  83298 slow type lookups

Next up, making type canonicalization not trivially silly.

llvm-svn: 39305
2007-01-26 01:27:23 +00:00
Chris Lattner 371f154c4f adjust to api change
llvm-svn: 39269
2007-01-22 07:41:51 +00:00
Chris Lattner 20ae9f6622 pretty print ... as well
llvm-svn: 39263
2007-01-21 23:48:06 +00:00
Chris Lattner 7f24b2abb8 Pretty print function prototypes as well.
llvm-svn: 39262
2007-01-21 23:46:27 +00:00
Chris Lattner ef1387808f Pretty print the function prototype. For example, print:
void (*signal(int arga, void (*argb)(double Y)))(void* Z) {}

as:

void (*signal(int arga, void (*argb)(double)))(void *) {
}

go C :)

llvm-svn: 39261
2007-01-21 23:11:09 +00:00
Chris Lattner 30b4b5cad8 default to -fsyntax-only
llvm-svn: 39254
2007-01-21 19:03:55 +00:00
Chris Lattner 3e7592ea78 Add support for -fno-operator-names, patch by Bill.
llvm-svn: 39245
2006-12-04 07:48:37 +00:00
Chris Lattner d6775fa217 add note in the output
llvm-svn: 39212
2006-11-21 06:36:58 +00:00
Chris Lattner 00348acace clear file info after processing one file, it shouldn't carry over to the
next.

llvm-svn: 39211
2006-11-21 06:34:57 +00:00
Chris Lattner 2ea9dd7fc0 ProcessInputFile no longer mutates LangInfo.
llvm-svn: 39210
2006-11-21 06:18:11 +00:00
Chris Lattner b352e3edb5 Change KeepComments/KeepMacroComments modes to be facets of the preprocessor
state, not aspects of the language standard being parsed.

llvm-svn: 39209
2006-11-21 06:17:10 +00:00
Chris Lattner ad7cdd37b3 simplify the Preprocessor ctor.
llvm-svn: 39208
2006-11-21 06:08:20 +00:00
Chris Lattner 96327eaa52 first step refactoring driver so that it can process multiple input files
at once.

llvm-svn: 39207
2006-11-21 05:52:55 +00:00
Chris Lattner 87f267ef4e eliminate global variables now that PPCallbacks can have state
llvm-svn: 39205
2006-11-21 05:02:33 +00:00
Chris Lattner b8d6d5a81d Formalize preprocessor callbacks together into a PPCallbacks structure, instead
of having a loose collection of function pointers.  This also allows clients to
maintain state, and reduces the size of the Preprocessor.h interface.

llvm-svn: 39203
2006-11-21 04:09:30 +00:00
Chris Lattner 38495cb2e7 -fsyntax-only is synonym for -parse-ast for now.
llvm-svn: 39202
2006-11-21 04:07:21 +00:00
Chris Lattner b0e7a06e53 Add some standard include paths for C++.
llvm-svn: 39200
2006-11-21 03:40:37 +00:00
Chris Lattner 229ce60fc9 split the ParseFunctionDefinition action into two actions, one which is
called before and one which is called after function definition parsing.

llvm-svn: 39196
2006-11-21 01:21:07 +00:00
Chris Lattner da8aa7b3a8 implement RTTI for Decl objects, eliminate some hokey virtual methods.
llvm-svn: 39185
2006-11-19 23:12:30 +00:00
Chris Lattner 288e86ff15 Rename SemaDeclSpec.{h|cpp} back to DeclSpec.{h|cpp} now that the distinction
between sema and parse is clear.

llvm-svn: 39167
2006-11-11 23:03:42 +00:00
Chris Lattner cb6a382b67 introduce a new ASTContext class to hold long-lived ast nodes.
llvm-svn: 39161
2006-11-10 06:20:45 +00:00
Chris Lattner 289ab7bb1d rename SemaDecl.cpp/h to SemaDeclSpec.cpp/h
llvm-svn: 39149
2006-11-08 06:54:53 +00:00
Chris Lattner c62b6c232f eliminate EmptyAction, merging it into MinimalAction instead.
llvm-svn: 39134
2006-11-05 18:44:26 +00:00
Chris Lattner 0663d2afd9 start factoring actions into two flavors: minimal and semantic actions.
llvm-svn: 39133
2006-11-05 18:39:59 +00:00
Chris Lattner ca96b89772 rename some options
llvm-svn: 39131
2006-11-05 18:00:10 +00:00
Chris Lattner 9fe24d75d2 for now -fsyntax-only builds all the AST's but doesn't print them.
llvm-svn: 39129
2006-11-05 07:59:55 +00:00
Chris Lattner 7ad0fbe1f2 rename a bunch of files for better consistency
llvm-svn: 39126
2006-11-05 07:46:30 +00:00
Chris Lattner 71e23ce2e1 Add AST node, AST building, actions, and printing for 'for' stmts.
llvm-svn: 39113
2006-11-04 20:18:38 +00:00
Chris Lattner 72b7d39d78 remove full locinfo AST nodes for now. They just clutter the implementation
and should be implemented with an ASTBuilder subclass anyway.

llvm-svn: 39107
2006-11-04 06:37:16 +00:00
Chris Lattner 9916c5ca7e Remove GNU C++ min/max operator extension support, they have been removed
from gcc mainline.

llvm-svn: 39067
2006-10-27 05:24:37 +00:00
Chris Lattner 05646c7f0e Fix these to allow clang to be in any dir.
llvm-svn: 39055
2006-10-26 04:56:55 +00:00
Chris Lattner 6d9a685d75 Make the driver print function bodies at -parse-print-ast
llvm-svn: 39048
2006-10-25 05:11:20 +00:00
Chris Lattner 911d0fef03 Return an error code if an error occurs.
llvm-svn: 39041
2006-10-25 03:15:08 +00:00
Chris Lattner ca1a1ed4cb Add -F option
llvm-svn: 39036
2006-10-22 07:34:56 +00:00
Chris Lattner 07b019a1bc add #include
llvm-svn: 39034
2006-10-22 07:28:56 +00:00
Chris Lattner b84f986f45 gnu90 is default again
llvm-svn: 39023
2006-10-20 06:13:18 +00:00
Chris Lattner 2f9888e2ca switch to gnu99 by default
llvm-svn: 39019
2006-10-20 05:03:55 +00:00
Chris Lattner 38681d7d81 Add intel include path
llvm-svn: 39016
2006-10-20 04:55:39 +00:00