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

1023 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek bfa82c4c23 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43052 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 23:37:27 +00:00
Fariborz Jahanian 2a35fa9b5e Fix location processing of @selector: the range should include the @ sign.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43051 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 23:21:02 +00:00
Steve Naroff 81bfde990c Add Sema::CheckMessageArgumentTypes()...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43050 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 23:12:48 +00:00
Chris Lattner 674af95412 Fix location processing of @encode: the range should include the @ sign.
@selector probably gets this wrong also.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43048 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 22:51:17 +00:00
Chris Lattner 311ff02fae 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43047 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 22:36:42 +00:00
Fariborz Jahanian 3e7fd152aa Patch to diagnose duplicate method implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43046 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:52:23 +00:00
Steve Naroff 3bea81bbae Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43045 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:36:54 +00:00
Chris Lattner 05de8bc173 publish location info
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43044 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:21:26 +00:00
Fariborz Jahanian c5c42f5311 Steve, pointer out that getName() is available for selectors. Made code much smaller, thanks.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43042 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:07:53 +00:00
Chris Lattner 2c64b7b938 Push the rewriter forward a bit more. Now it rewrites
#import to #include's as a test.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43041 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:07:07 +00:00
Chris Lattner 10864b4725 these aren't const.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43040 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 21:04:49 +00:00
Fariborz Jahanian f24d95acc1 Fix problem dumping/printing method names with null selector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43039 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 20:52:13 +00:00
Fariborz Jahanian b62f681340 Patch to implement AST generation for objective-c's @selector expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43038 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 20:40:23 +00:00
Steve Naroff 983df5b228 Emit diagnostics for methods not found.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43037 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 20:39:36 +00:00
Anton Korobeynikov bd0be39f4c Unbreak mingw32. Maybe there should be something like libClandSystem? :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43029 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 09:09:44 +00:00
Chris Lattner 943140ee64 initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43024 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 02:55:40 +00:00
Steve Naroff a1fe1176a4 Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43023 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 00:00:18 +00:00
Fariborz Jahanian a0818e3cd7 Patch to parse @selector expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43022 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 23:39:13 +00:00
Steve Naroff 2198891824 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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43021 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 23:35:17 +00:00
Steve Naroff a642beb9f1 Fix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().
Now were correctly allow the following...

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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43012 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 20:55:58 +00:00
Steve Naroff ec0550fa36 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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43009 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 20:41:53 +00:00
Anders Carlsson 7c50aca2fe Add code generation and sema checking for __builtin_va_arg.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43006 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 20:28:48 +00:00
Fariborz Jahanian be127ba477 Several name lookup conflict detection fixes involving objective-c names.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43000 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 19:16:57 +00:00
Steve Naroff 7e219e47de Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42983 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 14:41:52 +00:00
Steve Naroff 954ea17353 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];
    ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42975 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 03:14:16 +00:00
Anders Carlsson ee98ac5a13 Add support for Pascal strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42974 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 02:50:23 +00:00
Anders Carlsson 1ff8b58fa0 Fix a warning
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42973 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-15 02:50:04 +00:00
Steve Naroff ff1afdb4f5 - 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42971 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14 23:13:51 +00:00
Steve Naroff 3d58138992 Add category lookup (removing a couple FIXME's).
Changed ObjcInterfaceDecl::ListCategories->CategoryList.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42968 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14 18:27:41 +00:00
Steve Naroff 8de2826e4d Fix -ast-dump for ObjC.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42967 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14 17:03:01 +00:00
Steve Naroff 58ff9e8f06 - 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).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42957 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-14 00:58:41 +00:00
Anders Carlsson 23af9f2128 Fix an incorrect assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42951 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 05:52:34 +00:00
Chris Lattner 57c337d9ab 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42944 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 00:46:29 +00:00
Anders Carlsson fb5e5ba3c7 Add __builtin_va_list definitions for x86_64 and ppc64.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42943 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 00:45:48 +00:00
Chris Lattner 03b0710435 With this I can now insert stuff before tabs, woo.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42942 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 00:21:23 +00:00
Chris Lattner 88d0ed0c58 Woo, tab deletion now works. Next lets see if we can
insert stuff.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42941 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 00:17:04 +00:00
Chris Lattner 7c239606f3 another step forward in rewriter stuff. This still has
some incredibly subtle details that I'm working on getting
right.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42940 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-13 00:11:23 +00:00
Anders Carlsson 793680ed81 Generate code for va_start and va_end.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42939 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 23:56:29 +00:00
Fariborz Jahanian 1109b42c03 Patch to check for duplicate method decls in protocols.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 23:43:31 +00:00
Chris Lattner 833b2eb738 remove dead method with bogus comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42937 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 23:18:19 +00:00
Fariborz Jahanian e7f64cc250 Check and diagnose that objective-c objects may not be statically allocated.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42936 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 22:10:42 +00:00
Ted Kremenek 580b664e9c 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42933 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 20:51:52 +00:00
Chris Lattner 3457e8cbaa add a new SM::getDecomposedFileLoc method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42931 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 20:24:19 +00:00
Fariborz Jahanian 3fe44e4482 Fixed typo in comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42928 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 19:53:08 +00:00
Fariborz Jahanian 4cabdfc51c Fixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry lookup
ok class names and streamlined this logic to do the lookup once.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42926 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 19:38:20 +00:00
Steve Naroff 8f74476413 Replace one FIXME with another. We handle protocols just fine now. The ObjC decl will only be 0 when we have an error on the ObjC decl. I would prefer we pass in a decl that is marked as invalid. I don't think this is critical to fix now, however I'd like us to be consistent. There are currently many places that don't mark the decl as invalid (which need to be fixed)...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42923 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 18:49:25 +00:00
Anders Carlsson 6eda8c9cef Add some more diagnostics for va_start, fix tests so they pass with these new diags.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42917 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 17:48:41 +00:00
Fariborz Jahanian bece4ac257 Fixed a bug whereby, struct tag name matches a typedef/objc-class name
and hid them.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42915 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 16:34:10 +00:00
Steve Naroff 075878af57 Temporary fix to test case. This area is currently under construction...test case will be changing again soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42914 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 16:15:17 +00:00
Chris Lattner cde8bc49a1 add comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42887 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-12 00:37:26 +00:00