Douglas Gregor [Mon, 12 Apr 2010 17:09:20 +0000 (17:09 +0000)]
When creating the implicitly-declared special member functions, be
sure to introduce them into the current Scope (when we have one) in
addition to the DeclContext for the class, so that they can be found
by name lookup for inline members of the class. Fixes PR6570.
Douglas Gregor [Mon, 12 Apr 2010 16:00:01 +0000 (16:00 +0000)]
Fix a crash-on-invalid involving name lookup of tag names, where we
ended up finding a function template that we didn't expect. Recover
more gracefully, and fix a similar issue for class templates.
Douglas Gregor [Mon, 12 Apr 2010 07:51:13 +0000 (07:51 +0000)]
Add another test case for r101029, which verifies that we now
correctly diagnose instantiation of a function parameter with Objective-C
class type (since Objective-C classes can't be passed by value).
Douglas Gregor [Mon, 12 Apr 2010 07:48:19 +0000 (07:48 +0000)]
Be sure to instantiate the parameters of a function, even when the
function's type is (strictly speaking) non-dependent. This ensures
that, e.g., default function arguments get instantiated properly.
And, since I couldn't resist, collapse the two implementations of
function-parameter instantiation into calls to a single, new function
(Sema::SubstParmVarDecl), since the two had nearly identical code (and
each had bugs the other didn't!). More importantly, factored out the
semantic analysis of a parameter declaration into
Sema::CheckParameter, which is called both by
Sema::ActOnParamDeclarator (when parameters are parsed) and when a
parameter is instantiated. Previously, we were missing some
Objective-C and address-space checks on instantiated function
parameters.
Augment clang_getCursorUSR() to not always expect that clang_getCursorDecl() does the right
thing if the cursor is not a decl (such as in the case of macros).
Chris Lattner [Sun, 11 Apr 2010 08:28:14 +0000 (08:28 +0000)]
fix PR6811 by not parsing 'super' as a magic expression in
LookupInObjCMethod. Doing so allows all sorts of invalid code
to slip through to codegen. This patch does not change the
AST representation of super, though that would now be a natural
thing to do since it can only be in the receiver position and
in the base of a ObjCPropertyRefExpr.
There are still several ugly areas handling super in the parser,
but this is definitely a step in the right direction.
Chris Lattner [Sun, 11 Apr 2010 07:51:10 +0000 (07:51 +0000)]
actually the interface grossness in the previous patch was due to
typo correction. However, now that the code has been factored out
of LookupMemberExpr, it can recurse to itself instead of to
LookupMemberExpr! Remove grossness.
Chris Lattner [Sun, 11 Apr 2010 07:45:24 +0000 (07:45 +0000)]
factor the code that handles "expr.field" when expr is a
pointer to an objc interface out to a method in SemaExprObjC.
This is *much* uglier than it should be due to grossness in
LookupMemberExpr :(
Daniel Dunbar [Sat, 10 Apr 2010 18:18:57 +0000 (18:18 +0000)]
Driver: Only add extra -L paths on darwin if they exist. Unfortunately, this
means it isn't really possible to write the test case for this code, but this is
the kind of thing that really requires testing against the installed compiler
anyway.
John McCall [Sat, 10 Apr 2010 09:28:51 +0000 (09:28 +0000)]
Diagnose more cases of initializing distinct members of an anonymous union
member. Use a better diagnostic for this case. Also fix a bug with nested
anonymous structs/unions for -Wreorder; this last was PR6575.
John McCall [Sat, 10 Apr 2010 07:37:23 +0000 (07:37 +0000)]
Diagnose misordered initializers in constructor templates immediately instead of
when they're instantiated. Merge the note into the -Wreorder warning; it
doesn't really contribute much, and it was splitting a thought across diagnostics
anyway. Don't crash in the parser when a constructor's initializers end in a
comma and there's no body; the recovery here is still terrible, but anything's
better than a crash.
Daniel Dunbar [Sat, 10 Apr 2010 01:24:22 +0000 (01:24 +0000)]
Driver/Darwin/x86: When linking, incorporate -L paths based on the path where
Clang is installed. This is designed to match gcc, and is important when
installed in a non-standard location.
- This is gross, but no worse than ever. It will die when we finally move to
the compiler-rt based toolchain, any day now.
Daniel Dunbar [Sat, 10 Apr 2010 01:17:16 +0000 (01:17 +0000)]
Disable diag::err_file_modified on Win32 completely, until someone cares to fix
it. PR6812.
- This is another attempt at silencing annoying buildbot failures.
John McCall [Fri, 9 Apr 2010 22:26:14 +0000 (22:26 +0000)]
Provide an extremely unsatisfactory diagnostic (instead of crashing) when
mangling an unknown expression kind. Also conveniently tells the user what
kind of expression they should add to the mangler!
Douglas Gregor [Fri, 9 Apr 2010 21:30:38 +0000 (21:30 +0000)]
When upgrading an Objective-C class from a forward declaration to a
full-fledged @interface, be sure that the declaration has the right
lexical context. <rdar://problem/7827709>
Douglas Gregor [Fri, 9 Apr 2010 21:02:29 +0000 (21:02 +0000)]
Only complain about explicit instantiations following explicit
specializations when the explicit instantiation was... explicitly
written, i.e., not the product of an explicit instantiation of an
enclosing class. Fixes this spurious warning when Clang builds LLVM:
/Volumes/Data/dgregor/Projects/llvm/lib/CodeGen/MachineDominators.cpp:22:1:
warning: explicit instantiation of 'addRoot' that occurs after an
explicit specialization will be ignored (C++0x extension) [-pedantic]
Remove fixit for string literal comparison. Telling the user to use 'strcmp' is bad, and
we don't have enough information to tell them how to use 'strncmp'. Instead, change the
diagnostic to indicate they should use 'strncmp'.
John McCall [Fri, 9 Apr 2010 19:03:51 +0000 (19:03 +0000)]
Turn access control on by default in -cc1.
Remove -faccess-control from -cc1; add -fno-access-control.
Make the driver pass -fno-access-control by default.
Update a bunch of tests to be correct under access control.
John McCall [Fri, 9 Apr 2010 19:01:14 +0000 (19:01 +0000)]
Suppress access control diagnostics when looking up a base or member name
fails to find a type. There are no cases where it's valid for this to produce
an error.
Douglas Gregor [Fri, 9 Apr 2010 17:53:29 +0000 (17:53 +0000)]
Improve diagnostics like "initializing <type> from an expression of
type..." with "initializing <type> with an expression of type...",
which reads better. Thanks to John for the improved wording.
Douglas Gregor [Fri, 9 Apr 2010 17:41:13 +0000 (17:41 +0000)]
Remove all "used" static functions *after* we have performed all of
the implicit template instantiations we need to perform. Otherwise, we
end up erroneously diagnosing static functions as used if they were
only used within an implicit template instantiation. Fixes a bunch of
spurious failures when building Clang with Clang.
Douglas Gregor [Fri, 9 Apr 2010 15:54:22 +0000 (15:54 +0000)]
On Windows, disable the modification-time check for files used in
precompiled headers and/or when reading the contents of the file into
memory. These checks seem to be causing spurious regression-test
failures on Windows.
Douglas Gregor [Fri, 9 Apr 2010 00:35:39 +0000 (00:35 +0000)]
Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as
We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:
t.c:2:9: warning: initializing 'char *' from an expression of type
'char const [2]' discards qualifiers [-pedantic]
char *name = __func__;
^ ~~~~~~~~
For 'open' check in UnixAPIChecker, hard code value of 'O_CREAT' on Darwin.
This is still not an ideal solution, but should disable the check for other
targets where the value of O_CREAT is different.
Douglas Gregor [Thu, 8 Apr 2010 21:33:23 +0000 (21:33 +0000)]
Downgrade the "declaration does not declare anything" error to a
warning. It's not harmful to have such pointless declarations, and GCC
does not diagnose this issue consistently.