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

2791 Коммитов

Автор SHA1 Сообщение Дата
Anders Carlsson a75023d60f Simplify some diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60626 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 20:05:35 +00:00
Fariborz Jahanian 77e14bd3a7 Changed a 'FIXME' into new comment. Added a test case
testing declaration of properties in categories.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60625 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 19:59:02 +00:00
Ted Kremenek 759623efaf Add bandaid transfer function support for assignments involving ObjCKVCRefExpr.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 02:39:30 +00:00
Fariborz Jahanian 567c8df364 Patch to diagnose a variety of misuse of property
attributes. Example would be, readonly, assign or
assign, copy, etc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60620 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 01:12:43 +00:00
Douglas Gregor 5c37de7885 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-06 00:22:45 +00:00
Douglas Gregor 898574e749 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 23:32:09 +00:00
Fariborz Jahanian 9482a4f0fe Fixed a comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 22:36:19 +00:00
Fariborz Jahanian ae6f6fd152 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 :).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 22:32:48 +00:00
Fariborz Jahanian 8daab970b8 (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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 18:18:52 +00:00
Douglas Gregor 72c3f314d9 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 18:15:24 +00:00
Anders Carlsson 49184b2916 Use VerifyIntegerConstantExpression instead of isIntegerConstantExpr. Fixes PR2963
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60591 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 16:33:57 +00:00
Anders Carlsson d407a76199 This wasn't such a good idea after all as it broke some tests.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60582 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:24:13 +00:00
Anders Carlsson b3fee0f064 Handle __builtin___CFStringMakeConstantString in Expr::Evaluate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60581 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:18:05 +00:00
Anders Carlsson 9e09f5d361 Make Sema::CheckForConstantInitializer use Expr::Evaluate. This fixes PR3130.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60580 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 05:09:56 +00:00
Ted Kremenek 562731eabb Add SymbolRef::print() and have SymbolicRegion::print() use this method instead of calling SymbolRef::getNumber().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60578 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 02:45:20 +00:00
Ted Kremenek 6d0e2d2f3c Use trait-based profiling of SymbolRefs, avoiding calling getNumber() (which will soon be removed).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60577 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 02:39:38 +00:00
Ted Kremenek 2dabd4372c Rename SymbolID to SymbolRef. This is a precursor to some overhauling of the representation of symbolic values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 02:27:51 +00:00
Zhongxing Xu ebed7971cf Rename: FindContext -> FindDeclVisibleInContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 01:57:57 +00:00
Fariborz Jahanian de7394157c Patch for diagnosing type mismatch between
methods in class and its implementation.
This is work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 01:35:25 +00:00
Ted Kremenek f3d416267e Remove SymbolDataContentsOf (unused).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60572 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 01:31:31 +00:00
Ted Kremenek 2ed14beed7 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60570 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-05 00:47:52 +00:00
Chris Lattner 371f258e61 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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 23:50:19 +00:00
Chris Lattner ae0ee03fd9 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60563 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 23:20:07 +00:00
Fariborz Jahanian 06de37bade Output better diagnostics for continuation class
property attribute mis-specification.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60562 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:56:16 +00:00
Chris Lattner 8fc4dfb30e replace useNeXTRuntimeAsDefault with a generic hook that allows targets
to specify their default language options.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:54:33 +00:00
Ted Kremenek 0e50b6e7c1 Remove unneeded assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60559 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:47:11 +00:00
Sebastian Redl 7f6623914e Code cleanup in new handling.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60557 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:20:51 +00:00
Ted Kremenek 271b7af521 Use 'free' to release PerIDCache since it was allocated using calloc().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 22:09:37 +00:00
Ted Kremenek f5e8834747 Fix bug in attribute(nonnull) processing where not all of the parameter indices in nonnull(...) were actually processed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60546 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 19:38:33 +00:00
Sebastian Redl 636a7c42d4 Fix some diagnostics and enhance test cases. Now tests member new and ambiguous overloads.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60542 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 17:24:46 +00:00
Steve Naroff c77a636688 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 ".").
 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60540 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 16:24:46 +00:00
Daniel Dunbar 86ccea05f6 Mention an optimization opportunity pointed out by Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60535 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 09:05:45 +00:00
Ted Kremenek c48ea6e51d 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60523 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 02:08:27 +00:00
Ted Kremenek de63bdcb52 Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60520 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 02:06:04 +00:00
Zhongxing Xu 0b242ecdd5 Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60516 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 01:12:41 +00:00
Sebastian Redl 3a5013cab1 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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60515 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-04 00:10:55 +00:00
Sebastian Redl d457589fc6 Fix some type punning errors in SizeOfAlignOf and Typeid AST nodes. This should satisfy compilers and language lawyers alike.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 23:17:54 +00:00
Sebastian Redl b5a57a69e5 Overload resolution for the operator new function. Member version is still untested.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60503 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 20:26:15 +00:00
Ted Kremenek d7ff4874cb 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60490 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 19:06:30 +00:00
Ted Kremenek 73abd133ae 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>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60489 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 18:56:12 +00:00
Sebastian Redl cb354721a6 Fix typo in index operator overloading.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 16:32:40 +00:00
Anders Carlsson 98883e1e69 If a global var decl has an initializer, make sure to always set its linkage to external.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 05:51:23 +00:00
Ted Kremenek 6183e4815a PTH:
Use an array instead of a DenseMap to cache persistent IDs -> IdentifierInfo*.  This leads to a 4% speedup at -fsyntax-only using PTH.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60452 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 01:16:39 +00:00
Ted Kremenek 0c6a77bc1f - 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60447 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-03 00:38:03 +00:00
Sebastian Redl 6fec64874f Correct pretty printing of array new expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 22:08:59 +00:00
Ted Kremenek 6137dc99ef 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60437 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 19:46:31 +00:00
Ted Kremenek be1ee79d20 Added PTHManager, a utility class that will be used by Preprocessor to lazily create PTHLexer objects for pre-tokenized files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60436 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 19:45:05 +00:00
Fariborz Jahanian f3cd3fd859 More type-checking of setter/getter methods. This is still
work in prgress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 18:39:49 +00:00
Sebastian Redl bcf293bb63 Add better comments to ::new parsing. Thanks to Doug for the review.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60423 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 17:10:24 +00:00
Sebastian Redl 500386194c 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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 16:47:35 +00:00
Sebastian Redl fb4ccd7152 Make the parser handle ::new and ::delete correctly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 16:35:44 +00:00
Eli Friedman 09af4d9728 Update cmake build; patch by Csaba Hruska.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 16:23:30 +00:00
Eli Friedman 8de8d1d3f2 Fix for PR3150: obvious copy-paste bug in
ScalarExprEmitter::VisitBinLOr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60415 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 16:02:46 +00:00
Sebastian Redl cee63fbf0e Handle new by passing the Declaration to the Action, not a processed type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60413 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 14:43:59 +00:00
Ted Kremenek 04f9d468f7 Add FIXME.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60390 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 01:26:07 +00:00
Eli Friedman a385b3c9c4 Disabling this code due to regression on test/CodeGen/bitfield.c. See
PR3152.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60389 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 01:17:45 +00:00
Douglas Gregor 26236e8b75 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



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60387 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 00:41:28 +00:00
Fariborz Jahanian b85cce6498 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.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60386 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-02 00:19:12 +00:00
Douglas Gregor adcac8824a Basic support for parsing templates, from Andrew Sutton
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60384 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:54:00 +00:00
Douglas Gregor cb43d99952 Improve error recovery when parsing a function definition fails
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60380 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 23:03:32 +00:00
Douglas Gregor e89b02823a Initialize storage class even if we got an erroneous mutable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 22:46:22 +00:00
Douglas Gregor bec1c9d6f3 Objective-C keywords are not always identifiers. Some are also C++ keywords
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60373 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 21:46:47 +00:00
Steve Naroff d40910b581 -Add several ObjC types to Decl::getDeclKindName(), a useful debug hook.
-Start adding support for rewriting @synthesize.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60368 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 20:33:01 +00:00
Douglas Gregor 19ac6ff24e Use EmitInt, not Emit, to emit unsigned values
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60364 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 19:45:16 +00:00
Daniel Dunbar c1571453de Add LangOptions marker for assembler-with-cpp mode and use to define
__ASSEMBLER__ properly. Patch from Roman Divacky (with minor
formatting changes). Thanks!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60362 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 18:55:22 +00:00
Douglas Gregor a4745616eb Parse the exception-specification throw(...), a Microsoft extension
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60359 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 18:00:20 +00:00
Douglas Gregor 28d6cba4c4 Define NULL to __null in C++, so that it's guaranteed to have the same size as a pointer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60355 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 17:20:57 +00:00
Anders Carlsson 4fdfb0965b Generate the correct results for the comma expression. Fixes PR3123.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60334 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:44:05 +00:00
Anders Carlsson d26527708b Revert change that made isNullPointerConstant start emitting warnings. We don't want that :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60333 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 06:28:23 +00:00
Anders Carlsson 64712f196b Change more code over to using the new Expr::Evaluate
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60324 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:46:24 +00:00
Anders Carlsson 4b3f9c06d5 Change more code over to using the new Expr::Evaluate
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60323 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:42:14 +00:00
Anders Carlsson f35d35a231 Use the new Expr::Evaluate
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60321 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:31:41 +00:00
Anders Carlsson 07b5cc0f40 Remove dead code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60320 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:25:52 +00:00
Anders Carlsson 4000ea685a Add Sema::isNullPointerConstant which extwarns if necessary. Use it in Sema::CheckConditionalOperands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60319 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:17:22 +00:00
Anders Carlsson efa9b3877e Add a new variant of isNullConstantExpr that returns an EvalResult.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60318 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:13:57 +00:00
Anders Carlsson d3a61d5ec5 Use VerifyIntegerConstantExpression for case values.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60317 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:13:02 +00:00
Anders Carlsson 027f62ec18 Emit the correct diagnostic when a comma is in an ICE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-12-01 02:07:06 +00:00
Anders Carlsson e21555e666 Add Sema::VerifyIntegerConstantExpression
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60305 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 19:50:32 +00:00
Anders Carlsson 0e8acbbba7 Change the diagnostics that the evaluator reports to be of type NOTE.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60301 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 18:37:00 +00:00
Anders Carlsson f0c1e4b679 Replace the isEvaluated bool with a ShortCircuit int, making it easier to handle recursion
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60300 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 18:26:25 +00:00
Anders Carlsson 82206e267c Pass the expression to the Error and Extension methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60299 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 18:14:57 +00:00
Anders Carlsson 5b45d4ef1e Add a new variant of Evaluate and reimplement the old Evaluate in terms of the new.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60298 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 16:58:53 +00:00
Anders Carlsson fcb4d09531 General cleanup, evaluate the RHS of a logical op even if the LHS will give us the result.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60297 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 16:51:17 +00:00
Anders Carlsson 54da049661 EvalInfo now holds a reference to an EvalResult struct.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60296 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 16:38:33 +00:00
Zhongxing Xu 6987c7b741 Add support for initializing array with string literal.
This fixes PR3127
http://llvm.org/bugs/show_bug.cgi?id=3127


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60280 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 05:49:49 +00:00
Eli Friedman 994ffef435 Fix for PR2969: generate a memcpy from a constant for constant
initializers.  llvm-gcc appears to be more aggressive, but incorrect, 
for constructs like "const int a[] = {1,2,3};"; that said, current 
optimizers will do the appropriate optimizations when safe.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 02:11:09 +00:00
Eli Friedman 4310ff6d8b Minor update to CMake build system.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60269 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-30 01:46:21 +00:00
Zhongxing Xu 0395b5d498 To be consistent, make the index of the ElementRegion always signed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60248 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 12:05:04 +00:00
Douglas Gregor 2d8b273470 Implement the GNU __null extension
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60235 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-29 04:51:27 +00:00
Chris Lattner 5cf243a883 Switch QualType to use llvm::PointerIntPair internally to do the pointer
bitmangling.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60226 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 23:37:31 +00:00
Zhongxing Xu 96cb9fb620 Fix a serious bug.
When initialized, the index of the ElementRegion was unsigned. But the index
value of the ArraySubscriptExpr is signed. This inconsistency caused the value
of the array element retrieved to be UnknownVal despite it was initialized to
symbolic.

This is only a hack. Real fix of this problem is required.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60207 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 08:41:39 +00:00
Zhongxing Xu d5b499d43c Code cleanup. No functional change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60206 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 08:34:30 +00:00
Zhongxing Xu 353cbe134c Use std::make_pair instead of std::pair's ctor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60205 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-28 03:55:52 +00:00
Sebastian Redl e206532197 Fix order of evaluation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60160 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 07:28:14 +00:00
Zhongxing Xu f0bc50eaa3 Factory objects should not be temporary. It caches all objects in the set.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60151 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 06:08:40 +00:00
Zhongxing Xu d548479442 RegionViewMap factory is actually not used. All GDMs should use factories from
GDMContext.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60150 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 06:03:03 +00:00
Daniel Dunbar 4fe66aa202 Test commit.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60147 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 03:47:29 +00:00
Zhongxing Xu 8fd9b3508a Add comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60146 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 02:39:34 +00:00
Zhongxing Xu 5abf03bbb9 Add license comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60144 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 02:19:10 +00:00
Zhongxing Xu 22438a8dfe Add support for pluggable components of static analyzer.
- Creator function pointers are saved in ManagerRegistry.
 - The Register* class is used to notify ManagerRegistry new module is 
   available.
 - AnalysisManager queries ManagerRegistry for configurable module. Then it
   passes them to GRExprEngine, in turn to GRStateManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:55:08 +00:00
Douglas Gregor 7ca09760ee Add implicit conversions for Objective-C qualified ids, e.g.,
id<P0>

The intended overloading behavior of these entities isn't entirely
clear, and GCC seems to have some strange limitations (e.g., the
inability to overload on id<P0> vs. id<P1>). We'll want to revisit
these semantics and determine just how Objective-C++ overloading
should really work.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60142 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 01:19:21 +00:00
Douglas Gregor bf40818928 Cleanup formatting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60140 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:52:49 +00:00
Douglas Gregor 63a9490b27 Don't complain about block pointer to void* conversions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60138 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:44:28 +00:00
Ted Kremenek 82a500b141 PTHLexer now owns the Token vector.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60136 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:38:24 +00:00
Douglas Gregor 071f2aec57 Support block pointer conversions in C++. I'm storing the test case locally until we can enable blocks in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60133 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-27 00:15:41 +00:00
Douglas Gregor cb7de523cc Implement implicit conversions for Objective-C specific types, e.g.,
converting a pointer to one Objective-C interface into a pointer to another
Objective-C interface, and conversions with 'id'. The semantics seems
to match GCC, although they seem somewhat ad hoc.

Fixed a few cases where we assumed the C++ definition of isObjectType,
but were getting the C definition, causing failures in trouble with
conversions to void pointers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60130 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 23:31:11 +00:00
Argyrios Kyrtzidis 314fe782fd Attempt to unravel the if/else mess in Parser::ParseDirectDeclarator.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60124 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:40:03 +00:00
Fariborz Jahanian 6010bca98a Code gen for aggregate-valued properties and a test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60122 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 22:36:09 +00:00
Argyrios Kyrtzidis 44802cc435 Add some comments.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60119 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 21:51:07 +00:00
Argyrios Kyrtzidis 4bdd91c09f Implement some suggestions by Daniel:
-Change Parser::ParseCXXScopeSpecifier to MaybeParseCXXScopeSpecifier
-Remove Parser::isTokenCXXScopeSpecifier and fold it into MaybeParseCXXScopeSpecifier
-Rename Parser::TryAnnotateScopeToken to TryAnnotateCXXScopeToken and only allow it to be called when in C++

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60117 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 21:41:52 +00:00
Fariborz Jahanian b16308f1b3 Removed a FIXME. Added a test case for anonymous category.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60115 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 20:33:54 +00:00
Fariborz Jahanian 8cf0bb3c2a Set default property attributes on each property.
Implemented anonymous category (also know as continuation class)
used to override main class's property attribute. This is work in 
propgress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60114 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 20:01:34 +00:00
Anders Carlsson 4d6e8dd587 Convert incomplete array types before emitting debug info for them, fixes PR3134.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60109 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 17:40:42 +00:00
Douglas Gregor 7ffd0defb9 Fix a minor typo in the handling of the conditional operator for Objective-C interface pointers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60096 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 06:43:45 +00:00
Douglas Gregor 0a39668d6a Tweak the new ResolveOverloadedCallFn to just return a FunctionDecl. It makes ActOnCallExpr simpler
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60094 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 06:01:48 +00:00
Douglas Gregor f6b89691d2 Move the overloading logic of Sema::ActOnCallExpr to a separate function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60093 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 05:54:23 +00:00
Nuno Lopes cfe257198c remove debug-only assertion in the complex float evaluator as it makes some real apps crash
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-26 00:39:53 +00:00
Daniel Dunbar ab4c91c708 Only call TryAnnotateScopeToken when parsing C++.
- This improves -parse-noop of Carbon.h by +2%, and I believe
   compensates for the majority of the performance regression in r58913.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60063 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 23:05:24 +00:00
Anders Carlsson ad3d6917da Handle returning complex types that get coerced. Fixes PR3131
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60058 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 22:21:48 +00:00
Sebastian Redl a55e52c080 Use RAII objects to ensure proper destruction of expression and statement AST nodes in the parser in most cases, even on error.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60057 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 22:21:31 +00:00
Daniel Dunbar 71fcec9abf Fix 80-col violations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60051 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 21:53:21 +00:00
Fariborz Jahanian 31afbf02a3 Refactored checking on readonly property into a method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60050 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 21:48:26 +00:00
Fariborz Jahanian 6669db9d80 Patch to allow over-riding of readonly property to
a writable property in one of its category.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60035 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 17:56:43 +00:00
Anders Carlsson c9ad94e12a Remove more #ifdeffed code
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60033 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 17:16:39 +00:00
Anders Carlsson 704e4907ee Remove the #ifdeffed out code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60032 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 17:10:10 +00:00
Nuno Lopes 43d0ffdace remove unused var
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60018 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 12:23:46 +00:00
Douglas Gregor 0fe7bea6fc Simple parsing of exception specifications, with no semantic analysis yet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@60005 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 03:22:00 +00:00
Daniel Dunbar ddd3e8b90a Comment fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59997 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-25 00:20:22 +00:00
Fariborz Jahanian e793a6ec16 Patch to remove bogus waring when a property declaration
is imported from a protocol into the implementation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59988 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 22:16:00 +00:00
Sebastian Redl 618e5c0470 Remove an empty if and add a reminder for when we implement C++ try-catch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59987 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 21:45:59 +00:00
Ted Kremenek d017243919 Fix CFG bug where the 'increment' block for a 'for' statement would not be
properly reversed once constructed.

This fixes PR 3125:

http://llvm.org/bugs/show_bug.cgi?id=3125


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59982 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 20:50:24 +00:00
Sebastian Redl d14094db33 Remove some bad characters from comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59979 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 20:06:50 +00:00
Sebastian Redl ddee68bf6b Fix the fix of revision 59974. Now array-struct.c passes too.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59975 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 19:39:40 +00:00
Sebastian Redl e95db4f2cd Fix crash of array bounds checking under 64-bit.
There might be other, similar bugs lurking there.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59974 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 19:35:33 +00:00
Ted Kremenek a68c106ed2 Remove FIXME comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59973 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 19:27:06 +00:00
Zhongxing Xu baf03a7c0a Add support for AllocaRegion extent with GDM.
One design problem that is emerging is the signed-ness problem during static
analysis. Many unsigned value have to be converted into signed value because
it partipates in operations with signed values. 

On the other hand, we cannot blindly make all values occuring in static analysis
signed, because we do have cases where unsignedness is required, for example,
integer overflow detection.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59957 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 09:44:56 +00:00
Zhongxing Xu 8b86273806 Add utility methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59956 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 09:38:21 +00:00
Zhongxing Xu 1ed8d4ba8e Cleanup code with utility method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59951 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 07:02:06 +00:00
Chris Lattner d162584991 Change a whole lot of diagnostics to take QualType's directly
instead of converting them to strings first.  This also fixes a
bunch of minor inconsistencies in the diagnostics emitted by clang
and adds a bunch of FIXME's to DiagnosticKinds.def.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59948 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 06:25:27 +00:00
Chris Lattner d9d22dd9c9 Rename NamedDecl::getName() to getNameAsString(). Replace a bunch of
uses of getName() with uses of getDeclName().  This upgrades a bunch of
diags to take DeclNames instead of std::strings.

This also tweaks a couple of diagnostics to be cleaner and changes
CheckInitializerTypes/PerformInitializationByConstructor to pass
around DeclarationNames instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59947 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:29:24 +00:00
Anders Carlsson e8a32b855c Reimplement Expr::isConstantExpr in terms of Expr::Evaluate. This fixes PR2832.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59946 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:23:59 +00:00
Zhongxing Xu 4b89e034a7 Strings are NULL terminated. So the region size should plus one.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59943 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 05:16:01 +00:00
Anders Carlsson 35873c49ad The address of a variable is only constant if the variable has global storage.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59939 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:41:22 +00:00
Anders Carlsson 4bbc0e05a7 Fix bug in the constant evaluator. Fixes PR3115.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:21:33 +00:00
Chris Lattner 39f34e97d6 Migrate some stuff from NamedDecl::getName() to
NamedDecl::getNameAsString() to make it more explicit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59937 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 04:00:27 +00:00
Chris Lattner 8ec03f58c3 Rename NamedDecl::getIdentifierName() to ::getNameAsCString() and make it
assert if the name is not an identifier.  Update callers to do the right
thing and avoid this method in unsafe cases.  This also fixes an objc
warning that was missing a space, and migrates a couple more to taking
IdentifierInfo and QualTypes instead of std::strings.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59936 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:54:41 +00:00
Chris Lattner bb49c3ee5d simplify this code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59935 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:52:59 +00:00
Chris Lattner 077bf5e2f4 Rename Selector::getName() to Selector::getAsString(), and add
a new NamedDecl::getAsString() method.

Change uses of Selector::getName() to just pass in a Selector 
where possible (e.g. to diagnostics) instead of going through
an std::string.

This also adds new formatters for objcinstance and objcclass
as described in the dox.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59933 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 03:33:13 +00:00
Zhongxing Xu d0fd3b747c Add a comment about the signedness.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59932 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 02:30:48 +00:00
Zhongxing Xu 6613d08a19 Add getSize() support for StringRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-24 02:18:56 +00:00
Chris Lattner 1326a3dcbb convert some more warnings to NOTEs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59923 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 23:26:13 +00:00
Chris Lattner 8b265bd5eb remove warn_previous_declaration
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59922 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 23:20:13 +00:00
Chris Lattner 28eb7e992b make the 'to match this' diagnostic a note.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59921 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 23:17:07 +00:00
Chris Lattner 5f4a6829dc Make all the 'redefinition' diagnostics more consistent, and make the
"previously defined here" diagnostics all notes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59920 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 23:12:31 +00:00
Chris Lattner b8b96aff63 make some objc redefinition warnings more consistent: call definitions
"definitions", not declarations.  Point out the location of the 
original definition.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59919 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 22:46:27 +00:00
Chris Lattner 6ff0fc341f Tweak duplicate category diagnostic to work like the duplicate protocol diagnostic.
Also, point out where the previous decl was.  This unxfails two tests.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59918 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 22:38:38 +00:00
Chris Lattner 08631c5fa0 Convert IdentifierInfo's to be printed the same as DeclarationNames
with implicit quotes around them.  This has a bunch of follow-on 
effects and requires tweaking to a whole lot of code.  This causes
a regression in two tests (xfailed) by causing it to emit things like:

  Line 10: duplicate interface declaration for category 'MyClass1' ('Category1')

instead of:

  Line 10: duplicate interface declaration for category 'MyClass1(Category1)'

I will fix this in a follow-up commit.

As part of this, I had to start switching stuff to use ->getDeclName() instead
of Decl::getName() for consistency.  This is good, but I was planning to do this
as an independent patch.  There will be several follow-on patches
to clean up some of the mess, but this patch is already too big.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59917 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 21:45:46 +00:00
Chris Lattner 011bb4edf7 add support for inserting a DeclarationName into a diagnostic directly
without calling getAsString().  This implicitly puts quotes around the
name, so diagnostics need to be tweaked to accommodate this.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59916 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 20:28:15 +00:00
Chris Lattner 3fdf4b071d Genericize the qualtype formating callback to support any diag argument.
No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59908 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 09:21:17 +00:00
Chris Lattner 22caddc91d Add support for sending QualType's directly into diags and convert two
diags over to use this.  QualTypes implicitly print single quotes around 
them for uniformity and future extension.

Doing this requires a little function pointer dance to prevent libbasic
from depending on libast.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59907 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 09:13:29 +00:00
Zhongxing Xu 1c0c233253 Add out-of-bound memory access warning report code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59903 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 05:52:28 +00:00
Zhongxing Xu 63123d8e48 Clean up code by using utility methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59899 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-23 04:30:35 +00:00
Anders Carlsson 9d4c157baa Return false if we encounter a type we can't handle.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59889 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 22:56:32 +00:00
Anders Carlsson ef5a66d817 An expression is not foldable if it can't be fully evaluated. Fixes PR3060
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59887 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 22:32:07 +00:00
Fariborz Jahanian 43f447098d Implemented ir-gen for 'implicit' properties using the new AST nodes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59886 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 22:30:21 +00:00
Anders Carlsson 6dde0d5dc0 Case values must be evaluated
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59884 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 21:50:49 +00:00
Anders Carlsson 51fe996231 Use Expr::Evaluate for case statements. Fixes PR2525
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59881 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 21:04:56 +00:00
Chris Lattner 32b939b51b remove a dead enum
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59879 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 20:47:38 +00:00
Fariborz Jahanian ba8d2d684e Support for implicit property assignment. Error assigning to
'implicit' property with no 'setter'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59878 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 20:25:50 +00:00
Fariborz Jahanian 5daf570d0c New AST node to access "implicit" setter/getter using property dor syntax.
Issuing diagnostics when assigning to read-only properties.
This is work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59874 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 18:39:36 +00:00
Sebastian Redl e4c452c4c7 Implement a %plural modifier for complex plural forms in diagnostics. Use it in the overload diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59871 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 13:44:36 +00:00
Zhongxing Xu 369f42971b Remove debug code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59870 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 13:23:00 +00:00
Zhongxing Xu e8a964bdb4 Initial support for checking out of bound memory access. Only support
ConcreteInt index for now.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59869 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 13:21:46 +00:00
Chris Lattner 254be6ac14 remove some more old Diag methods, replace with a single static helper function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59868 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 08:32:36 +00:00
Chris Lattner 3cfa928f9c move the Diag method for Sema to be inline. This shrinks the release-asserts
clang executable (when built with gcc 4.2 on the mac) from 14519740 to 
14495028 bytes.  This shrinks individual object files as well: SemaChecking
from 23580->22248, SemaDeclObjc from 61368->57376, SemaExpr from 
115628->110516, as well as several others.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59867 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 08:28:49 +00:00
Chris Lattner 4984212fce Fix a weird inconsistency with hex floats. Previously the lexer
would not eat the "-1" in "0x0p-1", but LiteralSupport would accept
it when extensions are on.  This caused strangeness and failures 
when hexfloats were properly treated as an extension (not error)
in LiteralSupport.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59865 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 07:39:03 +00:00
Chris Lattner ac92d82911 remove the NumericLiteralParser::Diag helper method, inlining it into
its call sites.  This makes it more explicit when the hasError flag is
getting set and removes a confusing difference in behavior between
PP.Diag and Diag in this code.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59863 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 07:23:31 +00:00
Chris Lattner adc4eeb080 Move the Preprocessor::Diag methods inline. This has the interesting
(and carefully calculated) effect of allowing the compiler to reason
about the aliasing properties of DiagnosticBuilder object better,
allowing the whole thing to be promoted to registers instead of
resulting in a ton of stack traffic.

While I'm not very concerned about the performance of the Diag() method
invocations, I *am* more concerned about their code size and impact on the
non-diagnostic code.  This patch shrinks the clang executable (in 
release-asserts mode with gcc-4.2) from 14523980 to 14519816 bytes.  This
isn't much, but it shrinks the lexer from 38192 to 37776, PPDirectives.o
from 31116 to 28868 bytes, etc.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59862 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 07:03:46 +00:00
Chris Lattner 9efe970928 inline a method into its only two call sites.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59860 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 06:42:31 +00:00
Chris Lattner 30c6476e8e actually, this version isn't really needed.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59859 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 06:22:39 +00:00
Chris Lattner 306fda76b0 remove a sneaky version of Diag hiding in PreprocessorLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59858 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 06:20:42 +00:00
Anders Carlsson bcf6225ad6 Use tryEvaluate for constant exprs.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59857 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 02:34:39 +00:00
Chris Lattner 74d15dfd18 Change the Lexer::Diag method to not magically silence warnings,
force the caller to check instead.  This eliminates the need (and the
risk!) of weird null DiagnosticBuilder's floating around.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59856 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 02:02:22 +00:00
Chris Lattner a4f34eaab2 Teach tentative parsing to handle block pointers (rdar://6394309)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59853 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 01:15:33 +00:00
Chris Lattner 3cbfe2c415 Split the DiagnosticInfo class into two disjoint classes:
one for building up the diagnostic that is in flight (DiagnosticBuilder)
and one for pulling structured information out of the diagnostic when
formatting and presenting it.

There is no functionality change with this patch.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59849 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-22 00:59:29 +00:00
Ted Kremenek d2bdeed072 In PTHLexer::DiscardToEndOfLine() use Lex() instead of AdvanceToken(). This handles transitions in the preprocessor state.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59845 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 23:28:56 +00:00
Ted Kremenek b93efa3d8f Reenable the default lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59843 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 20:51:59 +00:00
Ted Kremenek d5a8f0bde6 When creating the raw tokens for PTHLexer, make sure the token representing the file to include is checked for being an identifier.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59842 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 20:51:15 +00:00
Ted Kremenek c840f0cbd9 When creating raw tokens for the PTHLexer specially handle angled strings for #include directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59840 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 19:41:29 +00:00
Fariborz Jahanian f2878e5dff Fixed bugzilla bug# 3095 related to code gen. for @synchronized.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59838 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 19:21:53 +00:00
Sebastian Redl 4c5d320a75 Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59835 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 19:14:01 +00:00
Chris Lattner 2c21a07352 merge some simple call diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59831 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 18:44:24 +00:00
Chris Lattner b1b4d337fa print a type in a diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59829 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 18:27:34 +00:00
Fariborz Jahanian 2ab1968eb4 Fields of ivars of struct types are considered ivars
themselves for gc API generation purposes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59828 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 18:14:01 +00:00
Chris Lattner 4e8a9e8640 reapply the (corrected) patch to use the new llvm intrinsics for memcpy/memmove etc.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59824 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:43:15 +00:00
Douglas Gregor bbe2743b02 Allow redeclaration of typedefs in C++
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59822 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:29:06 +00:00
Chris Lattner d67777662b temporarily revert Sangiv's patch.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59821 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:26:37 +00:00
Douglas Gregor c19923dda3 Tiny fix to the parsing of linkage-specifications
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59820 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 16:10:08 +00:00
Douglas Gregor 1ca50c3f54 Fix overloading of non-static member functions that differ in their cv-qualifiers
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59819 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 15:36:28 +00:00
Douglas Gregor 4fcd399a52 Enable some more operator overloading tests, and don't look into an identifier for functions that might not have one
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59818 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 15:30:19 +00:00
Sanjiv Gupta 8d668a467a mem[cpy,set,move] intrinsics are now overloaded.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59806 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:57:42 +00:00
Chris Lattner 416e46febc merge 3 more diagnostics into 1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59805 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:57:12 +00:00
Chris Lattner af7ae4e816 Add the concept of "modifiers" to the clang diagnostic format
strings.  This allows us to have considerable flexibility in how
these things are displayed and provides extra information that
allows us to merge away diagnostics that are very similar.

Diagnostic modifiers are a string of characters with the regex
[-a-z]+ that occur between the % and digit.  They may 
optionally have an argument that can parameterize them.

For now, I've added two example modifiers.  One is a very useful
tool that allows you to factor commonality across diagnostics
that need single words or phrases combined.  Basically you can
use %select{a|b|c}4 with with an integer argument that selects
either a/b/c based on an integer value in the range [0..3).

The second modifier is also an integer modifier, aimed to help
English diagnostics handle plurality.  "%s3" prints to 's' if 
integer argument #3 is not 1, otherwise it prints to nothing.
I'm fully aware that 's' is an English concept and doesn't
apply to all situations (mouse vs mice).  However, this is very
useful and we can add other crazy modifiers once we add support
for polish! ;-)

I converted a couple C++ diagnostics over to use this as an
example, I'd appreciate it if others could merge the other
likely candiates.  If you have other modifiers that you want,
lets talk on cfe-dev.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59803 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:50:02 +00:00
Chris Lattner 3528d3552c Change CheckIncrementDecrementOperand to test for common cases first
and fall through better.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59799 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 07:05:48 +00:00
Douglas Gregor fc195efd68 Cleanup memory management in overloading of operator->, slightly
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59791 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 03:04:22 +00:00
Douglas Gregor 621b3933e5 Don't print canonical types in overloading-related diagnostics
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59789 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 02:54:28 +00:00
Ted Kremenek cd4e2aecde PTHLexer:
- Move out logic for handling the end-of-file to LexEndOfFile (to match the Lexer) class.  The logic now mirrors the Lexer class more, which allows us to pass most of the Preprocessor test cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 00:58:35 +00:00
Fariborz Jahanian bd71be4683 Consolidated @try and @synchronize into a single
code gen. method.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59767 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 00:49:24 +00:00
Ted Kremenek 5917d7894e - Clean up transfer function logic for 'return' statements.
- Add check for returning an undefined value to a caller.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59764 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-21 00:27:44 +00:00
Fariborz Jahanian d1cc8040ea Support generation of objc_assign_ivar for ivar
write-barriers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59748 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 20:53:20 +00:00
Ted Kremenek 89d7ee9619 PTHLexer:
- Move PTHLexer::GetToken() to be inside PTHLexer.cpp.
- When lexing in raw mode, null out identifiers.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59744 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 19:49:00 +00:00
Fariborz Jahanian 24b93f2deb __weak ivar need not warn.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59743 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 19:35:51 +00:00
Fariborz Jahanian 7eda8367cf Introducing objc_assign_ivar to clang.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59740 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 19:23:36 +00:00
Fariborz Jahanian 80b0b42a09 Added a test case for __weak field decls. Change SetVarDeclObjCAttribute
to static function. Added comments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59738 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 18:10:58 +00:00
Ted Kremenek dd95d6cca5 Handle another case where we should use PTHLexer as an alternative to the normal Lexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59736 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:46:54 +00:00
Ted Kremenek 31aba425a0 PTHLexer:
- Rename 'CurToken' and 'LastToken' to 'CurTokenIdx' and 'LastTokenIdx'
  respectively.
- Add helper methods GetToken(), AdvanceToken(), AtLastToken() to abstract away
  details of the token stream. This also allows us to easily replace their
  implementation later.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59733 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:32:22 +00:00
Douglas Gregor 8ba10745f5 Add support for overloaded operator-> when used in a member access
expression (smart_ptr->mem).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59732 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:27:02 +00:00
Ted Kremenek 81d24e135c Rename IsNonPragmaNonMacroLexer to IsFileLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59731 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 16:19:53 +00:00
Douglas Gregor a967a6f6af Fix strange quote characters
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59729 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 13:33:37 +00:00
Ted Kremenek d6f53dc495 Rewrote PTHLexer::Lex by digging through the sources of Lexer again. Now we can do basic macro expansion using the PTHLexer.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59724 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 07:58:05 +00:00
Ted Kremenek 15ba2af0f9 Add ugly "test harness" for PTHLexer that is not enabled by default. The
(temporary hack) to test the PTHLexer is that whenever we would create a Lexer
object we instead raw lex a memory buffer first and then use the PTHLexer. This
logic exists only to driver the PTHLexer and will be removed/changed in the
future. Note that the regular path using normal Lexer objects is what is used by
default.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59723 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 07:56:33 +00:00
Chris Lattner 69d27b9f2e Daniel really really likes = instead of += :)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59716 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 07:09:32 +00:00
Chris Lattner f3a41af4d5 remove the last old-fashioned Diag method. Transition complete!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59714 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 06:38:18 +00:00
Chris Lattner 5dc266abe0 remove another old Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59713 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 06:13:02 +00:00
Chris Lattner d3a94e24dd remove another old-school Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59712 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 06:06:08 +00:00
Chris Lattner 572af49cc0 remove the type_info identifier cache. Compared to the cost
of doing the lookup_decl, the hash lookup is cheap.  Also,
typeid doesn't happen enough in real world code to worry about
it.

I'd like to eventually get rid of KnownFunctionIDs from Sema
also, but today is not that day.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59711 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 05:51:55 +00:00
Chris Lattner 8edea83d4d compared to the rest of the code in Sema::GetStdNamespace(),
looking up the "std" identifier is trivial.  Just do it, particularly
since this is only done if the namespace hasn't already been looked up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59710 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 05:45:14 +00:00
Chris Lattner 2bac0f6b37 remove some other identifiers that are looked up really early and only
used in one cold place.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59709 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 05:41:43 +00:00
Chris Lattner 8469265156 instead of looking up super at startup time,
just check for it when needed.  It doesn't incur real cost
in any hot paths.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59708 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 05:35:30 +00:00
Chris Lattner 92e62b0222 Rename IdentifierInfo::isName to ::isStr. Use a nifty trick
from Sebastian to enforce that a literal string is passed in,
and use this to avoid having to call strlen on it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59706 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 04:42:34 +00:00
Ted Kremenek a751217e76 Make FIXME a hard assertion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59695 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:52:55 +00:00
Ted Kremenek 68e48e4a81 Preprocessor::getCurrentFileLexer() now returns a PreprocessorLexer* instead of
a Lexer*. This means it will either return the current (normal) file Lexer or a
PTHLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:49:44 +00:00
Ted Kremenek 35c10c25dd Just use the SourceLocation of SysHeaderTok when doing a callback to emit #line
information. A diff of the -E output for Cocoa.h shows that there is no change
in output.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59693 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:45:11 +00:00
Ted Kremenek a275a191fc Assign the result of getCurrentFileLexer() to a PreprocessorLexer* instead of Lexer* (narrower interface).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59691 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:35:24 +00:00
Ted Kremenek 452e37837a - Default initialize ParsingPreprocessorDirective, ParsingFilename, and
LexingRawMode in the ctor of PreprocessorLexer.

- PTHLexer: Use "LastToken" instead of "NumToken"


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59690 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:29:45 +00:00
Ted Kremenek 4d35da2e41 Add (untested) implementation of PTHLexer::isNextPPTokenLParen() and PTHLexer::DiscardToEndOfLine().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59687 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 01:16:50 +00:00
Fariborz Jahanian 2682d8b3a0 More objc gc stuff. Read/Write barriers for local static/extern,
diagnostics on use of __weak attribute on fields,
Early support for read/write barriers for objc fields.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59682 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-20 00:15:42 +00:00
Douglas Gregor 106c6eb3f1 Implement the rest of C++ [over.call.object], which permits the object
being called to be converted to a reference-to-function,
pointer-to-function, or reference-to-pointer-to-function. This is done
through "surrogate" candidate functions that model the conversions
from the object to the function (reference/pointer) and the
conversions in the arguments.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59674 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:57:39 +00:00
Ted Kremenek ac80c6e06b Use PreprocessorLexer::getFileID() instead of Lexer::getFileLoc(). This is an intermediate step to having getCurrentLexer() return a PreprocessorLexer* instead of a Lexer*.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59672 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:55:25 +00:00
Ted Kremenek 1a531570d2 Move more cases of using 'CurLexer' to 'CurPPLexer'.
Use PTHLexer::isNextPPTokenLParen() when using the PTHLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59671 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:43:49 +00:00
Ted Kremenek 2f1c0243f7 Add stub for PTHLexer::isNextPPTokenLParen().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59670 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:42:26 +00:00
Ted Kremenek 17ff58a631 When using a PTHLexer, use DiscardToEndOfLine() instead of ReadToEndOfLine().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59668 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 22:21:33 +00:00
Ted Kremenek 41938c8493 - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.
- Add 'FileID' to PreprocessorLexer, and have Preprocessor query this fileid
  when looking up the FileEntry for a file

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59666 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 21:57:25 +00:00
Douglas Gregor f9eb905197 Support for calling overloaded function call operators (operator())
with function call syntax, e.g.,

  Functor f;
  f(x, y);

This is the easy part of handling calls to objects of class type 
(C++ [over.call.object]). The hard part (coping with conversions from
f to function pointer or reference types) will come later. Nobody uses
that stuff anyway, right? :)



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59663 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 21:05:33 +00:00
Douglas Gregor 487a75ab30 Some tweaks suggested by Argiris
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59661 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 19:09:45 +00:00
Oscar Fuentes 148f061354 CMake: Added some source files.
Patch contributed by Jay Foad!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59656 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:46:39 +00:00
Fariborz Jahanian 0c43f2681b More of objective-c's gc code-gen. Treat objective-c
objects as __strong when attribute unspecified.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59654 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:38:10 +00:00
Argyrios Kyrtzidis 051c13a4a9 Make DeclContext::getLexicalParent reuse DeclContext::getParent.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59651 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:07:24 +00:00
Argyrios Kyrtzidis 77407b8021 Take care another assert:
struct A {
  struct B;
};

struct A::B {
  void m() {} // Assertion failed: getContainingDC(DC) == CurContext && "The next DeclContext should be lexically contained in the current one."
};

Introduce DeclContext::getLexicalParent which may be different from DeclContext::getParent when nested-names are involved, e.g:

   namespace A {
      struct S;
   }
   struct A::S {}; // getParent() == namespace 'A'
                   // getLexicalParent() == translation unit


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59650 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 18:01:13 +00:00
Nuno Lopes a468d34bed fix folding of '*doubleArray'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59647 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 17:44:31 +00:00
Argyrios Kyrtzidis 20bc676228 Make the non-const DeclContext::getParent call the const version, instead of the other way around.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59646 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 17:36:39 +00:00
Fariborz Jahanian dbd32c20c5 Few more changes due to Daniel's feedback.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59645 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 17:34:06 +00:00
Douglas Gregor 337c6b9f5d Support overloading of the subscript operator[], including support for
built-in operator candidates. Test overloading of '&' and ','.

In C++, a comma expression is an lvalue if its right-hand
subexpression is an lvalue. Update Expr::isLvalue accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59643 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 17:17:41 +00:00
Steve Naroff 5cb93b8bf0 Fix <rdar://problem/6150376> [sema] crash on invalid message send.
The core fix in Sema::ActOnClassMessage(). All the other changes have to do with passing down the SourceLocation for the receiver (to properly position the cursor when producing an error diagnostic).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59639 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 15:54:23 +00:00
Douglas Gregor 7425373618 Added operator overloading for unary operators, post-increment, and
post-decrement, including support for generating all of the built-in
operator candidates for these operators. 

C++ and C have different rules for the arguments to the builtin unary
'+' and '-'. Implemented both variants in Sema::ActOnUnaryOp.

In C++, pre-increment and pre-decrement return lvalues. Update
Expr::isLvalue accordingly.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59638 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 15:42:04 +00:00
Argyrios Kyrtzidis 08b2c3743a Fix this:
With this snippet:
  void f(a::b);

An assert is hit:
Assertion failed: CachedTokens[CachedLexPos-1].getLocation() == Tok.getAnnotationEndLoc() && "The annotation should be until the most recent cached token", file ..\..\lib\Lex\PPCaching.cpp, line 98

Introduce Preprocessor::RevertCachedTokens that reverts a specific number of tokens when backtracking is enabled.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59636 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 15:22:16 +00:00
Argyrios Kyrtzidis fad03b2b38 Remove Preprocessor::CacheTokens boolean data member. The same functionality can be provided by using Preprocessor::isBacktrackEnabled().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59631 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 14:23:14 +00:00
Daniel Dunbar 371d16f45a Add spec ref to comment.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 11:54:05 +00:00
Zhongxing Xu c3a0599bac Add support for symbolicating global structs and arrays in RegionStoreManager::getInitialStore().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59619 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 11:06:24 +00:00
Zhongxing Xu eabf776661 Add SymbolData for array elements and struct fields.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59618 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 11:03:17 +00:00
Daniel Dunbar 06550395dd Fix silly code, use IdentifierInfo* instead of std::string in
PragmaPackStack. Thanks Chris!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59616 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 10:32:38 +00:00
Daniel Dunbar ed3849b456 Fix redundant load of bit-fields on assignment (to get the updated
value).
 - Use extra argument to EmitStoreThroughLValue to provide place to
   write update bit-field value if caller requires it.
 - This fixes several FIXMEs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59615 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 09:36:46 +00:00
Sanjiv Gupta 8fbc154096 Pointer width for PIC16 is 16 bits. Modify getMemCpy, getMemMove and getMemSet accordingly.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59613 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 09:02:07 +00:00
Chris Lattner f089551542 fix save-o
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59611 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:26:36 +00:00
Chris Lattner 865732239a simplify
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59610 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:24:49 +00:00
Chris Lattner 3c73c41cef stop calling II::getName() unnecesarily in sema
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59609 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 08:23:25 +00:00
Chris Lattner 7e3e9b152e simplify some code.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59608 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:55:04 +00:00
Chris Lattner 6898e33d0b remove uses of IdentifierInfo::getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59607 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:51:13 +00:00
Chris Lattner a9500f05ba remove some uses of IdentifierInfo::getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59606 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:49:38 +00:00
Chris Lattner edc66f3ab0 Use smallstring instead of new[]'ing a string. This simplifies
the code and speeds it up.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59604 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:41:27 +00:00
Chris Lattner da83bac90a remove uses of IdentifierInfo::getName()
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59603 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:37:42 +00:00
Chris Lattner 6cf3ed7be7 don't turn identifierinfo's into strings in diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59602 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:33:58 +00:00
Chris Lattner 43b628cd47 Allow sending IdentifierInfo*'s into Diagnostics without turning them into strings
first.  This should allow removal of a bunch of II->getName() calls.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59601 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:32:16 +00:00
Chris Lattner 8365223e54 convert some diags to use numbers instead of strings.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59600 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:25:44 +00:00
Chris Lattner e6db3b09a7 formatting
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:24:05 +00:00
Chris Lattner 30bc965443 add direct support for signed and unsigned integer arguments to diagnostics.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59598 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 07:22:31 +00:00
Chris Lattner a03a5b5a84 switch TextDiagnosticPrinter to raw_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59597 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:56:25 +00:00
Chris Lattner f4c8396577 rewrite FormatDiagnostic to be less gross and a lot more efficient.
This also makes it illegal to have bare '%'s in diagnostics.  If you
want a % in a diagnostic, use %%.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59596 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:51:40 +00:00
Daniel Dunbar 0293d540ba Discard unused runtime function declarations (for readability).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59594 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:15:35 +00:00
Chris Lattner 73d2a1b05b implement a transparent optimization with the diagnostics stuff:
const char*'s are now not converted to std::strings when the diagnostic
is formed, we just hold onto their pointer and format as needed.

This commit makes DiagnosticClient::FormatDiagnostic even more of a 
mess, I'll fix it in the next commit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59593 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 06:04:55 +00:00
Chris Lattner dcd5ef1248 remove one more old-style Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59589 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 05:27:50 +00:00
Chris Lattner fa25bbb351 Switch several more Sema Diag methods over. This simplifies the
__builtin_prefetch code to only emit one diagnostic per builtin_prefetch.
While this has nothing to do with the rest of the patch, the code seemed
like overkill when I was updating it.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59588 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 05:08:23 +00:00
Douglas Gregor 447b69e55e Built-in equality and relational operators have return type "bool" in C++,
not "int".

Fix a typo in the promotion of enumeration types that was causing some
integral promotions to look like integral conversions (leading to
extra ambiguities in overload resolution).

Check for "acceptable" overloaded operators based on the types of the
arguments. This is a somewhat odd check that is specified by the
standard, but I can't see why it actually matters: the overload
candidates it suppresses don't seem like they would ever be picked as
the best candidates.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59583 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 03:25:36 +00:00
Ted Kremenek 2df37b8eae Revert 59574 (caused tests to fail).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59579 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 01:54:47 +00:00
Fariborz Jahanian 5862650052 Generate strong write barriers for __strong objects.
Also, took care of Daniel's commments.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59575 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:59:10 +00:00
Ted Kremenek 0a36264440 - Move static function IsNonPragmaNonMacroLexer into Preprocessor.h.
- Add variants of IsNonPragmaNonMacroLexer to accept an IncludeMacroStack entry
  (simplifies some uses).
- Use IsNonPragmaNonMacroLexer in Preprocessor::LookupFile.

Performance testing of -Eonly on Cocoa.h shows no performance regression because
of this patch.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:46:18 +00:00
Ted Kremenek 4b71e3e439 Initialize CurPPLexer in Preprocessor's constructor.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59573 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:44:06 +00:00
Ted Kremenek ab7b32b7d4 Fix warning about RegionStoreManager::Retrieve() not always returning a value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59571 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-19 00:27:37 +00:00
Douglas Gregor 96176b3575 Partial expansion of C++ operator overloading (for binary operators)
to support operators defined as member functions, e.g.,

  struct X { 
    bool operator==(X&);
  };

Overloading with non-member operators is supported, and the special
rules for the implicit object parameter (e.g., the ability for a
non-const *this to bind to an rvalue) are implemented.

This change also refactors and generalizes the code for adding
overload candidates for overloaded operator calls (C++ [over.match.expr]),
both to match the rules more exactly (name lookup of non-member
operators actually ignores member operators) and to make this routine
more reusable for the other overloaded operators.

Testing for the initialization of the implicit object parameter is
very light. More tests will come when we get support for calling
member functions directly (e.g., o.m(a1, a2)).




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59564 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 23:14:02 +00:00
Chris Lattner c9c7c4e06b start converting Sema over to using its canonical Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59561 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 22:52:51 +00:00
Fariborz Jahanian 3e283e3445 Patch for generation of weak write barriers for objc
__weak objects.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59560 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 22:37:34 +00:00
Chris Lattner ebf5ddfbf7 introduce the one true Diag method for Sema. Next up: kill all the others off.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59556 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 21:53:24 +00:00
Chris Lattner 204b2fed90 Remove the last of the old-style Preprocessor::Diag methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59554 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 21:48:13 +00:00
Fariborz Jahanian 6dc2317b59 Generate objc_read_weak for __weak objc loads.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59553 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 21:45:40 +00:00
Fariborz Jahanian 6d657c4809 Some basic support toward objective-c's GC code gen.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59543 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 20:18:11 +00:00
Steve Naroff cfe8bf31ad Fix <rdar://problem/6329769> [sema] crash on duplication definition of interface with protocols.
As soon as we detect duplicate interfaces, discontinue further semantic checks (returning the original interface).

This is now consistent with how we handle protocols (and less error prone in general).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59541 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 19:15:30 +00:00
Douglas Gregor 10c4262aeb As threatened previously: consolidate name lookup and the creation of
DeclRefExprs and BlockDeclRefExprs into a single function
Sema::ActOnDeclarationNameExpr, eliminating a bunch of duplicate
lookup-name-and-check-the-result code.

Note that we still have the three parser entry points for identifiers,
operator-function-ids, and conversion-function-ids, since the parser
doesn't (and shouldn't) know about DeclarationNames. This is a Good
Thing (TM), and there will be more entrypoints coming (e.g., for C++
pseudo-destructor expressions).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59527 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 15:03:34 +00:00
Douglas Gregor e94ca9e437 Extend DeclarationName to support C++ overloaded operators, e.g.,
operator+, directly, using the same mechanism as all other special
names.

Removed the "special" identifiers for the overloaded operators from
the identifier table and IdentifierInfo data structure. IdentifierInfo
is back to representing only real identifiers.

Added a new Action, ActOnOperatorFunctionIdExpr, that builds an
expression from an parsed operator-function-id (e.g., "operator
+"). ActOnIdentifierExpr used to do this job, but
operator-function-ids are no longer represented by IdentifierInfo's.

Extended Declarator to store overloaded operator names. 
Sema::GetNameForDeclarator now knows how to turn the operator
name into a DeclarationName for the overloaded operator. 

Except for (perhaps) consolidating the functionality of
ActOnIdentifier, ActOnOperatorFunctionIdExpr, and
ActOnConversionFunctionExpr into a common routine that builds an
appropriate DeclRefExpr by looking up a DeclarationName, all of the
work on normalizing declaration names should be complete with this
commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59526 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 14:39:36 +00:00
Zhongxing Xu 9b6ceb1712 handle the case that the array element is of structure type when bind the whole array to a single value (for example, UnknownVal, UndefinedVal).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59521 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 13:11:04 +00:00
Chris Lattner 56b05c8829 remove one more Preprocessor::Diag method.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59512 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 08:02:48 +00:00
Chris Lattner 3692b09faa Convert the lexer and start converting the PP over to using canonical Diag methods.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59511 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:59:24 +00:00
Chris Lattner ef708fd4ab remove the last couple obsolete forms of Parser::Diag.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59510 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:50:21 +00:00
Chris Lattner 1ab3b96de1 Change a couple of the Parser::Diag methods to return DiagnosticInfo
and let the clients push whatever they want into the DiagnosticInfo
instead of hard coding a few forms.  Also switch various clients to
use Diag(Tok, ...) instead of Diag(Tok.getLocation(), ...) as the
canonical form to simplify the code a bit.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59509 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:48:38 +00:00
Chris Lattner 0a14eee528 This reworks some of the Diagnostic interfaces a bit to change how diagnostics
are formed.  In particular, a diagnostic with all its strings and ranges is now
packaged up and sent to DiagnosticClients as a DiagnosticInfo instead of as a 
ton of random stuff.  This has the benefit of simplifying the interface, making
it more extensible, and allowing us to do more checking for things like access
past the end of the various arrays passed in.

In addition to introducing DiagnosticInfo, this also substantially changes how 
Diagnostic::Report works.  Instead of being passed in all of the info required
to issue a diagnostic, Report now takes only the required info (a location and 
ID) and returns a fresh DiagnosticInfo *by value*.  The caller is then free to
stuff strings and ranges into the DiagnosticInfo with the << operator.  When
the dtor runs on the DiagnosticInfo object (which should happen at the end of
the statement), the diagnostic is actually emitted with all of the accumulated
information.  This is a somewhat tricky dance, but it means that the 
accumulated DiagnosticInfo is allowed to keep pointers to other expression 
temporaries without those pointers getting invalidated.

This is just the minimal change to get this stuff working, but this will allow
us to eliminate the zillions of variant "Diag" methods scattered throughout
(e.g.) sema.  For example, instead of calling:

  Diag(BuiltinLoc, diag::err_overload_no_match, typeNames,
       SourceRange(BuiltinLoc, RParenLoc));

We will soon be able to just do:

  Diag(BuiltinLoc, diag::err_overload_no_match)
      << typeNames << SourceRange(BuiltinLoc, RParenLoc));

This scales better to support arbitrary types being passed in (not just 
strings) in a type-safe way.  Go operator overloading?!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59502 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 07:04:44 +00:00
Ted Kremenek 46bbacac37 Attribute nonnull can be applied to block pointers.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59499 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 06:52:58 +00:00
Chris Lattner f812a45dd9 SourceManager::getLineNumber is logically const except for caching.
Use mutable to make it so.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 06:51:15 +00:00
Chris Lattner 470e5fc7b4 eliminate dependence of strange "Diagnostic::Report" method,
delete huge trailing whitespace to fit in 80 cols.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59497 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 06:07:40 +00:00
Chris Lattner 2383b7f6ae Change the diagnostics interface to take an array of pointers to
strings instead of array of strings.  This reduces string copying
in some not-very-important cases, but paves the way for future 
improvements.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59494 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 04:56:44 +00:00
Chris Lattner e837f931a8 cleanups and simplifications.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59491 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 04:44:58 +00:00
Ted Kremenek 4b391087f9 - Add Lexer::isPragma() accessor for clients of Lexer that aren't friends.
- Add static method to test if the current lexer is a non-macro/non-pragma
  lexer.
- Refactor some code in PPLexerChange to use this static method.
- No performance change.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59486 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:33:13 +00:00
Chris Lattner 29a1cfbec3 minor cleanups and tidying, no functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59485 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:30:42 +00:00
Chris Lattner 858bb6f2d6 implement a fixme by making warnings for ++/-- on non-modifiable-lvalues better.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59484 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:26:17 +00:00
Chris Lattner f67bd9f41c factor some code out into a helper function
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59483 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:22:49 +00:00
Ted Kremenek 68a91d5736 Replace more uses of 'CurLexer->' with 'CurPPLexer->'. No performance change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59482 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:12:54 +00:00
Ted Kremenek f6452c5421 Add hooks to use PTHLexer::Lex instead of Lexer::Lex when CurLexer is null.
Performance tests on Cocoa.h (using the regular Lexer) shows no performance
difference.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 01:04:47 +00:00
Ted Kremenek ac6b06df32 Added conditional guard 'if (CurLexer)' when using SetCommentRetentionState().
This is because the PTHLexer will not support this method. Performance testing
on preprocessing Cocoa.h shows that this results in a negligible performance
difference (less than 1%).

I tried making Lexer::SetCommentRetentionState() an out-of-line function (a
precursor to making it a virtual function in PreprocessorLexer) and noticed a 1%
decrease in speed (it is called in a hot part of the Preprocessor).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59477 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:43:07 +00:00
Ted Kremenek 60e45d4c41 Change a bunch of uses of 'CurLexer->' to 'CurPPLexer->', which should be the
alias for the current PreprocessorLexer. No functionality change. Performance
testing shows this results in no performance degradation when preprocessing
Cocoa.h.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59474 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:34:22 +00:00
Ted Kremenek 9c1b750c59 - Add 'CurPPLexer' to Preprocessor to keep track of the current
PreprocessorLexer, which will either be a 'Lexer' or 'PTHLexer'.
- Added stub field 'CurPTHLexer' to keep track of the current PTHLexer.
- Modified IncludeStackInfo to track both the current PTHLexer and
  current PreprocessorLexer.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59472 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-18 00:12:49 +00:00
Sebastian Redl a11f42f4bc Implement effects of 'mutable', and a few comments from Chris on its parsing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59470 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 23:24:37 +00:00
Douglas Gregor 10bd368824 Eliminate all of the placeholder identifiers used for constructors,
destructors, and conversion functions. The placeholders were used to
work around the fact that the parser and some of Sema really wanted
declarators to have simple identifiers; now, the code that deals with
declarators will use DeclarationNames.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59469 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 22:58:34 +00:00
Ted Kremenek 34265e7133 Fold assertion into second valid else branch. This removes a compiler warning
where the control reaches the end of a non-void function and also allows the
compiler to generate better code.  When this assertion is false we can easily
add more else cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59468 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 22:55:12 +00:00
Steve Naroff 87d3ef08d8 Fix <rdar://problem/6333904> [sema] message lookup on super is incorrect
Missing special lookup rule in Sema::ActOnInstanceMessage().


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59467 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 22:29:32 +00:00
Douglas Gregor 2def48394f Updated IdentifierResolver to deal with DeclarationNames. The names of
C++ constructors, destructors, and conversion functions now have a
FETokenInfo field that IdentifierResolver can access, so that these
special names are handled just like ordinary identifiers. A few other
Sema routines now use DeclarationNames instead of IdentifierInfo*'s.

To validate this design, this code also implements parsing and
semantic analysis for id-expressions that name conversion functions,
e.g.,

  return operator bool();

The new parser action ActOnConversionFunctionExpr takes the result of
parsing "operator type-id" and turning it into an expression, using
the IdentifierResolver with the DeclarationName of the conversion
function. ActOnDeclarator pushes those conversion function names into
scope so that the IdentifierResolver can find them, of course.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59462 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 20:34:05 +00:00
Chris Lattner ca354faa7e Implement rdar://6319320: give a good diagnostic for cases where people
are trying to use the old GCC "casts as lvalue" extension.  We don't and
will hopefully never support this.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59460 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 19:51:54 +00:00
Steve Naroff a8069f102f Fix <rdar://problem/6316324> [sema] spurious warning on comparison of qualified id.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59459 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 19:49:16 +00:00
Steve Naroff d7612e183b Fix <rdar://problem/6320086> parser rejects block capturing ivar.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59444 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 16:28:52 +00:00
Douglas Gregor 43c7bad105 Some cleanups for C++ operator overloading
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59443 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 16:14:12 +00:00
Douglas Gregor 1adbab6775 Simplify error messages for two-parameter overloaded increment/decrement operators
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59442 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 15:03:30 +00:00
Douglas Gregor 2e1cd4264d Introduction the DeclarationName class, as a single, general method of
representing the names of declarations in the C family of
languages. DeclarationName is used in NamedDecl to store the name of
the declaration (naturally), and ObjCMethodDecl is now a NamedDecl.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59441 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 14:58:09 +00:00
Eli Friedman 7b30b1c866 A few corrections to the expr constant work. Not enabled at the
moment.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59435 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 03:57:28 +00:00
Anders Carlsson aa432560ef More expr constant work. (Off by default).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59433 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-17 01:58:55 +00:00
Anders Carlsson 529569e68d Address some comments Eli had.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59430 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 22:46:56 +00:00
Nuno Lopes a25bd55e63 use HandleConversionToBool() to check if a given cond is foldable (per Eli's comment)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59429 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 22:06:39 +00:00
Anders Carlsson ccc3fce569 More complex float evaluator support.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59428 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 21:51:21 +00:00
Chris Lattner 6ee7aa154e rename Expr::tryEvaluate to Expr::Evaluate.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59426 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 21:24:15 +00:00
Anders Carlsson 9ad16aebc0 Add very limited support for evaluating complex floats.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59425 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 20:27:53 +00:00
Chris Lattner 51881c56b0 Trivial tidying
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59424 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 20:22:05 +00:00
Nuno Lopes f9ef0c675b fix folding of comma if given a non-constant operand.
Eli please take a look, as I'm not sure if this gets the extension warning in the right place

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59422 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 20:09:07 +00:00
Nuno Lopes ca7c2eaca3 make IntExprEvaluator fold the ?: operator
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59421 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 19:28:31 +00:00
Anders Carlsson 3068d11795 More work on the constant evaluator. Eli, it would be great if you could have a look at this.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59420 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 19:01:22 +00:00
Chris Lattner e7f74fc196 Fix PR3077: tokens that come from macro expansions whose macro was
defined in a system header should be treated as system header tokens
even if they are instantiated in a different place.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59418 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 18:36:34 +00:00
Chris Lattner 64c34f1c6f add dump and print methods, add operator<< for APValue.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59411 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 07:46:48 +00:00
Anders Carlsson 286f85e791 Add the ability to evaluate comparison operators with floating point numbers as operands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59408 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 07:17:21 +00:00
Zhongxing Xu cb529b542a Enhance modularization: return a <state,loc> pair to let GRExprEngine modify the
environment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59407 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 07:06:26 +00:00
Anders Carlsson 5ea7d07ea7 More constant expr work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59405 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 06:23:45 +00:00
Chris Lattner 531a550531 daniel prefers completed thoughts.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59404 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 06:16:27 +00:00
Zhongxing Xu dc0a25d9bf Enhances SCA to process untyped region to typed region conversion.
- RegionView and RegionViewMap is introduced to assist back-mapping from
   super region to subregions.
 - GDM is used to carry RegionView information.
 - AnonTypedRegion is added to represent a typed region introduced by pointer
   casting. Later AnonTypedRegion can be used in other similar cases, e.g.,
   malloc()'ed region.
 - The specific conversion is delegated to store manager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59382 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-16 04:07:26 +00:00
Chris Lattner 10cac6f711 Start implementing support for @synchonized with the darwin ObjC API.
Patch by Fariborz!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59377 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 21:26:17 +00:00
Anders Carlsson 5a9a457ecf Check in code that uses tryEvaluate for emitting constant exprs (not used yet).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59375 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 20:45:50 +00:00
Anders Carlsson e3daa76106 Handle padding in the constant CFString struct. Fixes PR3046.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59372 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-15 18:54:24 +00:00