Commit Graph

268 Commits

Author SHA1 Message Date
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Chris Lattner 83cfc7c03a Use the new llvm::TinyPtrVector class, which implements exactly what
ShadowMapEntry was.

llvm-svn: 135368
2011-07-18 01:54:02 +00:00
Fariborz Jahanian 7f4427fc60 Fix a bug where a local variable named 'self' is causing
implicit ivar accesses to go through the 'self' variable
rather than the real 'self' for the method. // rdar://9730771

llvm-svn: 134992
2011-07-12 17:16:56 +00:00
Hans Wennborg 38198ded24 Fix typo correction crash on overloaded functions, pr10283.
It would be cool if we could do overload resolution to suggest
the right function, but at least this fixes the crashing.

llvm-svn: 134976
2011-07-12 08:45:31 +00:00
Benjamin Kramer de1d62314a Initialize member.
llvm-svn: 134403
2011-07-05 09:46:31 +00:00
Douglas Gregor 3b22a88488 When adding boolean keywords for typo correction, add either "bool" or
"_Bool" (depending on dialect), but not both, since they have the same
edit distance from "Bool".

llvm-svn: 134263
2011-07-01 21:27:45 +00:00
Chandler Carruth 7d85c9b6b2 Fix non-determinism in selecting between equal-length names which refer
to the same declaration when correcting typos. This is done by
essentially sorting the corrections as they're added.

Original patch by Kaelyn Uhrain, but modified for style and correctness
by accounting for more than just the textual spelling.

This still is a bit of a WIP hack to make this deterministic. Kaelyn
(and myself) are working on a more principled solution going forward.

llvm-svn: 134038
2011-06-28 22:48:40 +00:00
Chandler Carruth b198e5a911 Fix an invalid use of ::back() on an newly emptied vector. Also tighten
up several places where we never expect to have NULL pointers to assert
early.

This fixes a valgrind error within CorrectTypo, but not the
non-determinism.

llvm-svn: 134032
2011-06-28 21:43:34 +00:00
Douglas Gregor 29cdc6bec0 Dynamically allocate the StringMaps used in typo correction so that we
don't rely on the existence of a copy constructor.

llvm-svn: 134009
2011-06-28 16:44:39 +00:00
Douglas Gregor c2fa169d6c Add support for C++ namespace-aware typo correction, e.g., correcting
vector<int>

to

  std::vector<int>

Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes
PR5776/<rdar://problem/8652971>.

Thanks Kaelyn!

llvm-svn: 134007
2011-06-28 16:20:02 +00:00
Jay Foad 0c3675f432 Fix unused label warning.
llvm-svn: 133790
2011-06-24 09:29:56 +00:00
Alexis Hunt 1da39282ec This patch started as an attempt to fix up the horrid naming
conventions. I then discovered a typo in the using declaration bit in
LookupSpecialMember. This led to discovering [namespace.udecl]p15, which
clang implements incorrectly. Thus I've added a comment and implemented
the code consistently with the rest of clang - that is incorrectly.

And because I don't want to include tests of something incorrect, I've
ripped the test out.

llvm-svn: 133784
2011-06-24 02:11:39 +00:00
Alexis Hunt 080709f82d Clean up the heart of the caching code and miss fewer edge cases.
llvm-svn: 133671
2011-06-23 00:26:20 +00:00
Alexis Hunt 46d1ce23a7 Fix a think-o that amazingly didn't show up until I started writing
implicit move tests.

llvm-svn: 133655
2011-06-22 22:13:13 +00:00
Alexis Hunt 2949f02333 Actually, you know, fix the problem.
llvm-svn: 133604
2011-06-22 02:58:46 +00:00
Alexis Hunt 7b7fece4d4 Avoid making assumption that this is either a CXXMethodDecl or a
FunctionTemplateDecl. I'm not quite sure what else it could be, though,
and would appreciate some insight.

This ought to fix the broken builds

llvm-svn: 133600
2011-06-22 02:25:26 +00:00
Alexis Hunt 491ec60802 Attempt to reapply this patch for caching copy assignment operator
lookup. Previously, it was breaking self-host, but it's been a week and
a half and I can't reproduce, so I need to see if it's still failing.

llvm-svn: 133581
2011-06-21 23:42:56 +00:00
Alexis Hunt b1b368f36d This change is breaking selfhost. Revert it until I have more time
to study it.

llvm-svn: 132843
2011-06-10 12:07:09 +00:00
Alexis Hunt ff0ff6549d Implement caching of copy assignment operator lookup.
I believe, upon, careful review, that this code causes us to incorrectly
handle exception specifications of copy assignment operators in C++03
mode. However, we currently do not seem to properly implement the subtle
distinction between copying of members and bases made by implicit copy
constructors and assignment operators in C++03 - namely that they are
limited in their overload selection - in all cases. As such, I feel that
committing this code is correct pending a careful review of our
implementation of these semantics.

llvm-svn: 132841
2011-06-10 09:24:41 +00:00
Alexis Hunt 899bd447cf Implement caching for copy constructors in similar situations.
llvm-svn: 132835
2011-06-10 04:44:37 +00:00
Alexis Hunt eef8ee0c8d Implement caching of default constructors on the resolution table. This
isn't yet used for the less controlled environments of initialization.

Also a few random text fixups.

llvm-svn: 132833
2011-06-10 03:50:41 +00:00
Alexis Hunt ba8e18d9ae Catch the memory leak in a bucket
llvm-svn: 132700
2011-06-07 00:11:58 +00:00
Alexis Hunt 4ac55e33be Reimplement r132572 on top of a FoldingSet, thus hopefully solving both
the self-host failures and Chandler's concerns.

llvm-svn: 132622
2011-06-04 04:32:43 +00:00
Alexis Hunt 967ea7ca6b Revert r132572 to figure out why it broke selfhost and clean it up as
suggested by Chandler.

llvm-svn: 132593
2011-06-03 21:10:40 +00:00
Alexis Hunt 1b02ed8c7c Begin implementing a cache of special member lookups. Currently only
destructors are implemented but other special members are on the way,
which is where the real benefits of this will be visible.

llvm-svn: 132572
2011-06-03 18:36:49 +00:00
Alexis Hunt ea6f0320f0 Implement implicit deletion of default constructors.
Yes, I'm aware that the diagnostics are awful.

Tests to follow.

llvm-svn: 131203
2011-05-11 22:34:38 +00:00
Alexis Hunt 88c75c311f Clean up trivial default constructors now.
hasTrivialDefaultConstructor() really really means it now.

Also implement a fun standards bug regarding aggregates. Doug, if you'd
like, I can un-implement that bug if you think it is truly a defect.

The bug is that non-special-member constructors are never considered
user-provided, so the following is an aggregate:

struct foo {
  foo(int);
};

It's kind of bad, but the solution isn't obvious - should

struct foo {
  foo (int) = delete;
};

be an aggregate or not?

Lastly, add a missing initialization to FunctionDecl.

llvm-svn: 131101
2011-05-09 21:45:35 +00:00
Chandler Carruth 38a328276c Don't abuse reinterpret cast to do something the API of PointerUnion
provides proper support for. This was caught by
-Wundefined-reinterpret-cast, and I think a reasonable case for it to
warn on.

Also use is<...> instead of dyn_cast<...> when the result isn't needed.

This whole thing should probably switch to using UsuallyTinyPtrVector.

llvm-svn: 130707
2011-05-02 18:54:36 +00:00
Jay Foad 72e705ed94 Like the coding standards say, do not use "using namespace std".
llvm-svn: 130054
2011-04-23 09:06:00 +00:00
Richard Smith 02e85f3bc5 Add support for C++0x's range-based for loops, as specified by the C++11 draft standard (N3291).
llvm-svn: 129541
2011-04-14 22:09:26 +00:00
Axel Naumann 43dec14079 From Vassil Vassilev: Give external source's last resort lookup a chance, even if an identifier could resolve to a builtin.
llvm-svn: 129438
2011-04-13 13:19:46 +00:00
Douglas Gregor 8e93666a71 Objective-C++: The global namespace is an associated namespace of an
Objective-C pointer type. Fixes <rdar://problem/9142559>.

llvm-svn: 129339
2011-04-12 01:02:45 +00:00
Sebastian Redl 7c6c9e971c Reinstate r127112, "Propagate new-style exception spec information to ExtProtoInfo.", this time with the missing header.
llvm-svn: 127118
2011-03-06 10:52:04 +00:00
NAKAMURA Takumi c92335a87c Revert r127112, "Propagate new-style exception spec information to ExtProtoInfo."
It seems missing "clang/Basic/ExceptionSpecificationType.h".

llvm-svn: 127115
2011-03-06 00:17:36 +00:00
Sebastian Redl 69d37125a9 Propagate new-style exception spec information to ExtProtoInfo.
llvm-svn: 127112
2011-03-05 22:42:26 +00:00
Abramo Bagnara 1c3af96724 Fixed LabelDecl source range and cleaned creation code.
llvm-svn: 127094
2011-03-05 18:21:20 +00:00
Abramo Bagnara 124fdf6dd4 Fixed source range for LabelDecl.
llvm-svn: 126952
2011-03-03 18:24:14 +00:00
Axel Naumann 016538ad2a From Vassil Vassilev:
Add an interface for last resort, unqualified lookup. It can provide results for unqualified lookup when Sema fails to find anything itself.

llvm-svn: 126387
2011-02-24 16:47:47 +00:00
Argyrios Kyrtzidis 12f146a3ef Use PointerUnion::getAddrOf instead of messing with PointerUnion & reinterpret_cast.
llvm-svn: 126021
2011-02-19 04:02:34 +00:00
Chris Lattner 9ba479bd2c fix rdar://9024687, a crash on invalid that we used to silently ignore.
llvm-svn: 125962
2011-02-18 21:16:39 +00:00
Chris Lattner 43e7f31f11 implement basic support for __label__. I wouldn't be shocked if there are
bugs from other clients that don't expect to see a LabelDecl in a DeclStmt,
but if so they should be easy to fix.

This implements most of PR3429 and rdar://8287027

llvm-svn: 125817
2011-02-18 02:08:43 +00:00
Chris Lattner ebb5c6c717 Switch labels over to using normal name lookup, instead of their
own weird little DenseMap.  Hey look, we now emit unused label
warnings deterministically, amazing.

llvm-svn: 125813
2011-02-18 01:27:55 +00:00
Douglas Gregor 042465709f When searching for visible declarations (e.g., for code completion),
be sure to look at all of the Objective-C class declarations within a
@class. Fixes <rdar://problem/8876207>.

llvm-svn: 125635
2011-02-16 01:39:26 +00:00
NAKAMURA Takumi f9cbcc4cc2 Fix whitespace.
llvm-svn: 124364
2011-01-27 07:10:08 +00:00
NAKAMURA Takumi 7c2888689d 7bit-ize.
llvm-svn: 124363
2011-01-27 07:09:49 +00:00
Douglas Gregor e4ff4b56fe Replace the representation of template template argument pack
expansions with something that is easier to use correctly: a new
template argment kind, rather than a bit on an existing kind. Update
all of the switch statements that deal with template arguments, fixing
a few latent bugs in the process. I"m happy with this representation,
now.

And, oh look! Template instantiation and deduction work for template
template argument pack expansions.

llvm-svn: 122896
2011-01-05 18:58:31 +00:00
Douglas Gregor bfe022caa1 When we attempt to create a built-in that involves a library type we
don't have access to (e.g., fprintf, which needs the library type
FILE), fail with a warning and forget about the builtin
entirely. Previously, we would actually provide an error, which breaks
autoconf's super-lame checks for fprintf, longjmp, etc. Fixes PR8316.

llvm-svn: 122744
2011-01-03 09:37:44 +00:00
Francois Pichet 8e8f492f65 Remove obsolete comments.
llvm-svn: 122686
2011-01-02 09:19:59 +00:00
John McCall db40c7f573 Restore r121752 without modification.
llvm-svn: 121763
2010-12-14 08:05:40 +00:00
John McCall 5546da68bb Pull out r121752 in case it's causing the selfhost breakage.
llvm-svn: 121759
2010-12-14 07:30:51 +00:00