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

3304 Коммитов

Автор SHA1 Сообщение Дата
John McCall e7e278bce2 Don't enter a new scope for a namespace-qualified declarator unless we're
in a file context.  In well-formed code, only happens with friend functions.
Fixes PR 5760.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91146 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 20:04:54 +00:00
Douglas Gregor ef96eac2b8 When code completion of an overload set fails, produce results for ordinary name lookup instead.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 19:06:04 +00:00
Douglas Gregor a61a87980d Add a function's cv-qualifiers to the code-completion results as an
informative chunk.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91139 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:44:16 +00:00
Douglas Gregor d1cd31aeb8 Teach code completion to instantiate templates when it needs to
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:28:39 +00:00
Douglas Gregor ce82196076 Member function templates can occur after . or ->
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91137 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 18:14:22 +00:00
Douglas Gregor 7628294ee8 Tweak code-completion results by suppressing class template
specializations and class template partial specializations (they're
never named directly). Also, member access expressions only refer to
value declarations (fields, functions, enumerators, etc.) and
Objective-C property declarations; filter out everything else.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 17:31:05 +00:00
Douglas Gregor e29ffaae9b Class template (partial) specializations should not show up in code completion results
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 16:18:54 +00:00
Benjamin Kramer 8d04258483 Random string-related cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91119 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 13:33:18 +00:00
Eli Friedman 03981014e4 Fix a recent regression from the initialization changes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91097 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:42:07 +00:00
John McCall d7533ec10b Check if the target of a using decl is already declared in this scope before
doing any of the other redeclaration checks.  We were missing a few cases.
Fixes PR 5752.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:33:26 +00:00
John McCall 60fa3cfd7a Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.


We implement access declarations in terms of using declarations, which is
quite reasonable.  However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics.  This
isn't a priority, so I'll just file a PR and hope someone else does it. :)


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 02:10:03 +00:00
Eli Friedman ed0716b7b7 Fix the handling of dependent enums per C++ DR 502.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91089 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 01:34:50 +00:00
Fariborz Jahanian 737061fc29 Patch to fix a crash trying to access a category name in
objective-c++ mode and also removed dead-code in this area.
(fixes radar 7456710).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-11 00:26:36 +00:00
Mike Stump c9875bfa6f Don't complain about falling off the end of a function with an asm
block, if the function is supposed to return a value as we don't know
exactly what the asm code does.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91073 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 22:57:48 +00:00
Eli Friedman 29a7f3342c Clean up enum constants so that they're finally sane. Fixes PR3173 and a
recently introduced crash.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91070 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 22:29:29 +00:00
Fariborz Jahanian 5501636b41 Add support for finding composite type of twp objective-c pointers
in objective-c++ mode.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 20:46:08 +00:00
John McCall 41ce66f8e2 Improve the diagnostic when a new declaration conflicts with a using shadow
declaration.  Rename note_using_decl to note_using, which is possibly less confusing.
Add a test for non-class-scope using decl collisions and be sure to note the case
we can't diagnose yet.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 19:51:03 +00:00
Fariborz Jahanian eebc4750fd Move composite type finding of two objective-c expressions
into its own helper method. No change in functionality.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91056 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 19:47:41 +00:00
Douglas Gregor 0966f35898 Implement C++ DR437, which involves exception-specifications that name
a type currently being defined, from Nicola Gigante!


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91052 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 18:13:52 +00:00
Douglas Gregor d87b61f639 Move initialization via initializer list over to InitializationSequences.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91050 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 17:56:55 +00:00
John McCall 9f54ad4381 Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not.  In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91045 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 09:41:52 +00:00
Eli Friedman 153c33ed95 Fix for PR5515: allow "merging" array bounds both forwards and backwards.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@91044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-10 08:54:47 +00:00
Douglas Gregor 20093b4bf6 Reimplement reference initialization (C++ [dcl.init.ref]) using the
new notion of an "initialization sequence", which encapsulates the
computation of the initialization sequence along with diagnostic
information and the capability to turn the computed sequence into an
expression. At present, I've only switched one CheckReferenceInit
callers over to this new mechanism; more will follow.

Aside from (hopefully) being much more true to the standard, the
diagnostics provided by this reference-initialization code are a bit
better than before. Some examples:

p5-var.cpp:54:12: error: non-const lvalue reference to type 'struct
Derived'
      cannot bind to a value of unrelated type 'struct Base'
  Derived &dr2 = b; // expected-error{{non-const lvalue reference to
  ...
           ^     ~
p5-var.cpp:55:9: error: binding of reference to type 'struct Base' to
a value of
      type 'struct Base const' drops qualifiers
  Base &br3 = bc; // expected-error{{drops qualifiers}}
        ^     ~~

p5-var.cpp:57:15: error: ambiguous conversion from derived class
      'struct Diamond' to base class 'struct Base':
    struct Diamond -> struct Derived -> struct Base
    struct Diamond -> struct Derived2 -> struct Base
  Base &br5 = diamond; // expected-error{{ambiguous conversion from
      ...
              ^~~~~~~
p5-var.cpp:59:9: error: non-const lvalue reference to type 'long'
      cannot bind to
      a value of unrelated type 'int'
  long &lr = i; // expected-error{{non-const lvalue reference to type
      ...
        ^    ~

p5-var.cpp:74:9: error: non-const lvalue reference to type 'struct
Base' cannot
      bind to a temporary of type 'struct Base'
  Base &br1 = Base(); // expected-error{{non-const lvalue reference to
  ...
        ^     ~~~~~~

p5-var.cpp:102:9: error: non-const reference cannot bind to bit-field
'i'
  int & ir1 = (ib.i); // expected-error{{non-const reference cannot
  ...
        ^     ~~~~~~
p5-var.cpp:98:7: note: bit-field is declared here
  int i : 17; // expected-note{{bit-field is declared here}}
      ^






git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90992 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 23:02:17 +00:00
Fariborz Jahanian 83dc32594c Codegen. support for ObjCIsaExpr AST which until now
was not needed (fixes radar 7453430).



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90981 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 19:05:56 +00:00
John McCall 842aef8d94 First pass at implementing C++ enum semantics: calculate (and store) an
"integer promotion" type associated with an enum decl, and use this type to
determine which type to promote to.  This type obeys C++ [conv.prom]p2 and
is therefore generally signed unless the range of the enumerators forces
it to be unsigned.

Kills off a lot of false positives from -Wsign-compare in C++, addressing
rdar://7455616




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90965 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 09:09:27 +00:00
Anders Carlsson eac813909b Look through using declarations when searching for allocation overloads.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 07:39:44 +00:00
Eli Friedman 772fffa234 Fix for PR5730: make sure to consistently call
PerformObjectArgumentInitialization from BuildCXXMemberCallExpr.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90950 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 04:53:56 +00:00
Eli Friedman c8c771ed7e Whitespace fix.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 04:52:43 +00:00
Anders Carlsson 63fb6737e7 Don't warn about function templates or function template specializations.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90943 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:44:46 +00:00
John McCall 871b2e7c0f Rename Sema::IsOverload to Sema::CheckOverload. Teach it to ignore unresolved
using value decls;  we optimistically assume they won't turn into conflicts.
Teach it to tell the caller *why* the function doesn't overload with the returned
decl;  this will be useful for using hiding.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90939 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:35:25 +00:00
Anders Carlsson 9f89dd783d Move the missing prototypes checking out into a new function. Don't warn about inline functions. Add a test.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90938 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:30:09 +00:00
Anders Carlsson b6cc91be4d Pass the current SourceLocation to getAssignOperatorMethod, fixing a crash when the assign operator method needs to be instantiated. Doug, please review the updated default-assignment-operator.cpp change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90935 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 03:01:51 +00:00
Mike Stump b89192151e Add support for the cleanup attribute for C++; we don't have to copy
all of g++'s bugs.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90924 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 01:50:36 +00:00
Douglas Gregor 43c79c2b07 Implemented an implicit conversion from "noreturn" function types (and
pointers thereof) to their corresponding non-noreturn function
types. This conversion is considered an exact match for
overload-resolution purposes. Note that we are a little more strict
that GCC is, because we encode noreturn in the type system, but that's
a Good Thing (TM) because it does not allow us to pretend that
potentially-returning function pointers are non-returning function
pointers.

Fxies PR5620.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90913 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-09 00:47:37 +00:00
Fariborz Jahanian 92ef5d7572 More detailed analysis of typecast to an objective-c pointer
in objective-c++ mode without being too lenient.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90895 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 23:09:15 +00:00
John McCall fead20c1de Handle unresolved using decls in bare lookups. These are not being adequately
tested.  Fixes PR5727.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90893 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 22:45:53 +00:00
Fariborz Jahanian 0cedfbdb44 Patch to allow matching 0 with an objective-c pointer type
in objective-c++ mode. Fixes radar 7443165



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 20:04:24 +00:00
Fariborz Jahanian ebea307a76 Patch to allow cstyle cast of objective-c pointers in objective-c++
mode as they are pervasive.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90867 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 19:22:33 +00:00
Fariborz Jahanian 52efc3fdba Refactor objective-c pointer assignment compatibility logic. No
intended functionality change.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90865 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 18:24:49 +00:00
Douglas Gregor 0ae7b3f1d5 Implement template instantiation for exception specifications. Also,
print exception specifications on function types and
declarations. Fixes <rdar://problem/7450999>.

There is some poor source-location information here, because we don't
track locations of the types in exception specifications. Filed PR5719.

Failures during template instantiation of the signature of a function
or function template have wrong point-of-instantiation location
information. I'll tackle that with a separate commit.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90863 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 17:45:32 +00:00
Douglas Gregor 1237259bda When performing unqualified name lookup in C++, don't look directly
into transparent contexts; instead, we'll look into their nearest
enclosing non-transparent contexts further up the stack. Fixes PR5479.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90859 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 15:38:36 +00:00
John McCall 454feb9da6 The refactor of implicit member access expressions means we don't need this
horrible isAddressOfOperand hack in TreeTransform, since that syntactic
information is managed by the initial parser callbacks now.

That's enough insomniac commits for one night.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90849 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 09:21:05 +00:00
John McCall dbd872f273 DeclRefExpr stores a ValueDecl internally.
Template instantiation can re-use DeclRefExprs.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90848 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 09:08:17 +00:00
John McCall 604e7f14d6 Correctly implement the C++03 and 0x restrictions on class-member using
declarations.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 07:46:18 +00:00
Eli Friedman 6bc20135a2 Fix for PR5710: make sure to put function template specializations into the
DeclContext, so they don't completely disappear from the AST.

I don't particularly like this fix, but I don't see any obviously better way
to deal with it, and I think it's pretty clearly an improvement; comments
welcome.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90835 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 05:40:03 +00:00
Fariborz Jahanian 7e42cf2ca1 Patch to warn when discarding objective-c pointer type qualifiers
Still some refactoring to do.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90830 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-08 03:35:08 +00:00
John McCall 812c15476c Recover from dot accesses to record pointers and arrow accesses to records.
Patch by Nicola Gigante!



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90814 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 22:46:59 +00:00
Ted Kremenek 3cdff236e2 Add the BlockDecl to the DeclContext.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90808 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 22:01:30 +00:00
Fariborz Jahanian 6d910f07d8 Allow accessing 'isa' via '->' operator.
(fixes radar 7447251).


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@90795 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-07 20:09:25 +00:00
Fariborz Jahanian 2b5ff1a147 Patch to allow restrict applied to id/Class types.
(fixes radar 7442244).


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