Commit Graph

8422 Commits

Author SHA1 Message Date
Anders Carlsson 8e0ba05074 Did not mean to commit this.
llvm-svn: 61296
2008-12-21 00:16:32 +00:00
Anders Carlsson 3d312f8788 Handle VLA indexing
llvm-svn: 61295
2008-12-21 00:11:23 +00:00
Douglas Gregor 2eedc3aa1c Add support for member references (E1.E2, E1->E2) with C++ semantics,
which can refer to static data members, enumerators, and member
functions as well as to non-static data members.

Implement correct lvalue computation for member references in C++. 
Compute the result type of non-static data members of reference type properly.

llvm-svn: 61294
2008-12-20 23:49:58 +00:00
Fariborz Jahanian a0befc0a6f Finish up saving original parameter type and
using it in ObjC's method parameter encoding.

llvm-svn: 61293
2008-12-20 23:29:59 +00:00
Eli Friedman 5ad3c91b27 Extend the unsupported error to include break and continue, and fix a
warning by using an unsigned index.

llvm-svn: 61292
2008-12-20 23:18:29 +00:00
Eli Friedman f4084708cd Make VLAs usable, and make basic usage work correctly. Also, add a
simple test that actually does VLA codegen.

Note that despite the fact that the alloca isn't in the entry block, it 
should dominate all uses; this is guaranteed by the restrictions on goto 
into VLA scope in C99.

llvm-svn: 61291
2008-12-20 23:11:59 +00:00
Anders Carlsson 5d985f5f16 Handle typedefs to VLAs (Emit the size expr when we encounter the typedef
llvm-svn: 61290
2008-12-20 21:51:53 +00:00
Anders Carlsson fbef9c208f Check the entire StackSaveValues stack for VLAs when dealing with goto and return statements. Noticed by Eli Friedman.
llvm-svn: 61289
2008-12-20 21:33:38 +00:00
Anders Carlsson c20879a6e4 Make sure to generate code for arguments that have a variably modified type.
llvm-svn: 61288
2008-12-20 21:28:43 +00:00
Fariborz Jahanian 0c277dbee2 Add case for the new AST node.
llvm-svn: 61287
2008-12-20 21:06:28 +00:00
Fariborz Jahanian 7664ffb954 introducing ParmVarWithOriginalTypeDecl class to
keep track of the original parameter decl. types.
This is work in progress.

llvm-svn: 61286
2008-12-20 20:56:12 +00:00
Anders Carlsson 8a01b79274 Change EmitVLASize to take a QualType that must be a variably modified type.
Emit the size even if the declared type is a variably modified type. This lets us handle

void f(int n) {
  int (*a)[n];
  
  printf("size: %d\n", sizeof(*a));
}

llvm-svn: 61285
2008-12-20 20:46:34 +00:00
Anders Carlsson e388a5bf44 Split up emitting of VLA sizes and getting the size of a VLA.
llvm-svn: 61284
2008-12-20 20:27:15 +00:00
Anders Carlsson 6200f0c533 Add some ErrorUnsupported calls and turn on VLA codegen again.
llvm-svn: 61283
2008-12-20 19:33:21 +00:00
Fariborz Jahanian 7acf0749d4 Strangely enough, name of ObjC class is not encoded into the
full encoding of the class which has an ivar of pointer to this
class. Its name is encoded in the type for the ivar in the
ivar-list metadata. This patch conforms to the above rule.

llvm-svn: 61282
2008-12-20 19:17:01 +00:00
Sebastian Redl e10c2c32af Implement checks for bool in increment and decrement.
llvm-svn: 61275
2008-12-20 09:35:34 +00:00
Zhongxing Xu af7415ffb1 Lazy bingding for region-store manager.
* Now Bind() methods take and return GRState* because binding could
  also alter GDM.
* No variables are initialized except those declared with initial
  values.
* failed C test cases are due to bugs in RemoveDeadBindings(),
which removes constraints that is still alive. This will be fixed in later
patch.
* default value of array and struct regions will be implemented in later patch.

llvm-svn: 61274
2008-12-20 06:32:12 +00:00
Ted Kremenek ab66b87f7f Updated checker build.
llvm-svn: 61273
2008-12-20 02:16:48 +00:00
Ted Kremenek 7d002beb5b Fix <rdar://problem/6454568>: BugReporter should correctly handle switch statements with no default case.
llvm-svn: 61270
2008-12-20 01:41:43 +00:00
Chris Lattner 9fa1552ca8 avoid using a typedef that isn't always included from headers.
llvm-svn: 61269
2008-12-19 23:51:20 +00:00
Fariborz Jahanian 1d35f12e6b More encoding support. This time for
@encode of classes and bitfields.

llvm-svn: 61268
2008-12-19 23:34:38 +00:00
Anders Carlsson 6736d1a2bb Get rid of the old Expr::Evaluate variant.
llvm-svn: 61260
2008-12-19 20:58:05 +00:00
Anders Carlsson 091134785d Pass -fblocks to clang
llvm-svn: 61258
2008-12-19 20:56:23 +00:00
Douglas Gregor 6ab9978b66 Add a missing @end. Why didn't this get diagnosed?
llvm-svn: 61256
2008-12-19 19:16:37 +00:00
Douglas Gregor a119f10482 Support more implicit conversions for Objective-C types. Addresses <rdar://problem/6458293>.
llvm-svn: 61255
2008-12-19 19:13:09 +00:00
Fariborz Jahanian 8c036a3af4 Test case for my last @encode patch.
llvm-svn: 61247
2008-12-19 17:45:06 +00:00
Douglas Gregor 47d3f2742a Allow downcasts of pointers to Objective-C interfaces, with a
warning. This matches GCC's behavior and addresses
<rdar://problem/6458293>.

llvm-svn: 61246
2008-12-19 17:40:08 +00:00
Anders Carlsson 324de7ba46 Fix for PR3234
llvm-svn: 61245
2008-12-19 17:27:57 +00:00
Ted Kremenek dde7df9de2 Updated checker build.
llvm-svn: 61233
2008-12-19 00:19:19 +00:00
Fariborz Jahanian 781c5c879c Several@encode bug fixes for ObjC.
llvm-svn: 61231
2008-12-19 00:14:49 +00:00
Ted Kremenek 4e15d97ae4 Update Xcode project.
llvm-svn: 61230
2008-12-19 00:03:48 +00:00
Douglas Gregor 1e57a3fb46 Add some more implicit conversions for Objective-C++
llvm-svn: 61229
2008-12-18 23:43:31 +00:00
Ted Kremenek 021752ab4e Added test case for suppressing leak warnings for reference-counted objects passed by-reference to an unknown function.
llvm-svn: 61227
2008-12-18 23:40:58 +00:00
Ted Kremenek 5b26c11f56 Fix regression when invalidating reference-counts for objects passed-by-reference to a function/method.
llvm-svn: 61224
2008-12-18 23:34:57 +00:00
Steve Naroff 1ef21279b6 Don't define __STDC__ when compiling with -fms-extensions
llvm-svn: 61223
2008-12-18 22:37:25 +00:00
Douglas Gregor b04675d112 Don't check initializers when there are dependent types or type-dependent expressions involved
llvm-svn: 61212
2008-12-18 21:49:58 +00:00
Douglas Gregor 55ad91fecb Ultrasimplistic sketch for the parsing of C++ template-ids. This won't
become useful or correct until we (1) parse template arguments
correctly, (2) have some way to turn template-ids into types,
declarators, etc., and (3) have a real representation of templates.

llvm-svn: 61208
2008-12-18 19:37:40 +00:00
Ted Kremenek 9443f0ea5e Use '&' to test StartOfLine flag.
llvm-svn: 61205
2008-12-18 18:15:29 +00:00
Fariborz Jahanian f8f0c6b1bc Removed a slot in ObjCMemRegExpr used in
code gen which did not belong there.

llvm-svn: 61203
2008-12-18 17:29:46 +00:00
Steve Naroff d96f7cca5f Fix http://llvm.org/bugs/show_bug.cgi?id=3189.
llvm-svn: 61202
2008-12-18 15:50:41 +00:00
Chris Lattner 84a1162e4c add a simple fast-path for the common case of [] and [4] in
array size declarators.  No need to go through all the trouble
of parsing crazy things like [static const 4] when most code
doesn't need it.

llvm-svn: 61200
2008-12-18 07:27:21 +00:00
Chris Lattner 97f2bbdbcc rename argument
llvm-svn: 61199
2008-12-18 07:07:10 +00:00
Chris Lattner cf0bab2042 disallow attributes in a few callers of ParseTypeQualifierListOpt,
these completely ignore parsed attributes anyway, so don't try
to read them.

llvm-svn: 61198
2008-12-18 07:02:59 +00:00
Chris Lattner b6ec4e75ad Clean up the C89/C++ warnings about C99 array features to not
emit duplicate diags (some in parser and some in sema) and to
warn about use of typequals in array sizes.  This implements 
PR2759.

llvm-svn: 61197
2008-12-18 06:50:14 +00:00
Zhongxing Xu 6437a9eaf6 Add method used by ImmutableMap GDM specialization.
llvm-svn: 61193
2008-12-18 05:15:58 +00:00
Daniel Dunbar 9ae0afdcd6 Allow ABI to use StructRet even for scalar values.
- Update comment to reflect fact that StructRet is now supported for
   any type (modulo LLVM support).

 - No functionality change, no scalar types currently use this
   feature.

llvm-svn: 61192
2008-12-18 04:52:14 +00:00
Chris Lattner 0cb00d66ea This is valid in C++.
void foo() { return foo(); }

llvm-svn: 61188
2008-12-18 02:03:48 +00:00
Chris Lattner 27e5beff70 Merge function-return.c into function.c
Fix PR2790 by making a warning an EXTWARN instead of EXTENSION.
Add a new EXTENSION warning for "return (some void expression);"

llvm-svn: 61187
2008-12-18 02:01:17 +00:00
Chris Lattner d19c1c0d6d implement PR3177 - "__extension__ union" not supported in C++ mode
llvm-svn: 61180
2008-12-18 01:12:00 +00:00
Ted Kremenek a1fd586dca Updated checker build.
llvm-svn: 61173
2008-12-17 23:55:41 +00:00
Ted Kremenek aceeb25660 Rewrite PTHLexer::DiscardToEndOfLine() to not use GetToken and instead only read the bytes needed to determine if a token is not at the start of the line.
llvm-svn: 61172
2008-12-17 23:52:11 +00:00
Nuno Lopes 394ec984f2 fix leakage of var's initializers
llvm-svn: 61171
2008-12-17 23:39:55 +00:00
Ted Kremenek 63ff81c4e1 Change PTHLexer::getSourceLocation() to not call GetToken() and instead just read the file offset in the token data buffer directly.
llvm-svn: 61170
2008-12-17 23:36:32 +00:00
Ted Kremenek 8c4bb56219 PTHLexer::isNextPPTokenLParen() no longer calls GetToken() and just reads the token kind from the token data buffer. This results in a minor speedup and reduces the dependency on GetToken().
llvm-svn: 61168
2008-12-17 23:08:31 +00:00
Douglas Gregor 19b8c4fffa Delay semantic analysis of the C++ names casts when the subexpression is type-dependent or the destination type is dependent.
llvm-svn: 61165
2008-12-17 22:52:20 +00:00
Nuno Lopes e013c7f6c1 fix a few more memory leaks: clean the ASTRecordLayouts, ASTObjCInterfaces and ASTRecordForInterface maps
llvm-svn: 61163
2008-12-17 22:30:25 +00:00
Eli Friedman 46f8c1290a Oops, accidentally commited the wrong version of the test (original
commit r61160).

llvm-svn: 61162
2008-12-17 22:22:03 +00:00
Fariborz Jahanian 4496c0ff86 Patch to re-implement duplicate ivar checking
(which will pass duplicate-ivar-check.m test again).

llvm-svn: 61161
2008-12-17 22:21:44 +00:00
Eli Friedman 44842d140f Do proper recovery from an invalid switch condiition. Fixes PR3229.
llvm-svn: 61160
2008-12-17 22:19:57 +00:00
Ted Kremenek 62d4c12d2c CF-retain/release checker:
- Fix regression reported in <rdar://problem/6452745>.  After a null check, null references to resources should not have a retain count.  This regression was caused by removing the call to "GRTransferFuncs::EvalAssume" in BasicConstraintManager.
- Added a test case to test this behavior.

llvm-svn: 61155
2008-12-17 21:50:35 +00:00
Fariborz Jahanian f327e89dab This patch will build the Records lazily per Steve's comments.
Note that one test duplicate-ivar-check.m will fail because I 
need to re-implement duplicate ivar checking.

llvm-svn: 61154
2008-12-17 21:40:49 +00:00
Chris Lattner d88c933970 add a dropped word back
llvm-svn: 61152
2008-12-17 21:38:44 +00:00
Ted Kremenek be3864ae6f Updated checker build.
llvm-svn: 61151
2008-12-17 21:02:35 +00:00
Ted Kremenek 300c9cc8c6 Fix <rdar://problem/6451816>:
- Because of the introduction of AnonTypedRegions when reasoning about casts, we
  had a regression in the "symbolication" of variable values passed-by-reference
  to a function. This is now fixed in CFRefCount.cpp (-checker-cfref) by
  blasting through the layer of AnonTypedRegions when symbolicating the value of
  the variable. This logic may get moved elsewhere. Note that this change
  affects only -checker-cfref and not -checker-simple; eventually this logic
  should get pulled out of CFRefCount.cpp into a more common place. All users
  use -checker-cfref by default, and -checker-simple should probably just be
  removed.  
- Updated test 'Analysis/uninit-vals-ps.c' to only use -checker-cfref and added
  a test case for this regression.

llvm-svn: 61147
2008-12-17 19:42:34 +00:00
Ted Kremenek 29d34ec64a Add pretty-printing for AnonTypedRegion.
llvm-svn: 61146
2008-12-17 19:25:50 +00:00
Ted Kremenek a7d73b1fd4 Shadow CurPtr with a local variable in ReadToken.
llvm-svn: 61145
2008-12-17 18:38:19 +00:00
Fariborz Jahanian 7ca027a101 Added comment to Steve's patch to clarify the case.
llvm-svn: 61144
2008-12-17 18:25:24 +00:00
Fariborz Jahanian fff8cba8da Consolidated property check into property-typecheck-1.m file.
Improved on property diagnostics.
Added a FIXME per Steve's comments.

llvm-svn: 61141
2008-12-17 17:55:55 +00:00
Douglas Gregor 664fda14d3 Make the injected-class-name of a C++ class a separate RecordDecl from the class itself, with a different scope. This eliminates some ownership issues, so that the RecordDecl only lives in a single context
llvm-svn: 61140
2008-12-17 16:48:01 +00:00
Douglas Gregor 816dba163e Remove the crufty reverse_decl_iterator
llvm-svn: 61139
2008-12-17 16:32:39 +00:00
Douglas Gregor ec8806e8ec Removed the warning
warning: statement was disambiguated as declaration

because it is currently firing in cases where the declaration would
not actually parse as a statement. We'd love to bring this warning
back if we can make it more accurate.

llvm-svn: 61137
2008-12-17 16:19:15 +00:00
Steve Naroff d1a36798b7 Remove rewriter dependency on 'nil' macro (used when rewriting for(...))
llvm-svn: 61135
2008-12-17 14:24:39 +00:00
Steve Naroff 596e137c84 Fix <rdar://problem/6450964> clang on xcode: Assertion failed: (RecordForDecl && "lookupFieldDeclForIvar no storage for class").
This was a recent regression caused by r61043 (related to code gen. for ivar references).

Fariborz, please review. I have some other concerns related to code generation for ivars that we can discuss later.

llvm-svn: 61134
2008-12-17 14:13:49 +00:00
Chris Lattner 3d72297909 diagnose C99 6.9.1p5, C arguments in definitions that are lacking
a name.  This implements PR3208.

llvm-svn: 61127
2008-12-17 07:32:46 +00:00
Chris Lattner 438e501b2e Move the other Sema::ActOnLinkageSpec to SemaDeclCXX.
Move Sema::ActOnDefs to SemaDeclObjC

llvm-svn: 61126
2008-12-17 07:13:27 +00:00
Chris Lattner 3b024a3c9e Move Sema::ActOnLinkageSpec to SemaDeclCXX.
llvm-svn: 61125
2008-12-17 07:09:26 +00:00
Douglas Gregor 2f52119843 Make sure that enumerators show up within the enumeration declaration. Fixes. PR clang/3220
llvm-svn: 61116
2008-12-17 02:04:30 +00:00
Douglas Gregor 89da43922b Fix PrintParserCallbacks for the new ActOnLinkageSpec actions
llvm-svn: 61115
2008-12-17 01:46:43 +00:00
Fariborz Jahanian 1470e9322e Semantics of @protocol attributes.
llvm-svn: 61114
2008-12-17 01:07:27 +00:00
Steve Naroff b13688804c Tweaks to allow us to rewrite with -x=objective-c++ enabled.
llvm-svn: 61113
2008-12-17 00:20:22 +00:00
Nuno Lopes 17f345f2f2 remove debug stmt, sorry..
llvm-svn: 61112
2008-12-16 22:59:47 +00:00
Nuno Lopes 5773a1be41 fix PR 3222: allow one to get the address of a global function in C++
llvm-svn: 61111
2008-12-16 22:58:26 +00:00
Douglas Gregor 29ff7d0634 Make linkage-specifications hold on to all of their declarations
llvm-svn: 61110
2008-12-16 22:23:02 +00:00
Eli Friedman be649698b6 Fix crash with -ast-dump in C++.
llvm-svn: 61108
2008-12-16 22:14:15 +00:00
Ted Kremenek d9de9f148e Add new GRWorkList class that uses two queues:
- one queue (FIFO) to queue up nodes at block entrances
- another queue (LIFO) to queue up other nodes
- The idea is to explore basic blocks to completion, but to do a BFS exploration of blocks.

llvm-svn: 61106
2008-12-16 22:13:33 +00:00
Ted Kremenek 9e08ff40da ProgramPoint:
- Added four new ProgramPoint types that subclass PostStmt for use in
  GRExprEngine::EvalLocation:
  - PostOutOfBoundsCheckFailed
  - PostUndefLocationCheckFailed
  - PostNullCheckFailed
  - PostLocationChecksSucceed
  These were created because of a horribly subtle caching bug in EvalLocation
  where a node representing an "bug condition" in EvalLocation (e.g. a null
  dereference) could be re-used as the "non-bug condition" because the Store did
  not contain any information to differentiate between the two. The extra
  program points just disables any accidental caching between EvalLocation and
  its callers.

GRExprEngine:
- EvalLocation now returns a NodeTy* instead of GRState*.  This should be used as the "vetted" predecessor for EvalLoad/EvalStore.

llvm-svn: 61105
2008-12-16 22:02:27 +00:00
Douglas Gregor 4d87df5853 Delay parsing of default arguments of member functions until the class
is completely defined (C++ [class.mem]p2).

Reverse the order in which we process the definitions of member
functions specified inline. This way, we'll get diagnostics in the
order in which the member functions were declared in the class.

llvm-svn: 61103
2008-12-16 21:30:33 +00:00
Eli Friedman 42b1e9e252 Silence a couple more operator precedence warnings; this shouldn't
change the semantics.  Please correct this if the precedence was 
actually supposed to be something different.

llvm-svn: 61099
2008-12-16 20:15:50 +00:00
Eli Friedman c8a590dda3 Warning fixes to operator precedence warnings.
Someone should double-check that I didn't somehow break ObjC 
serialization; I think the change there actually changes the semantics.

llvm-svn: 61098
2008-12-16 20:06:41 +00:00
Nate Begeman f2a6e5f0c0 Remove tabs.
llvm-svn: 61097
2008-12-16 19:57:09 +00:00
Fariborz Jahanian 3a1bb22178 Patch to check for ObjC's property type.
llvm-svn: 61090
2008-12-16 17:51:01 +00:00
Steve Naroff 61d879e424 Fix <rdar://problem/6445502> clang ObjC rewriter: _Block_release has wrong parameter type in preamble
llvm-svn: 61088
2008-12-16 15:50:30 +00:00
Douglas Gregor 195002917e Partial fix for qualified name lookup, such that the lookup of N in
N::X only skips those entities specified in C++ [basic.lookup.qual]p1.

Note that both EDG and GCC currently get this wrong. EDG has confirmed
that the bug will be fixed in a future version.

llvm-svn: 61079
2008-12-16 06:37:47 +00:00
Zhongxing Xu c4a4c5f02d Implement RegionStoreManager::Remove().
llvm-svn: 61069
2008-12-16 02:36:30 +00:00
Fariborz Jahanian a599c1352b Diagnose that ivars in current and super class may not
be duplicates and a test case.

llvm-svn: 61068
2008-12-16 01:08:35 +00:00
Douglas Gregor 29e174cc58 Make name lookup when we're inside a declarator's scope, such as ClassName::func, work with the new unqualified name lookup code. Test it with default arguments in out-of-line member definitions
llvm-svn: 61060
2008-12-16 00:38:16 +00:00
Douglas Gregor dd12c786a0 Added a test for default arguments added to out-of-line member
functions. They work except that name lookup within the default
arguments needs to be deferred until the class definition is complete
(see FIXME in the test).

llvm-svn: 61059
2008-12-16 00:08:34 +00:00
Douglas Gregor ad590506a7 Diagnose erroneous uses of out-of-line member definitions and scope
specifiers. Specifically: 
  * Determine when an out-of-line function definition does not match
    any declaration within the class or namespace (including coping
    with overloaded functions).
  * Complain about typedefs and parameters that have scope specifiers.
  * Complain about out-of-line declarations that aren't also
  definitions.
  * Complain about non-static data members being declared out-of-line.
  * Allow cv-qualifiers on out-of-line member function definitions.

llvm-svn: 61058
2008-12-15 23:53:10 +00:00
Eli Friedman 254a1a285c Fix for PR3212: don't descend into C++ operator overloading code for C
programs.

llvm-svn: 61056
2008-12-15 22:34:21 +00:00
Eli Friedman bb2b3be9e1 Make error handling for va_start a bit more robust. Fixes PR3213.
llvm-svn: 61055
2008-12-15 22:05:35 +00:00
Fariborz Jahanian 48ee658562 Name of addLayoutToClass is confusing as no layout calculation
is done. Layout is calculated lazily at code gen type.
This patch changes the name.

llvm-svn: 61054
2008-12-15 21:58:08 +00:00
Douglas Gregor 1349b457ee Place constructors and destructors into the DeclContext of the class,
just like all other members, and remove the special variables in
CXXRecordDecl to store them. This eliminates a lot of special-case
code for constructors and destructors, including
ActOnConstructor/ActOnDeclarator and special lookup rules in
LookupDecl. The result is far more uniform and manageable.

Diagnose the redeclaration of member functions.

llvm-svn: 61048
2008-12-15 21:24:18 +00:00
Fariborz Jahanian cfac794a5c And a test case for my previous patch.
llvm-svn: 61044
2008-12-15 20:39:58 +00:00
Fariborz Jahanian b517e90662 Code gen. for ivar references; including bitfield
ivars.

llvm-svn: 61043
2008-12-15 20:35:07 +00:00
Ted Kremenek 6c7ea11300 Preprocessor: Allocate MacroInfo objects using a BumpPtrAllocator instead using new/delete. This speeds up -Eonly on Cocoa.h using the regular lexer by 1.8% and the PTHLexer by 3%.
llvm-svn: 61042
2008-12-15 19:56:42 +00:00
Ted Kremenek 4299d5d2d8 Fix regression in handling sizeof(void) in the static analyzer.
llvm-svn: 61039
2008-12-15 18:51:00 +00:00
Fariborz Jahanian cd489a822c Removed setRecordForDecl. Added a FIXME.
llvm-svn: 61038
2008-12-15 18:04:20 +00:00
Douglas Gregor a24cd4f35a Don't double-destroy constructors defined out-of-line. This is a
half-solution; the real solution is coming when constructors and
destructors are treated like all other functions by ActOnDeclarator.

llvm-svn: 61037
2008-12-15 17:33:16 +00:00
Douglas Gregor c811d8f055 Create new EnumDecl nodes for redeclarations of enums, linking them
together in the same way that we link RecordDecl/CXXRecordDecl nodes. 

Unify ActOnTag and ActOnTagStruct.

Fixes PR clang/2753.

llvm-svn: 61034
2008-12-15 16:32:14 +00:00
Nuno Lopes 3167976f77 dont call iterator::end() on every cycle and dont read already-deleted memory
llvm-svn: 61015
2008-12-14 21:53:25 +00:00
Nuno Lopes 13c2c1eeca minor WS fix for the previous commit
llvm-svn: 61008
2008-12-14 17:44:24 +00:00
Nuno Lopes 127adb4462 fix leakage of CXXSpecialName objects in DeclarationNameTable
llvm-svn: 61007
2008-12-14 17:27:25 +00:00
Zhongxing Xu b0cc30ddb4 I think we should getRValueType here. The lvaluetype of an array region is 'pointer to array'.
llvm-svn: 61003
2008-12-14 03:14:52 +00:00
Ted Kremenek d2f9cd1cbd Updated checker build.
llvm-svn: 61002
2008-12-14 01:25:59 +00:00
Anders Carlsson 6b958f9634 Store the size of the EH stack inside each BreakContinue struct so we know when a break/continue won't cross a try block.
llvm-svn: 60998
2008-12-13 22:52:24 +00:00
Fariborz Jahanian b1378f9b0f Patch for ObjCIvarRefExpr containing the field
matching the storage layout for this ivar

llvm-svn: 60996
2008-12-13 22:20:28 +00:00
Ted Kremenek b5670fd555 MemRegion:
- Overhauled the notion of "types" for TypedRegions.  We now distinguish between the "lvalue" of a region (via getLValueRegion()) and the "rvalue" of a region (va getRValueRegion()).  Since a region represents a chunk of memory it has both, but we were conflating these concepts in some cases, leading to some insidious bugs.
- Removed AnonPointeeType, partially because it is unused and because it doesn't have a clear notion of lvalue vs rvalue type.  We can add it back once there is a need for it and we can resolve its role with these concepts.

StoreManager:
- Overhauled StoreManager::CastRegion.  It expects an *lvalue* type for a region.  This is actually what motivated the overhaul to the MemRegion type mechanism.  It also no longer returns an SVal; we can just return a MemRegion*.
- BasicStoreManager::CastRegion now overlays an "AnonTypedRegion" for pointer-pointer casts.  This matches with the MemRegion changes.
- Similar changes to RegionStore, except I've added a bunch of FIXMEs where it wasn't 100% clear where we should use TypedRegion::getRValueRegion() or TypedRegion::getLValueRegion().

AuditCFNumberCreate check:
- Now blasts through AnonTypedRegions that may layer the original memory region, thus checking if the actually memory block is of the appropriate type.  This change was needed to work with the changes to StoreManager::CastRegion.

GRExprEngine::VisitCast:
- Conform to the new interface of StoreManager::CastRegion.

Tests:
- None of the analysis tests fail now for using the "basic store".
- Disabled the tests 'array-struct.c' and 'rdar-6442306-1.m' pending further testing and bug fixing.

llvm-svn: 60995
2008-12-13 21:49:13 +00:00
Fariborz Jahanian 0222553d1c Add storage layout to ObjC classes.
llvm-svn: 60993
2008-12-13 20:28:25 +00:00
Chris Lattner 77c76ae3de eliminate the isCXXNamedOperator function and some string compares and
use identifierinfo instead.  Patch by Chris Goller!

llvm-svn: 60992
2008-12-13 20:12:40 +00:00
Ted Kremenek 1c89be0216 Temporarily XFAIL these tests.
llvm-svn: 60991
2008-12-13 19:27:01 +00:00
Ted Kremenek f065b15f7d A series of cleanups/fixes motivated by <rdar://problem/6442306>:
GRExprEngine (VisitCast):
- When using StoreManager::CastRegion, always use the state and value it returns to generate the next node.  Failure to do so means that region values returned that don't require the state to be modified will get ignored.

MemRegion:
- Tighten the interface for ElementRegion.  Now ElementRegion can only be created with a super region that is a 'TypedRegion' instead of any MemRegion.  Code in BasicStoreManager/RegionStoreManager already assumed this, but it would result in a dynamic assertion check (and crash) rather than just having the compiler forbid the construction of such regions.
- Added ElementRegion::getArrayRegion() to return the 'typed version' of an ElementRegion's super region.
- Removed bogus assertion in ElementRegion::getType() that assumed that the super region was an AnonTypedRegion.  All that matters is that it is a TypedRegion, which is now true all the time by design.

BasicStore:
- Modified getLValueElement() to check if the 'array' region is a TypedRegion before creating an ElementRegion.  This conforms to the updated interface for ElementRegion.

RegionStore:
- In ArrayToPointer() gracefully handle things we don't reason about, and only create an ElementRegion if the array region is indeed a TypedRegion.

llvm-svn: 60990
2008-12-13 19:24:37 +00:00
Chris Lattner e69336c22d disable Anders' recent VLA patch, this fixes PR3209.
llvm-svn: 60989
2008-12-13 18:58:59 +00:00
Sebastian Redl c675baba92 Some utilities for using the smart pointers in Actions, especially Sema. Convert a few functions.
llvm-svn: 60983
2008-12-13 16:23:55 +00:00
Sebastian Redl cb6e2c6156 Convert remaining expression parsers to smart pointers. Now on to the Action connection.
llvm-svn: 60982
2008-12-13 15:32:12 +00:00
Sebastian Redl 19ed30be38 stdlib.h is the wrong header for printf, and introduces test-breaking definitions of inlines on Linux
llvm-svn: 60981
2008-12-13 15:31:28 +00:00
Cedric Venet c41deefec7 Add /Za to all MSVC build of a clang libraries.
This allow to use the new move emulation for smart pointer by disabling language extension.

llvm-svn: 60979
2008-12-13 11:00:04 +00:00
Ted Kremenek 877556f4b9 PTH: Added minor 'sibling jumping' optimization for iterating over the side table used for fast preprocessor block skipping. This has a minor performance improvement when preprocessing Cocoa.h, but can have some wins in pathologic cases.
llvm-svn: 60966
2008-12-12 22:05:38 +00:00
Steve Naroff 3b0da664bd Fix <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.
llvm-svn: 60962
2008-12-12 21:05:34 +00:00
Chris Lattner 6bf1db148c fix a buggy fall through that caused a crash-on-invalid. rdar://6248081
llvm-svn: 60961
2008-12-12 19:20:14 +00:00
Daniel Dunbar a4daf203fe Add test case for using mmintrin (and making sure that inlining is
working with and without debug info).

llvm-svn: 60960
2008-12-12 19:12:02 +00:00
Daniel Dunbar 7b127324ce Force i[0-9]86 to i386 when using LLVM_HOSTTRIPLE.
Only use major part of OS version when on darwin and modifying OS part
of target triple.

llvm-svn: 60957
2008-12-12 18:34:35 +00:00
Ted Kremenek 56572ab9e9 Added PTH optimization to not process entire blocks of tokens that appear in skipped preprocessor blocks. This improves PTH speed by 6%. The code for this optimization itself is not very optimized, and will get cleaned up.
llvm-svn: 60956
2008-12-12 18:34:08 +00:00
Ted Kremenek ee87e0bd31 Enhance PTH preprocessor-condition-block side table to track #elseinformation as well.
llvm-svn: 60955
2008-12-12 18:31:09 +00:00
Chris Lattner 04397358ec Implement the final (hopefully) wrinkle to i-c-e + builtin_constant_p
processing: it allows arbitrary foldable constants as the operand of ?: when
builtin_constant_p is the condition.

llvm-svn: 60954
2008-12-12 18:00:51 +00:00
Douglas Gregor 4287b37389 Enable out-of-line definitions of C++ constructors and destructors
llvm-svn: 60947
2008-12-12 08:25:50 +00:00
Anders Carlsson 30032889ae Implement allocation and sizeof VLAs. This is very basic for now.
llvm-svn: 60943
2008-12-12 07:38:43 +00:00
Chris Lattner e141a9e225 rdar://6060752 - don't warn about trigraphs in bcpl-style comments
llvm-svn: 60942
2008-12-12 07:34:39 +00:00
Chris Lattner ee99aa63ca fix breakage I introduced in r60938
llvm-svn: 60941
2008-12-12 07:33:52 +00:00
Douglas Gregor b9d2380204 Add test of enumerator types
llvm-svn: 60940
2008-12-12 07:27:10 +00:00
Anders Carlsson ccbe9200f9 Add map of VLA types and their sizes
llvm-svn: 60939
2008-12-12 07:19:02 +00:00
Chris Lattner dcba4a7713 silence warning in release-asserts mode about unused variable, also
move comment into assert message.

llvm-svn: 60938
2008-12-12 07:16:09 +00:00
Chris Lattner 89770575cd fix thought-o
llvm-svn: 60937
2008-12-12 07:14:34 +00:00
Chris Lattner 4bf85ffe83 merge these testcases into one file.
llvm-svn: 60936
2008-12-12 07:01:24 +00:00
Chris Lattner d260aa03b5 add a fixme.
llvm-svn: 60935
2008-12-12 06:57:03 +00:00
Chris Lattner 85b25bc344 implement rdar://6091492 - ?: with __builtin_constant_p as the operand is an i-c-e.
llvm-svn: 60934
2008-12-12 06:55:44 +00:00
Chris Lattner 10da53c60c use smarter error recovery for do/while.
llvm-svn: 60933
2008-12-12 06:35:28 +00:00
Chris Lattner c0081db332 apply the new error recovery smarts we have for if's to while's and switch's.
llvm-svn: 60932
2008-12-12 06:31:07 +00:00
Chris Lattner fce12fdf6f rename recovery-3 to recovery.c
llvm-svn: 60931
2008-12-12 06:21:41 +00:00
Chris Lattner 5b3ddc8ef9 merge recovery-1 into recovery-3.
llvm-svn: 60930
2008-12-12 06:21:18 +00:00
Chris Lattner bc2d77cdf2 merge recovery-2.c into recovery-3.c.
Substantially improve error recovery after broken if conditions by
parsing the full if when we have a semantic error instead of using
parser recovery techniques to recover from a semantic error.

This fixes rdar://6094870 - spurious error after invalid 'if' condition

llvm-svn: 60929
2008-12-12 06:19:11 +00:00
Chris Lattner d8980509b3 minor refactoring of ParseParenExpression
llvm-svn: 60928
2008-12-12 06:00:12 +00:00
Chris Lattner dca17ceb19 add expected diag
llvm-svn: 60927
2008-12-12 05:59:56 +00:00
Chris Lattner db44f532c0 add ownership.h to xcode project
llvm-svn: 60926
2008-12-12 05:54:54 +00:00
Anders Carlsson 8a472c3151 Work in preparation for VLAs. Make sure to restore the stack if necessary (Saving the stack isn't implemented right now :)
llvm-svn: 60925
2008-12-12 05:52:00 +00:00
Chris Lattner 053441f39d Fix rdar://6095061 - gcc allows __builtin_choose_expr as an lvalue
llvm-svn: 60924
2008-12-12 05:35:08 +00:00
Chris Lattner 54139445ba Testcase for something that already works. Clang agrees with Comeau,
and this makes sense.  likely a gcc bug that it doesn't diagnose the bad
restrict.

llvm-svn: 60923
2008-12-12 05:25:55 +00:00
Chris Lattner b4396f40a0 add codegen support for __func__ and friends, producing the same
output that GCC does.  rdar://6440297

llvm-svn: 60922
2008-12-12 05:18:02 +00:00
Chris Lattner f45c5ecb3b fix rdar://6097892 - gcc incompat: clang rejects __func__, __FUNCTION__, and __PRETTY_FUNCTION__ outside func
Yeah, this is "useful".

llvm-svn: 60921
2008-12-12 05:05:20 +00:00
Chris Lattner 81ed6805db Implement rdar://6138816 - [sema] named bitfields cannot have 0 width
llvm-svn: 60920
2008-12-12 04:56:04 +00:00
Douglas Gregor 1d248c53ab In C++, set the type of each of the enumerators in an enumeration to
the type of the enumeration once the enumeration has been defined.

Fix the overloading test-case to properly create enums that promote
the way we want them to.

Implement C++0x promotions from enumeration types to long
long/unsigned long long. We're using these promotions in Carbon.h
(since long long is a common extension).

Fixes PR clang/2954: http://llvm.org/bugs/show_bug.cgi?id=2954

llvm-svn: 60917
2008-12-12 02:00:36 +00:00
Ted Kremenek 864eb39233 PTH:
- Added a side-table per each token-cached file with the preprocessor conditional stack.  This tracks what #if's are matched with what #endifs and where their respective tokens are in the PTH file.  This will allow for quick skipping of excluded conditional branches in the Preprocessor.
- Performance testing shows the addition of this information (without actually utilizing it) leads to no performance regressions.

llvm-svn: 60911
2008-12-11 23:36:38 +00:00
Chris Lattner ece9ae718b add annotation
llvm-svn: 60907
2008-12-11 23:11:52 +00:00
Sebastian Redl d65cea8dde Convert a big bunch of expression parsers to use smart pointers.
llvm-svn: 60906
2008-12-11 22:51:44 +00:00
Ted Kremenek ca153f7349 PTHLexer: Keep track of the location of the last '#' token and provide the means to jump ahead in the token stream.
llvm-svn: 60905
2008-12-11 22:41:47 +00:00
Sebastian Redl 90893187c4 Convert some more expression parsers to use smart pointers.
llvm-svn: 60904
2008-12-11 22:33:27 +00:00
Sebastian Redl 59b5e517c7 Convert selected expression parsers to use smart pointers.
llvm-svn: 60900
2008-12-11 21:36:32 +00:00
Steve Naroff a5c0db8467 Rename a local predicate to avoid confusion with Type::isBlockPointerType().
llvm-svn: 60899
2008-12-11 21:05:33 +00:00
Steve Naroff 5ac4eac3b6 Fixup generated code for imported block decl refs.
Found while investigating <rdar://problem/6435837> clang ObjC rewriter: use Block_release instead of Block_destroy.

llvm-svn: 60898
2008-12-11 20:51:38 +00:00
Douglas Gregor 7a4fad1b0b Address some comments on the name lookup/DeclContext patch from Chris
llvm-svn: 60897
2008-12-11 20:41:00 +00:00
Ted Kremenek 67ab296d5c Remove unused ivar CurTokenIdx.
llvm-svn: 60896
2008-12-11 20:39:48 +00:00
Sebastian Redl bab9a4b5ea Convert the remaining statement parsers to smart pointers.
llvm-svn: 60895
2008-12-11 20:12:42 +00:00
Sebastian Redl b62406f6e4 Convert some more statement parsers to smart pointers.
llvm-svn: 60892
2008-12-11 19:48:14 +00:00
Steve Naroff e4d722bf2f Fix <rdar://problem/6435842> clang ObjC rewriter: #include Block.h, Block_private.h or come up with #define to prevent double-definition
llvm-svn: 60890
2008-12-11 19:43:14 +00:00
Sebastian Redl 042ad95d4e Convert a number of statement parsers to smart pointers.
llvm-svn: 60888
2008-12-11 19:30:53 +00:00
Steve Naroff 1fa7bd16c8 Fix <rdar://problem/6435382> clang ObjC rewriter: @property/@synthesize and blocks don't work together
llvm-svn: 60887
2008-12-11 19:29:16 +00:00
Douglas Gregor e029561346 Actually distinguish between RecordDecl::field_iterator and RecordDecl::field_const_iterator, propagating the constness down to the FieldDecls.
llvm-svn: 60883
2008-12-11 17:59:21 +00:00
Douglas Gregor 91f84216f7 Unifies the name-lookup mechanisms used in various parts of the AST
and separates lexical name lookup from qualified name lookup. In
particular:
  * Make DeclContext the central data structure for storing and
    looking up declarations within existing declarations, e.g., members
    of structs/unions/classes, enumerators in C++0x enums, members of
    C++ namespaces, and (later) members of Objective-C
    interfaces/implementations. DeclContext uses a lazily-constructed
    data structure optimized for fast lookup (array for small contexts,
    hash table for larger contexts). 

  * Implement C++ qualified name lookup in terms of lookup into
    DeclContext.

  * Implement C++ unqualified name lookup in terms of
    qualified+unqualified name lookup (since unqualified lookup is not
    purely lexical in C++!)

  * Limit the use of the chains of declarations stored in
    IdentifierInfo to those names declared lexically.

  * Eliminate CXXFieldDecl, collapsing its behavior into
    FieldDecl. (FieldDecl is now a ScopedDecl).

  * Make RecordDecl into a DeclContext and eliminates its
    Members/NumMembers fields (since one can just iterate through the
    DeclContext to get the fields).

llvm-svn: 60878
2008-12-11 16:49:14 +00:00
Zhongxing Xu 26776c2784 Identify AnonPointeeRegion by the symbol that is concretized.
llvm-svn: 60870
2008-12-11 09:08:46 +00:00
Zhongxing Xu 02fe71290a AnonPointeeRegions are now identified by the MemRegion of the pointer pointing
to them.

llvm-svn: 60868
2008-12-11 02:27:34 +00:00
Ted Kremenek 0bc1320d95 Updated checker build.
llvm-svn: 60864
2008-12-11 00:20:13 +00:00
Anders Carlsson 591b2224cb Add another complex promotion test.
llvm-svn: 60863
2008-12-10 23:57:51 +00:00
Anders Carlsson b05961c700 Make sure to promote expressions of the form (floating point + complex integer) correctly, to (complex floating point + complex floating point)
llvm-svn: 60862
2008-12-10 23:30:05 +00:00
Ted Kremenek 8e1f05fc26 PreprocessorLexer (and subclasses):
- Added virtual method 'getSourceLocation()' (no arguments) that gets the location of the next "observable" location (e.g., next character, next token).
PPLexerChange.cpp:
- Implemented FIXME by using PreprocessorLexer::getSourceLocation() to get the location in the file we are returning to after lexing a #included file.  This appears to be slightly faster than having the branch (i.e., 'if(CurLexer)').  It's also not a really hot part of the Preprocessor.

llvm-svn: 60860
2008-12-10 23:20:59 +00:00
Douglas Gregor 85970ca84c Added a warning when referencing an if's condition variable in the
"else" clause, e.g.,

  if (int X = foo()) {
  } else {
    if (X) { // warning: X is always zero in this context
    }
  }

Fixes rdar://6425550 and lets me think about something other than
DeclContext.

llvm-svn: 60858
2008-12-10 23:01:14 +00:00
Steve Naroff c68cfcfd03 The "real" fix for <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
Commit r60845 was premature.

llvm-svn: 60852
2008-12-10 22:14:21 +00:00
Douglas Gregor 9aa8b55d10 Fix PR clang/3175: CheckAddressOfOperand does not handle references to class vars
llvm-svn: 60849
2008-12-10 21:26:49 +00:00
Douglas Gregor 872ffce257 Some cleanups to the dependent-types commit, as suggested by Sebastian
llvm-svn: 60848
2008-12-10 20:57:37 +00:00
Steve Naroff 13ac125edf Fix <rdar://problem/6424347> clang on xcode: Assertion failed: (0 && "unexpected type"), function mergeTypes,
llvm-svn: 60845
2008-12-10 20:07:25 +00:00
Ted Kremenek d40ab7b72a Declare PerIDCache as IdentifierInfo** instead of void*. This is just cleaner. No performance change.
llvm-svn: 60843
2008-12-10 19:40:23 +00:00
Steve Naroff 68e167df8e Fix <rdar://problem/6418623> Bogus block type compatibility warning.
llvm-svn: 60842
2008-12-10 17:49:55 +00:00
Steve Naroff df70577b9c Fix regression caused by fixing <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
llvm-svn: 60839
2008-12-10 14:53:27 +00:00
Douglas Gregor 7307d6ca96 Use a scoped object to manage entry/exit from a parser scope rather than explicitly calling EnterScope/ExitScope
llvm-svn: 60830
2008-12-10 06:34:36 +00:00
Anders Carlsson a726c1763a Append an extra newline to the module inline asm if it's not empty.
llvm-svn: 60827
2008-12-10 02:21:04 +00:00
Ted Kremenek a30391c31f Updated checker build.
llvm-svn: 60819
2008-12-10 00:50:24 +00:00
Fariborz Jahanian 7572ac5614 Patch to allow a getter call using property dot-syntax notation.
llvm-svn: 60816
2008-12-10 00:21:50 +00:00
Sebastian Redl d9f7b1c230 Modify the move emulation according to the excellent design of Howard Hinnant. Makes for much nicer syntax when smart pointers are used consistently. Also, start converting internal argument passing of Parser to smart pointers.
llvm-svn: 60809
2008-12-10 00:02:53 +00:00
Ted Kremenek 42a217f4c0 Fix to BasicStoreManager::getElementLValue: If the base region is a symbol, layer an AnonTypedRegion on top of it.
llvm-svn: 60808
2008-12-09 23:50:57 +00:00
Fariborz Jahanian ea831ee11c Prevent bogus warning on unimplemented setter/getter when user
has added declaration of these methods in its @interface.

llvm-svn: 60803
2008-12-09 22:43:22 +00:00
Ted Kremenek 62cc9daae3 Have BasicStoreManager::getLValueElement() have logic similar to BasicStoreManager::getLValueField() (i.e., don't just return the 'base' as the SVal)
llvm-svn: 60795
2008-12-09 21:20:27 +00:00
Steve Naroff 70cb0071c9 Add testcase for commit r60781.
llvm-svn: 60793
2008-12-09 20:59:16 +00:00
Fariborz Jahanian 3d8552a75d Support for implementation of property in the case where
the synthesis is in an implementation of s subclass of
a super class where the property has been declared.

llvm-svn: 60792
2008-12-09 20:23:04 +00:00
Sebastian Redl c13f26873f Kick out the proof-of-concept ASTOwner and replace it with ASTOwningResult
llvm-svn: 60791
2008-12-09 20:22:58 +00:00
Ted Kremenek 93041ba483 Add preliminary CFG support for @throw. We basically treat it like a return statement.
llvm-svn: 60790
2008-12-09 20:20:09 +00:00
Ted Kremenek 1857ff4e2c In GRExprEngine treat @throw as an 'abort' that ends the current path. This is a temporary solution.
llvm-svn: 60789
2008-12-09 20:18:58 +00:00
Sebastian Redl 7379577ab0 Lay the groundwork for converting the entire parser-sema chain to smart pointers.
llvm-svn: 60782
2008-12-09 19:36:21 +00:00
Steve Naroff b0498eebc2 Sema::ActOnMethodDeclaration(): Make sure we perform the default function/array conversion for parameter types.
This fixes <rdar://problem/6424064> checker on xcode: (possible bad AST) can the type of a method parameter really have "isFunctionType() == true"?
and http://llvm.org/bugs/show_bug.cgi?id=2997.

llvm-svn: 60781
2008-12-09 19:36:17 +00:00
Chris Lattner 2e41b0e6e7 Fix a serious null termination bug found by David Chisnall!
llvm-svn: 60778
2008-12-09 19:10:54 +00:00
Sebastian Redl e0c2affc5e Fill in C++ status table for expressions.
llvm-svn: 60763
2008-12-09 14:40:01 +00:00
Sebastian Redl 17f2c7d251 Consistently use smart pointers for stmt and expr nodes in parser local variables.
llvm-svn: 60761
2008-12-09 13:15:23 +00:00
Steve Naroff 08628db9d2 Fix <rdar://problem/6429113> clang ObjC rewriter: crash rewriting file with Blocks and properties
More fancy footwork to cope with rewriting property 'setters'.

llvm-svn: 60760
2008-12-09 12:56:34 +00:00
Zhongxing Xu 2a46a8ef52 initialize member variable.
llvm-svn: 60759
2008-12-09 12:26:46 +00:00
Zhongxing Xu 2e8123e5bb Add utility method. Remove an unused method.
llvm-svn: 60758
2008-12-09 10:51:19 +00:00
Ted Kremenek c28ce29a12 [static analyzer] Extend VLA size checking to look for undefined sizes.
llvm-svn: 60734
2008-12-09 00:44:16 +00:00
Ted Kremenek 08134c984b Update Driver to new interface for LiveVariables.
llvm-svn: 60732
2008-12-09 00:17:51 +00:00
Ted Kremenek d7266bf20a Add zero-sized VLA check test case.
llvm-svn: 60731
2008-12-09 00:14:48 +00:00
Ted Kremenek 6ee0a11814 Fixed LiveVariables bug where we didn't consider block-level expressions that functioned as the size of a VLA to be live.
llvm-svn: 60730
2008-12-09 00:14:14 +00:00
Fariborz Jahanian 8e0079c787 Change condition under which 'retain'/'copy' are directly evaluated.
llvm-svn: 60729
2008-12-08 23:56:17 +00:00
Ted Kremenek 8f7afdd21e Add checking for zero-sized VLAs.
llvm-svn: 60726
2008-12-08 22:47:34 +00:00
Ted Kremenek 223005f35a Incorporate MissingDealloc_IBOutlet.m test case into MissingDealloc.m
llvm-svn: 60722
2008-12-08 22:05:43 +00:00
Ted Kremenek 1f9dd45f57 Incorporate MissingDeallc_SEL.m test case into MissingDealloc.m
llvm-svn: 60721
2008-12-08 22:01:50 +00:00
Ted Kremenek 8f5c0ede0f Add test case for <rdar://problem/6380411>.
llvm-svn: 60720
2008-12-08 21:59:21 +00:00
Chris Lattner 46415261ee Fix PR3172: if we see an eof or } at the top level, reject it.
This is important because ParseDeclarationOrFunctionDefinition
skips to, but does not consume, an } on error.

llvm-svn: 60719
2008-12-08 21:59:01 +00:00
Chris Lattner 3a90716f6a improve comment.
llvm-svn: 60718
2008-12-08 21:53:24 +00:00
Ted Kremenek 96d2eecf85 'self.myIvar = nil' (properties) only releases myIvar when the property has kind 'assign'. This fixes <rdar://problem/6380411>.
llvm-svn: 60717
2008-12-08 21:44:15 +00:00
Steve Naroff 5fd31b17df ObjCInterfaceDecl::lookupInstanceMethod() needs to look through a categories protocols.
Fixes <rdar://problem/6418640> clang on prokit: error: incompatible type returning 'id', expected 'NSSize'

llvm-svn: 60716
2008-12-08 20:57:28 +00:00
Steve Naroff f1ab600362 Fix a couple uninitialized variables from my previous commit.
llvm-svn: 60713
2008-12-08 20:01:41 +00:00
Dan Gohman 16873c6284 Remove the #include of ScheduleDAGSDNodes.h, which is no longer necessary.
llvm-svn: 60712
2008-12-08 19:45:33 +00:00
Fariborz Jahanian 3edadfc730 Changed 'readonly' 'retain/copy' diagnostics into
warning as it is allowed in gcc and will break projects.

llvm-svn: 60710
2008-12-08 19:28:10 +00:00
Fariborz Jahanian 3685995d2c Since we do not allow a readonly property to be 'copy'retain', we
must allow the continuation class to extend it to a 'readwrite'
and 'copy/retain'.

llvm-svn: 60709
2008-12-08 18:47:29 +00:00
Douglas Gregor 5daeee2bd6 Move Sema::isTemplateParameterDecl to Decl::isTemplateParameter, where it belongs
llvm-svn: 60708
2008-12-08 18:40:42 +00:00
Steve Naroff f122ff0cad Fix <rdar://problem/6423452> clang ObjC rewriter: Don't use __declspec(dllimport) for Blocks functions, as they are linked statically.
llvm-svn: 60704
2008-12-08 17:30:33 +00:00
Steve Naroff 1042ff345a Handle chained/nested property 'getters' (obj.p1.p2.p3).
This is a follow-up to fixing <rdar://problem/6213955> clang ObjC rewriter: rewriter doesn't appear to support @property and @synthesize.

llvm-svn: 60700
2008-12-08 16:43:47 +00:00
Sebastian Redl 82639aff7b Fill in some parts of cxx_status.html
llvm-svn: 60699
2008-12-08 16:24:08 +00:00
Zhongxing Xu 17a37ebf32 fix 80-col violation.
llvm-svn: 60693
2008-12-08 07:14:51 +00:00
Zhongxing Xu 8df5083bb4 fix typo.
llvm-svn: 60686
2008-12-08 05:12:38 +00:00
Eli Friedman 14fb8587be Workaround for PR3173. The fix is correct in the sense that if the enum
code were working correctly, it would be a no-op, but it's not really a 
proper fix.  That said, I don't really want to touch the enum code at 
the moment because I don't understand it very well, and this seems to 
be a relatively visible regression.

llvm-svn: 60680
2008-12-08 02:21:03 +00:00
Sebastian Redl 66f6fa1b2b Fix outdated comment. Checks so much more than just typedefs in C++.
llvm-svn: 60676
2008-12-07 20:13:57 +00:00
Nuno Lopes cbab7f6b29 add missing gentoo c++ include paths
llvm-svn: 60655
2008-12-07 12:11:37 +00:00
Chris Lattner b3582b939e a minor grammar fix
llvm-svn: 60646
2008-12-07 00:59:53 +00:00
Anders Carlsson a1a9c28d30 Pass the VLA size expr range to the VLA diags
llvm-svn: 60645
2008-12-07 00:49:48 +00:00
Anders Carlsson 0d8f0ba6ed Improve VLA diagnostics/sema checking. Fixes PR2361 and PR2352.
llvm-svn: 60638
2008-12-07 00:20:55 +00:00
Fariborz Jahanian 06d0dd641b Setters returning a typedef of 'void' should not cause error.
Bug reported by Chris L.

llvm-svn: 60635
2008-12-06 23:12:49 +00:00
Fariborz Jahanian d2c2ad515e Use of properties declared in protocols in the category
via the category's protocol list1s, with appropriate
diagnsostics and a test case.

llvm-svn: 60634
2008-12-06 23:03:39 +00:00
Anders Carlsson 3bb1ffca94 Simplify test.
llvm-svn: 60631
2008-12-06 22:27:22 +00:00
Fariborz Jahanian ff83998e31 Improve error reporting of property and setter/getter
type mimatches.

llvm-svn: 60630
2008-12-06 21:48:16 +00:00
Fariborz Jahanian 8707e322cc Check for correct'void' return type for setter methods.
llvm-svn: 60629
2008-12-06 21:11:37 +00:00
Anders Carlsson 5df391e5c7 Add diagnostics for bitfields.
llvm-svn: 60628
2008-12-06 20:33:04 +00:00
Anders Carlsson 45f4b8c0f2 Fix invalid bit-field.
llvm-svn: 60627
2008-12-06 20:32:39 +00:00
Anders Carlsson 233a60d03e Simplify some diagnostics.
llvm-svn: 60626
2008-12-06 20:05:35 +00:00
Fariborz Jahanian 62293f4d97 Changed a 'FIXME' into new comment. Added a test case
testing declaration of properties in categories.

llvm-svn: 60625
2008-12-06 19:59:02 +00:00
Ted Kremenek 69d78b9d98 Add bandaid transfer function support for assignments involving ObjCKVCRefExpr.
llvm-svn: 60622
2008-12-06 02:39:30 +00:00
Fariborz Jahanian 5a3422f602 Patch to diagnose a variety of misuse of property
attributes. Example would be, readonly, assign or
assign, copy, etc.

llvm-svn: 60620
2008-12-06 01:12:43 +00:00
Douglas Gregor b0846b0f51 Add support for calls to dependent names within templates, e.g.,
template<typename T> void f(T x) {
    g(x); // g is a dependent name, so don't even bother to look it up
    g(); // error: g is not a dependent name
  }

Note that when we see "g(", we build a CXXDependentNameExpr. However,
if none of the call arguments are type-dependent, we will force the
resolution of the name "g" and replace the CXXDependentNameExpr with
its result.

GCC actually produces a nice error message when you make this
mistake, and even offers to compile your code with -fpermissive. I'll
do the former next, but I don't plan to do the latter.

llvm-svn: 60618
2008-12-06 00:22:45 +00:00
Douglas Gregor 4619e439b6 Introduce basic support for dependent types, type-dependent
expressions, and value-dependent expressions. This permits us to parse
some template definitions.

This is not a complete solution; we're missing type- and
value-dependent computations for most of the expression types, and
we're missing checks for dependent types and type-dependent
expressions throughout Sema.

llvm-svn: 60615
2008-12-05 23:32:09 +00:00
Fariborz Jahanian 9c196795e6 Fixed a comment.
llvm-svn: 60611
2008-12-05 22:36:19 +00:00
Fariborz Jahanian fbbaf6afae This test checks for duplicate implementation of the same
property. It also checks for duplicate use of the same ivar
in two different iproperty implementations. It also caught
an error for a test case used in CodeGen :).

llvm-svn: 60610
2008-12-05 22:32:48 +00:00
Fariborz Jahanian 88909849bb Fixed a test case. Added a test case showing property setter's
type mismatch (related to my last patch).

llvm-svn: 60599
2008-12-05 18:38:31 +00:00
Fariborz Jahanian 7988d7dc3e (instance/class) Method type checking between class and its implementation.
(instance/class) Method type checking between category and its implementation.
And a test case for all.

llvm-svn: 60598
2008-12-05 18:18:52 +00:00
Douglas Gregor 5101c24f60 Representation of template type parameters and non-type template
parameters, with some semantic analysis:
  - Template parameters are introduced into template parameter scope
  - Complain about template parameter shadowing (except in Microsoft mode)

Note that we leak template parameter declarations like crazy, a
problem we'll remedy once we actually create proper declarations for
templates. 

Next up: dependent types and value-dependent/type-dependent
expressions.

llvm-svn: 60597
2008-12-05 18:15:24 +00:00
Steve Naroff 6d6da255fb Fixed <rdar://problem/6213808> clang ObjC rewriter: @finally is not always executed
llvm-svn: 60593
2008-12-05 17:03:39 +00:00
Anders Carlsson 1aa679227b Use VerifyIntegerConstantExpression instead of isIntegerConstantExpr. Fixes PR2963
llvm-svn: 60591
2008-12-05 16:33:57 +00:00
Anders Carlsson 98463cd44d This wasn't such a good idea after all as it broke some tests.
llvm-svn: 60582
2008-12-05 05:24:13 +00:00
Anders Carlsson 3bc1d7d3d3 Handle __builtin___CFStringMakeConstantString in Expr::Evaluate.
llvm-svn: 60581
2008-12-05 05:18:05 +00:00
Anders Carlsson 1e495d9860 Make Sema::CheckForConstantInitializer use Expr::Evaluate. This fixes PR3130.
llvm-svn: 60580
2008-12-05 05:09:56 +00:00
Ted Kremenek bd4551cced Change the implementation of symbol_iterator to not use a union and rely on any details of SymbolRef's implementation.
llvm-svn: 60579
2008-12-05 02:56:39 +00:00
Ted Kremenek c9e7622a52 Add SymbolRef::print() and have SymbolicRegion::print() use this method instead of calling SymbolRef::getNumber().
llvm-svn: 60578
2008-12-05 02:45:20 +00:00
Ted Kremenek 3cb81db1b2 Use trait-based profiling of SymbolRefs, avoiding calling getNumber() (which will soon be removed).
llvm-svn: 60577
2008-12-05 02:39:38 +00:00
Ted Kremenek e2c86c30d0 Remove (unused) RegionExtent and subclasses. Extents are now represented easily using SVals.
llvm-svn: 60576
2008-12-05 02:36:00 +00:00
Ted Kremenek d8242f19f7 Rename SymbolID to SymbolRef. This is a precursor to some overhauling of the representation of symbolic values.
llvm-svn: 60575
2008-12-05 02:27:51 +00:00
Zhongxing Xu fbcf1e2623 Rename: FindContext -> FindDeclVisibleInContext.
llvm-svn: 60574
2008-12-05 01:57:57 +00:00
Fariborz Jahanian 521b3a363e Patch for diagnosing type mismatch between
methods in class and its implementation.
This is work in progress.

llvm-svn: 60573
2008-12-05 01:35:25 +00:00
Ted Kremenek 8e942123cb Remove SymbolDataContentsOf (unused).
llvm-svn: 60572
2008-12-05 01:31:31 +00:00
Ted Kremenek d368de794a StoreManager::Retrieve and StoreManager::RemoveDeadBindings now take a GRState* argument instead of a Store. This allows them to use the GDM for storing other data.
llvm-svn: 60570
2008-12-05 00:47:52 +00:00
Chris Lattner 5b4927048f -std=c99 defaults blocks to off even on darwin, but -fblocks overrides
even it. 

llvm-svn: 60568
2008-12-05 00:10:44 +00:00
Steve Naroff 22216db0ec Finish up support for <rdar://problem/6213955> clang ObjC rewriter: rewriter doesn't appear to support @property and @synthesize.
llvm-svn: 60565
2008-12-04 23:50:32 +00:00
Chris Lattner 79413956d4 change getCurFunctionDecl to skip through Block contexts to find
the containing block.  Introduce a new getCurFunctionOrMethodDecl
method to check to see if we're in a function or objc method.
Minor cleanups to other related places.  This fixes rdar://6405429.

llvm-svn: 60564
2008-12-04 23:50:19 +00:00
Chris Lattner 2ca529ce61 instead of forcing blocks on by default, make them default to off, but let
specific targets default them to on.  Default blocks to on on 10.6 and later.
Add a -fblocks option that allows the user to override the target's default.
Use -fblocks in the various testcases that use blocks.

llvm-svn: 60563
2008-12-04 23:20:07 +00:00
Fariborz Jahanian 5271058c75 Output better diagnostics for continuation class
property attribute mis-specification.

llvm-svn: 60562
2008-12-04 22:56:16 +00:00
Chris Lattner c7c6dd4d97 replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.

llvm-svn: 60561
2008-12-04 22:54:33 +00:00
Ted Kremenek 1aed3ddffa Remove unneeded assertion.
llvm-svn: 60559
2008-12-04 22:47:11 +00:00
Ted Kremenek bf28bceb10 Remove unneeded assertion. We already know that FE->getName() is an absolute path.
llvm-svn: 60558
2008-12-04 22:36:44 +00:00
Sebastian Redl 33a3101d43 Code cleanup in new handling.
llvm-svn: 60557
2008-12-04 22:20:51 +00:00
Ted Kremenek baedbf47f6 Use 'free' to release PerIDCache since it was allocated using calloc().
llvm-svn: 60556
2008-12-04 22:09:37 +00:00
Ted Kremenek 561370c23e Add 'expected-warning' to make test case pass.
llvm-svn: 60548
2008-12-04 19:44:23 +00:00
Ted Kremenek d58e74182e Add another static analyzer test case involving attribute(nonnull).
llvm-svn: 60547
2008-12-04 19:39:12 +00:00
Ted Kremenek 7d71db77d2 Fix bug in attribute(nonnull) processing where not all of the parameter indices in nonnull(...) were actually processed.
llvm-svn: 60546
2008-12-04 19:38:33 +00:00
Steve Naroff f8d556881e Fix build breakage from my previous commit.
Will discuss with Chris...

llvm-svn: 60545
2008-12-04 19:10:03 +00:00
Ted Kremenek 3f0e5c88d9 Add another test case for attribute(nonnull) checking.
llvm-svn: 60544
2008-12-04 18:35:53 +00:00
Sebastian Redl f84512a360 Fix some diagnostics and enhance test cases. Now tests member new and ambiguous overloads.
llvm-svn: 60542
2008-12-04 17:24:46 +00:00
Steve Naroff 4588d0f060 Several things...
- Implement RewritePropertySetter(). While the routine is simple, there were some tricky changes to RewriteFunctionBodyOrGlobalInitializer(), the main rewriter loop. It also required some additional instance data to distinguish setters from getters, as well as some changes to RewritePropertyGetter().

- Implement FIXME: for pretty printing ObjCPropertyRefExpr's.

- Changed ObjCPropertyRefExpr::getSourceRange() to point to the end of the property name (not the beginning). Also made a minor name change from "Loc"->"IdLoc" (to make it clear the Loc does not point to the ".").
 

llvm-svn: 60540
2008-12-04 16:24:46 +00:00
Daniel Dunbar 2c4efe68ea Mention an optimization opportunity pointed out by Chris.
llvm-svn: 60535
2008-12-04 09:05:45 +00:00
Ted Kremenek 677779ab36 Revamp RegionStoreManager::RemoveDeadBindings. This method now does a complete mark-and-sweep of the store, removing dead regions and recording the set of live and dead symbols appropriately.
llvm-svn: 60523
2008-12-04 02:08:27 +00:00
Ted Kremenek 4a3f1efd25 Revise bogus comment I just committed.
llvm-svn: 60522
2008-12-04 02:07:20 +00:00
Ted Kremenek 4cef8c2d58 Add comment to test case for documentation.
llvm-svn: 60521
2008-12-04 02:06:27 +00:00
Ted Kremenek 8e8cc81aec Update comment.
llvm-svn: 60520
2008-12-04 02:06:04 +00:00
Zhongxing Xu 96c0fa8b42 Add comments.
llvm-svn: 60516
2008-12-04 01:12:41 +00:00
Sebastian Redl 45c2f9d320 Correct CodeGen assumption that LongTy == Int32Ty in a few places. This makes several CodeGenObjC tests pass on 64-bit by fixing assertions. This doesn't mean that the result is actually what the GNU runtime expects, though.
llvm-svn: 60515
2008-12-04 00:10:55 +00:00
Sebastian Redl ba3fdfcbff Fix some type punning errors in SizeOfAlignOf and Typeid AST nodes. This should satisfy compilers and language lawyers alike.
llvm-svn: 60511
2008-12-03 23:17:54 +00:00
Ted Kremenek 5a6ef49e70 Added GDM query functions "contains" for the data types that support the "Contains" method.
llvm-svn: 60505
2008-12-03 20:49:14 +00:00
Ted Kremenek 217dc8de69 Added partial specialization of GRStatePartialTrait<T> with T = ImmutableSet<...>.
llvm-svn: 60504
2008-12-03 20:48:33 +00:00