Commit Graph

2218 Commits

Author SHA1 Message Date
Fariborz Jahanian a32aaefadc Implementation of AST for @protocol expression.
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Hartmut Kaiser 7078da8e58 Updated VC++ build system.
Silenced some VC++ warnings.
Had to rephrase a partial specialization of the IntrospectionTrait struct in SerializationTest.cpp, please review.
Added a compiler specific workaround in IdentifierTable.h. Is that the way to fix this kind of issues?

llvm-svn: 43074
2007-10-17 15:00:17 +00:00
Chris Lattner 253023b25f fix problems with test/sema/Cocoa.m etc on non-apple machines.
llvm-svn: 43067
2007-10-17 06:04:46 +00:00
Anders Carlsson f94cd1ffe6 Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Anders Carlsson 86edafc6d6 Fix the build.
llvm-svn: 43057
2007-10-17 00:50:25 +00:00
Ted Kremenek 970217fae9 Added Driver/SerializationTest.cpp to the XCode project.
llvm-svn: 43054
2007-10-16 23:40:12 +00:00
Ted Kremenek 4e816133c8 Started work on clang object serialization. Experimental
serialization logic as well as driver code is now in
Driver/SerializationTest.cpp.  The status of this code is that it
should be used by no clients.

Added --test-pickling option to driver to run the serialization code.

Modified IdentifierInfo and IdentifierTable to have friend classes
that permit object serialization.  Such friendship may not be needed
in the final design.

llvm-svn: 43052
2007-10-16 23:37:27 +00:00
Fariborz Jahanian 6bd1d612ac Fix location processing of @selector: the range should include the @ sign.
llvm-svn: 43051
2007-10-16 23:21:02 +00:00
Steve Naroff 077c83bddb Add Sema::CheckMessageArgumentTypes()...
llvm-svn: 43050
2007-10-16 23:12:48 +00:00
Chris Lattner 37390bed4d Fix location processing of @encode: the range should include the @ sign.
@selector probably gets this wrong also.

llvm-svn: 43048
2007-10-16 22:51:17 +00:00
Chris Lattner a7c19feca2 Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.

llvm-svn: 43047
2007-10-16 22:36:42 +00:00
Fariborz Jahanian ebac2cb235 Patch to diagnose duplicate method implementations.
llvm-svn: 43046
2007-10-16 21:52:23 +00:00
Steve Naroff d275426449 Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.

llvm-svn: 43045
2007-10-16 21:36:54 +00:00
Chris Lattner 5a2fe28aca publish location info
llvm-svn: 43044
2007-10-16 21:21:26 +00:00
Fariborz Jahanian 923aebe09c Steve, pointer out that getName() is available for selectors. Made code much smaller, thanks.
llvm-svn: 43042
2007-10-16 21:07:53 +00:00
Chris Lattner 0bd1c97293 Push the rewriter forward a bit more. Now it rewrites
#import to #include's as a test.

llvm-svn: 43041
2007-10-16 21:07:07 +00:00
Chris Lattner 9a36bb84ea these aren't const.
llvm-svn: 43040
2007-10-16 21:04:49 +00:00
Fariborz Jahanian 81ccd88f0e Fix problem dumping/printing method names with null selector.
llvm-svn: 43039
2007-10-16 20:52:13 +00:00
Fariborz Jahanian 4bef462a3e Patch to implement AST generation for objective-c's @selector expression.
llvm-svn: 43038
2007-10-16 20:40:23 +00:00
Steve Naroff 55f52da24c Emit diagnostics for methods not found.
llvm-svn: 43037
2007-10-16 20:39:36 +00:00
Anton Korobeynikov 002c52ce6e Unbreak mingw32. Maybe there should be something like libClandSystem? :)
llvm-svn: 43029
2007-10-16 09:09:44 +00:00
Chris Lattner e6dcd505d0 initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed.

llvm-svn: 43024
2007-10-16 02:55:40 +00:00
Steve Naroff 698495522d Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).
llvm-svn: 43023
2007-10-16 00:00:18 +00:00
Fariborz Jahanian 76a9427783 Patch to parse @selector expressions.
llvm-svn: 43022
2007-10-15 23:39:13 +00:00
Steve Naroff f73b784a5e Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.

I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).

llvm-svn: 43021
2007-10-15 23:35:17 +00:00
Steve Naroff 126b4d835f Fix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().
Now were correctly allow the following...

    i = [str rangeOfString:@"]"].length;

llvm-svn: 43012
2007-10-15 20:55:58 +00:00
Steve Naroff 32e44c0032 Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Anders Carlsson 7e13ab88a2 Add code generation and sema checking for __builtin_va_arg.
llvm-svn: 43006
2007-10-15 20:28:48 +00:00
Fariborz Jahanian d4b3015dd7 Several name lookup conflict detection fixes involving objective-c names.
llvm-svn: 43000
2007-10-15 19:16:57 +00:00
Steve Naroff 66e9f331ba Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).

llvm-svn: 42983
2007-10-15 14:41:52 +00:00
Steve Naroff 271643620b Teach the type checker about "id". This removes the following bogus warning...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.m
t.m:29:18: warning: incompatible pointer types assigning 'id' to 'NSString *'
    resultString = [[NSString alloc] initWithFormat:0 arguments:0];
    ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm-svn: 42975
2007-10-15 03:14:16 +00:00
Anders Carlsson cbfc4b8824 Add support for Pascal strings.
llvm-svn: 42974
2007-10-15 02:50:23 +00:00
Anders Carlsson b30f47a869 Fix a warning
llvm-svn: 42973
2007-10-15 02:50:04 +00:00
Steve Naroff 5d15254496 - Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.
- Start looking up methods in the global method pools (for "id").
- Start integrating interface types into the type system.

llvm-svn: 42971
2007-10-14 23:13:51 +00:00
Steve Naroff ca0ecfe048 Add category lookup (removing a couple FIXME's).
Changed ObjcInterfaceDecl::ListCategories->CategoryList.

llvm-svn: 42968
2007-10-14 18:27:41 +00:00
Steve Naroff e7ed06e6fc Fix -ast-dump for ObjC.
llvm-svn: 42967
2007-10-14 17:03:01 +00:00
Steve Naroff 5811baf1a0 - Added Sema::AddFactoryMethodToGlobalPool and Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow us to efficiently lookup a method from a selector given no type information (for the "id" data type).
- Fixed some funky "}
                    else {" indentation in Sema::ActOnAddMethodsToObjcDecl(). I'd prefer we stay away from this style...it wastes space and isn't any easier to read (from my perspective, at least:-)

- Changed Parser::ParseObjCInterfaceDeclList() to only call Action::ActOnAddMethodsToObjcDecl() when it actually has methods to add (since most interface have methods, this is a very minor cleanup).

llvm-svn: 42957
2007-10-14 00:58:41 +00:00
Anders Carlsson d5f857f2e5 Fix an incorrect assertion.
llvm-svn: 42951
2007-10-13 05:52:34 +00:00
Chris Lattner 6a91cc03ad haha, my devious plot is complete:
$ clang rewrite.c -rewrite-test
prints:

int foo() {
        b:      foo();
f:      foo();
    foo();
}

for:

int foo() {
	b:	foo();
f:	foo();
    foo();
}

amazing.

llvm-svn: 42944
2007-10-13 00:46:29 +00:00
Anders Carlsson a7408e742a Add __builtin_va_list definitions for x86_64 and ppc64.
llvm-svn: 42943
2007-10-13 00:45:48 +00:00
Chris Lattner 2a8ab05f5f With this I can now insert stuff before tabs, woo.
llvm-svn: 42942
2007-10-13 00:21:23 +00:00
Chris Lattner 58bad341bc Woo, tab deletion now works. Next lets see if we can
insert stuff.

llvm-svn: 42941
2007-10-13 00:17:04 +00:00
Chris Lattner 2fcf1b83c1 another step forward in rewriter stuff. This still has
some incredibly subtle details that I'm working on getting
right.

llvm-svn: 42940
2007-10-13 00:11:23 +00:00
Anders Carlsson 24ebce6fca Generate code for va_start and va_end.
llvm-svn: 42939
2007-10-12 23:56:29 +00:00
Fariborz Jahanian fd0312ed79 Patch to check for duplicate method decls in protocols.
llvm-svn: 42938
2007-10-12 23:43:31 +00:00
Chris Lattner bee82b0675 remove dead method with bogus comment.
llvm-svn: 42937
2007-10-12 23:18:19 +00:00
Fariborz Jahanian ecfe4f1453 Check and diagnose that objective-c objects may not be statically allocated.
llvm-svn: 42936
2007-10-12 22:10:42 +00:00
Ted Kremenek 41362cea7b Added notion of '*' specified format width/specifiers when checking
printf format strings.  Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Carlsson for reporting this missing feature.

llvm-svn: 42933
2007-10-12 20:51:52 +00:00
Chris Lattner 2c06f7ea45 add a new SM::getDecomposedFileLoc method.
llvm-svn: 42931
2007-10-12 20:24:19 +00:00
Fariborz Jahanian 02fbb68e85 Fixed typo in comment.
llvm-svn: 42928
2007-10-12 19:53:08 +00:00