Commit Graph

7956 Commits

Author SHA1 Message Date
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
Sebastian Redl faf6808e7a Overload resolution for the operator new function. Member version is still untested.
llvm-svn: 60503
2008-12-03 20:26:15 +00:00
Ted Kremenek cd7cc1ec0b Properly "include" abs_path.
llvm-svn: 60502
2008-12-03 19:50:37 +00:00
Ted Kremenek 6cd08e42e4 Use abs_path to resolve symbolic links and '..' in report table.
llvm-svn: 60493
2008-12-03 19:19:23 +00:00
Ted Kremenek eda6c23984 Don't have special treatment from pruning the common suffices of files in /Developer, /usr, etc.
llvm-svn: 60491
2008-12-03 19:16:58 +00:00
Ted Kremenek fff9f4aaaf BasicConstraintManager:
- Fix nonsensical logic in AssumeSymGE. When comparing 'sym >= constant' and the
  constant is the maximum integer value, add the constraint that 'sym ==
  constant' when the path is deemed feasible.  All other cases are feasible.
- Improve AssumeSymGT. When comparing 'sym > constant' and constant is the
  maximum integer value we know the path is infeasible.
- Add test case for this enhancement to AssumeSymGT.

llvm-svn: 60490
2008-12-03 19:06:30 +00:00
Ted Kremenek f935cfe277 BasicConstraintManager:
- Fix nonsensical logic in AssumeSymLE. When comparing 'sym <= constant' and the
  constant is the minimum integer value, add the constraint that 'sym ==
  constant' when the path is deemed feasible.  All other cases are feasible.
- Improve AssumeSymLT to address <rdar://problem/6407949>.  When comparing
  'sym < constant' and constant is the minimum integer value we know the
  path is infeasible.
- Add test case for <rdar://problem/6407949>.

llvm-svn: 60489
2008-12-03 18:56:12 +00:00
Sebastian Redl 9c33e96813 Fix typo in index operator overloading.
llvm-svn: 60483
2008-12-03 16:32:40 +00:00
Anders Carlsson 6a113d9ddb If a global var decl has an initializer, make sure to always set its linkage to external.
llvm-svn: 60462
2008-12-03 05:51:23 +00:00
Ted Kremenek 73a4d28758 PTH:
Use an array instead of a DenseMap to cache persistent IDs -> IdentifierInfo*.  This leads to a 4% speedup at -fsyntax-only using PTH.

llvm-svn: 60452
2008-12-03 01:16:39 +00:00
Steve Naroff f326f4056e More support for rewriting property getter/setters.
llvm-svn: 60450
2008-12-03 00:56:33 +00:00
Ted Kremenek e1fc020e65 Update Xcode project.
llvm-svn: 60448
2008-12-03 00:38:43 +00:00
Ted Kremenek 33eeabda61 - Remove PTHManager.cpp. Move all of its functions to PTHLexer.cpp since some of the internal methods are used by PTHLexer (their implementations are intertwined.) This enables some important inlining opportunities at -O3.
- Don't construct an std::vector<Token> prior to feeding PTH tokens to the Preprocessor.  Stream them off the PTH file directly.

llvm-svn: 60447
2008-12-03 00:38:03 +00:00
Sebastian Redl d6d55eeef5 Correct pretty printing of array new expressions.
llvm-svn: 60444
2008-12-02 22:08:59 +00:00
Ted Kremenek d328da1b65 Update Xcode project.
llvm-svn: 60441
2008-12-02 20:16:22 +00:00
Ted Kremenek da4d9dfbca Add "-token-cache" option for using pretokenized cache files.
llvm-svn: 60440
2008-12-02 19:57:31 +00:00
Ted Kremenek af058b5696 Preprocessor:
- Added method "setPTHManager" that will be called by the driver to install
  a PTHManager for the Preprocessor.
- Fixed some comments.
- Added EnterSourceFileWithPTH to mirror EnterSourceFileWithLexer.

llvm-svn: 60437
2008-12-02 19:46:31 +00:00
Ted Kremenek 498b6210fc Added PTHManager, a utility class that will be used by Preprocessor to lazily create PTHLexer objects for pre-tokenized files.
llvm-svn: 60436
2008-12-02 19:45:05 +00:00
Ted Kremenek ccaab17e2c PTH emission:
- Output 32 bit integers using bit-shifting + write of individual bytes.
  This is motivated because we aren't guaranteed to load 32-bit ints of the mmaped PTH file at 4-byte offsets.
- Don't emit flags for IdentifierInfos.  These are lazily populated by the Preprocessor/Parser.
- Only write out tokens for files with absolute paths.  This is potentially temporary, but simplifies things for now.

llvm-svn: 60435
2008-12-02 19:44:08 +00:00
Fariborz Jahanian eae373ea32 More type-checking of setter/getter methods. This is still
work in prgress.

llvm-svn: 60430
2008-12-02 18:39:49 +00:00
Nuno Lopes 48b5a33826 llvm-ld doesnt support '-g', so aovid passing that opt to it
llvm-svn: 60428
2008-12-02 18:19:03 +00:00
Steve Naroff 0629704e78 Add a couple FIXME's.
llvm-svn: 60427
2008-12-02 17:54:50 +00:00
Steve Naroff c038b3af03 Make sure synthesized properties get inserted into the classes/categories meta data.
llvm-svn: 60426
2008-12-02 17:36:43 +00:00
Sebastian Redl 5c6ebcc198 Parsing new and delete is now complete.
llvm-svn: 60425
2008-12-02 17:22:40 +00:00
Sebastian Redl 538787f571 Add better comments to ::new parsing. Thanks to Doug for the review.
llvm-svn: 60423
2008-12-02 17:10:24 +00:00
Sebastian Redl 6ef75e9ee8 Make RegionStoreManager::InitializeArray safe against array sizes that don't have pointer width.
This may be the case on 64-bit systems. Whether that fact is a bug is a different question, but it's easy to cure the symptom.

llvm-svn: 60422
2008-12-02 16:47:35 +00:00
Sebastian Redl db36b9b962 Make the parser handle ::new and ::delete correctly.
llvm-svn: 60421
2008-12-02 16:35:44 +00:00
Sebastian Redl fb5df7235a int-arith-convert.c makes assumptions about integer sizes, so force a specific architecture
llvm-svn: 60420
2008-12-02 16:34:01 +00:00
Eli Friedman 39bc53593d Update cmake build; patch by Csaba Hruska.
llvm-svn: 60418
2008-12-02 16:23:30 +00:00
Steve Naroff 003d00eea3 Simplify previous commit.
llvm-svn: 60416
2008-12-02 16:05:55 +00:00
Eli Friedman e918435f94 Fix for PR3150: obvious copy-paste bug in
ScalarExprEmitter::VisitBinLOr.

llvm-svn: 60415
2008-12-02 16:02:46 +00:00
Steve Naroff 9af949105a More work to rewrite synthesize properties (<rdar://problem/6213955>)
llvm-svn: 60414
2008-12-02 15:48:25 +00:00
Sebastian Redl 351bb78a10 Handle new by passing the Declaration to the Action, not a processed type.
llvm-svn: 60413
2008-12-02 14:43:59 +00:00
Ted Kremenek 817737a002 Add FIXME.
llvm-svn: 60390
2008-12-02 01:26:07 +00:00
Eli Friedman f5d08c9ee4 Disabling this code due to regression on test/CodeGen/bitfield.c. See
PR3152.

llvm-svn: 60389
2008-12-02 01:17:45 +00:00
Douglas Gregor f558618fa4 A little more scaffolding for parsing templates:
- Template parameter scope to hold the template parameters
  - Template parameter context for parsing declarators
  - Actions for template type parameters and non-type template
    parameters

llvm-svn: 60387
2008-12-02 00:41:28 +00:00
Fariborz Jahanian 015a48d1db This patch corrects problem in searching for a setter/getter method for
a property. Previous scheme of seaching in interface's list of methods
would not work because this list is not yet constructed. This is in preparation
for doing semantic check on viability of setter/getter method declarations.

llvm-svn: 60386
2008-12-02 00:19:12 +00:00
Douglas Gregor eb31f39558 Basic support for parsing templates, from Andrew Sutton
llvm-svn: 60384
2008-12-01 23:54:00 +00:00
Douglas Gregor da747baa3c Improve error recovery when parsing a function definition fails
llvm-svn: 60380
2008-12-01 23:03:32 +00:00
Douglas Gregor b690cbb928 Initialize storage class even if we got an erroneous mutable
llvm-svn: 60377
2008-12-01 22:46:22 +00:00
Douglas Gregor 90abb6dead Objective-C keywords are not always identifiers. Some are also C++ keywords
llvm-svn: 60373
2008-12-01 21:46:47 +00:00
Douglas Gregor dce30aa0f9 Fix RUN line
llvm-svn: 60372
2008-12-01 21:17:52 +00:00
Steve Naroff e1908e393e -Add several ObjC types to Decl::getDeclKindName(), a useful debug hook.
-Start adding support for rewriting @synthesize.

llvm-svn: 60368
2008-12-01 20:33:01 +00:00
Douglas Gregor e912266bdb Test blocks in C++ mode
llvm-svn: 60367
2008-12-01 19:48:06 +00:00
Douglas Gregor 95c326d14a Use EmitInt, not Emit, to emit unsigned values
llvm-svn: 60364
2008-12-01 19:45:16 +00:00
Daniel Dunbar 0132cdc45c Add test case for __ASSEMBLER__ definition.
llvm-svn: 60363
2008-12-01 19:23:47 +00:00
Daniel Dunbar 1f3d7849a8 Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!

llvm-svn: 60362
2008-12-01 18:55:22 +00:00
Douglas Gregor c12ce19595 Enable blocks in C++
llvm-svn: 60361
2008-12-01 18:34:47 +00:00
Douglas Gregor 2dc61144cd Make sure __null test runs in both 32- and 64-bit. Thanks Anders
llvm-svn: 60360
2008-12-01 18:05:11 +00:00
Douglas Gregor 356513d7d0 Parse the exception-specification throw(...), a Microsoft extension
llvm-svn: 60359
2008-12-01 18:00:20 +00:00
Douglas Gregor dc37c81448 Add the test for __null
llvm-svn: 60357
2008-12-01 17:31:21 +00:00
Douglas Gregor f7ab50df29 Define NULL to __null in C++, so that it's guaranteed to have the same size as a pointer
llvm-svn: 60355
2008-12-01 17:20:57 +00:00
Anders Carlsson 5b3638b6e7 Generate the correct results for the comma expression. Fixes PR3123.
llvm-svn: 60334
2008-12-01 06:44:05 +00:00
Anders Carlsson eade3ad1f1 Revert change that made isNullPointerConstant start emitting warnings. We don't want that :)
llvm-svn: 60333
2008-12-01 06:28:23 +00:00
Anders Carlsson 0309d904f7 Fix test. (0 && (a(),1)) is a valid I-C-E according to C99.
llvm-svn: 60331
2008-12-01 06:27:38 +00:00
Anders Carlsson 8628645e94 Change more code over to using the new Expr::Evaluate
llvm-svn: 60324
2008-12-01 02:46:24 +00:00
Anders Carlsson 38eef1de6c Change more code over to using the new Expr::Evaluate
llvm-svn: 60323
2008-12-01 02:42:14 +00:00
Anders Carlsson c9687907c5 Use the new Expr::Evaluate
llvm-svn: 60321
2008-12-01 02:31:41 +00:00
Anders Carlsson e7c2ac4b54 Remove dead code.
llvm-svn: 60320
2008-12-01 02:25:52 +00:00
Anders Carlsson 1dbffc6e36 Add Sema::isNullPointerConstant which extwarns if necessary. Use it in Sema::CheckConditionalOperands.
llvm-svn: 60319
2008-12-01 02:17:22 +00:00
Anders Carlsson 4bb9113da4 Add a new variant of isNullConstantExpr that returns an EvalResult.
llvm-svn: 60318
2008-12-01 02:13:57 +00:00
Anders Carlsson f7fba46331 Use VerifyIntegerConstantExpression for case values.
llvm-svn: 60317
2008-12-01 02:13:02 +00:00
Anders Carlsson 564730a857 Emit the correct diagnostic when a comma is in an ICE.
llvm-svn: 60316
2008-12-01 02:07:06 +00:00
Anders Carlsson e54e8a1182 Add Sema::VerifyIntegerConstantExpression
llvm-svn: 60305
2008-11-30 19:50:32 +00:00
Anders Carlsson b33d6c8611 Change the diagnostics that the evaluator reports to be of type NOTE.
llvm-svn: 60301
2008-11-30 18:37:00 +00:00
Anders Carlsson 5862001157 Replace the isEvaluated bool with a ShortCircuit int, making it easier to handle recursion
llvm-svn: 60300
2008-11-30 18:26:25 +00:00
Anders Carlsson 27b8c5c464 Pass the expression to the Error and Extension methods.
llvm-svn: 60299
2008-11-30 18:14:57 +00:00