Douglas Gregor [Wed, 13 Oct 2010 22:19:53 +0000 (22:19 +0000)]
Generalize the checking for qualification of (non-friend) class
members. Provide a hard error when the qualification doesn't match the
current class type, or a warning + Fix-it if it does match the current
class type. Fixes PR8159.
Douglas Gregor [Wed, 13 Oct 2010 20:41:14 +0000 (20:41 +0000)]
There is no reason for dereferencing a pointer-to-member to require
that the class type into which the pointer points be complete, even
though the standard requires it. GCC/EDG do not require a complete
type here, so we're calling this a problem with the standard. Fixes
PR8328.
Douglas Gregor [Wed, 13 Oct 2010 18:05:20 +0000 (18:05 +0000)]
Introduce a bit into Type that keeps track of whether there are any
unnamed or local types within that type. This bit is cached along with
the linkage of a type, so that it can be recomputed (e.g., when we see
that a typedef has given a name to an anonymous declaration).
Use this bit when checking C++03 [temp.arg.type]p2, so that we don't
walk template argument types repeatedly.
Douglas Gregor [Wed, 13 Oct 2010 17:22:14 +0000 (17:22 +0000)]
Fix a silly bug in the suppression of non-error diagnostics in a
SFINAE context, where we weren't getting the right diagnostic argument
count. I blame DiagnosticBuilder's weirdness. Fixes PR8372.
Douglas Gregor [Wed, 13 Oct 2010 16:58:14 +0000 (16:58 +0000)]
Compute whether a type is variably modified as we build the type,
rather than walking the type's structure every time we request this
information. Performance optimization; no functionality change.
John McCall [Wed, 13 Oct 2010 05:45:15 +0000 (05:45 +0000)]
Support friend function declarations in local classes correctly.
Fixes a crash and diagnoses the error condition of an unqualified
friend which doesn't resolve to something. I'm still not certain how
this is useful.
Douglas Gregor [Wed, 13 Oct 2010 00:27:52 +0000 (00:27 +0000)]
Teach the warning about unnamed/local types in template arguments to
actually walk the template argument type to find any unnamed/local
types within it. Fixes PR6784.
Douglas Gregor [Tue, 12 Oct 2010 23:32:35 +0000 (23:32 +0000)]
Introduce support for emitting diagnostics (warnings + their notes)
that are suppressed during template argument deduction. This change
queues diagnostics computed during template argument deduction. Then,
if the resulting function template specialization or partial
specialization is chosen by overload resolution or partial ordering
(respectively), we will emit the queued diagnostics at that point.
This addresses most of PR6784. However, the check for unnamed/local
template arguments (which existed before this change) is still only
skin-deep, and needs to be extended to look deeper into types. It must
be improved to finish PR6784.
John McCall [Tue, 12 Oct 2010 23:13:28 +0000 (23:13 +0000)]
Handle dependent friends more explicitly and deal with the possibility
of templated-scope friends by marking them invalid and white-listing all
accesses until such time as we implement them. Fixes a crash, this time
without a broken test case.
John McCall [Tue, 12 Oct 2010 19:40:14 +0000 (19:40 +0000)]
Enter the context of the declared function template when performing
deduction and the final substitution, but not while substituting the
explicit template arguments. Fixes rdar://problem/8537391
Douglas Gregor [Tue, 12 Oct 2010 18:51:08 +0000 (18:51 +0000)]
When finalizing a function template specialization following template
argument deduction, make sure to check the correctness of deduced template
type arguments (which we had previously skipped) along with other
kinds of template arguments. This fixes part of PR6784, but we're
still swallowing the extension warning about unnamed/local template
arguments.
Douglas Gregor [Tue, 12 Oct 2010 18:23:32 +0000 (18:23 +0000)]
If we end up instantiating a function parameter whose default argument
has not yet been parsed, note that the default argument hasn't been
parsed and keep track of all of the instantiations of that function
parameter. When its default argument does get parsed, imbue the
instantiations with that default argument. Fixes PR8245.
Francois Pichet [Tue, 12 Oct 2010 01:01:43 +0000 (01:01 +0000)]
This patch remove the Win32 XFAIL from remap-complete.c
The problem was that text files were open in text mode and Microsoft implementation of fread and write will try to do nasty line-feed conversion which make the line position no longer valid. The fix is to read and write files in binary mode.
Douglas Gregor [Tue, 12 Oct 2010 00:50:20 +0000 (00:50 +0000)]
When we load an ASTUnit from command-line arguments, hold on to the
diagnostics produced by the driver itself. Previously, we were
allowing these to either be dropped or to slip through to stderr.
John McCall [Tue, 12 Oct 2010 00:20:44 +0000 (00:20 +0000)]
Add some infrastructure for dealing with expressions of 'placeholder' type,
i.e. expressions with an internally-convenient type which should not be
appearing in generally valid, complete ASTs.
Douglas Gregor [Mon, 11 Oct 2010 23:17:59 +0000 (23:17 +0000)]
Eliminate CIndexer::getClangPath(), since libclang no longer depends
on the presence of a 'clang' executable. Simplify
CIndexer::getClangResourcesPath() a bit.
Patch up the CMake makefiles to install headers into two locations in
the build tree, for those silly cases where 'clang' will end up
looking into the wrong build directory for headers.
Douglas Gregor [Mon, 11 Oct 2010 22:02:06 +0000 (22:02 +0000)]
Eliminate -fdiagnostics-binary and all of the infrastructure for
emitting diagnostics in a binary form to be consumed by libclang,
since libclang no longer does any of its work out-of-process, making
this code dead. Besides, this stuff never worked at 100% anyway.
Douglas Gregor [Mon, 11 Oct 2010 21:37:58 +0000 (21:37 +0000)]
Switch c-index-test from clang_codeComplete() over to
clang_codeCompleteAt(). This uncovered a few issues with the latter:
- ASTUnit wasn't saving/restoring diagnostic state appropriately between
reparses and code completions.
- "Overload" completions weren't being passed through to the client
This patch does a few things in the area of objective-c
properties.
1. Generates the AST for lexical info. of accessing
getter/setter methods using dot-syntax notation.
This fixes //rdar: //8528170.
2. Modifes rewriter to handle the AST putout in 1.
3. Supportes in rewriter ObjCImplicitSetterGetter ASTs.
Douglas Gregor [Mon, 11 Oct 2010 16:52:23 +0000 (16:52 +0000)]
Eliminate clang_setUseExternalASTGeneration() from libclang. Between
improvements to the compiler and the introduction of crash recovery,
it no longer makes sense to allow this mode. Moreover, this eliminates
one use of the "clang" executable from within libclang; we'd like them
all to go away.
Axel Naumann [Mon, 11 Oct 2010 09:18:43 +0000 (09:18 +0000)]
Declare argv parameters as const char* const* instead of to char** to clarify that they are not modified, and to allow for string literals as arguments.
Chris Lattner [Mon, 11 Oct 2010 05:44:49 +0000 (05:44 +0000)]
Per discussion with Sanjiv, remove the PIC16 target from mainline. When/if
it comes back, it will be largely a rewrite, so keeping the old codebase
in tree isn't helping anyone.
NAKAMURA Takumi [Mon, 11 Oct 2010 02:27:37 +0000 (02:27 +0000)]
lib/Frontend/InitHeaderSearch.cpp: Fix compatibility to Cygming.
- lib/gcc/include should not be included. Clang oughta have alternatives. (PR7956)
- Cygwin: /usr/include/w32api should be included. gcc/cygwin does.
- gcc/cygwin uses gcc paths as /usr/lib not /lib. They are same on Cygwin environment, though, We have to take what gcc/cygwin does.
- Cygwin-1.7: Use 4.3.4.
- Cygwin-1.5: Use 4.3.2 for gcc-4.
Benjamin Kramer [Sat, 9 Oct 2010 15:49:00 +0000 (15:49 +0000)]
Don't rely on a StringRef being null-terminated (it's not) for deprecation messages.
Store pointer and length of the message in DelayedDiagnostic and hide the gory union details.
Method implemented in class's implementation may implement
one declared in class's extension and not one declared
in class's superclass. This supresses a bogus warning on
method type mismatch.
Fixes //rdar: // 8530080
When dealing with an assignment with LHS being a property reference
expression, the entire assignment tree is rewritten into a property
setter messaging. This includes rewriting the RHS.
Do not attempt to rewrite RHS again. Never rewrite a rewritten text!
Fixes //rdar: //8527018.
Douglas Gregor [Fri, 8 Oct 2010 20:56:19 +0000 (20:56 +0000)]
Revert the hack Chris Lattner added in r97981 to work around
brokenness in the designated-initializer ASTs. The ASTs were fixed by
Alp Toker's patch (r116098) for PR6955. Fixes PR6537.
Douglas Gregor [Fri, 8 Oct 2010 20:44:28 +0000 (20:44 +0000)]
This patch fixes multiple issues in clang's designated init builder and
completes support for C1X anonymous struct/union init features:
* Indexed anonymous member initializers should not be expanded. Doing so makes
little sense and would cause unresolvable semantic ambiguity in valid code
(regression introduced by r69153).
* Subobject initialization of (possibly nested) anonymous members are now
referred to with paths relative to the naming record context, eliminating the
synthesis of incorrect implicit InitListExprs that caused CodeGen to assert.
* Field lookup was missing a null check in IdentifierInfo comparison which
caused lookup for a known (already resolved) field to match the first unnamed
data member it encountered leading to silent miscompilation.
* Subobject paths are no longer built using the general purpose
Sema::BuildAnonymousStructUnionMemberPath(). If any corner cases crop up, we
will now assert earlier in Sema instead of passing invalid InitListExprs
through to CodeGen.