Commit Graph

2323 Commits

Author SHA1 Message Date
Douglas Gregor 0c88030abd 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.
llvm-svn: 66734
2009-03-11 23:00:04 +00:00
Daniel Dunbar 8ce48d8c10 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

llvm-svn: 66713
2009-03-11 22:05:26 +00:00
Steve Naroff 28a531e003 Implement FIXME related to <rdar://problem/6496506> Implement class setter/getter for properties.
llvm-svn: 66689
2009-03-11 20:12:18 +00:00
Douglas Gregor 1efa437be6 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.

llvm-svn: 66685
2009-03-11 18:59:21 +00:00
Ted Kremenek be485b6c7d 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).

llvm-svn: 66679
2009-03-11 18:17:16 +00:00
Douglas Gregor 2689746705 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?

llvm-svn: 66662
2009-03-11 16:48:53 +00:00
Steve Naroff aa82be2b5b Fix <rdar://problem/6655054> clang issues bogus error on property usage in a dot-syntax.
llvm-svn: 66659
2009-03-11 15:15:01 +00:00
Steve Naroff 1d984fe2bd Fix <rdar://problem/6578665> user declared setter method should be used when using property syntx.
llvm-svn: 66658
2009-03-11 13:48:17 +00:00
Zhongxing Xu f6b6a39b04 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'.

llvm-svn: 66656
2009-03-11 09:15:38 +00:00
Zhongxing Xu 507202ecb7 Fix crash when LHS of pointer arithmetic is not ElementRegion.
llvm-svn: 66649
2009-03-11 07:43:49 +00:00
Chris Lattner 6e76e592a3 Improve the "bad receiver" warning for ObjC message sends to be less confusing.
llvm-svn: 66635
2009-03-11 03:47:47 +00:00
Ted Kremenek 0fa538528e Fix PR 3780: In one code path in BasicValueFactory::getValue() we would not
return an unsigned integer for a null pointer value.

llvm-svn: 66630
2009-03-11 02:52:39 +00:00
Ted Kremenek 3f5a85ad06 SimpleConstraintManager doesn't reason about bitwise-constraints on symbolic
values. Indicating this in 'canReasonAbout' allows GRExprEngine to recover
path-sensitivity in some cases.

llvm-svn: 66628
2009-03-11 02:29:48 +00:00
Chris Lattner 14311925f2 fix PR3258 by rejecting invalid numeric operands.
llvm-svn: 66618
2009-03-11 00:23:13 +00:00
Chris Lattner 3fa25c683f checking for symbolic operands as well as % at end of string.
llvm-svn: 66614
2009-03-11 00:06:36 +00:00
Chris Lattner a41b847401 reject invalid escape characters in extended-asm strings with a nice diagnostic.
llvm-svn: 66605
2009-03-10 23:51:40 +00:00
Douglas Gregor 0760fa1618 Add type checking for tentative definitions at the end of the
translation unit.

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

llvm-svn: 66601
2009-03-10 23:43:53 +00:00
Douglas Gregor 8145742349 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.

llvm-svn: 66584
2009-03-10 21:58:27 +00:00
Douglas Gregor 79cf603428 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.

llvm-svn: 66572
2009-03-10 20:44:00 +00:00
Douglas Gregor 2a72edd413 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.

llvm-svn: 66563
2009-03-10 18:52:44 +00:00
Douglas Gregor 65b2c4c381 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.

llvm-svn: 66560
2009-03-10 18:33:27 +00:00
Douglas Gregor 4ea568f213 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.

llvm-svn: 66557
2009-03-10 18:03:33 +00:00
Fariborz Jahanian 156506e749 ir-gen support for class getter/setter call
using property dot-syntax.

llvm-svn: 66556
2009-03-10 18:03:11 +00:00
Anders Carlsson 0275115f66 Address Doug's comments wrt the mangler and fix Eli's test case
llvm-svn: 66549
2009-03-10 17:07:44 +00:00
Chris Lattner f85a938985 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).

llvm-svn: 66533
2009-03-10 06:42:37 +00:00
Chris Lattner 6dd0f9263d reduce duplication of parsing code between %0 and %x0 and
add support for modifiers on named references, like %c[foo].

llvm-svn: 66532
2009-03-10 06:38:02 +00:00
Chris Lattner d7d5fdf090 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.

llvm-svn: 66531
2009-03-10 06:33:24 +00:00
Douglas Gregor fcd5db3bfa 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.

llvm-svn: 66513
2009-03-10 00:06:19 +00:00
Douglas Gregor d9c90a7317 Add a test case that goes with the last commit
llvm-svn: 66510
2009-03-09 23:48:53 +00:00
Douglas Gregor c40290e452 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.

llvm-svn: 66509
2009-03-09 23:48:35 +00:00
Ted Kremenek 0b891a343a retain/release checker: Allow allocations to fail by returning nil.
llvm-svn: 66487
2009-03-09 22:46:49 +00:00
Ted Kremenek 3987bbee34 Add test case for <rdar://problem/6659160>.
llvm-svn: 66483
2009-03-09 22:28:18 +00:00
Daniel Dunbar ae3338429f NeXT: Set alignment on a number of ObjC metadata variables (matching llvm-gcc).
llvm-svn: 66481
2009-03-09 22:18:41 +00:00
Chris Lattner 1897de1c38 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.

llvm-svn: 66468
2009-03-09 21:19:16 +00:00
Steve Naroff 9527bbfc08 Implement property '.' notation on Factory/Class objects. Parser changes aren't very pretty:-(
This fixes <rdar://problem/6496506> Implement class setter/getter for properties.

llvm-svn: 66465
2009-03-09 21:12:44 +00:00
Chris Lattner 794c001ad4 fix PR3764 - A redefinition of a pre-processor macro fails
Redefinition checking should ignore the leading whitespace and
start of line flags on the first token of an expansion.

llvm-svn: 66442
2009-03-09 20:33:32 +00:00
Chris Lattner 5c1f4d3c02 convert this to use -verify.
llvm-svn: 66441
2009-03-09 20:31:39 +00:00
Chris Lattner b960cdd255 rename test
llvm-svn: 66440
2009-03-09 20:30:53 +00:00
Chris Lattner ed9f14c4c9 do not warn about -=/=- confusion with macros, thanks to rdogra for a testcase.
llvm-svn: 66416
2009-03-09 07:11:10 +00:00
Chris Lattner 6417fb5bf4 this test isn't testing anything.
llvm-svn: 66389
2009-03-08 20:12:34 +00:00
Chris Lattner 40dc267160 undefined -> unspecified. Thanks Mike.
llvm-svn: 66388
2009-03-08 19:52:14 +00:00
Chris Lattner 222b8bd6ad implement PR3753, warning about comparisons with a string literal.
llvm-svn: 66387
2009-03-08 19:39:53 +00:00
Steve Naroff ed03170d28 Improvements to private method lookup.
Patch by Jean-Daniel Dupas. Thanks!

llvm-svn: 66383
2009-03-08 18:56:13 +00:00
Chris Lattner 7253991f9d add \n characters to the scratch buffer *before* returned tokens.
This prevents caret diagnostics from the scratch buffer from 
including other tokens in the scratch buffer that occurred beforei
them.

llvm-svn: 66375
2009-03-08 08:16:41 +00:00
Chris Lattner 36c39c9b0a refine the "use of unary operator that may be intended as compound assignment (+=)"
warning to only trigger when there is whitespace or something else after the + as
suggested by Eli.

llvm-svn: 66370
2009-03-08 06:51:10 +00:00
Chris Lattner c0452e402b add rdar#
llvm-svn: 66356
2009-03-08 01:43:34 +00:00
Anders Carlsson 4ed74dd6b7 Make mangling work with anonymous tag types. Doug, please review
llvm-svn: 66353
2009-03-07 23:57:03 +00:00
Chris Lattner c808fc34b3 fix test
llvm-svn: 66352
2009-03-07 23:39:35 +00:00
Anders Carlsson 16d5d291ec Mangle Objective-C interfaces correctly (where correctly refers to what gcc does)
llvm-svn: 66349
2009-03-07 22:03:21 +00:00
Eli Friedman 4663a3368d Make constant emission for @encode use the common string emission code.
This is a bit cleaner, and also "fixes" bad code that compares the 
addresses of the string constants.

llvm-svn: 66346
2009-03-07 20:17:55 +00:00