Submitted by:
Reviewed by:
Finish up Sema::ParseMemberReferenceExpr. This involved:
- added a getMember() function to RecordDecl.
- added stronger typing for "Members" (from Decl->FieldDecl).
- added a dignostic for members not found.
- changed MemberExpr to install the correct TypeRef.
- In general, simplified and cleaned up the routing.
llvm-svn: 39364
Submitted by:
Reviewed by:
Implement type checking. First round of changes are:
- Added predicates to Type.
- Added predicates to BinExpr.
- Added Check hooks that model the categories for Binary ops.
- Added TypeRef to Expr. Will lazily eval subclasses...
- Misc bug fixes/cleanups.
llvm-svn: 39360
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
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
whose decl objects are lazily created the first time they are referenced.
Builtin functions are described by the clang/AST/Builtins.def file, which
makes it easy to add new ones.
This is missing two important pieces:
1. Support for the rest of the gcc builtins.
2. Support for target-specific builtins (e.g. __builtin_ia32_emms).
Just adding this builtins reduces the number of implicit function definitions
by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h.
I need to add all the i386-specific ones to eliminate several hundred more.
ugh.
llvm-svn: 39327
translation-unit scope, so we only warn about each implicitly defined
function once. This cuts the number of errors parsing carbon.h from 616 to 550.
llvm-svn: 39325
struct q { int a, a; };
with:
t.c:3:19: error: duplicate member 'a'
struct q { int a, a; };
^
t.c:3:16: error: previous definition is here
struct q { int a, a; };
^
llvm-svn: 39303
This emits these diagnostics:
t.c:4:14: error: redefinition of 'a'
enum foo22 { a, b };
^
t.c:3:5: error: previous definition is here
int a;
^
t.c:8:17: error: redefinition of enumerator 'b'
enum foo23 { c, b };
^
t.c:4:17: error: previous definition is here
enum foo22 { a, b };
^
4 diagnostics generated.
for:
int a;
enum foo22 { a, b };
enum foo23 { c, b };
llvm-svn: 39302
t.c:10:15: warning: 'bonk' may not be nested in a struct due to flexible array member
struct bink bonk;
^
t.c:13:14: error: 'struct bink' may not be used as an array element due to flexible array member
struct bink A[123];
^
for:
struct bink {
struct bink *a;
int X[]; // ok.
};
struct foo {
int A;
struct bink bonk;
};
struct bink A[123];
llvm-svn: 39296
struct bork {
int X[];
};
struct bink {
struct bink a;
int X[]; // ok.
};
to:
t.c:3:7: error: flexible array 'X' not allowed in otherwise empty struct
int X[];
^
t.c:7:15: error: field 'a' has incomplete type
struct bink a;
^
llvm-svn: 39295
like:
struct S { struct S {} X; };
with:
t.c:2:19: error: nested redefinition of 'struct'
struct S { struct S {} X; };
^
t.c:2:1: error: previous definition is here
struct S { struct S {} X; };
^
llvm-svn: 39292
struct blah * P;
union blah *P2;
we now emit:
t.c:2:1: error: redefinition of 'blah' with tag that does not match previous use
union blah *P2;
^
t.c:1:8: error: previous use is here
struct blah * P;
^
llvm-svn: 39275
Detect and emit errors when names are redefined in the same scope, e.g.
test/Parser/argument_redef.c, which now emits:
argument_redef.c:4:22: error: redefinition of 'A'
int foo(int A) { int A; }
^
argument_redef.c:4:13: error: previous definition is here
int foo(int A) { int A; }
^
llvm-svn: 39257
the info. Also, call Actions.ParseParamDeclaratorType instead of
Actions.ParseDeclarator for parameter type lists: we don't want declaration
objects created when parsing a function declarator, we just want type info.
llvm-svn: 39230
parameters: build an array of ParamInfo structures and pass it to the
declarator for safe keeping (it owns the list).
Next step: actually populate the arg array with useful stuff.
llvm-svn: 39229