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.
Add static analyzer check for calls to 'pthread_once()' where the control-flow has
automatic storage. This matches the corresponding check for 'dispatch_once()'.
Remove micro-optimization for not issueing CFG-based warnings for 'static inline' functions
unless they are used. I discussed this with Daniel Dunbar, and we agreed that this
provides an inconsistent warnings experience for the user and that there were
genuine cases where we wouldn't want to do this optimization.
Douglas Gregor [Thu, 8 Apr 2010 18:16:15 +0000 (18:16 +0000)]
Introduce an egregious hack to work around a bug in libstdc++ 4.2.x's
<tr1/hashtable> header, where a friend class template
std::tr1::__detail::_Map_base is declared with the wrong template
parameters. GCC doesn't catch the problem, so Clang does a little
back-flip to avoid diagnosing just this one instance of the problem.
Make CXXScopeSpec invalid when incomplete, and propagate that into any
Declarator that depends on it. This fixes several redundant errors and bad
recoveries.
Douglas Gregor [Thu, 8 Apr 2010 15:52:03 +0000 (15:52 +0000)]
Eliminate excessive PCH deserialization caused by the search for
__cxxabiv1::__fundamental_type_info in every translation
unit. Previously, we would perform name lookup for
__cxxabiv1::__fundamental_type_info at the end of IRGen for a each
translation unit, to determine whether it was present. If so, we we
produce type information for all of the fundamental types. However,
this name lookup causes PCH deserialization of a significant part of the
translation unit, which has a woeful impact on performance.
With this change, we now look at each record type after we've
generated its vtable to see if it is
__cxxabiv1::__fundamental_type_info. If so, we generate type info for
all of the fundamental types. This works because
__cxxabiv1::__fundamental_type_info should always have a key function
(typically the virtual destructor), that will be defined once in the
support library. The fundamental type information will end up there.