Commit Graph

8422 Commits

Author SHA1 Message Date
Sebastian Redl 58097c79c2 Fill in C++ status table for statements.
llvm-svn: 61457
2008-12-28 17:18:13 +00:00
Sebastian Redl 1cbb59182c Convert a two more statement actions to smart pointers.
llvm-svn: 61456
2008-12-28 16:13:43 +00:00
Sebastian Redl 4f84ddccc8 Fix a grep error that caused CodeGenObjC/encode-test.m to fail.
llvm-svn: 61455
2008-12-28 15:48:05 +00:00
Sebastian Redl a2b5e31cb1 Diagnose declarations that don't declare anything, and fix PR3020.
Examples:
int;
typedef int;

llvm-svn: 61454
2008-12-28 15:28:59 +00:00
Sebastian Redl 85cd7bac29 Fix filename typo.
llvm-svn: 61453
2008-12-28 14:19:27 +00:00
Nuno Lopes 037bc858a0 add RUN line
llvm-svn: 61452
2008-12-27 23:47:34 +00:00
Anders Carlsson f562b39e80 Add a MS specific intrinsic.
llvm-svn: 61446
2008-12-27 04:26:15 +00:00
Anders Carlsson a7e0e61b9d Eli noticed that I had forgotten some #defines. Add them.
llvm-svn: 61445
2008-12-26 22:49:10 +00:00
Anders Carlsson 70f8da06d3 Add float.h header. Eli, please review :)
llvm-svn: 61444
2008-12-26 17:10:18 +00:00
Anders Carlsson 702cb5c29f Add __builtin_flt_rounds
llvm-svn: 61443
2008-12-26 16:43:35 +00:00
Douglas Gregor 1dc9826a46 Add support for out-of-line definitions of conversion functions and member operators
llvm-svn: 61442
2008-12-26 15:00:45 +00:00
Anders Carlsson 88b53663fb Fix implementation of _mm_pause.
llvm-svn: 61441
2008-12-26 02:22:10 +00:00
Anders Carlsson 19ef5d49d4 OK, all tests pass. Let's start using the SSE2 header
llvm-svn: 61440
2008-12-26 00:57:11 +00:00
Anders Carlsson c8f436df25 Add two more builtins
llvm-svn: 61439
2008-12-26 00:55:49 +00:00
Anton Korobeynikov b46e3a8d3b Complete the test after adding handling of merged attributes on decls.
llvm-svn: 61438
2008-12-26 00:52:17 +00:00
Anton Korobeynikov d72f47aa05 Add full dllimport / dllexport support: both sema checks and codegen.
Patch by Ilya Okonsky

llvm-svn: 61437
2008-12-26 00:52:02 +00:00
Anton Korobeynikov 3112c877c1 Testcase for stdcall/fastcall sema checks.
Patch by Ilya Okonsky!

llvm-svn: 61436
2008-12-26 00:51:21 +00:00
Anders Carlsson 37ba1a5927 Fix formatting
llvm-svn: 61435
2008-12-26 00:50:47 +00:00
Anders Carlsson 37c2371a88 Add _mm_pause and _MM_SHUFFLE
llvm-svn: 61434
2008-12-26 00:49:43 +00:00
Anders Carlsson 85eb1247a3 More SSE2 intrinsics
llvm-svn: 61433
2008-12-26 00:45:50 +00:00
Anders Carlsson a0d5ca2773 More SSE2 intrinsics
llvm-svn: 61432
2008-12-25 23:48:58 +00:00
Steve Naroff f9c29d4200 Add parser support for __forceinline, __w64, __ptr64.
llvm-svn: 61431
2008-12-25 14:41:26 +00:00
Steve Naroff 44ac777741 Add parser support for __cdecl, __stdcall, and __fastcall.
Change preprocessor implementation of _cdecl to reference __cdecl.

llvm-svn: 61430
2008-12-25 14:16:32 +00:00
Zhongxing Xu 4c1661102e Add Fedora 10 GCC paths.
llvm-svn: 61429
2008-12-25 09:28:01 +00:00
Anders Carlsson 51beccbd0b Make _mm_add_si64 inlined
llvm-svn: 61428
2008-12-25 07:07:08 +00:00
Steve Naroff 3a9b7e0cff Add explicit "fuzzy" parse support for Microsoft declspec.
Remove previous __declspec macro that would effectively erase the construct prior to parsing.

llvm-svn: 61422
2008-12-24 20:59:21 +00:00
Sebastian Redl 068b13d62a Fix try statement deserialization.
llvm-svn: 61421
2008-12-24 13:02:38 +00:00
Ted Kremenek 2907ab7d77 Add a bunch of comments and FIXMEs.
llvm-svn: 61419
2008-12-24 07:46:32 +00:00
Zhongxing Xu c7a2792817 set region default value if there are not enough init values for array and struct.
llvm-svn: 61418
2008-12-24 07:29:24 +00:00
Zhongxing Xu be2d5535f6 Add serialization support for TypeOfType.
llvm-svn: 61417
2008-12-24 07:22:26 +00:00
Zhongxing Xu 329f204b1b Add serialization support for TypeOfExpr.
llvm-svn: 61416
2008-12-24 06:36:01 +00:00
Douglas Gregor b9bd8a994c Keep track of template arguments when we parse them. Right now, we don't actually do anything with the template arguments, but they'll be used to create template declarations
llvm-svn: 61413
2008-12-24 02:52:09 +00:00
Anders Carlsson a283f91a67 Add integer arithmetic intrinsics
llvm-svn: 61412
2008-12-24 02:41:00 +00:00
Anders Carlsson b08ac0b2b0 Add store/set/load intrisics
llvm-svn: 61411
2008-12-24 02:11:54 +00:00
Anders Carlsson f15e71d170 Start implementing some SSE2 instructions
llvm-svn: 61410
2008-12-24 01:45:22 +00:00
Ted Kremenek ae189ec1be Comment and fixup GDM entries for RegionStore to use unique 'tag classes' to identify GDM entries.
llvm-svn: 61409
2008-12-24 01:05:03 +00:00
Douglas Gregor 583540360c Correct the order in which we cope with end-of-class-definition
semantics and improve our handling of default arguments. Specifically,
we follow this order:

  - As soon as the see the '}' in the class definition, the class is
  complete and we add any implicit declarations (default constructor,
  copy constructor, etc.) to the class.
  - If there are any default function arguments, parse them
  - If there were any inline member function definitions, parse them

As part of this change, we now keep track of the the fact that we've
seen unparsed default function arguments within the AST. See the new
ParmVarDecl::hasUnparsedDefaultArg member. This allows us to properly
cope with calls inside default function arguments to other functions
where we're making use of the default arguments.

Made some C++ error messages regarding failed initializations more
specific. 

llvm-svn: 61406
2008-12-24 00:01:03 +00:00
Anton Korobeynikov 484f05e14d Sema for fastcall/stdcall stuff. Tests will follow.
Patch by Ilya Okonsky!

llvm-svn: 61394
2008-12-23 22:24:07 +00:00
Douglas Gregor 17eb26bc4e Fix misguided type selection
llvm-svn: 61393
2008-12-23 22:05:29 +00:00
Douglas Gregor 74a3444394 When determining whether a class type has a const copy constructor, be
sure to look at all of the results returned by name lookup. Fixes
<rdar://problem/6465262>

llvm-svn: 61388
2008-12-23 21:31:30 +00:00
Fariborz Jahanian 4ecf1e94db Last patch, for now, to privde ObjC's encoding of types.
We now pass all gcc's encoding compatibility tests.

llvm-svn: 61387
2008-12-23 21:30:15 +00:00
Douglas Gregor 8b9ccca5e5 Don't push OverloadedFunctionDecls onto the chain of declarations
attached to an identifier. Instead, all overloaded functions will be
pushed into scope, and we'll synthesize an OverloadedFunctionDecl on
the fly when we need it. 

llvm-svn: 61386
2008-12-23 21:05:05 +00:00
Steve Naroff 6ab6dc75ef Fix <rdar://problem/6465284> clang ObjC rewriter: objc_super messed up again.
llvm-svn: 61384
2008-12-23 20:11:22 +00:00
Fariborz Jahanian 0f66a6c926 Lot more encoding work. We are closing the gap to
gcc compatibilty in all aspects of encoding now.

llvm-svn: 61383
2008-12-23 19:56:47 +00:00
Ted Kremenek b0051a9955 Remove old PTH token-generation test harness.
llvm-svn: 61382
2008-12-23 19:25:33 +00:00
Ted Kremenek 78cc24730e PTH: Remove some methods and simplify some conditions in PTHLexer::Lex(). No big functionality change.
llvm-svn: 61381
2008-12-23 19:24:24 +00:00
Ted Kremenek a754c40390 PTH: Use 3 bytes instead of 4 bytes to encode the persistent ID for a token.
- This reduces the PTH size for Cocoa.h by 7%.
- The increases PTH -Eonly speed for Cocoa.h by 0.8%.

llvm-svn: 61377
2008-12-23 18:41:34 +00:00
Ted Kremenek 3f94706e57 Cosmetics: rename a variable and tighten spacing. No functionality change.
llvm-svn: 61375
2008-12-23 18:27:26 +00:00
Sebastian Redl ccd251b88f Merge pr-3188.cpp into constructor.cpp.
llvm-svn: 61370
2008-12-23 16:41:32 +00:00
Chris Lattner 68a1b9a16f Add a setter for CVR qualifiers, patch by Lukasz Janyst!
llvm-svn: 61367
2008-12-23 04:57:30 +00:00
Ted Kremenek 1bd0a550d0 PTH:
- Encode the token length with 2 bytes instead of 4.
- This reduces the size of the .pth file for Cocoa.h by 12%.
- This speeds up PTH time (-Eonly) on Cocoa.h by 1.6%.

llvm-svn: 61364
2008-12-23 02:52:12 +00:00
Ted Kremenek 66076a964b PTH:
- In PTHLexer::Lex read all of the token data from PTH file before
  constructing the token.  The idea is to enhance locality.
- Do not use Read8/Read32 in PTHLexer::Lex.  Inline these operations manually.
- Change PTHManager::ReadIdentifierInfo() to PTHManager::GetIdentifierInfo().
  They are functionally the same except that PTHLexer::Lex() reads the
  persistent id.

These changes result in a 3.3% speedup for PTH on Cocoa.h (-Eonly).

llvm-svn: 61363
2008-12-23 02:30:15 +00:00
Ted Kremenek 1b18ad240c PTH:
- Embed 'eom' tokens in PTH file.
- Use embedded 'eom' tokens to not lazily generate them in the PTHLexer.
  This means that PTHLexer can always advance to the next token after
  reading a token (instead of buffering tokens using a copy).
- Moved logic of 'ReadToken' into Lex.  GetToken & ReadToken no longer exist.
- These changes result in a 3.3% speedup (-Eonly) on Cocoa.h.
- The code is a little gross.  Many cleanups are possible and should be done.

llvm-svn: 61360
2008-12-23 01:30:52 +00:00
Douglas Gregor 033f56d533 Add some block-pointer conversions in C++
llvm-svn: 61359
2008-12-23 00:53:59 +00:00
Douglas Gregor 55297ac499 Don't explicitly represent OverloadedFunctionDecls within
DeclContext. Instead, just keep the list of currently-active
declarations and only build the OverloadedFunctionDecl when we
absolutely need it.

This is a half-step toward eliminating the need to explicitly build
OverloadedFunctionDecls that store sets of overloaded
functions. This was suggested by Argiris a while back, and it's a good
thing for several reasons: first, it eliminates the messy logic that
currently tries to keep the OverloadedFunctionDecl in sync with the 
declarations that are being added. Second, it will (eventually)
eliminate the need to allocate memory for overload sets, which could
help performance. Finally, it helps set us up for when name lookup can
return multiple (possibly ambiguous) results, as can happen with
lookup of class members in C++.

Next steps: make the IdentifierResolver store overloads as separate
entries in its list rather than replacing them with an
OverloadedFunctionDecl now, then see how far we can go toward
eliminating OverloadedFunctionDecl entirely.

llvm-svn: 61357
2008-12-23 00:26:44 +00:00
Fariborz Jahanian daef00bca6 More encoding support; in this case, encoding of
outer-most const of pointer types.

llvm-svn: 61355
2008-12-22 23:22:27 +00:00
Steve Naroff 2654e18c84 Fix <rdar://problem/6463613> clang ObjC rewriter: assertion failure rewriting @selector?.
llvm-svn: 61351
2008-12-22 22:16:07 +00:00
Sebastian Redl 45f11a9b05 Guard against the return of PR3188
llvm-svn: 61348
2008-12-22 21:43:13 +00:00
Sebastian Redl 9b244a8797 Full AST support and better Sema support for C++ try-catch.
llvm-svn: 61346
2008-12-22 21:35:02 +00:00
Douglas Gregor 79a6b01802 Support conversion from a null pointer constant o any Objective-C object pointer type. Fixes rdar://problem/6463298
llvm-svn: 61340
2008-12-22 20:51:52 +00:00
Fariborz Jahanian 8b2d1294db Fixed a bug showed up the meta-data for protocol
instance methods by building print-class-info.m,
whose output is now identical to what gcc puts out.

llvm-svn: 61339
2008-12-22 20:41:58 +00:00
Sebastian Redl 54c04d4700 Partial AST and Sema support for C++ try-catch.
llvm-svn: 61337
2008-12-22 19:15:10 +00:00
Fariborz Jahanian ed4c443193 Patch to remove bogus warning in case of @dynamic
property in a category and to issue diagnostics
for mismatch method in some other cases.

llvm-svn: 61336
2008-12-22 19:05:31 +00:00
Sebastian Redl 04253537dc Expr and Stmt must be destroyed with Destroy, not delete. Fixes PR/3245.
llvm-svn: 61335
2008-12-22 17:51:10 +00:00
Anders Carlsson c72502308d Fix test failures noticed by Fariborz.
llvm-svn: 61334
2008-12-22 17:42:23 +00:00
Zhongxing Xu 4ee570a4cb Fix initialization order.
llvm-svn: 61333
2008-12-22 08:30:52 +00:00
Anders Carlsson e5f993da3d Flip the switch and start using the new xmmintrin.h
llvm-svn: 61332
2008-12-22 07:36:02 +00:00
Anders Carlsson 27046fc4e6 Comment out _mm_insert_pi16 for now
llvm-svn: 61331
2008-12-22 07:34:23 +00:00
Anders Carlsson 5aa0c50e29 Implement the last intrinsics, _mm_insert_pi16 is the last remaining one now.
llvm-svn: 61330
2008-12-22 07:08:03 +00:00
Douglas Gregor 97fd6e24c4 Add support for calls to overloaded member functions. Things to note:
- Overloading has to cope with having both static and non-static
    member functions in the overload set.
  - The call may or may not have an implicit object argument,
    depending on the syntax (x.f() vs. f()) and the context (static
    vs. non-static member function).
  - We now generate MemberExprs for implicit member access expression.
  - We now cope with mutable whenever we're building MemberExprs.

llvm-svn: 61329
2008-12-22 05:46:06 +00:00
Anders Carlsson 25b16dbcd8 Add macros
llvm-svn: 61328
2008-12-22 05:42:03 +00:00
Anders Carlsson 8b79fc8aab Add misc intrinsics
llvm-svn: 61327
2008-12-22 05:20:34 +00:00
Anders Carlsson 53b3d4a32a Add control register intrinsics
llvm-svn: 61326
2008-12-22 05:00:07 +00:00
Anders Carlsson 4cf8ac8bb8 Add integer intrinsics
llvm-svn: 61325
2008-12-22 04:55:36 +00:00
Anders Carlsson 0462eb270a Generate code for __builtin_ia32_pshufw
llvm-svn: 61324
2008-12-22 04:54:32 +00:00
Anders Carlsson 70d5f46646 Add cacheability intrinsics
llvm-svn: 61323
2008-12-22 03:50:21 +00:00
Anders Carlsson 1e71996bd1 Add store intrinsics
llvm-svn: 61322
2008-12-22 03:16:40 +00:00
Anders Carlsson c7d0d8b60d Add set intrinsics
llvm-svn: 61321
2008-12-22 02:51:35 +00:00
Anders Carlsson 13fd3a1411 Add load intrinsics
llvm-svn: 61320
2008-12-22 02:43:30 +00:00
Zhongxing Xu 5b0ae81ab1 Add an option to make 'RemoveDeadBindings' a configurable behavior. This enables
us to measure the effect of this optimization.

llvm-svn: 61319
2008-12-22 01:52:37 +00:00
Anders Carlsson 1e4a9b7c0d _mm_cvtsi64_ss is 64-bit only, so wrap it in #ifdef __x86_64__
Add composite conversion intrinsics - will implement them shortly.

llvm-svn: 61318
2008-12-22 01:26:50 +00:00
Anders Carlsson 157643c8d7 Add a couple of conversion intrinsics
llvm-svn: 61317
2008-12-22 00:48:30 +00:00
Anders Carlsson 60053dd2a5 Add comparison intrinsics.
llvm-svn: 61316
2008-12-22 00:28:39 +00:00
Anders Carlsson 2df1ce496e Check in an in-progress version of xmmintrin.h that I had lying around.
llvm-svn: 61315
2008-12-22 00:01:20 +00:00
Anders Carlsson 39def3adc8 Add codegen support for __null
llvm-svn: 61314
2008-12-21 22:39:40 +00:00
Sebastian Redl fc24b63b9a Fix a comment.
llvm-svn: 61313
2008-12-21 19:24:58 +00:00
Sebastian Redl b219c90d7b Parser support for C++ try-catch.
llvm-svn: 61312
2008-12-21 16:41:36 +00:00
Zhongxing Xu 7b9c57083b Correct comments.
llvm-svn: 61311
2008-12-21 13:00:52 +00:00
Sebastian Redl f795cbed2e Test case makes a platform assumption, so force triple.
llvm-svn: 61310
2008-12-21 12:17:24 +00:00
Sebastian Redl 52f03bac60 Convert a few Stmt actions to smart pointers.
llvm-svn: 61309
2008-12-21 12:04:03 +00:00
Sebastian Redl 8de8234de4 Document how move semantics and the emulation work. Do this in-file because it's such a specific thing.
Restructure code for less duplication.

llvm-svn: 61308
2008-12-21 11:56:24 +00:00
Zhongxing Xu d93e03b25f fix 80-col violation.
llvm-svn: 61306
2008-12-21 04:46:06 +00:00
Anders Carlsson 3ebc7c4a0d Implement alignof for vla types.
llvm-svn: 61305
2008-12-21 03:48:05 +00:00
Zhongxing Xu 40b0e50ffd Use utility method.
llvm-svn: 61304
2008-12-21 03:46:11 +00:00
Anders Carlsson e0808df4a5 Add ASTContext::getBaseElementType and use it in CodeGenFunction::EmitArraySubscriptExpr.
llvm-svn: 61303
2008-12-21 03:44:36 +00:00
Anders Carlsson 118467dfb7 Commit the right version of the test
llvm-svn: 61302
2008-12-21 03:40:32 +00:00
Anders Carlsson 76dbc0423e Make sure to emit the size expression for sizeof(type)
llvm-svn: 61301
2008-12-21 03:33:21 +00:00
Zhongxing Xu 303a6d4f11 Use utility methods. No functional change.
llvm-svn: 61300
2008-12-21 03:31:01 +00:00
Zhongxing Xu f97d95a782 Remove unused function.
llvm-svn: 61299
2008-12-21 03:26:05 +00:00
Eli Friedman dea4193e8a Fix for PR3246: an empty clobber list is the empty string, not a null
string.

That said, we should probably try and track down the correct clobber 
lists for the targets that don't have them (PPC, ARM, and Sparc), 
so that we can generate correct code.

llvm-svn: 61298
2008-12-21 01:15:32 +00:00
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