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

1116 Коммитов

Автор SHA1 Сообщение Дата
Douglas Gregor 70c5ac70ac Refactor code completion for expressions that occur as arguments in
Objective-C message sends. There is no functionality change here; this
is prep work for using the parameter types to help guide the
expression results when code-completing the argument.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114375 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-20 23:34:21 +00:00
Douglas Gregor ac5fd8404f Continue parsing more postfix expressions, even after semantic
errors. Improves code completion in yet another case.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114255 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-18 01:28:11 +00:00
Douglas Gregor 9485989038 Improve recovery when the middle expression of a ternary operator is ill-formed
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114231 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 22:41:34 +00:00
Douglas Gregor 200b292139 When we run into an error parsing or type-checking the left-hand side
of a binary expression, continue on and parse the right-hand side of
the binary expression anyway, but don't call the semantic actions to
type-check. Previously, we would see the error and then, effectively,
skip tokens until the end of the statement. 

The result should be more useful recovery, both in the normal case
(we'll actually see errors beyond the first one in a statement), but
it also helps code completion do a much better job, because we do
"real" code completion on the right-hand side of an invalid binary
expression rather than completing with the recovery completion. For
example, given

  x = p->y

if there is no variable named "x", we can still complete after the p->
as a member expression. Along the recovery path, we would have
completed after the "->" as if we were in an expression context, which
is mostly useless.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114225 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 22:25:06 +00:00
Gabor Greif 9fe871a80d rename variable, 'Type' seems to be present in
the enclosing scope, which confuses gcc v3.4 to no end

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114174 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-17 10:21:45 +00:00
Douglas Gregor c7b6d88336 Implement code completion for Objective-C class message sends that are
missing the opening bracket '[', e.g.,

  NSArray <CC>

at function scope. Previously, we would only give trivial completions
(const, volatile, etc.), because we're in a "declaration name"
scope. Now, we also provide completions for class methods of NSArray,
e.g.,

  alloc

Note that we already had support for this after the first argument,
e.g.,

  NSArray method:x <CC>

would get code completion for class methods of NSArray whose selector
starts with "method:". This was already present because we recover
as if NSArray method:x were a class message send missing the opening
bracket (which was committed in r114057).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114078 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 15:14:18 +00:00
Douglas Gregor 9497a73ad0 Implement automatic bracket insertion for Objective-C class message
sends. These are far trickier than instance messages, because we
typically have something like

  NSArray alloc]

where it appears to be a declaration of a variable named "alloc" up
until we see the ']' (or a ':'), and at that point we can't backtrace.
So, we use a combination of syntactic and semantic disambiguation to
treat this as a message send only when the type is an Objective-C type
and it has the syntax of a class message send (which would otherwise
be ill-formed).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114057 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-16 01:51:54 +00:00
Douglas Gregor 77328d1bb9 Handle bracket insertion for Objective-C class messages in a very
narrow, almost useless case where we're inside a parenthesized
expression, e.g.,

  (NSArray alloc])

The solution to the general case still eludes me.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114039 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 23:19:31 +00:00
Nick Lewycky 304b752a45 Initialize TypeOrExpr to NULL to silence a false-positive uninitialized warning
from certain GCC's. Patch by Neil Vachharajani!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113995 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 18:35:19 +00:00
Douglas Gregor 78edf51554 Improve code completion for Objective-C message sends when the opening
'[' is missing. Prior commits improving recovery also improved code
completion beyond the first selector, e.g., at or after the "to" in

  calculator add:x to:y

but not after "calculator". We now provide the same completions for

  calculator <CC>

that we would for

  [calculator <CC>

if "calculator" is an expression whose type is something that can
receive Objective-C messages.

This code completion works for instance and super message sends, but not
class message sends.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113976 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 16:23:04 +00:00
Douglas Gregor fa885c11e3 Extend bracket insertion to message sends to "super", e.g.,
super method:arg]

will now recover nicely and insert the '[' before 'super'.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113971 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 15:09:43 +00:00
Douglas Gregor b65042da3a Extend bracket insertion to handle nullary selectors, e.g.
a getFoo]




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113969 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 14:54:45 +00:00
Douglas Gregor 0fbda68b50 Implement bracket insertion for Objective-C instance message sends as
part of parser recovery. For example, given:

  a method1:arg];

we detect after parsing the expression "a" that we have the start of a
message send expression. We pretend we've seen a '[' prior to the a,
then parse the remainder as a message send. We'll then give a
diagnostic+fix-it such as:

fixit-objc-message.m:17:3: error: missing '[' at start of message
      send expression
  a method1:arg];
  ^
  [

The algorithm here is very simple, and always assumes that the open
bracket goes at the beginning of the message send. It also only works
for non-super instance message sends at this time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113968 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-15 14:51:05 +00:00
Douglas Gregor 0268810a46 Introduce a new code-completion context for a parenthesized
expression, e.g., after the '(' that could also be a type cast. Here,
we provide types as code-completion results in C/Objective-C (C++
already had them), although we wouldn't in a normal expression context.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113904 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-14 23:59:36 +00:00
Michael J. Spencer 560a921b85 Revert "CMake: Update to use standard CMake dependency tracking facilities instead"
This reverts commit r113631

Conflicts:

	CMakeLists.txt
	lib/CodeGen/CMakeLists.txt

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113817 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-13 23:54:41 +00:00
Douglas Gregor be0f7bd61c When parsing default function arguments, do not mark any declarations
used in the default function argument as "used". Instead, when we
actually use the default argument, make another pass over the
expression to mark any used declarations as "used" at that point. This
addresses two kinds of related problems:

  1) We were marking some declarations "used" that shouldn't be,
  because we were marking them too eagerly.
  2) We were failing to mark some declarations as "used" when we
  should, if the first time it was instantiated happened to be an
  unevaluated context, we wouldn't mark them again at a later point.

I've also added a potentially-handy visitor class template
EvaluatedExprVisitor, which only visits the potentially-evaluated
subexpressions of an expression. I bet this would have been useful for
noexcept...

Fixes PR5810 and PR8127.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113700 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-11 20:24:53 +00:00
Sebastian Redl bd7c849de9 Eli helped me understand how evaluation contexts work.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113642 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:57:27 +00:00
Michael J. Spencer 5a7f34958c CMake: Update to use standard CMake dependency tracking facilities instead
of whatever we were using before...

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113631 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 21:13:16 +00:00
Sebastian Redl 02bc21a88e Parse the noexcept operator and stub out sema.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113622 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-10 20:55:37 +00:00
Douglas Gregor 80c60f7284 When we parse a pragma, keep track of how that pragma was originally
spelled (#pragma, _Pragma, __pragma). In -E mode, use that information
to add appropriate newlines when translating _Pragma and __pragma into
#pragma, like GCC does. Fixes <rdar://problem/8412013>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113553 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 22:45:38 +00:00
Douglas Gregor a1a04786ce Eliminate the comma locations from all of the Sema routines that deal
with comma-separated lists. We never actually used the comma
locations, nor did we store them in the AST, but we did manage to
waste time during template instantiation to produce fake locations.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113495 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 16:33:13 +00:00
Douglas Gregor 3d37c0ada0 Add proper type-source information to UnaryTypeTraitExpr, including
libclang visitation.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-09 16:14:44 +00:00
Douglas Gregor 4eb4f0f962 Fix a few minor issues with parsing and semantic analysis of C++
typeid expressions: 
  - make sure we have a proper source location for the closing ')'
  - cache the declaration of std::type_info once we've found it



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113441 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 23:14:30 +00:00
Douglas Gregor bfae8bd625 Clean up some of the CMake dependencies
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113416 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 21:40:53 +00:00
Francois Pichet 01b7c3028d Microsoft's __uuidof operator implementation part 1.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113356 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 12:20:18 +00:00
Douglas Gregor ab6677ec40 Provide proper type-source location information for
CXXTemporaryObjectExpr, CXXScalarValueInitExpr, and
CXXUnresolvedConstructExpr, getting rid of a bunch of FIXMEs in the
process.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113319 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-08 00:15:04 +00:00
John McCall 837b1a3711 Improve error recovery when we see ':' and expect a ';'.
I, at least, make this typo all the time.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113243 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 18:31:03 +00:00
Douglas Gregor 9ba23b4cea Improve recovery when there is a stray ']' or ')' before the ';' at
the end of a statement. Fixes <rdar://problem/6896493>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113202 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 15:23:11 +00:00
Douglas Gregor 751f692237 Improve recovery when a comma is missing between enumerators in an
enumeration definition. Fixes <rdar://problem/7159693>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 14:51:08 +00:00
Douglas Gregor b1f6fa4896 Improve diagnostic and recovery when missing a comma between base or
member initializers in a C++ constructor. Fixes <rdar://problem/7796492>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113199 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-07 14:35:10 +00:00
Fariborz Jahanian 3846ca29a8 Use std::string instead of llvm::StringRef to avoid dangling ref.
Per Chris's comment.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112979 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 18:01:09 +00:00
Fariborz Jahanian afbc68177c Use getSpelling to get original text of the
c++ operator token. (radar 8328250).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112977 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 17:33:04 +00:00
Dawn Perchik 52fc314e1b Add symantic support for the Pascal calling convention via
"__attribute((pascal))" or "__pascal" (and "_pascal" under
-fborland-extensions).  Support still needs to be added to llvm.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112939 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 01:29:35 +00:00
Fariborz Jahanian be74740cc2 Patch to allow alternative representation of c++
operators (and, or, etc.) to be used as selectors
to match g++'s behavior.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112935 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 01:26:16 +00:00
Sebastian Redl d4b25cbde1 Implement __has_virtual_destructor. Patch by Steven Watanabe.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112905 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-02 23:19:42 +00:00
Chris Lattner f65086b479 when emitting an error about a missing } in a compound statement, emit
a "to match this {" note, pointing out the opener.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112709 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-01 15:49:26 +00:00
Sebastian Redl c238f09a26 Implement the __has_nothrow trait family, by Steven Watanabe.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112577 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 04:59:00 +00:00
Sebastian Redl 88e64ca96d Enable inline namespaces in C++03 as an extension.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112566 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-31 00:36:45 +00:00
Sean Hunt 6cf750298d Revert my user-defined literal commits - r1124{58,60,67} pending
some issues being sorted out.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112493 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-30 17:47:05 +00:00
Sean Hunt 0016d519b8 Implement C++0x user-defined string literals.
The extra data stored on user-defined literal Tokens is stored in extra
allocated memory, which is managed by the PreprocessorLexer because there isn't
a better place to put it that makes sure it gets deallocated, but only after
it's used up. My testing has shown no significant slowdown as a result, but
independent testing would be appreciated.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112458 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 21:26:48 +00:00
Fariborz Jahanian f459beb2fa ObjClang++: Allow declaration of block variable in a collection
statement header (fixes radar 8295106).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112443 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-29 17:20:53 +00:00
Douglas Gregor 0133f525a2 Basic code completion support for the base and member initializers in
a constructor.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112330 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-28 00:00:50 +00:00
Sebastian Redl d078e64145 Parser support for inline namespaces
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112320 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 23:12:46 +00:00
Chris Lattner 5add754172 handle :: in selectors in objc++ mode, rdar://8366474
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112307 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 22:32:41 +00:00
Douglas Gregor 1a480c403a Suggest "const" and "volatile" code completions after a function
declarator, the very definition of "low-hanging fruit".


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112274 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 17:35:51 +00:00
Douglas Gregor b1e03539b8 Fix CMake dependencies, from Fernando Pelliccioni!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112261 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 14:18:05 +00:00
John McCall 9c72c6088d Propagate whether an id-expression is the immediate argument of
an '&' expression from the second caller of ActOnIdExpression.

Teach template argument deduction that an overloaded id-expression
doesn't give a valid type for deduction purposes to a non-static
member function unless the expression has the correct syntactic
form.

Teach ActOnIdExpression that it shouldn't try to create implicit
member expressions for '&function', because this isn't a        
permitted form of use for member functions.

Teach CheckAddressOfOperand to diagnose these more carefully.
Some of these cases aren't reachable right now because earlier
diagnostics interrupt them.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112258 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-27 09:08:28 +00:00
John McCall f312b1ea17 One who seeks knowledge learns something new every day.
One who seeks the Tao unlearns something new every day.
Less and less remains until you arrive at non-action.
When you arrive at non-action,
nothing will be left undone.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112244 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 23:41:50 +00:00
Douglas Gregor 458433d2f0 Implement code completion for @selector expressions
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112186 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-26 15:07:07 +00:00
Douglas Gregor c1a3e5e738 Initialize the translation-unit scope before lexing the first
token. The first token might be something that ends up triggering code
completion, which in turn requires a valid Scope. Test case forthcoming.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112066 91177308-0d34-0410-b5e6-96231b3b80d8
2010-08-25 18:07:12 +00:00