Commit Graph

3584 Commits

Author SHA1 Message Date
Douglas Gregor 6b8232ff82 Eliminate cursor kinds used to express definitions. Instead, provide
CIndex functions that (1) map from a reference or declaration to the
corresponding definition, if available, and (2) determine whether a
given declaration cursor is also a definition. This eliminates a lot
of duplication in the cursor kinds, and maps more closely to the Clang
ASTs.

This is another API + ABI breaker with no deprecation. Yay, progress.

llvm-svn: 93893
2010-01-19 19:34:47 +00:00
Fariborz Jahanian c1d2fa5d48 Issue diagnostics (instead of crashing in code gen) when using
property dot-syntax notation to use setter/getters in objective-c. 
Fixes radar 7553050.

llvm-svn: 93883
2010-01-19 17:48:02 +00:00
Douglas Gregor 9abe2377e7 Teach Sema::ActOnDependentTemplateName that a dependent template name
in a member access expression referring into the current instantiation
need not be resolved at template definition *if* the current
instantiation has any dependent base classes. Fixes PR6081.

llvm-svn: 93877
2010-01-19 16:01:07 +00:00
Douglas Gregor a3b624aa55 In a mem-initializer, a nested-name-specifier followed by an
identifier always names a type. In the case of a dependent
nested-name-specifier, build a TypenameType to describe the dependent
base type. I'd like to move more of this behavior up into the parser,
but this fixes PR6062.

llvm-svn: 93871
2010-01-19 06:46:48 +00:00
Douglas Gregor 5204248f96 When looking up enumerator names for redeclaration, use the
ForRedeclaration flag so that we don't look into base classes. 
Fixes PR6061.

llvm-svn: 93862
2010-01-19 06:06:57 +00:00
Fariborz Jahanian 42ffdb32fb Allow conversion of pointer to an objective-c pointer to
a similar pointer. Fixes radar 7552179.

llvm-svn: 93803
2010-01-18 22:59:22 +00:00
John McCall e15bbff98d Preserve type source information in compound literal expressions.
Patch by Enea Zaffanella!

llvm-svn: 93752
2010-01-18 19:35:47 +00:00
Fariborz Jahanian cdb8575c9b Mostly renaming some methods and updating comments to
reflect what these methods are actually doing. One method
template for future work. No change in functionality.

llvm-svn: 93742
2010-01-18 18:41:16 +00:00
Douglas Gregor c9b7a59b30 Improve source-location information for builtin TypeLocs, from Enea
Zaffanella (with a couple of my tweaks).

llvm-svn: 93733
2010-01-18 18:04:31 +00:00
Douglas Gregor 8c94086c90 Encoding calling conventions in the type system, from Charles Davis!
llvm-svn: 93726
2010-01-18 17:14:39 +00:00
Douglas Gregor 7f792cf329 Introduce a second queue of "local" pending implicit instantiation,
which are instantiations of the member functions of local
classes. These implicit instantiations have to occur at the same time
as---and in the same local instantiation scope as---the enclosing
function, since the member functions of the local class can refer to
locals within the enclosing function. This should really, really fix PR5764.

llvm-svn: 93666
2010-01-16 22:29:39 +00:00
Douglas Gregor f5974fa0d5 When we are instantiating a member function of a local class, be sure
to merge the local instantiation scope with the outer local
instantiation scope, so that we can instantiate declarations from the
function owning the local class. Fixes an assert while instantiating
Boost.MPL's BOOST_MPL_ASSERT_MSG.

llvm-svn: 93651
2010-01-16 20:21:20 +00:00
Douglas Gregor e1ad8a105a Partial fix for PR6022, where we were complaining when a friend
function template declared within a class template did not match a
function in another scope. We really need to rework how
friends-in-templates are semantically checked.

llvm-svn: 93642
2010-01-16 18:09:52 +00:00
Douglas Gregor 071676f422 Improve location information for Objective-C category declarations. We
previously only had a single location (the @ in @interface); now we
know where the @ is (for the start of the declaration), where the
class name is (that's the normal "location" now for diagnostics), and
where the category name is. Also, eliminated the redundant "end"
location, since ObjCContainerDecl already has better @end information.

The only XFAIL'd test is temporary; will un-XFAIL-it once I've taught
CIndex how to use the new locations.

llvm-svn: 93639
2010-01-16 16:38:58 +00:00
Douglas Gregor 002b671055 Keep track of the source locations for each protocol reference in
Objective-C classes, protocol definitions, forward protocol
declarations, and categories. This information isn't actually used
yet; that's coming next.

llvm-svn: 93636
2010-01-16 15:02:53 +00:00
John McCall 982adb518c Fix a use of uninitialized memory in overload diagnostics.
llvm-svn: 93629
2010-01-16 03:50:16 +00:00
Eli Friedman 1fcf66b0dd Make the AST explicitly represent the cast of the first operand of a
pointer-to-member operator.

llvm-svn: 93592
2010-01-16 00:00:48 +00:00
Mike Stump ea409449aa Generalize handling for unreachable code warnings to all binary operators.
llvm-svn: 93584
2010-01-15 23:33:51 +00:00
John McCall 3712d9e391 Candidates with arity mismatches are extra-special non-viable and need to
stand at the back of the line.

Thanks to Oliver Hunt for reminding me to do this.

llvm-svn: 93583
2010-01-15 23:32:50 +00:00
Mike Stump d4d6fb3374 Refine location reporting for unreachable code warnings for comma expressions.
llvm-svn: 93574
2010-01-15 23:17:13 +00:00
John McCall 7fe6e9c2f1 Make LookupResult::resolveKind() robust against NotFoundInCurrentInstantiation.
Fixes PR 6049.

llvm-svn: 93557
2010-01-15 21:27:01 +00:00
John McCall d377e04489 Preserve type source information for C++ named casts through template
instantiation.

llvm-svn: 93533
2010-01-15 19:13:16 +00:00
John McCall ebe5474148 Don't lose type source information when rebuilding C-style cast expressions.
Also we don't need to recheck for altivec initializers, I think.

llvm-svn: 93529
2010-01-15 18:56:44 +00:00
John McCall 9751396d70 Preserve type source information in explicit cast expressions.
Patch by Enea Zaffanella.

llvm-svn: 93522
2010-01-15 18:39:57 +00:00
Douglas Gregor 27b174f4c3 When determining whether the type is the current instantiation, strip
qualifiers. Fixes PR6021.

llvm-svn: 93513
2010-01-15 16:05:33 +00:00
John McCall 38836f0f39 Don't repeat lookup when instantiating resolved member expressions.
Adjust BuildMemberReferenceExpr to perform the inheritance check on implicit
member accesses, which can arise from unqualified lookups and therefore may
reference decls from enclosing class scopes.

Fixes PR 5838.

llvm-svn: 93510
2010-01-15 08:34:02 +00:00
Mike Stump 6a11229dc8 Refine unreachable warnings. WIP.
llvm-svn: 93500
2010-01-15 02:06:42 +00:00
Douglas Gregor d0d2ee0e4b When performing qualified name lookup into the current instantiation,
do not look into base classes if there are any dependent base
classes. Instead, note in the lookup result that we couldn't look into
any dependent bases. Use that new result kind to detect when this case
occurs, so that we can fall back to treating the type/value/etc. as a
member of an unknown specialization.

Fixes an issue where we were resolving lookup at template definition
time and then missing an ambiguity at template instantiation time.

llvm-svn: 93497
2010-01-15 01:44:47 +00:00
Chris Lattner 0b534d5969 fix grammaro
llvm-svn: 93452
2010-01-14 21:00:58 +00:00
Douglas Gregor 04b1152aac After dyn_cast'ing, it generally makes sense to check the *output* of
the dyn_cast against NULL rather than the *input*. Fixes PR6025.

llvm-svn: 93435
2010-01-14 18:13:22 +00:00
Douglas Gregor d2e6a45722 When qualified lookup into the current instantiation fails (because it
finds nothing), and the current instantiation has dependent base
classes, treat the qualified lookup as if it referred to an unknown
specialization. Fixes PR6031.

llvm-svn: 93433
2010-01-14 17:47:39 +00:00
Douglas Gregor fc59ce1ea4 Switch a few callers of MaybeAddResult over to AddResult, when the
declarations we're adding do not need any name-hiding checks.

llvm-svn: 93431
2010-01-14 16:14:35 +00:00
Douglas Gregor 2b8162b7d0 Switch code-completion's ivar lookup over to LookupVisibleDecls,
eliminating yet one more ResultBuilder::MaybeAddResult caller.

llvm-svn: 93430
2010-01-14 16:08:12 +00:00
Douglas Gregor 78a210145b Start migrating code-completion results from
ResultBuilder::MaybeAddResult over to ResultBuilder::AddResult.

llvm-svn: 93429
2010-01-14 16:01:26 +00:00
Douglas Gregor 09bbc651f4 Switch the remaining code completions over to LookupVisibleDecls,
after adding the ability to determine whether our lookup is a
base-class lookup. Eliminate CollectMemberLookupResults, since it is
no longer used (yay).

llvm-svn: 93428
2010-01-14 15:47:35 +00:00
Douglas Gregor 200c99dd1e Move code completion for qualified name lookup (foo::) to
LookupVisibleDecls. Also, a function does not hide another function.

llvm-svn: 93421
2010-01-14 03:35:48 +00:00
John McCall 4700099719 Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics.  Unfortunately, the non-overload diagnostics are not
this good.

llvm-svn: 93420
2010-01-14 03:28:57 +00:00
Douglas Gregor a6e2edcc3a Eliminate the code-completion-specifier CollectLookupResults in favor
of the more general LookupVisibleDecls.

llvm-svn: 93419
2010-01-14 03:27:13 +00:00
Douglas Gregor 6ae4c5278c Simplify the code-completion logic for nested-name-specifiers: rather
than traversing visible declarations twice, only perform one traversal
and recognize nested-name-specifiers as special.

llvm-svn: 93418
2010-01-14 03:21:49 +00:00
Mike Stump 0a7d9305f1 Don't assume a random access iterator, instead just use CFG::iterator.
Thanks Ted.

llvm-svn: 93413
2010-01-14 02:45:29 +00:00
Mike Stump 29ce3a3114 Avoid snowballing errors into additional warnings. To do better, we'd
need an error term for the CFG.  I suspect we'll always have to cope
with getCFG returning 0, though, I'd love to see even that possibility
removed.

llvm-svn: 93411
2010-01-14 02:26:52 +00:00
Douglas Gregor 69a8e083c5 When providing completions for a member access expression in C++,
provided nested-name-specifier results for base classes (only), rather
than everything that could possibly be a nested-name-specifier.

llvm-svn: 93398
2010-01-14 01:17:14 +00:00
Douglas Gregor c580c5205f Switch code-completion for ordinary names over to the new(ish)
LookupVisibleDecls, unifying the name lookup mechanisms used by code
completion and typo correction. Aside from the software-engineering
improvements, this makes code-completion see through using directives
and see ivars when performing unqualified name lookup in an
Objective-C instance method.

llvm-svn: 93397
2010-01-14 01:09:38 +00:00
John McCall a1709fd822 Improve the diagnostic for bad conversions in overload resolution to talk
about 'object argument' vs. 'nth argument'.

llvm-svn: 93395
2010-01-14 00:56:20 +00:00
Douglas Gregor e0717ab39c More refactoring of ResultBuilder::MaybeAddResult. No intended
functionality change.

llvm-svn: 93386
2010-01-14 00:41:07 +00:00
Douglas Gregor 7c208616b4 Refactor the "is this declaration interesting" logic in
code-completion's ResultBuilder::MaybeAddResult for later reuse.

llvm-svn: 93379
2010-01-14 00:20:49 +00:00
Douglas Gregor 0235c4243f Look through using declarations when determining whether one decl hides another
llvm-svn: 93378
2010-01-14 00:06:47 +00:00
Douglas Gregor f98e6a28e4 Banish the notion of a "rank" for code-completion results, since we
are no longer using it for anything. No intended functionality change.

llvm-svn: 93376
2010-01-13 23:51:12 +00:00
Douglas Gregor 52ce62f069 Improve the sorting of code-completion results. We now always sort by
the "typed" text, first, then take into account
nested-name-specifiers, name hiding, etc. This means that the
resulting sort is actually alphabetical :)

llvm-svn: 93370
2010-01-13 23:24:38 +00:00
John McCall e8c8cd2a58 Don't report ambiguities in the user-defined conversion if we weren't supposed
to be considering user-defined conversions in the first place.

Doug, please review;  I'm not sure what we should be doing if we see a real
ambiguity in selecting a copy constructor when otherwise suppressing
user-defined conversions.

Fixes PR6014.

llvm-svn: 93365
2010-01-13 22:30:33 +00:00