Adrian Prantl [Tue, 18 Jun 2013 00:27:36 +0000 (00:27 +0000)]
Remove an ugly hack that was meant to eliminate the breakpoint ambiguity
between a block assignment and the entry of the block function. In reality
this wouldn't work anyway because blocks are predominantly created
on-the-fly inside of an ObjC method invocation.
The proper fix for the ambiguity is to use -gcolumn-info to differentiate
the breakpoints.
This is expected to break some block-related darwin-gdb tests.
Manman Ren [Mon, 17 Jun 2013 19:42:49 +0000 (19:42 +0000)]
X86 intrinsics: cmpge|gt|nge|ngt_ss|_sd
These intrinsics should return the comparision result in the low bits and keep
the high bits of the first source operand.
When calling to builtin functions, the source operands are swapped and the high
bits of the second source operand are kept. To fix the issue, an extra
shufflevector is used.
Rafael Espindola [Mon, 17 Jun 2013 19:26:19 +0000 (19:26 +0000)]
Revert "Updated test cases for contextual conversion"
This reverts commit r184100.
It was faling on some bots:
http://bb.pgr.jp/builders/cmake-clang-i686-mingw32/builds/1973/steps/test_clang/logs/Clang%20%3A%3A%20SemaCXX__cxx1y-contextual-conversion-tweaks.cpp
Richard Smith [Mon, 17 Jun 2013 18:05:42 +0000 (18:05 +0000)]
Avoid using __SIZE_TYPE__ in a -std=c++98 -pedantic-errors test, because that
triggers an error on MS targets where __SIZE_TYPE__ expands to 'long long'.
Serge Pavlov [Mon, 17 Jun 2013 17:18:51 +0000 (17:18 +0000)]
Clean up empty struct/union recognition.
Make use of getTypeSizeInChars to detect structs/unions of zero size. It allows
more accurate detection of types of zero size. It however has a side effect -
sequence of used types may change, that is why the test 'override-layout' was
modified.
Fixes incorrect indentation of line comments after break and re-alignment.
Summary:
Selectively propagate the information about token kind in
WhitespaceManager::replaceWhitespaceInToken.For correct alignment of new
segments of line comments in order to align them correctly. Don't set
BreakBeforeParameter in breakProtrudingToken for line comments, as it introduces
a break after the _next_ parameter. Added tests for related functions.
Reid Kleckner [Mon, 17 Jun 2013 12:56:08 +0000 (12:56 +0000)]
[AST] Don't include RecursiveASTVisitor.h in ASTContext.h
The untemplated implementation of getParents() doesn't need to be in a
header file.
RecursiveASTVisitor.h is full of repeated macro expansion. Moving this
include to ASTContext.cpp speeds up compilation of
LambdaMangleContext.cpp, a small C++ file with few includes, from 3.7s
to 2.8s for me locally. I haven't measured a full build, but it can't
hurt.
I had to fix a few static analyzer files that were depending on
transitive includes of C++ AST headers.
Richard Smith [Sun, 16 Jun 2013 05:05:39 +0000 (05:05 +0000)]
PR16339: Don't produce a diagnostic pointing at the whitespace between a '#if'
and a '!defined(X)' if we find a broken header guard. This is suboptimal; we
should point the diagnostic at the 'X' token not the 'if' token, but it fixes
the crash.
Larisse Voufo [Sat, 15 Jun 2013 20:17:46 +0000 (20:17 +0000)]
Updated the support for contextual conversion tweaks (n3323) with a previously overlooked part: implicitly converting array sizes to size_t, rather than contextually converting them to some unique type.
Faisal Vali [Sat, 15 Jun 2013 11:54:37 +0000 (11:54 +0000)]
A quick fix to allow return type deduction on member templates
by ensuring DiagnoseUseOfDecl is called both on the found decl and the
decl being used (i.e the specialization in the case of member templates) whenever they are different.
Per the exchange captured in
http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20130610/081636.html
a more comprehensive fix that allows both decls to be passed into DiagnoseUseOfDecl is (or should be) forthcoming relatively soon.
Ed Schouten [Sat, 15 Jun 2013 09:40:14 +0000 (09:40 +0000)]
Emit native implementations of atomic operations on FreeBSD/armv6.
Just like on Linux, FreeBSD/armv6 assumes the system supports
ldrex/strex unconditionally. It is also used by the kernel. We can
therefore enable support for it, like we do on Linux.
While there, change one of the unit tests to explicitly test against
armv5 instead of armv7, as it actually tests whether libcalls are
emitted.
Richard Smith [Sat, 15 Jun 2013 00:30:29 +0000 (00:30 +0000)]
PR16263: Implement current direction of core issue 1376. Binding a reference to
the result of a cast-to-reference-type lifetime-extends the object to which the
reference inside the cast binds.
This requires us to look for subobject adjustments on both the inside and the
outside of the MaterializeTemporaryExpr when looking for a temporary to
lifetime-extend (which we also need for core issue 616, and possibly 1213).
Richard Smith [Fri, 14 Jun 2013 22:27:52 +0000 (22:27 +0000)]
Fix handling of const_cast from prvalue to rvalue reference: such a cast is
only permitted if the source object is of class type, and should materialize a
temporary for the reference to bind to.
Reid Kleckner [Fri, 14 Jun 2013 17:17:23 +0000 (17:17 +0000)]
[Driver] Refactor clang driver to use LLVM's Option library
The big changes are:
- Deleting Driver/(Arg|Opt)*
- Rewriting includes to llvm/Option/ and re-sorting
- 'using namespace llvm::opt' in clang::driver
- Fixing the autoconf build by adding option everywhere
As discussed in the review, this change includes using directives in
header files. I'll make follow up changes to remove those in favor of
name specifiers.
Summary:
Don't remove backslashes from block comments. Previously this
/* \ \ \ \ \ \
*/
would be turned to this:
/*
*/
which spoils some kinds of ASCII-art, people use in their comments. The behavior
was related to handling escaped newlines in block comments inside preprocessor
directives. This patch makes handling it in a more civilized way.
Chandler Carruth [Fri, 14 Jun 2013 08:57:18 +0000 (08:57 +0000)]
Fix the warning for divide by zero to be a bit more robust. ;]
Previously, it only ever fired for zeros which formed null pointers.
Now, hilariously, in C++98 this was almost anything. Including tricks
like warning on the divisor in this code:
Why the RHS of the outer divide is a null pointer constant is a sordid
tale of sorrow. Anyways, the committee fixed this for C++11 and onward
as part of core isssue 903, and Richard recently implemented this fix
causing the warning to go away here (and elsewhere).
This patch restores the warning here and adds it for numerous other
somewhat obvious gaffes:
int g(int x) {
return x / (int)(0.0);
}
The patch is essentially just using the full power of our constant
folding in Clang to produce the warning, but insisting that it must fold
to an *integer* which is zero so that we don't get false positives
anywhere.
Richard Smith [Thu, 13 Jun 2013 22:07:02 +0000 (22:07 +0000)]
Avoid fallthrough in header, to allow external users of Clang libraries to
build with Clang's -Wimplicit-fallthrough warning enabled. The fallthrough
was not making this code better.
Tim Northover [Thu, 13 Jun 2013 15:02:46 +0000 (15:02 +0000)]
Teach clang about the armv4/armv4t distinction
When choosing a default CPU, clang used to pick ARM7TDMI (which has Thumb) even
when the more restrictive armv4 triple was specified. This should fix that.
Richard Smith [Thu, 13 Jun 2013 03:23:42 +0000 (03:23 +0000)]
C++11: If a class has a user-declared copy operation or destructor, the
implicit definition of a copy operation is deprecated. Add a warning for this
to -Wdeprecated. This warning is disabled by default for now, pending
investigation into how common this situation is.
Richard Smith [Wed, 12 Jun 2013 23:38:09 +0000 (23:38 +0000)]
Simplify: we don't need any special-case lifetime extension when initializing
declarations of reference type; they're handled by the general case handling of
MaterializeTemporaryExpr.
Richard Smith [Wed, 12 Jun 2013 22:31:48 +0000 (22:31 +0000)]
PR12086, PR15117
Introduce CXXStdInitializerListExpr node, representing the implicit
construction of a std::initializer_list<T> object from its underlying array.
The AST representation of such an expression goes from an InitListExpr with a
flag set, to a CXXStdInitializerListExpr containing a MaterializeTemporaryExpr
containing an InitListExpr (possibly wrapped in a CXXBindTemporaryExpr).
This more detailed representation has several advantages, the most important of
which is that the new MaterializeTemporaryExpr allows us to directly model
lifetime extension of the underlying temporary array. Using that, this patch
*drastically* simplifies the IR generation of this construct, provides IR
generation support for nested global initializer_list objects, fixes several
bugs where the destructors for the underlying array would accidentally not get
invoked, and provides constant expression evaluation support for
std::initializer_list objects.
Richard Smith [Wed, 12 Jun 2013 21:51:50 +0000 (21:51 +0000)]
Move detection of reference members binding to temporaries from building of
CXXCtorInitializers to the point where we perform the questionable lifetime
extension. This exposed a selection of false negatives in the warning.
Richard Trieu [Wed, 12 Jun 2013 21:20:57 +0000 (21:20 +0000)]
Introducing -Wheader-guard, a warning that checks header guards actually work
properly. This warning checks that the #ifndef and #define directives at
the beginning of a header refer to the same macro name. Includes a fix-it
hint to correct the header guard.
Richard Smith [Wed, 12 Jun 2013 20:42:33 +0000 (20:42 +0000)]
Reapply r183721, reverted in r183776, with a fix for a bug in the former (we
were lacking ExprWithCleanups nodes in some cases where the new approach to
lifetime extension needed them).
Original commit message:
Rework IR emission for lifetime-extended temporaries. Instead of trying to walk
into the expression and dig out a single lifetime-extended entity and manually
pull its cleanup outside the expression, instead keep a list of the cleanups
which we'll need to emit when we get to the end of the full-expression. Also
emit those cleanups early, as EH-only cleanups, to cover the case that the
full-expression does not terminate normally. This allows IR generation to
properly model temporary lifetime when multiple temporaries are extended by the
same declaration.
We have a pre-existing bug where an exception thrown from a temporary's
destructor does not clean up lifetime-extended temporaries created in the same
expression and extended to automatic storage duration; that is not fixed by
this patch.
Pavel Labath [Wed, 12 Jun 2013 07:45:04 +0000 (07:45 +0000)]
Fix memory corruption in CStringChecker
Summary:
"register" functions for the checker were caching the checker objects in a
static variable. This caused problems when the function is called with a
different CheckerManager.
Eli Friedman [Tue, 11 Jun 2013 21:48:11 +0000 (21:48 +0000)]
Correctly handle designated initializers which modify an array initialized
with a string. This case is sort of tricky because we can't modify the
StringLiteral used to represent such initializers.
We are forced to decompose the string into individual characters.