Ted Kremenek [Thu, 13 Oct 2011 18:50:06 +0000 (18:50 +0000)]
Tweak -Wuninitialized's handling of 'int x = x' to report that as the root cause of an uninitialized variable IFF there are other uses of that uninitialized variable. Fixes <rdar://problem/9259237>.
Douglas Gregor [Wed, 12 Oct 2011 20:35:48 +0000 (20:35 +0000)]
When we determine that a function template specialization produced as
part of template argument deduction is ill-formed, we mark it as
invalid and treat it as a deduction failure. If we happen to find that
specialization again, treat it as a deduction failure rather than
silently building a call to the declaration.
Fixes PR11117, a marvelous bug where deduction failed after creating
an invalid specialization, causing overload resolution to pick a
different candidate. Then we performed a similar overload resolution
later, and happily picked the invalid specialization to
call... resulting in a silent link failure.
Bob Wilson [Wed, 12 Oct 2011 19:55:31 +0000 (19:55 +0000)]
Change __extension__ to disable only diagnostics controlled by -pedantic.
This changes clang to match GCC's behavior for __extension__, which temporarily
disables the -pedantic flag. Warnings that are enabled without -pedantic
are not affected. Besides the general goodness of matching GCC's precedent,
my motivation for this is that macros in the arm_neon.h header need to use
__extension__ to avoid pedantic complaints about their use of statement
expressions, yet we still want to warn about incompatible pointer arguments
for those macros.
Rafael Espindola [Wed, 12 Oct 2011 19:51:18 +0000 (19:51 +0000)]
Add returns_twice to functions that are known to return twice. This implements
the same behavior of gcc by keeping the attribute out of the function type.
Douglas Gregor [Wed, 12 Oct 2011 19:26:40 +0000 (19:26 +0000)]
Switch diagnostic text from "C++0x" over to "C++11".
We'd also like for "C++11" or "c++11" to be used for the warning
groups, but without removing the old warning flags. Patches welcome;
I've run out of time to work on this today.
Douglas Gregor [Wed, 12 Oct 2011 16:37:45 +0000 (16:37 +0000)]
Introduce BalancedDelimiterTracker, to better track open/close
delimiter pairs and detect when we exceed the implementation limit for
nesting depth, from Aaron Ballman!
Douglas Gregor [Wed, 12 Oct 2011 15:40:49 +0000 (15:40 +0000)]
Teach __has_nothrow_assign not to complain about access (GCC and EDG
ignore access entirely for it) and not to crash on assignment operator
templates. Fixes PR11110.
Richard Smith [Wed, 12 Oct 2011 00:37:51 +0000 (00:37 +0000)]
Handle Perforce-style conflict markers like normal conflict markers. Perforce
swaps over the <<<< and >>>> markers, and uses shorter markers than traditional
tools.
John McCall [Tue, 11 Oct 2011 23:14:30 +0000 (23:14 +0000)]
Catch placeholder types in DefaultLvalueConversion
and DefaultFunctionArrayLvalueConversion. To prevent
significant regression for should-this-be-a-call fixits,
and to repair some such regression from the introduction of
bound member placeholders, make those placeholder checks
try to build calls appropriately. Harden the build-a-call
logic while we're at it.
Eric Christopher [Tue, 11 Oct 2011 23:00:55 +0000 (23:00 +0000)]
Start handling debug line and scope information better:
Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.
Richard Smith [Tue, 11 Oct 2011 19:57:52 +0000 (19:57 +0000)]
Add a -Wc++0x-compat warning for C++11 keywords used as identifiers when in
C++98 mode. Only the first occurrence of each keyword will produce a warning.
Daniel Dunbar [Tue, 11 Oct 2011 18:20:16 +0000 (18:20 +0000)]
Driver: Add support for a new -nostdlibinc option.
- This disables the system include directories, but not the compiler builtin
directories. Useful for projects that want to use things like the intrinsic
headers, but are otherwise freestanding.
- I'm willing to reconsider the option naming, I also considered providing an
explicit -builtinc (which would match -nobuiltininc), but this is more
consistent with existing options.
Kaelyn Uhrain [Tue, 11 Oct 2011 01:02:41 +0000 (01:02 +0000)]
Add typo correction for type names.
The main motivation was to do typo correction in C++ "new" statements,
though picking it up in other places where type names are expected was
pretty much a freebie.
Douglas Gregor [Mon, 10 Oct 2011 23:37:54 +0000 (23:37 +0000)]
Make sure we initialize the "extra" data within the libclang code
completion context, in case we end up having no code-completion
callback. Individual instances of this problem are always bugs that
need to be fixed, but it's better to make sure we have initialized
data here.
Ted Kremenek [Mon, 10 Oct 2011 22:36:28 +0000 (22:36 +0000)]
Rework construction of CXXForRangeStmt not to recycle the same DeclRefExpr in multiple subexpressions. This breaks the tree structure
of the AST and completely breaks the CFG invariants.
Patch by Jim Goodnow II and reviewed by Richard Smith!
[libclang] Implement ConcurrencyCheck using a recursive mutex to allow re-entrancy in the same thread.
The checks are performed only in DEBUG, it becomes no-op in release mode.
Douglas Gregor [Mon, 10 Oct 2011 18:59:29 +0000 (18:59 +0000)]
When substituting into a sizeof parameter pack expression in a context
where we can't expand (i.e., multi-level substitution), be sure to
substitute the pack with its level-reduced pack. Fixes PR10230.
Chad Rosier [Mon, 10 Oct 2011 18:44:24 +0000 (18:44 +0000)]
When an included non-system directory duplicates a system directory the clang
frontend removes the non-system directory to maintain gcc compatibility. When
this happens NumAngled needs to be updated.
PR11097
Richard Smith [Mon, 10 Oct 2011 18:28:20 +0000 (18:28 +0000)]
Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
behaviour.
- Factor out evaluation of bitfield bit widths.
- Fix a few places which would evaluate an expression twice: once to determine
whether it is a constant expression, then again to get the value.
Douglas Gregor [Mon, 10 Oct 2011 18:15:57 +0000 (18:15 +0000)]
Don't suggest 'noreturn' for function template instantiations, because
it might be wrong for other instantiations of the same function
template. Fixes PR10801.
Sebastian Redl [Mon, 10 Oct 2011 18:10:00 +0000 (18:10 +0000)]
Now that we support move generation, mention this in the language extension and C++ status pages. Also update the C++ status for default functions, which are complete now that we can generate move functions, and destructor exception specifications, which I did a while ago.
Richard Smith [Mon, 10 Oct 2011 16:38:04 +0000 (16:38 +0000)]
constexpr: Disable checking of constructor member initializer lists for
constexpr constructor templates. Such checking is optional, and currently hard
to get right since clang doesn't generate implicit member initializers until
instantiation (even for non-dependent members).
This is needed for clang to accept libstdc++ from g++4.6 in c++0x mode.
Douglas Gregor [Mon, 10 Oct 2011 16:05:18 +0000 (16:05 +0000)]
When adding a direct initializer to a declaration, allow the
initializer to update the type of the declaration. For example, this
allows us to determine the size of an incomplete array from its
initializer. Fixes PR10288.
Sean Hunt [Mon, 10 Oct 2011 06:18:57 +0000 (06:18 +0000)]
Begin work consolidating ShouldDelete* functions.
Begin with just default constructors. One note is that as a side effect
of this, a conformance test was removed on the basis that this is almost
certainly a defect as with most of union initialization. As it is, clang
does not implement union initialization close to the standard as it's
quite broken as written. I hope to write a paper addressing the issues
eventually.