Commit Graph

641 Commits

Author SHA1 Message Date
Chris Lattner d235d162d0 change print methods to render into a string, which is more useful for diagnostics
and for handling precedence of types more accurately

llvm-svn: 39177
2006-11-13 06:22:30 +00:00
Chris Lattner 7ccecb90d4 Implement parsing, printing and AST'ing of array types (except for the bounds).
This allows us to handle:

int (*A)[restrict static 4][6];

for example.

llvm-svn: 39176
2006-11-12 08:50:50 +00:00
Chris Lattner 47814666e1 Implement and use isa/dyncast/cast etc for Type classes.
llvm-svn: 39175
2006-11-12 00:56:20 +00:00
Chris Lattner d5973ebbe2 Teach ASTContext to delete all created types in its dtor.
Teach getPointerType to (stupidly) memoize all created pointers.
Give types an enum so we can implement classof.

llvm-svn: 39174
2006-11-12 00:53:46 +00:00
Chris Lattner 970e54e3ac Build ASTs for the pointer qualifiers on declarators. This allows us to
parse (and print) things like:

int* const* restrict* const volatile***

etc.

llvm-svn: 39173
2006-11-12 00:37:36 +00:00
Chris Lattner aecbefa519 We can now parse and remember the distinction between:
'unsigned char' and 'unsigned char const'.

-Chris

llvm-svn: 39172
2006-11-12 00:05:06 +00:00
Chris Lattner 8ddf65053e DeclSpec::TQ and TypeRef::TQ should stay in sync
llvm-svn: 39171
2006-11-11 23:59:23 +00:00
Chris Lattner b571a5cbdc implement conversion of simple declspec base types, and implement TypeRef::dump
llvm-svn: 39170
2006-11-11 23:56:48 +00:00
Chris Lattner 5983de06cd add note about eliminating DeclSpec.
Add TypeRef::dump method.

llvm-svn: 39169
2006-11-11 23:56:01 +00:00
Chris Lattner 96bff30868 fix comment
llvm-svn: 39168
2006-11-11 23:55:28 +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 f84a79c4e9 restructure code to build the framework for creating types from declarators.
llvm-svn: 39166
2006-11-11 22:59:23 +00:00
Chris Lattner f391a3ba70 Expand TypeRef itf
llvm-svn: 39165
2006-11-10 07:21:44 +00:00
Chris Lattner ef51c20065 add the builtin types
llvm-svn: 39164
2006-11-10 07:17:23 +00:00
Chris Lattner 3522b20265 Tweak Type.h to compile.
llvm-svn: 39163
2006-11-10 06:49:39 +00:00
Chris Lattner ddc135e593 Let ASTContext hold target info, since it's useful
llvm-svn: 39162
2006-11-10 06:34:16 +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 88724336e9 with xcode bugs worked around, I can actually add files to the project, woo
llvm-svn: 39160
2006-11-10 05:33:04 +00:00
Chris Lattner e168f76c2d move the rest of the expr sema to SemaExpr.cpp and the decl processing stuff
to SemaDecl.cpp

llvm-svn: 39159
2006-11-10 05:29:30 +00:00
Chris Lattner bd638926e2 remove diag helper that implicitly reports the diagnostic at the current
token: it is better for the code to be explicit.

llvm-svn: 39158
2006-11-10 05:19:25 +00:00
Chris Lattner eaafe122b6 move semantic analysis of break/continue out of the parser into the sema class.
llvm-svn: 39157
2006-11-10 05:17:58 +00:00
Chris Lattner af8d581230 move semantic analysis of statements to it's own file.
llvm-svn: 39156
2006-11-10 05:07:45 +00:00
Chris Lattner 5b183d882b split semantic analysis of expressions out to its own file
llvm-svn: 39155
2006-11-10 05:03:26 +00:00
Chris Lattner ddd6fc84cf move ASTBuilder.h/cpp to be a private Sema.h/cpp files, not part of the
interface exported by libast.

llvm-svn: 39154
2006-11-10 04:58:55 +00:00
Chris Lattner cc67ec1743 rename ASTBuilder to Sema
llvm-svn: 39153
2006-11-09 06:54:47 +00:00
Chris Lattner ce76529a56 move Type.h to libAST
llvm-svn: 39152
2006-11-09 06:37:20 +00:00
Chris Lattner 08f2791bdc update comment
llvm-svn: 39151
2006-11-09 06:34:47 +00:00
Chris Lattner 697e5d692b Change courses on how we do semantic analysis. Semantic analysis
fundamentally requires having an AST around, so move all sema to the
AST library.  This is the first step, later steps will be needed to
clean up libast.

llvm-svn: 39150
2006-11-09 06:32:27 +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 b26b665742 rename these methods so that they read correctly.
llvm-svn: 39148
2006-11-08 06:10:32 +00:00
Chris Lattner 3503cefbba split ParseStringExpr into semantic/minimal actions
llvm-svn: 39147
2006-11-08 06:03:59 +00:00
Chris Lattner 87ca807e15 add Type.h to the project
llvm-svn: 39146
2006-11-08 06:03:37 +00:00
Chris Lattner 257aae5b47 add a note
llvm-svn: 39145
2006-11-08 06:03:16 +00:00
Chris Lattner bacf0bfe45 add a note
llvm-svn: 39144
2006-11-08 05:53:27 +00:00
Chris Lattner e030db6901 Structure for the type representation.
llvm-svn: 39143
2006-11-08 05:45:01 +00:00
Chris Lattner f89b50c38d init std::string with it's default ctor instead of "".
llvm-svn: 39141
2006-11-06 06:37:47 +00:00
Chris Lattner 034a18c3d2 use default ctor
llvm-svn: 39140
2006-11-06 06:33:29 +00:00
Chris Lattner 168f349036 this is not a converting ctor
llvm-svn: 39139
2006-11-06 06:31:59 +00:00
Chris Lattner b6a0e1781f implement trivial scope caching. This reduces malloc traffic in the common
case, speeding up parsing of this contrived example:

#define A {{}}
#define B A A A A A A A A A A
#define C B B B B B B B B B B
#define D C C C C C C C C C C
#define E D D D D D D D D D D
#define F E E E E E E E E E E
#define G F F F F F F F F F F
#define H G G G G G G G G G G

void foo() {
  H
}

from 7.478s to 4.321s.  GCC requires 8.2s.

llvm-svn: 39138
2006-11-06 00:22:42 +00:00
Chris Lattner 1576870356 pretty print postfix ++/-- nicer
llvm-svn: 39137
2006-11-05 23:54:51 +00:00
Chris Lattner 33ad2cacc9 Make Scope keep track of the kind of scope it is. Properly scope loop and
switch statements.  Make break/continue check that they are inside of an
appropriate control-flow construct.  This implements Parser/bad-control.c.

llvm-svn: 39136
2006-11-05 23:47:55 +00:00
Chris Lattner c19ddcd6dd rename EmptyAction.cpp -> MinimalAction.cpp
llvm-svn: 39135
2006-11-05 18:46:16 +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 a6198b4e33 typographical tweaks
llvm-svn: 39132
2006-11-05 18:05:21 +00:00
Chris Lattner ca96b89772 rename some options
llvm-svn: 39131
2006-11-05 18:00:10 +00:00
Chris Lattner f78e6035da move some content around to make README more focused
llvm-svn: 39130
2006-11-05 17:54:43 +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 c95c8f2356 Fix a bug
llvm-svn: 39128
2006-11-05 07:59:22 +00:00
Chris Lattner cf6bc66421 silence some warnings when asserts are disabled.
llvm-svn: 39127
2006-11-05 07:59:08 +00:00