John McCall [Thu, 14 Jan 2010 20:11:39 +0000 (20:11 +0000)]
Pre-emptive bugfixes in the diagnostics code: allow arbitrary punctuation
characters to be escaped and implement a scan-forward function which
properly respects brace nesting.
Douglas Gregor [Thu, 14 Jan 2010 17:47:39 +0000 (17:47 +0000)]
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.
Douglas Gregor [Thu, 14 Jan 2010 15:47:35 +0000 (15:47 +0000)]
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).
David Chisnall [Thu, 14 Jan 2010 14:08:19 +0000 (14:08 +0000)]
Made ObjC method name mangling match GCC (which does it in a stupid and broken way that can give conflicts on method names containing underscores, but is needed for gdb to work because gdb does not know how to read ObjC class tables and relies on the mangling).
John McCall [Thu, 14 Jan 2010 03:28:57 +0000 (03:28 +0000)]
Improve overload diagnostics some more by calling out qualifier mismatches
for special diagnostics. Unfortunately, the non-overload diagnostics are not
this good.
Douglas Gregor [Thu, 14 Jan 2010 03:21:49 +0000 (03:21 +0000)]
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.
Mike Stump [Thu, 14 Jan 2010 02:26:52 +0000 (02:26 +0000)]
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.
Douglas Gregor [Thu, 14 Jan 2010 01:17:14 +0000 (01:17 +0000)]
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.
Douglas Gregor [Thu, 14 Jan 2010 01:09:38 +0000 (01:09 +0000)]
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.
John McCall [Thu, 14 Jan 2010 00:50:32 +0000 (00:50 +0000)]
Add the %ordinal format modifier for turning '1' into '1st'. Hard-coded for
English right now; would not be impossible to grab a special format string
from the diagnostic pool and localize that way.
Devang Patel [Thu, 14 Jan 2010 00:48:09 +0000 (00:48 +0000)]
Because CurLoc is the current source location as far as CGDebugInfo is concerned. It is expected that this is set (usually left bracket location of function body compound statement) before EmitfunctionStart() is used.
Douglas Gregor [Wed, 13 Jan 2010 23:24:38 +0000 (23:24 +0000)]
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 :)
John McCall [Wed, 13 Jan 2010 22:30:33 +0000 (22:30 +0000)]
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.
Ted Kremenek [Wed, 13 Jan 2010 21:46:36 +0000 (21:46 +0000)]
Reorganize CIndex.cpp into clearer sections of functions, and add a utility function 'MakeCXCursor' to centralize the logic for creating CXCursor objects.
Douglas Gregor [Wed, 13 Jan 2010 21:24:21 +0000 (21:24 +0000)]
Whenever completing ordinary names for an Objective-C source, also
provide completions for @ keywords. Previously, we only provided
@-completions after an @ was actually typed, which is useful but
probably not the common case.
Also, make sure a few Objective-C 2.0 completions only show up when
Objective-C 2.0 support is enabled (the default).
Douglas Gregor [Wed, 13 Jan 2010 17:31:36 +0000 (17:31 +0000)]
Reimplement constructor declarator parsing to cope with template-ids
that name constructors, the endless joys of out-of-line constructor
definitions, and various other corner cases that the previous hack
never imagined. Fixes PR5688 and tightens up semantic analysis for
constructor names.
Additionally, fixed a problem where we wouldn't properly enter the
declarator scope of a parenthesized declarator. We were entering the
scope, then leaving it when we saw the ")"; now, we re-enter the
declarator scope before parsing the parameter list.
Note that we are forced to perform some tentative parsing within a
class (call it C) to tell the difference between
C(int); // constructor
and
C (f)(int); // member function
which is rather unfortunate. And, although it isn't necessary for
correctness, we use the same tentative-parsing mechanism for
out-of-line constructors to improve diagnostics in icky cases like:
C::C C::f(int); // error: C::C refers to the constructor name, but
// we complain nicely and recover by treating it as
// a type.
John McCall [Wed, 13 Jan 2010 09:16:55 +0000 (09:16 +0000)]
Record some basic information about bad conversion sequences. Use that
information to feed diagnostics instead of regenerating it. Much room for
improvement here, but fixes some unfortunate problems reporting on method calls.
Sean Hunt [Wed, 13 Jan 2010 09:01:02 +0000 (09:01 +0000)]
Implement semantic checking for C++ literal operators.
This now rejects literal operators that don't meet the requirements.
Templates are not yet checked for.
Sean Hunt [Wed, 13 Jan 2010 08:31:49 +0000 (08:31 +0000)]
Add a bunch more feature-checking macros for C++0x features. Some of these are
disabled with the intent that users can start with them now and not have to change
a thing to have them work when we implement the features.
John McCall [Wed, 13 Jan 2010 06:44:51 +0000 (06:44 +0000)]
Insert clang-flags into the clang command. Currently it needs to be a list;
future work should permit strings (by splitting them into a list o' strings).
Daniel Dunbar [Wed, 13 Jan 2010 00:48:06 +0000 (00:48 +0000)]
cc1: Factor out CompilerInstance::ExecuteAction which has the majority of the
clang -cc1 logic for running an action against a set of options.
- This should make it easier to build tools that have a clang -cc1 like
interface, but aren't actually part of clang -cc1.
John McCall [Wed, 13 Jan 2010 00:25:19 +0000 (00:25 +0000)]
Improve the reporting of non-viable overload candidates by noting the reason
why the candidate is non-viable. There's a lot we can do to improve this, but
it's a good start. Further improvements should probably be integrated with the
bad-initialization reporting routines.
Ted Kremenek [Wed, 13 Jan 2010 00:13:47 +0000 (00:13 +0000)]
Make method definitions in TUVisitor out-of-line, making it easy to tell what visitor methods are defined.
Generalize TUVisitor to take a general "root" and "iterator" callback; this is prep. work to merging TUVisitor and CDeclVisitor.
Douglas Gregor [Wed, 13 Jan 2010 00:12:48 +0000 (00:12 +0000)]
Remove broken fix-it when a default function argument has been
redefined. There's a FIXME with an apology about why we don't try to
do better here. Fixes <rdar://problem/7513023>.
Douglas Gregor [Tue, 12 Jan 2010 23:18:54 +0000 (23:18 +0000)]
Don't emit string-comparison or self-comparison warnings in
unevaluated contexts, because they only matter for code that will
actually be evaluated at runtime.
As part of this, I had to extend PartialDiagnostic to support fix-it
hints.
Douglas Gregor [Tue, 12 Jan 2010 21:28:44 +0000 (21:28 +0000)]
Improve recovery for template-ids whose template-name doesn't actually
name a template, when they occur in a base-specifier. This is one of
the (few) places where we know for sure that an identifier followed by
a '<' must be a template name, so we can diagnose and recover well:
Chandler Carruth [Tue, 12 Jan 2010 20:32:25 +0000 (20:32 +0000)]
Fix the CodeGen half of PR5911 by changing reference initialization to
correctly look through arrays to see cv-qualifiers. Also enhances the routine
for doing this to preserve more type sugaring for diagnostics.
Douglas Gregor [Tue, 12 Jan 2010 17:52:59 +0000 (17:52 +0000)]
Parse dependent template-ids in base clauses and member
initializers. This isn't actually in the C++ grammar (in any version),
but that's clearly an oversight: both GCC and EDG support this syntax,
and it's used within Boost code. I'll file a core issue proposing
precisely the change made here. Fixes PR6008.
Douglas Gregor [Tue, 12 Jan 2010 17:06:20 +0000 (17:06 +0000)]
When determining whether a given name is a template in a dependent
context, do not attempt typo correction. This harms performance (as
Abramo noted) and can cause some amusing errors, as in this new
testcase.
John McCall [Tue, 12 Jan 2010 07:18:19 +0000 (07:18 +0000)]
So I was sitting around, trying vainly to think of something to commit, and then
I said to myself, self, why don't you go add a couple of parameters to a method
and then fail to use them, and I thought that sounded like a pretty good idea,
so I did it.
John McCall [Tue, 12 Jan 2010 02:15:36 +0000 (02:15 +0000)]
Reorganize some of the code to note overload candidates. Improves the
fidelity with which we note them as functions/constructors and templates
thereof. Also will be helpful when reporting bad conversions (next).