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.
Daniel Dunbar [Thu, 8 Apr 2010 02:59:45 +0000 (02:59 +0000)]
IRgen: Move the bit-field access type into CGBitFieldInfo, and change bit-field LValues to just store the base address of object containing the bit-field.
When a template (without arguments) is passed as a template type
parameter, explicitly ask the user to give it arguments. We used to
complain that it wasn't a type and expect the user to figure it out.
Sean Hunt [Wed, 7 Apr 2010 23:11:06 +0000 (23:11 +0000)]
Implement checking for template literal operator functions. This
code won't actually get used yet because we don't handle non-type
parameter packs, but when we do, this code should jump in and work.
Chris Lattner [Wed, 7 Apr 2010 20:49:23 +0000 (20:49 +0000)]
add a new driver-level -ferror-limit=412 option, which causes clang to stop
emitting diagnostics after it has produced that many errors. Give this a
default value of 20 which produces plenty of errors for people to fix before
recompiling but not so many that their entire console scrolls away when the
compiler gets confused. The experience looks like this:
$ clang foo.c
<tons of crap>
foo.c:102:3: error: unknown type name 'somethingbad'
somethingbad x;
^
fatal error: too many errors emitted, stopping now
36 warnings and 20 errors generated.
Douglas Gregor [Wed, 7 Apr 2010 20:29:57 +0000 (20:29 +0000)]
Return early from Sema::MarkDeclarationReferenced when we know there
isn't any extra work to perform. Also, don't check for unused
parameters when the warnings will be suppressed anyway. Improves
performance of -fsyntax-only on 403.gcc's combine.c by ~2.5%.
<rdar://problem/7836787>
Douglas Gregor [Wed, 7 Apr 2010 17:57:12 +0000 (17:57 +0000)]
Improve handling of friend types in several ways:
- When instantiating a friend type template, perform semantic
analysis on the resulting type.
- Downgrade the errors concerning friend type declarations that do
not refer to classes to ExtWarns in C++98/03. C++0x allows
practically any type to be befriended, and ignores the friend
declaration if the type is not a class.
Douglas Gregor [Wed, 7 Apr 2010 16:53:43 +0000 (16:53 +0000)]
Split Sema::ActOnFriendTypeDecl into Sema::CheckFriendTypeDecl (for
semantic analysis) and Sema::ActOnFriendTypeDecl (the action
callback). This is a prerequisite for improving template instantiation
of friend type declarations.
Chris Lattner [Wed, 7 Apr 2010 05:46:54 +0000 (05:46 +0000)]
a ridiculous amount of propagation through the backend later,
have the code generate slap a srcloc metadata on inline asm nodes.
This allows us to diagnose invalid inline asms with such nice
diagnostics as: