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

239 Коммитов

Автор SHA1 Сообщение Дата
Ted Kremenek 240f1f00dd Renamed ValueManager to BasicValueFactory.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48025 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-07 20:13:31 +00:00
Chris Lattner 631bf6c325 add analysis source files to project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47953 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 18:22:36 +00:00
Chris Lattner 48b32440f7 Add the various pathsensitive headers to the project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47952 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 18:20:02 +00:00
Chris Lattner 1b653432f0 ProgramEdge.h doesn't exist anymore.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 18:18:31 +00:00
Chris Lattner 2b94fe35ed Add codegen support for ObjC message expressions with the GNU runtime.
Patch by David Chisnall!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-01 08:45:05 +00:00
Anders Carlsson d429cd459a Add Attr.h which is an AST-level class for GCC attributes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47112 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-14 07:14:34 +00:00
Chris Lattner 2ae34ed8ca pass the astconsumer into Sema's ctor, clean up some stuff in
Sema::ActOnTranslationUnitScope.  The various ObjC pieces at the top
of Sema.cpp should be moved into SemaObjC or something.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46787 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 00:46:58 +00:00
Chris Lattner e91c134d8f rename ASTSTreamer.{h|cpp} -> ParseAST.{h|cpp}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46786 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-06 00:23:21 +00:00
Chris Lattner dcbc5b0b07 Make rewriter::inserttext return a bool to indicate if it failed.
Add a RewriteTest::ReplaceStmt method to factor the 'checking for
rewrite failed + emitting diagnostic if so' code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-31 19:37:57 +00:00
Anders Carlsson 84005b4b6b Tweaks to EmitLValue in CGExprConstant. Patch by Eli Friedman.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-26 04:30:23 +00:00
Steve Naroff a15c15a193 Add Basic/Targets.cpp to the Xcode project...
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46182 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-18 23:34:17 +00:00
Fariborz Jahanian 33b9c4e4c6 Patch to rewrite ObjC2's foreach-stmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45760 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-08 22:06:28 +00:00
Chris Lattner 85a932e26f move objc expr sema to its own file.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-04 22:32:30 +00:00
Chris Lattner 8f925280ab Fix a crash reported by Seo Sanghyeon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45530 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-03 06:36:51 +00:00
Chris Lattner 0fc53dfc7a Compute the proper sourcerange for an CompoundLiteralExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45504 91177308-0d34-0410-b5e6-96231b3b80d8
2008-01-02 21:46:24 +00:00
Chris Lattner c063e43618 move file to proper place in project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45379 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28 05:27:01 +00:00
Chris Lattner bfc7930db0 From Lucas Newman:
"Here's a tiny patch that lets the clang Xcode project build in any 
location, so llvm doesn't have to be checked out in your home folder."


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45376 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-28 00:38:23 +00:00
Chris Lattner 1dc4304d65 alphabetize in project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45373 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-27 20:59:50 +00:00
Ted Kremenek 6af1753620 Updated Xcode project to be in sync with recent changes in file locations
introduced in r45292 (http://llvm.org/viewvc/llvm-project?rev=45292&view=rev)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45293 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-21 21:48:31 +00:00
Ted Kremenek 9dadf5a3ff Updated locations of TranslationUnit.[cpp,h] in XCode project.
Added AST/ASTConsumer.cpp to XCode project.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45206 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-19 18:07:54 +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
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
Chris Lattner 2f6974a14c Targets.cpp is gone.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45119 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 20:56:50 +00:00
Chris Lattner 3af66a9335 Sink getName into DirectoryLookup to simplify the client in clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45106 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 17:57:27 +00:00
Chris Lattner 0f441ab20c add headermap.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45095 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 08:22:46 +00:00
Chris Lattner 822da61b74 Step #1 in adding headermap support to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@45089 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-17 06:36:45 +00:00
Steve Naroff 5e71124dab Encode enumeral types.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44956 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 22:30:11 +00:00
Chris Lattner 4c52509ffb unbreak the build. I'm still working on test failures.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44938 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 17:58:05 +00:00
Chris Lattner 4d3914836e split objc pieces of SemaDecl.cpp out into SemaDeclObjC.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44925 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 07:09:47 +00:00
Chris Lattner a9e6372208 Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44908 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 04:13:20 +00:00
Chris Lattner b3a99cd5bc Add ObjC parser support for concatenated ObjC strings. Note that
this is passed to sema and ignored there, so the second part of the
string will not make it into the AST.  Passing to Fariborz to finish
Sema + AST construction.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44898 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-12 01:04:12 +00:00
Anders Carlsson 564f1de67d Move target specific builtin IDs to TargetBuiltins.h so that they can be used by CGBuiltin.cpp
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44748 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-09 23:17:02 +00:00
Ted Kremenek 8b5f658031 Added Driver/TranslationUnit.h and Driver/TranslationUnit.cpp to the
XCode project.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44632 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 21:36:57 +00:00
Ted Kremenek 589fd42d71 Added Basic/LangOptions.cpp to XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44625 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-05 19:07:32 +00:00
Chris Lattner 1438b4918a fix a couple switch codegen problems Oliver reported.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44484 91177308-0d34-0410-b5e6-96231b3b80d8
2007-12-01 05:27:33 +00:00
Chris Lattner e365c50a21 pass diagnostics into the rewrite test client.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44468 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-30 22:25:36 +00:00
Steve Naroff 1f64432558 Several fixes/simplifications surrounding how we stream top-level decl AST's.
The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D; 

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44421 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 22:54:11 +00:00
Chris Lattner b751c28a1a Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Bug pointed out by Michael Zolda, thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44408 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-28 18:51:29 +00:00
Ted Kremenek 588e5ebee2 Moved logic for -Wfloat-equal to SemaChecking.cpp.
Moved utility functions IgnoreParen and friends to be static inline functions
defined in SemaUtil.h.

Added SemaUtil.h to Xcode project.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44312 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-25 00:58:00 +00:00
Steve Naroff f68a63f9cf Fix a basic bug (having to do with typedefs) in Sema::UsualArithmeticConversions().
This resuled in the following crash below.

Also modified the usual-float.c test case to capture this case.

[steve-naroffs-imac:clang/test/Sema] snaroff% ../../../../Debug/bin/clang usual-float.c
Assertion failed: (0 && "Sema::UsualArithmeticConversions(): illegal float comparison"), function UsualArithmeticConversions, file SemaExpr.cpp, line 960.
0   clang                               0x001ef9b9 _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8315PrintStackTraceEv + 45
1   clang                               0x001efd5f _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8313SignalHandlerEi + 323
2   libSystem.B.dylib                   0x90c6297b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x90cdb782 raise + 26
5   libSystem.B.dylib                   0x90cead3f abort + 73
6   libSystem.B.dylib                   0x90cdc923 __assert_rtn + 101
7   clang                               0x00077316 _ZN5clang4Sema26UsualArithmeticConversionsERPNS_4ExprES3_b + 1004
8   clang                               0x000803cf _ZN5clang4Sema27CheckMultiplyDivideOperandsERPNS_4ExprES3_NS_14SourceLocationEb + 181
9   clang                               0x0007a8e8 _ZN5clang4Sema10ActOnBinOpENS_14SourceLocationENS_3tok9TokenKindEPvS4_ + 472
10  clang                               0x000cf058 _ZN5clang6Parser26ParseRHSOfBinaryExpressionENS_6Action12ActionResultILj0EEEj + 1286
11  clang                               0x000cf2de _ZN5clang6Parser25ParseAssignmentExpressionEv + 86



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43985 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-10 19:45:54 +00:00
Chris Lattner b7489d8129 change source location to have two bits for macros, tracking
whether the location is the start and/or end of an expansion.
These are currently not set or used by anything.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43968 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 23:52:16 +00:00
Steve Naroff f3473a7e48 Rewrite global variable initializers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43947 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-09 15:20:18 +00:00
Chris Lattner fab21b6d73 add a getAtOffset() member to simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43905 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 20:51:02 +00:00
Chris Lattner 8b0c2f659d Add a new RewriteRope data structure which is a smarter way to represent the text
backing a rewrite buffer than using an std::vector<char>.  This class was hacked
together very quickly and needs to be cleaned up, but it seems to work.  It speeds
up rewriting a a 7M file from 6.43s to 0.24s on my machine.  The impl could also
be made to be a lot more algorithmically sound.

This produces identical output to using vector on this testcase, if it causes a
problems or bugs are encountered, it can be disabled by changing the 
RewriteBuffer::Buffer typedef back.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43884 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-08 07:35:14 +00:00
Ted Kremenek 8c35a9b3b9 Added TypeSerialization.cpp and DeclSerialization.cpp to the XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43710 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-05 17:04:40 +00:00
Chris Lattner 770951b5bb add support for vector type compatibility checking. Patch by Nate Begeman.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43604 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 05:03:41 +00:00
Steve Naroff 6c6a2dbb4d Tweak RewriteInterfaceDecl() to generate a typedef (if one hasn't already been generated).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43600 91177308-0d34-0410-b5e6-96231b3b80d8
2007-11-01 03:35:41 +00:00
Fariborz Jahanian 19d74e1494 More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43580 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 21:59:43 +00:00
Steve Naroff 8ee529b567 Implement a more sensible strategy for ObjC built-in types (addressing a long standing FIXME in Sema::GetObjcIdType()).
This removes several gross hacks to work around the previous "lazy" behavior.

Two notes:
- MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME.
- I didn't convert Sema::GetObjcProtoType() yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43567 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 18:42:27 +00:00
Fariborz Jahanian dea84f82b2 After Anders check-in, we can now encode 'Class' type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43556 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 16:00:13 +00:00
Steve Naroff 9165ad378f Add some plumbing to help cope with rewriting "id<p>", "Class<p>*".
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43543 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 04:38:33 +00:00
Fariborz Jahanian 8be9d0a9cd Added new type and bitfield fields in some decl types in preparation for objective-c's type qualifiers.
Added initialization of Class/SEMA types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43534 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-31 00:12:35 +00:00
Steve Naroff 09b266eb2a Stop pre-defining objc_msgSend/objc_getClass in the preprocessor. Instead, I generate these declaration on the fly when rewriting a message expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43529 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 23:14:51 +00:00
Fariborz Jahanian c2939bc82c Added type encoding for 'id' type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43504 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 17:06:23 +00:00
Steve Naroff 2feac5e559 Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten properly).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43494 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-30 03:43:13 +00:00
Fariborz Jahanian 33e1d64ab5 Encoding for objectiive-c methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43481 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 22:57:28 +00:00
Steve Naroff 60fcceeedb This commit contains lot's of small tweaks to how we pass around and store SourceLocation's for interfaces/protocols/categories/implementations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43475 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 21:38:07 +00:00
Anders Carlsson e8c4953352 Address Chris's comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43445 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 06:33:42 +00:00
Chris Lattner fe79595619 Implement *skeletal* support for representing GNU inline asm stmts in the AST,
resolving a crash on a .i file in PR1750.  We now generate 49 errors on the
.i file in that bug.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43433 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-29 04:04:16 +00:00
Fariborz Jahanian 4d733d3288 Path to synthesize 'instance' size field of _objc_class metadata.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43409 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 23:09:28 +00:00
Steve Naroff bef1185418 Start rewriting ObjC interfaces. As a start, we comment out all the methods. This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43404 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-26 20:53:56 +00:00
Ted Kremenek f152b2ee87 Added DeclSerialization.cpp to XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43362 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 21:39:10 +00:00
Fariborz Jahanian ccd87b07a7 Refactored several meta data for reusability.
Changed the entire rewrite of metadata to write to std::string
object instead of stdout.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43360 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 20:55:25 +00:00
Chris Lattner 158ecb9767 Convert one type of metadata to use std::string instead of
printf as an example.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43346 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 17:07:24 +00:00
Ted Kremenek a194bc6018 Added SourceLocation.cpp to XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43344 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 16:03:53 +00:00
Chris Lattner 27437caade Add a new ChooseExpr::isConditionTrue method to unify
some code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43322 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-25 00:29:32 +00:00
Fariborz Jahanian 2e6d935930 Refactord instance and class metadata emission. Refactored protocols metadata emission.
Implemented emission of category metadata,


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43308 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-24 19:23:36 +00:00
Steve Naroff ebf2b56bce Add some plumbing to rewrite message expressions (still under construction).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43274 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-23 23:50:29 +00:00
Steve Naroff 7e15891fc8 - Add rewrite rule for @class.
- Add setter/getter to ObjcClassDecl.
- Predefined key runtime functions.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43257 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-23 20:20:08 +00:00
Fariborz Jahanian e887c09395 This patch generates protocol metadata and all its sub-metadata.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43233 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-22 21:41:37 +00:00
Steve Naroff 806a4ebcf5 Fix the previous (short lived:-) FIXME.
I didn't realize that GCC considers this a hard error (I thought it was built-in).

Since it's not, we should simply emit an error.

[dylan:~/llvm/tools/clang] admin% cc -c trivial.m
trivial.m:6: error: cannot find interface declaration for 'NSConstantString'

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang trivial.m 
trivial.m:6:16: error: cannot find interface declaration for 'NSConstantString'
NSString *s = @"123";
               ^
1 diagnostic generated.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43157 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 23:53:51 +00:00
Ted Kremenek 6acaabc91e Added StmtIterator.cpp and StmtIterator.h to the XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43139 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 18:22:01 +00:00
Steve Naroff fd8b4a4b29 Fix the following bug...
unsigned char asso_values[] = { 34 };
int legal2() { 
  return asso_values[0]; 
}

The code that creates the new constant array type was operating on the original type.

As a result, the constant type being generated was "unsigned char [1][]" (which is wrong).

The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]"

I added this case to array-init.c, which clearly didn't catch this bogosity...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43112 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-18 03:27:23 +00:00
Ted Kremenek 5a59d92fb0 Added Driver/SerializationTest.cpp to the XCode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@43054 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-16 23:40:12 +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
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
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
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 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 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 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
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
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
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
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
Chris Lattner 88e0052dd8 add RewriterTest.cpp to xcode project.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42863 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-11 16:34:20 +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
Steve Naroff e21b573bbf Refinements to Sema::GetObjcIdType()...
- Cache the typedef, not the type (avoids importing AST/Type.h).
- Emit an error if "id" cannot be found.
- Comment the routine and add a FIXME to reconsider how we emulate GCC's new fangled behavior. This isn't a priority for now, since almost no code depends on having "id" built-in.
- Add a test.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42845 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 23:24:43 +00:00
Anders Carlsson 2d85f8ba62 Emit a warning when the body of an if block is a NullStmt.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42840 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 20:50:11 +00:00
Chris Lattner d19144b244 resolve a fixme, by moving __builtin_va_list to a more logical
place and making it correctly parameterized on the target.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42830 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-10 17:48:53 +00:00
Steve Naroff b216c8861c Make sure methods with no return type default to "id".
This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).

Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.

Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42817 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 22:01:59 +00:00
Fariborz Jahanian 05672a0ce8 Remove addition of protocol names to declaration scopes, use a separate
DenseMap to keep track of such declarations and derive ObjcProtocolDecl
directyly from NamedScope.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42801 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 18:03:53 +00:00
Chris Lattner 4e1d99a8a4 switch more code to use Token::is/isNot where possible.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42797 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:41:39 +00:00
Chris Lattner b652cea7d7 rename some "Parse" actions to "ActOn". Move code around in
ParseFunctionDefinition so that ActOnFunctionDefBody is always
called if ActOnStartOfFunctionDef is called.  This fixes a crash
reported by Nuno Lopes.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42793 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-09 17:14:05 +00:00
Fariborz Jahanian e37882ad33 Added a new class for Interfaces qualified by protocol list.
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42776 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 23:06:41 +00:00
Steve Naroff 22cdd239dc Removed unused instance variable from FieldDecl.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42773 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 21:56:47 +00:00
Chris Lattner 8307adb684 Move identifierTable.h to the right folder.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42770 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 21:35:59 +00:00
Steve Naroff eefc418b8e Convert Selector Maps/Sets to use stronger typing (now that we have DenseMapInfo in IdentifierTable.h).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@42767 91177308-0d34-0410-b5e6-96231b3b80d8
2007-10-08 21:05:34 +00:00