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

2218 Коммитов

Автор SHA1 Сообщение Дата
Chris Lattner 810f6d5d62 introduce a new -fheinous-gnu-extensions flag that enables really
really horrible extensions that are disabled by default but that can
be accepted by -fheinous-gnu-extensions (but which always emit a 
warning when enabled).

As our first instance of this, implement PR3788/PR3794, which allows
non-lvalues in inline asms in contexts where lvalues are required. bleh.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66910 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 17:38:01 +00:00
Ted Kremenek 6ae8a36006 Add a hack in the analyzer to recover some path-sensitivity at branch
conditions. Currently the analyzer does not reason well about
promotions/truncations of symbolic values, so at branch conditions when we see:

  if (condition)
  
and condition is something like a 'short' or 'char', essentially ignore the
promotion to 'int' so that we track constraints on the original symbolic value.
We only ignore the casts if the underlying type has the same or fewer bits as
the converted type.

This fixes:

<rdar://problem/6619921>



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66899 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 16:32:54 +00:00
Steve Naroff d8eb456289 Reimplement fix for <rdar://problem/6451399> problems with labels and blocks.
This solution is much simpler (and doesn't add any per-scope overhead, which concerned Chris). 

The only downside is the LabelMap is now declared in two places (Sema and BlockSemaInfo). My original fix tried to unify the LabelMap in "Scope" (which would support nested functions in general). In any event, this fixes the bug given the current language definition. If/when we decide to support GCC style nested functions, this will need to be tweaked.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66896 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 16:03:38 +00:00
Steve Naroff caaacecb2b Remove ActiveScope (revert http://llvm.org/viewvc/llvm-project?view=rev&revision=65694 and http://llvm.org/viewvc/llvm-project?view=rev&revision=66741).
Will replace with something better today...


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 15:38:40 +00:00
Ted Kremenek 610e81d6b7 Fix failure reported by Sebastian of test/Analysis/ptr-arith.c when the target
is 64-bit. I used his suggestion of doing a direct bitwidth/signedness
conversion of the 'offset' instead of just changing the sign. For more
information, see:

http://lists.cs.uiuc.edu/pipermail/cfe-dev/2009-March/004587.html


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 15:35:24 +00:00
Fariborz Jahanian 146a458ad4 Fix test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66856 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:43:34 +00:00
Fariborz Jahanian 3b8a652d60 Fixed an ir-gen bug related to strong-cast generation of
source being a non-pointer.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:42:52 +00:00
Mike Stump e3c75e0861 Fix spelling error, and add target triplet to header.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66853 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:41:24 +00:00
Mike Stump 039df91439 When testing with VERBOSE=0, report results in the ISO format. We
include the triplet so that people that run multiple targets in
parallel, say i386 and x86_64 can distinguish between the two.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 00:21:49 +00:00
Douglas Gregor df0325110b Implement template instantiation for builtin binary operators
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 22:46:12 +00:00
Fariborz Jahanian 2e050f11c4 Use paropery's setter attribute name as
the selector for the property setter.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 22:34:11 +00:00
Ted Kremenek e6fbdf538b Fix crash when using TypedViewRegions and ObjCQualifiedIdTypes (TypedViewRegion::getLValueType() was not implemented).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 22:15:08 +00:00
Douglas Gregor a0e500db61 Straw man for instantiation of expressions. Use it to instantiate the
width of bitfields. 

I'll be burning this down and replacing it with a properly-dispatched
implementation like the one used for types.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66796 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 16:53:44 +00:00
Daniel Dunbar 50f4f46902 Add Diagnostic files for Frontend and move a couple errors over.
- Notably, clang now exits with an error if it can't find a
   file. This flushed out a bug in the CGColorSpace.c test case. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66789 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 10:14:16 +00:00
Zhongxing Xu e8cba00b40 Add comments to test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66760 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 01:55:38 +00:00
Douglas Gregor 656de633ac Fix various problems with matching out-of-line definitions of static
class members to the corresponding in-class declaration.

Diagnose the erroneous use of 'static' on out-of-line definitions of
class members. 



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 23:52:16 +00:00
Douglas Gregor 021c3b372c Move most of the checking from ActOnCXXMemberDeclarator to other, more general routines. This is a step toward separating the checking logic from Declarators, which in turn is required for template instantiation.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66734 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 23:00:04 +00:00
Daniel Dunbar e06a75f4c8 x86_32 ABI: Don't try and expand structures with bitfields.
- This is an ABI incompatiblity, but this is not likely to be a huge
   deal in practice. For now we at least generate self consistent code
   instead of crashing.
 - <rdar://problem/6657601> x86-32 ABI: Bitfields in small structures
   are not passed correctly


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66713 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 22:05:26 +00:00
Steve Naroff 335c6808aa Implement FIXME related to <rdar://problem/6496506> Implement class setter/getter for properties.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66689 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 20:12:18 +00:00
Douglas Gregor 3cf538d5c4 Implement basic template instantiation for fields. Reshuffle checking
for FieldDecls so that the parser and the template instantiation make
use of the same semantic checking module.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66685 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 18:59:21 +00:00
Ted Kremenek 344d4c8726 Fix StmtIterator bug reported in PR 3780 where a VLA within a DeclGroup would
not be consulted for its size expression when operator* was called in the
StmtIterator (this resulted in an assertion failure).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66679 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 18:17:16 +00:00
Douglas Gregor 4fdf1faedb Add basic, hackish support for instantiation of typedefs in a class
template. More importantly, start to sort out the issues regarding
complete types and nested-name-specifiers, especially the question of:
when do we instantiate a class template specialization that occurs to
the left of a '::' in a nested-name-specifier?




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 16:48:53 +00:00
Steve Naroff f178728e8c Fix <rdar://problem/6655054> clang issues bogus error on property usage in a dot-syntax.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66659 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 15:15:01 +00:00
Steve Naroff 1ca6694b5b Fix <rdar://problem/6578665> user declared setter method should be used when using property syntx.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66658 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 13:48:17 +00:00
Zhongxing Xu 3c4b37980a This test case checks if we get the right rvalue type of a TypedViewRegion.
The ElementRegion's type depends on the array region's rvalue type. If it was
a pointer type, we would get a loc::SymbolVal for '*p'.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66656 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 09:15:38 +00:00
Zhongxing Xu 2b1dc17919 Fix crash when LHS of pointer arithmetic is not ElementRegion.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66649 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 07:43:49 +00:00
Chris Lattner 4018a28ba1 Improve the "bad receiver" warning for ObjC message sends to be less confusing.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 03:47:47 +00:00
Ted Kremenek fa6228d614 Fix PR 3780: In one code path in BasicValueFactory::getValue() we would not
return an unsigned integer for a null pointer value.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 02:52:39 +00:00
Ted Kremenek 7de20fe9aa SimpleConstraintManager doesn't reason about bitwise-constraints on symbolic
values. Indicating this in 'canReasonAbout' allows GRExprEngine to recover
path-sensitivity in some cases.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66628 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 02:29:48 +00:00
Chris Lattner 8575927833 fix PR3258 by rejecting invalid numeric operands.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66618 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 00:23:13 +00:00
Chris Lattner eab8cfbf4b checking for symbolic operands as well as % at end of string.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66614 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-11 00:06:36 +00:00
Chris Lattner 3182db1c8e reject invalid escape characters in extended-asm strings with a nice diagnostic.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66605 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:51:40 +00:00
Douglas Gregor 275a369f00 Add type checking for tentative definitions at the end of the
translation unit.

Thread the various declarations of variables via
VarDecl::getPreviousDeclaration.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:43:53 +00:00
Douglas Gregor a03aca82de Partial fix for PR3310, concerning type-checking for tentative
definitions. We were rejecting tentative definitions of incomplete
(which is bad), and now we don't.

This fix is partial because we don't do the end-of-translation-unit
initialization for tentative definitions that don't ever have any
initializers specified.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66584 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 21:58:27 +00:00
Douglas Gregor df667e71b1 Extend the notion of active template instantiations to include the
context of a template-id for which we need to instantiate default
template arguments.

In the TextDiagnosticPrinter, don't suppress the caret diagnostic if
we are producing a non-note diagnostic that follows a note diagnostic
with the same location, because notes are (conceptually) a part of the
warning or error that comes before them.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66572 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 20:44:00 +00:00
Douglas Gregor 27b152fa74 If we run into multiple errors within the same template instantiation,
only print the template instantiation backtrace for the first error.

Also, if a base class has failed to type-check during instantiation,
just drop that base class and continue on to check other base classes.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66563 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:52:44 +00:00
Douglas Gregor 98137534e6 Add pretty-printing for class template specializations, e.g.,
'struct A<double, int>'

In the "template instantiation depth exceeded" message, print
"-ftemplate-depth-N" rather than "-ftemplate-depth=N".

An unnamed tag type that is declared with a typedef, e.g., 

  typedef struct { int x, y; } Point;

can be used as a template argument. Allow this, and check that we get
sensible pretty-printing for such things.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66560 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:33:27 +00:00
Douglas Gregor ee1828a6b5 Add a notion of "post-diagnostic hooks", which are callbacks attached
to a diagnostic that will be invoked after the diagnostic (if it is
not suppressed). The hooks are allowed to produce additional
diagnostics (typically notes) that provide more information. We should
be able to use this to help diagnostic clients link notes back to the
diagnostic they clarify. Comments welcome; I'll write up documentation
and convert other clients (e.g., overload resolution failures) if
there are no screams of protest.

As the first client of post-diagnostic hooks, we now produce a
template instantiation backtrace when a failure occurs during template
instantiation. There's still more work to do to make this output
pretty, if that's even possible.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66557 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:03:33 +00:00
Fariborz Jahanian 3523d4f59e ir-gen support for class getter/setter call
using property dot-syntax.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66556 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 18:03:11 +00:00
Anders Carlsson 4843e584b5 Address Doug's comments wrt the mangler and fix Eli's test case
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66549 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 17:07:44 +00:00
Chris Lattner 88beebe6ec Fix PR3682 by just disabling a broken assertion. This check should be
done in sema, and is reflected by the existing PR3258.  In the meantime,
fix PR3682 by disabling a bogus assertion (which doesn't account for + 
operands).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66533 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 06:42:37 +00:00
Chris Lattner 02af974dca reduce duplication of parsing code between %0 and %x0 and
add support for modifiers on named references, like %c[foo].



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66532 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 06:38:02 +00:00
Chris Lattner 10ca96ae9a move matching of named operands into AsmStmt class. At the same
time handle + operands in operand counting, fixing asm.c:t7 to
expand into $2 instead of $1.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66531 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 06:33:24 +00:00
Douglas Gregor 26dce44534 Limit the template instantiation depth to some user-configurable value
(default: 99). Beyond this limit, produce an error and consider the
current template instantiation a failure.

The stack we're building to track the instantiations will, eventually,
be used to produce instantiation backtraces from diagnostics within
template instantiation. However, we're not quite there yet.

This adds a new Clang driver option -ftemplate-depth=NNN, which should
eventually be generated from the GCC command-line operation
-ftemplate-depth-NNN (note the '-' rather than the '='!). I did not
make the driver changes to do this mapping.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66513 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 00:06:19 +00:00
Douglas Gregor 1a873ae65f Add a test case that goes with the last commit
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66510 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 23:48:53 +00:00
Douglas Gregor 40808ce6ac Implement template instantiation for ClassTemplateSpecializationTypes,
such as replacing 'T' in vector<T>. There are a few aspects to this:

  - Extend TemplateArgument to allow arbitrary expressions (an
    Expr*), and switch ClassTemplateSpecializationType to store
    TemplateArguments rather than it's own type-or-expression
    representation.

  - ClassTemplateSpecializationType can now store dependent types. In
    that case, the canonical type is another
    ClassTemplateSpecializationType (with default template arguments
    expanded) rather than a declaration (we don't build Decls for
    dependent types).

  - Split ActOnClassTemplateId into ActOnClassTemplateId (called from
    the parser) and CheckClassTemplateId (called from
    ActOnClassTemplateId and InstantiateType). They're smart enough to
    handle dependent types, now.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66509 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 23:48:35 +00:00
Ted Kremenek 25d01badc5 retain/release checker: Allow allocations to fail by returning nil.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66487 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:46:49 +00:00
Ted Kremenek cd57fcec52 Add test case for <rdar://problem/6659160>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:28:18 +00:00
Daniel Dunbar 58a2912800 NeXT: Set alignment on a number of ObjC metadata variables (matching llvm-gcc).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66481 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 22:18:41 +00:00
Chris Lattner 0c73f37f0a Fix PR3766, a really nasty silent miscompilation case where we emitted
a warning and then threw away the AST.  While I'm in there, tighten up the
code to actually reject completely bogus cases (sending a message to a 
struct).  We still allow sending a message to an int, which doesn't make
sense but GCC allows it and is easy to support.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@66468 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-09 21:19:16 +00:00