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

118 Коммитов

Автор SHA1 Сообщение Дата
Sebastian Redl 669d5d74b8 Implement parsing and semantic checking of the 'mutable' keyword.
Thanks to Doug for the review. Actual effects of mutable to follow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59331 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-14 23:42:31 +00:00
Chris Lattner 195044028b Fix a couple of suboptimalities in error recovery.
1. In the top level of ParseStatementOrDeclaration, don't eat a } if we
   just parsed a statement if it list there.  Also, don't even bother
   emitting an error about a missing semicolon if the statement had a 
   bug (an rbrace is fine).
2. In do/while parsing, don't require a 'while' to be present if the do
   body didn't parse.

This allows us to generate a clean diagnostic for this code:

t.c:1:22: error: expected expression
void foo (void) { do . while (0); }
                     ^

Thanks to Neil for pointing this out.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59256 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 18:52:53 +00:00
Chris Lattner a668e8ec3b implement a fixme :), switch to -verify mode.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59253 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-13 18:42:17 +00:00
Sebastian Redl c42e118384 Implement C++ 'typeid' parsing and sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59042 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 11:37:55 +00:00
Chris Lattner 1f6f54be86 Fix PR3031 by silencing follow-on errors in invalid declarations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59027 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-11 06:13:16 +00:00
Sebastian Redl ab963c6221 Update C++ status to reflect parser capabilities for chapter 9 (classes). Slightly extend the class parser test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58909 91177308-0d34-0410-b5e6-96231b3b80d8
2008-11-08 15:40:37 +00:00
Daniel Dunbar e10b0f236b "One" line fix for -parse-noop failure, "id" and several other things
were being treated as type names for non-Objective-C files.
 - Other lines are just because MinimalAction didn't have access to
   the LangOptions.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58498 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-31 08:56:51 +00:00
Douglas Gregor 27c8dc06f6 Implement initialization of a reference (C++ [dcl.init.ref]) as part
of copy initialization. Other pieces of the puzzle:

  - Try/Perform-ImplicitConversion now handles implicit conversions
    that don't involve references.
  - Try/Perform-CopyInitialization uses
    CheckSingleAssignmentConstraints for C. PerformCopyInitialization
    is now used for all argument passing and returning values from a
    function.
  - Diagnose errors with declaring references and const values without
    an initializer. (Uses a new Action callback, ActOnUninitializedDecl).
  
We do not yet have implicit conversion sequences for reference
binding, which means that we don't have any overloading support for
reference parameters yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-29 00:13:59 +00:00
Chris Lattner 0fc73f722f implement some more FIXMEs, by rejecting more bogus stuff in
objc mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58216 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:29:41 +00:00
Chris Lattner 79ed6b5902 add some simple designator testcases. Reject things like this:
struct foo Y[10] = {
  [4] .arr [2] 4  // expected-error {{expected '=' or another designator}}
};

because the "missing equals" extension only is valid if there 
is exactly one array designator.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@58215 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-26 23:22:23 +00:00
Chris Lattner aab740af64 Support attributes in *yet another* place. Is there any place you
can't stick an attributes?


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57795 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 04:57:38 +00:00
Chris Lattner 7399ee0aa6 Fix a parser bug where we let attributes interfere with our disambiguation
of whether a '(' was a grouping paren or the start of a function declarator.
This is PR2796.

Now we eat the attribute before deciding whether the paren is grouping or
not, then apply it to the resultant decl or to the first argument as needed.

One somewhat surprising aspect of this is that attributes interact with
implicit int in cases like this:

void a(x, y) // k&r style function
void b(__attribute__(()) x, y); // function with two implicit int arguments
void c(x, __attribute__(()) y); // error, can't have attr in identifier list.

Fun stuff.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57790 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-20 02:05:46 +00:00
Argyrios Kyrtzidis e25d270b4d Allow variadic arguments without named ones for C++, e.g. "void(...);"
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57143 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-06 00:07:55 +00:00
Daniel Dunbar f7a726b5f2 De-XFAIL test/Parser/pragma-pack.c
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57069 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:45:56 +00:00
Chris Lattner 4f2670d827 Move the expected-warning lines to a place that clang -verify will pick them
up.  Speculatularly hacktastic, but strangely beautiful?
Daniel, lines 20/21 are rejected, please investigate.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57067 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:38:15 +00:00
Daniel Dunbar fcdd8fe26d Add Parser support for #pragma pack
- Uses Action::ActOnPragmaPack
 - Test case is XFAIL pending verifier fixes.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57066 91177308-0d34-0410-b5e6-96231b3b80d8
2008-10-04 19:21:03 +00:00
Daniel Dunbar 246e70f69c Parser support for prefix __attribute__ on @protocol.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56642 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-26 04:48:09 +00:00
Chris Lattner 69d349a874 Fix rdar://6222856: the receiver of a message expr is an
arbitrary expr, not just a assign expr.  The grammar comment
was right, the code was just wrong.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56353 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-19 17:44:00 +00:00
Argyrios Kyrtzidis 8592b1d9a0 Fix test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56012 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:56:12 +00:00
Argyrios Kyrtzidis 71b914b999 Implement parser support for the 'condition' part of C++ selection-statements and iteration-statements (if/switch/while/for).
Add new 'ActOnCXXConditionDeclarationExpr' action, called when the 'condition' is a declaration instead of an expression.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@56007 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-09 20:38:47 +00:00
Argyrios Kyrtzidis 0f07203293 Support "typeof unary-expression" (GNU C++ extension).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55833 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-05 11:26:19 +00:00
Steve Naroff c9a4eea592 Pull code from last commit. will put back soon.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55637 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 18:04:36 +00:00
Steve Naroff 042f955a20 Implement block pseudo-storage class modifiers (__block, __byref).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55635 91177308-0d34-0410-b5e6-96231b3b80d8
2008-09-02 15:20:19 +00:00
Steve Naroff 296e8d5fdc Add parser/action support for block literal expressions.
Parser support for blocks is almost complete...just need to add support for the __block() storage class qualifier.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55495 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-28 19:20:44 +00:00
Steve Naroff 5618bd4a52 First wave of changes to support "blocks" (an extension to C).
This commit adds the declaration syntax (and associated type).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55417 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-27 16:04:49 +00:00
Eli Friedman 0976278aff Fix a minor crash-on-invalid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@55082 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-20 22:07:34 +00:00
Argyrios Kyrtzidis b348b810e7 C++ casts, (static_cast. dynamic_cast, etc.) can have postfix-expression pieces.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@54850 91177308-0d34-0410-b5e6-96231b3b80d8
2008-08-16 19:45:32 +00:00
Chris Lattner 2b1cc8be4d continue cleaning up code, and disable sending a message directly to an
interface.  This fixes a bug where we used to accept:

void test2(NSNumber x) {
	[x METH];
}

which doesn't make sense and GCC rejects.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53841 91177308-0d34-0410-b5e6-96231b3b80d8
2008-07-21 06:12:56 +00:00
Argyrios Kyrtzidis 3a9fdb4742 Handle unnamed bitfields when parsing C++ classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52855 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-28 08:10:48 +00:00
Argyrios Kyrtzidis 4cc18a4d52 Add parsing support for C++ classes.
Note that Parser::ParseCXXMemberSpecification is temporarily disabled until the Sema support is in place.
Once ParseCXXMemberSpecification is enabled, the Parser/cxx-class.cpp test will pass.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52694 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-24 22:12:16 +00:00
Chris Lattner 13fd7e5111 "this patch adds code generation hooks for Objective-C constant strings. It also modifies Sema so that Objective-C constant strings are treated as untyped objects if the interface for the constant string class can not be found. This is consistent with Apple GCC. I thought it was consistent with GNU GCC, since this was causing failures when trying to compile GNUstep with (GNU) GCC, but it appears that this is not the case when attempting to produce a simple test case to demonstrate it. Possibly there is a way of making the error go away, but I haven't found out what it is yet."
Patch by David Chisnall!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52599 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-21 21:44:18 +00:00
Argyrios Kyrtzidis c577a0e9bf Multiple tests in a single test file must be linked with '&&'.
Otherwise, failing tests other than the last one will not be reported.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@52231 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-12 12:40:02 +00:00
Chris Lattner b93fb49566 handle the full assignment-expression grammar when using an
objc message send in an initializer expression.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51882 91177308-0d34-0410-b5e6-96231b3b80d8
2008-06-02 21:31:07 +00:00
Chris Lattner aec3a1eb21 Fix a couple crashes on invalid input.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51622 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 23:32:43 +00:00
Eli Friedman 1f3105e1ee Change diagnostic per suggestion, to make it a bit clearer what is
happening.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51574 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-27 02:01:50 +00:00
Gabor Greif 1b76779233 fix typo
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51479 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-23 11:19:39 +00:00
Eli Friedman 33701a6167 Test from PR2332; bug already fixed by r51311.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51316 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 12:55:29 +00:00
Eli Friedman 6e33dd5b5c Fix the scope of K&R-style argument declarations so that they don't
extend beyond the end of the function.

I'm not completely sure this is the right way to fix this bug, so 
someone familiar with the parser should double-check.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51311 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-20 09:10:20 +00:00
Nate Begeman 8a99764f9b Extend vector member references to include {.hi, .lo, .e, .o} which return a
vector of the same element type and half the width, with the high, low, even,
and odd elements respectively.

Allow member references to member references, so that .hi.hi gives you the high
quarter of a vector.  This is fairly convenient syntax for some insert/extract
operations.

Remove some unnecessary methods/types in the ExtVectorElementExpr class.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50892 91177308-0d34-0410-b5e6-96231b3b80d8
2008-05-09 06:41:27 +00:00
Chris Lattner 65bb89c382 Two improvements to initializer parsing:
1. If we hit a semantic error, try harder to recover to emit
   diagnostics for later initializer errors (PR2241).
2. Don't leak parsed initializers on an error.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49998 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-20 19:07:56 +00:00
Nate Begeman 213541a68a OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49942 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-18 23:10:10 +00:00
Chris Lattner 3825c2eb00 reject 'int test(x, x) int x; {}'
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49271 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:50:56 +00:00
Chris Lattner aaf9ddbeab reject 'typedef int y; int test(x, y)'.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49270 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-06 06:47:48 +00:00
Chris Lattner d658b562e8 Fix handling of implicit int, resolving PR2012 and reverting (and
subsuming) my patch for PR1999.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49251 91177308-0d34-0410-b5e6-96231b3b80d8
2008-04-05 06:32:51 +00:00
Chris Lattner 6b884508c3 implement simple support for arbitrary token lookahead. Change the
objc @try parser to use it, fixing a FIXME.  Update the 
objc-try-catch-1.m file to pass now that we get more reasonable 
errors.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@48129 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-10 06:06:04 +00:00
Chris Lattner 42e6737f2e Remove the first layer of support for "portability" warnings. This is
theoretically useful, but not useful in practice.  It adds a bunch of 
complexity, and not much value.  It's best to nuke it.  One big advantage
is that it means the target interfaces will soon lose their SLoc arguments
and target queries can never emit diagnostics anymore (yay).  Removing this
also simplifies some of the core preprocessor which should make it slightly
faster.

Ted, I didn't simplify TripleProcessor, which can now have at most one
triple, and can probably just be removed.  Please poke at it when you have
time.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47930 91177308-0d34-0410-b5e6-96231b3b80d8
2008-03-05 01:18:20 +00:00
Chris Lattner 5280408ab3 Fix PR2042. One remaining issue: we don't currently diagnose
int foobar(int);
 int foobar() {}

which requires ifdef'ing out a testcase in predefined-function.c.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47236 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-17 19:31:09 +00:00
Chris Lattner 99d724f6a3 Fix PR1999, by emitting a hard error only if an argument declarator is completely
missing.  Otherwise, it is an implicit int case, which is valid in c90 and invalid 
elsewhere, but accepted as an extension.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46938 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-10 23:08:00 +00:00
Anders Carlsson 8bd36fcb44 Behave correctly if a constraint expression is invalid.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46910 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-09 19:57:29 +00:00
Steve Naroff 64515f3185 Fix Parser::ParseObjCTryStmt() to allow for trailing @-keyword statements/expressions.
This bug fix is the result of not having 2-token lookahead to recognize specific @-keywords.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46768 91177308-0d34-0410-b5e6-96231b3b80d8
2008-02-05 21:27:35 +00:00