Commit Graph

34055 Commits

Author SHA1 Message Date
Chris Lattner f0a40e7ef4 correctly handle stuff like:
typedef int G;
  X = sizeof(const G);
  X = sizeof(restrict G);

llvm-svn: 39190
2006-11-20 04:17:27 +00:00
Chris Lattner d0342e5989 Create a new TypeNameType class, which represents typedefs as types. This
allows us to handle stuff like:

typedef int G;
 ..
  X = sizeof(G);

llvm-svn: 39189
2006-11-20 04:02:15 +00:00
Chris Lattner 2ebe4bb64d when a typedef name is parsed as part of declspecs, remember the decl for the
typedef.

llvm-svn: 39188
2006-11-20 01:29:42 +00:00
Chris Lattner 5ca17df626 decls should all have types
llvm-svn: 39187
2006-11-19 23:32:49 +00:00
Chris Lattner 591a675b1c remove #include of clang/Parse/DeclSpec.h from clang/AST/Decl.h
llvm-svn: 39186
2006-11-19 23:16:18 +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 200bdc3b90 add an action method for declspecs without declarators, like "struct foo;".
llvm-svn: 39184
2006-11-19 02:43:37 +00:00
Chris Lattner 94c22cd5b9 rename ParsedClassDeclaration -> ParsedObjcClassDeclaration.
llvm-svn: 39183
2006-11-19 02:35:21 +00:00
Chris Lattner 302b4be4c2 build TypedefDecl objects when parsing typedefs.
Add a parsing fastpath for when we see typedef at the top-level.

llvm-svn: 39182
2006-11-19 02:31:38 +00:00
Chris Lattner 33e8a55ed0 Parse and remember types enough that we can pretty print:
void foo(int X) {
  X = __alignof(int);
  X = sizeof(const int** restrict ** volatile*);
}

as:

x = __alignof(int)
x = sizeof(int const **restrict **volatile *)

llvm-svn: 39181
2006-11-19 01:48:02 +00:00
Chris Lattner 558cb292da add an action for parsing type names.
llvm-svn: 39180
2006-11-19 01:31:06 +00:00
Chris Lattner 52f3dc1ee3 add a note
llvm-svn: 39179
2006-11-19 01:17:45 +00:00
Chris Lattner 9dfdb3c70d rearrange the type printing code so that we can do the horrible C "inside out"
thing properly.  This allows us to print types like:
int (*A)[restrict static 4][6];

properly, in addition to representing them properly. :)

llvm-svn: 39178
2006-11-13 07:38:09 +00:00
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 6e544a9cca Fix an oversight: for modules with no other identifying target info,
the sparc backend should be preferred when running on sparcs.

llvm-svn: 39142
2007-07-11 16:32:10 +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