aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
AgeCommit message (Collapse)Author
2011-08-03Improve overloaded function handling in the typo correction code.Kaelyn Uhrain
Change TypoCorrection to store a set of NamedDecls instead of a single NamedDecl. Also add initial support for performing function overload resolution to Sema::DiagnoseEmptyLookup. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@136807 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-23remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner
LLVM.h imports them into the clang namespace. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135852 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18Use the new llvm::TinyPtrVector class, which implements exactly whatChris Lattner
ShadowMapEntry was. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@135368 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12Fix a bug where a local variable named 'self' is causingFariborz Jahanian
implicit ivar accesses to go through the 'self' variable rather than the real 'self' for the method. // rdar://9730771 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134992 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-12Fix typo correction crash on overloaded functions, pr10283.Hans Wennborg
It would be cool if we could do overload resolution to suggest the right function, but at least this fixes the crashing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134976 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-05Initialize member.Benjamin Kramer
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134403 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-01When adding boolean keywords for typo correction, add either "bool" orDouglas Gregor
"_Bool" (depending on dialect), but not both, since they have the same edit distance from "Bool". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134263 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28Fix non-determinism in selecting between equal-length names which referChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134038 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28Fix an invalid use of ::back() on an newly emptied vector. Also tightenChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134032 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28Dynamically allocate the StringMaps used in typo correction so that weDouglas Gregor
don't rely on the existence of a copy constructor. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134009 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-28Add support for C++ namespace-aware typo correction, e.g., correctingDouglas Gregor
vector<int> to std::vector<int> Patch by Kaelyn Uhrain, with minor tweaks + PCH support from me. Fixes PR5776/<rdar://problem/8652971>. Thanks Kaelyn! git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134007 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24Fix unused label warning.Jay Foad
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133790 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-24This patch started as an attempt to fix up the horrid namingSean Hunt
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133784 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-23Clean up the heart of the caching code and miss fewer edge cases.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133671 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22Fix a think-o that amazingly didn't show up until I started writingSean Hunt
implicit move tests. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133655 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22Actually, you know, fix the problem.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133604 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-22Avoid making assumption that this is either a CXXMethodDecl or aSean Hunt
FunctionTemplateDecl. I'm not quite sure what else it could be, though, and would appreciate some insight. This ought to fix the broken builds git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133600 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21Attempt to reapply this patch for caching copy assignment operatorSean Hunt
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133581 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10This change is breaking selfhost. Revert it until I have more timeSean Hunt
to study it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132843 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10Implement caching of copy assignment operator lookup.Sean Hunt
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132841 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10Implement caching for copy constructors in similar situations.Sean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132835 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-10Implement caching of default constructors on the resolution table. ThisSean Hunt
isn't yet used for the less controlled environments of initialization. Also a few random text fixups. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132833 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-07Catch the memory leak in a bucketSean Hunt
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132700 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-04Reimplement r132572 on top of a FoldingSet, thus hopefully solving bothSean Hunt
the self-host failures and Chandler's concerns. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132622 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03Revert r132572 to figure out why it broke selfhost and clean it up asSean Hunt
suggested by Chandler. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132593 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03Begin implementing a cache of special member lookups. Currently onlySean Hunt
destructors are implemented but other special members are on the way, which is where the real benefits of this will be visible. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@132572 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-11Implement implicit deletion of default constructors.Sean Hunt
Yes, I'm aware that the diagnostics are awful. Tests to follow. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131203 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-09Clean up trivial default constructors now.Sean Hunt
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@131101 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-02Don't abuse reinterpret cast to do something the API of PointerUnionChandler Carruth
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130707 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-23Like the coding standards say, do not use "using namespace std".Jay Foad
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@130054 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-14Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith
draft standard (N3291). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129541 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-13From Vassil Vassilev: Give external source's last resort lookup a chance, ↵Axel Naumann
even if an identifier could resolve to a builtin. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129438 91177308-0d34-0410-b5e6-96231b3b80d8
2011-04-12Objective-C++: The global namespace is an associated namespace of anDouglas Gregor
Objective-C pointer type. Fixes <rdar://problem/9142559>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@129339 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06Reinstate r127112, "Propagate new-style exception spec information to ↵Sebastian Redl
ExtProtoInfo.", this time with the missing header. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127118 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-06Revert r127112, "Propagate new-style exception spec information to ↵NAKAMURA Takumi
ExtProtoInfo." It seems missing "clang/Basic/ExceptionSpecificationType.h". git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127115 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05Propagate new-style exception spec information to ExtProtoInfo.Sebastian Redl
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127112 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-05Fixed LabelDecl source range and cleaned creation code.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127094 91177308-0d34-0410-b5e6-96231b3b80d8
2011-03-03Fixed source range for LabelDecl.Abramo Bagnara
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126952 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-24From Vassil Vassilev:Axel Naumann
Add an interface for last resort, unqualified lookup. It can provide results for unqualified lookup when Sema fails to find anything itself. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126387 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-19Use PointerUnion::getAddrOf instead of messing with PointerUnion & ↵Argyrios Kyrtzidis
reinterpret_cast. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126021 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18fix rdar://9024687, a crash on invalid that we used to silently ignore.Chris Lattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125962 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18implement basic support for __label__. I wouldn't be shocked if there areChris Lattner
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 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125817 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-18Switch labels over to using normal name lookup, instead of their Chris Lattner
own weird little DenseMap. Hey look, we now emit unused label warnings deterministically, amazing. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125813 91177308-0d34-0410-b5e6-96231b3b80d8
2011-02-16When searching for visible declarations (e.g., for code completion),Douglas Gregor
be sure to look at all of the Objective-C class declarations within a @class. Fixes <rdar://problem/8876207>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125635 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-27Fix whitespace.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124364 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-277bit-ize.NAKAMURA Takumi
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@124363 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-05Replace the representation of template template argument packDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122896 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-03When we attempt to create a built-in that involves a library type weDouglas Gregor
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122744 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-02Remove obsolete comments.Francois Pichet
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122686 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-14Restore r121752 without modification.John McCall
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121763 91177308-0d34-0410-b5e6-96231b3b80d8