Граф коммитов

42 Коммитов

Автор SHA1 Сообщение Дата
Steve Naroff 14f3f1b80e Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when diagnosing incorrect code.
Bug submitted by Eli.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45989 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-14 23:33:18 +00:00
Ted Kremenek a526c5c67e Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45715 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-07 19:49:32 +00:00
Chris Lattner 529bd02aff When promoting array to pointer for argument, don't lose type qualifiers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 22:50:48 +00:00
Chris Lattner 0bc735ffcf Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45410 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-29 19:59:25 +00:00
Chris Lattner 68cfd49ea3 reenable this code, fix the testcase.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45205 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 18:01:43 +00:00
Chris Lattner 852e311512 disable my commit from yesterday, fixing a regression test failure.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45204 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 17:49:45 +00:00
Chris Lattner cd8812948b Implement C99 6.7.5.3p1
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45188 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 05:31:29 +00:00
Fariborz Jahanian d58fabf7ed Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45174 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 21:33:44 +00:00
Steve Naroff b99a4a3630 Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45146 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-18 03:41:15 +00:00
Fariborz Jahanian c569249ca0 Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45121 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 21:03:50 +00:00
Fariborz Jahanian b107ce82d4 Simplified setting up Method's scope before generating AST for its nody.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44576 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-04 19:20:11 +00:00
Nate Begeman bff5f5cfd1 Rename Sema method to follow class naming convention
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44069 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-13 21:49:48 +00:00
Steve Naroff 6649992b19 Remove Sema::ObjcBuildMethodParameter().
Modify Sema::ParseParamDeclarator() to work for both ActOnStartOfFunctionDef() and ObjcActOnStartOfMethodDef().



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44006 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-12 03:44:46 +00:00
Fariborz Jahanian 360300ca2e Some code clean up in the form of name changes for functions which
process method definitions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 22:27:59 +00:00
Fariborz Jahanian 1f7b6f88f1 Added class context to method declarations. Provide "interface *" type
to 'self' method of instance methods.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 19:52:12 +00:00
Fariborz Jahanian 3560002bed Insert invisble arguments to method definition header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43948 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 17:18:29 +00:00
Fariborz Jahanian 306d68f5ef First patch toward rewriting of method definitions. This is work in progress.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43915 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 23:49:49 +00:00
Fariborz Jahanian 4b6c9051c6 Patch to create protocol conforming class types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42856 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 00:55:41 +00:00
Chris Lattner c7229c338c move IdentifierTable.h from liblex to libbasic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42730 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-07 08:58:51 +00:00
Steve Naroff 980e508ca7 Move ObjC decls to DeclObjC.h, a new AST header.
Update clients and add to project file.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-01 19:00:59 +00:00
Steve Naroff 08d92e46d2 Start converting Action methods from Parse-prefix to ActOn-prefix.
The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41986 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-15 18:49:24 +00:00
Steve Naroff 08d51393bf Fix the following bug submitted by Justin Handville.
int main(int argc, char* argv[])
{
  return 0;
}

After speaking briefly with Chris, we decided this should be a front-end fix.

The fix...have Sema::GetTypeForDeclarator() do the default function/array conversion, as
I outlined in the 9/9 email on this topic.

Since this conversion is done before Sema::ParseParamDeclarator(), I thought I could
remove the conversion from Sema::ParseParamDeclarator(). Unfortunately, this didn't work.
The conversion apparently needs to be done in both places (which doesn't make sense to me).

Will investigate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41811 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-10 22:17:00 +00:00
Steve Naroff 3536b443bc The goal of this commit is to get just enough Sema support to recognize Objective-C classes
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
preliminary.

The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41752 91177308-0d34-0410-b5e6-96231b3b80d8
2007-09-06 21:24:23 +00:00
Steve Naroff 42471f8bc6 Final phase of array cleanup (for now), removing a FIXME from yesterday.
Moved several array constraints checks from Sema::VerifyConstantArrayType() to
Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and
could be removed eventually.

Now, we get the following (correct) messages for BlockVarDecls:-)

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic
x.c:4:20: error: size of array has non-integer type 'float'
  int size_not_int[f];
                   ^
x.c:5:21: error: array size is negative
  int negative_size[1-2];
                    ^~~
x.c:6:17: warning: zero size arrays are an extension
  int zero_size[0];
                ^
3 diagnostics generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41624 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 22:35:45 +00:00
Steve Naroff c9406125e2 Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.
Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41616 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-30 18:10:14 +00:00
Steve Naroff 5912a3544e Finish converting decls over to the new invalid decl API.
Also removed an old FIXME (FIXME: "auto func();" passes through...).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41555 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 20:14:24 +00:00
Chris Lattner 94f81fd0b0 extwarn about VLAs in C89 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41545 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 16:54:00 +00:00
Chris Lattner d1eb332181 c++'0x has long long also.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41544 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 16:41:29 +00:00
Chris Lattner b23deda733 warn about long long when in c89 mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 16:40:32 +00:00
Steve Naroff e1223f7246 Implement more thoughful error recovery when dealing with bogus declarator types.
For example, the following code was resulting in spurious warnings. This was the result of
Sema::GetTypeForDeclarator() synthesizing a type to hand back to the caller (in this case,
"int []", instead of "struct s[]", which is invalid).

struct s; 
struct s* t (struct s z[]) {   // expected-error {{array has incomplete element type}}
  return z;
}

Strategy: Flag the error in Declarator/DeclaratorChunk. This info is later stored in 
the ParmVarDecl. If the decl is referenced, Sema::ParseIdentifierExpr() will check if 
the type is invalid. If so, it quietly returns "true", without instantiating a DeclRefExpr.

This seems to work nicely. If Chris is happy with the approach, I will generalize this to
all VarDecls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41521 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-28 03:03:08 +00:00
Steve Naroff 26b8ff45ba Fix bogus warnings (noticed by Chris) with array-constraints.c.
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit
only deals with the array types (DeclaratorCheck::Array), though the
rest of this routine should be reviewed. Given the complexity of C declarators,
I don't want to change the entire routine now (will discuss with Chris tomorrow).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41443 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-26 14:38:38 +00:00
Chris Lattner 3cbc38bd35 add sema support for complex integer types
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41232 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-21 17:02:28 +00:00
Steve Naroff 8d1a3b8ca1 Two typeof() related changes...
- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type). 

One "random" (or at least delayed:-) change...

- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40676 91177308-0d34-0410-b5e6-96231b3b80d8
2007-08-01 17:20:42 +00:00
Chris Lattner 02c642e8f4 remove more explicit accesses to the canonical type pointer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40653 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 21:33:24 +00:00
Chris Lattner a1d9fdea79 rename isReferenceType to follow the new scheme.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40640 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 16:56:34 +00:00
Steve Naroff d1861fd633 Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40631 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-31 12:34:36 +00:00
Chris Lattner 78c75fb3d2 recover from void argument types more nicely.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40169 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 05:30:18 +00:00
Chris Lattner 4565d4e83c better wording for an error, suggested by Neil.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40163 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 05:26:43 +00:00
Chris Lattner 2ff5426cd8 improve and simplify error recovery for calls, fix a crash when diagnosing
invalid arguments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40161 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-21 05:18:12 +00:00
Chris Lattner 5265af5b55 Fix a crasher that Neil reported: Sema::GetTypeForDeclarator should never
return a null type.  If there is an error parsing the type, pick a new type
for error recovery purposes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@40029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-19 00:42:40 +00:00
Chris Lattner 7a543ad55a Unspecified type specs default to int. This fixes a crash
on test/Sema/implicit-int.c



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39833 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-13 21:02:29 +00:00
Reid Spencer 5f016e2cb5 Stage two of getting CFE top correct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@39734 91177308-0d34-0410-b5e6-96231b3b80d8
2007-07-11 17:01:13 +00:00