David Blaikie [Thu, 25 Jul 2013 21:19:01 +0000 (21:19 +0000)]
Don't forward all assembler arguments untouched to -cc1as
Use the same filtering for assembly arguments to -cc1as as we do for
-cc1, this allows a consistent (& more useful) diagnostic experience for
users (rather than getting an error from -cc1as (which a user shouldn't
really be thinking about) about --foo, they get an error from clang
about --foo in -Wa,)
I'm sort of surprised by the separation of -cc1as & the separate
argument handling, etc, but at least this removes a little bit of the
duplication.
Rafael Espindola [Thu, 25 Jul 2013 13:45:29 +0000 (13:45 +0000)]
Don't pass %s twice to clang -cc1.
The reason this clang invocation was failing is that it had two %s. We would
close stdout after the first one and report a fatal error when trying to
print the second.
Rafael Espindola [Thu, 25 Jul 2013 02:11:20 +0000 (02:11 +0000)]
Avoid recursions when the parser finds out that it has too many brackets.
BalancedDelimiterTracker::diagnoseOverflow calls P.SkipUntil, and before this
patch P.SkipUnti is recursive, causing problems on systems with small stacks.
This patch fixes it by making P.SkipUnti non recursive when just looking for
eof.
Adrian Prantl [Thu, 25 Jul 2013 00:23:42 +0000 (00:23 +0000)]
Debug Info: Fine-tune the simple return expression location handling to
only affect functions without a separate return block. This fixes the
linetable for void functions with cleanups and multiple returns.
Documentation parsing: if typedef name is being declared
via a macro, try using declaration's starting location.
This is improvement over not having a valid location and
dropping comment altogether. // rdar://14348912
Eli Bendersky [Wed, 24 Jul 2013 21:22:01 +0000 (21:22 +0000)]
Partial revert of r185568.
r186899 and r187061 added a preferred way for some architectures not to get
intrinsic generation for math builtins. So the code changes in r185568 can
now be undone (the test remains).
Richard Smith [Wed, 24 Jul 2013 17:51:13 +0000 (17:51 +0000)]
Rename feature test for lambda init-captures from cxx_generalized_capture to
cxx_init_capture. "generalized" is neither descriptive nor future-proof. No
compatibility problems expected, since we've never advertised having this
feature.
Mark Seaborn [Wed, 24 Jul 2013 16:25:13 +0000 (16:25 +0000)]
Use ARM-style representation for C++ method pointers under PNaCl/Emscripten
Before this change, Clang uses the x86 representation for C++ method
pointers when generating code for PNaCl. However, the resulting code
will assume that function pointers are 0 mod 2. This assumption is
not safe for PNaCl, where function pointers could have any value
(especially in future sandboxing models).
So, switch to using the ARM representation for PNaCl code, which makes
no assumptions about the alignment of function pointers.
Since we're changing the "le32" target, this change also applies to
Emscripten. The change is beneficial for Emscripten too. Emscripten
has a workaround to make function pointers 0 mod 2. This change would
allow the workaround to be removed.
Samuel Benzaquen [Wed, 24 Jul 2013 14:48:01 +0000 (14:48 +0000)]
Add support for Adaptative matchers on the dynamic registry.
Summary:
Add support for Adaptative matchers on the dynamic registry.
Each adaptative matcher is created with a function template. We instantiate the function N times, one for each possible From type and apply the techniques used on argument overloaded and polymorphic matchers to add them to the registry.
Daniel Jasper [Wed, 24 Jul 2013 13:10:59 +0000 (13:10 +0000)]
clang-format: Initial (incomplete) support for the WebKit coding style.
This is far from implementing all the rules given by
http://www.webkit.org/coding/coding-style.html
The important new feature is the support for styles that don't have a
column limit. For such styles, clang-format will (at the moment) simply
respect the input's formatting decisions within statements.
Richard Smith [Wed, 24 Jul 2013 07:11:57 +0000 (07:11 +0000)]
C++1y: track object lifetime during constexpr evaluation, and don't allow
objects to be used once their lifetimes end. This completes the C++1y
constexpr extensions.
Bill Schmidt [Tue, 23 Jul 2013 22:15:57 +0000 (22:15 +0000)]
[PowerPC64] Fix passing of single-vector-member structs to match ABI.
The 64-bit PowerPC ELF ABI requires a struct that contains a single
vector member to be passed in a vector register as though the wrapping
struct were not present. Instead we were passing this as a byval
struct.
The same logic was already present for floating-point arguments, so
this patch just extends the logic to handle vector types. The new
test case verifies that clang coerces the parameter and annotates it
as inreg.
Removing a number of individual run lines and replacing them with single line test cases. This reduces the number of test runs, provides the same coverage, and allows us to test that the attribute names are included in the diagnostic.
Richard Trieu [Tue, 23 Jul 2013 18:01:49 +0000 (18:01 +0000)]
Add new diagnostic messages when too many arguments are presented to a
function-like macro. Clang will attempt to correct the arguments by detecting
braced initializer lists:
1) If possible, suggest parentheses around arguments
containing braced lists which will give the proper number of arguments.
2) If a braced list is detected at the start of a macro argument, it cannot be
corrected by parentheses. Instead, just point out the location of these
braced lists.
Rafael Espindola [Tue, 23 Jul 2013 15:17:51 +0000 (15:17 +0000)]
Use -### instead of -ccc-echo.
This is still a fairly odd test. Clang wants to run gcc for assembling. At
least with -### it only prints that instead of actually trying to run it with
-ccc-echo.
Jordan Rose [Tue, 23 Jul 2013 02:15:20 +0000 (02:15 +0000)]
[analyzer] Enable pseudo-destructor expressions.
These are cases where a scalar type is "destructed", usually due to
template instantiation (e.g. "obj.~T()", where 'T' is 'int'). This has
no actual effect and the analyzer should just skip over it.
Jordan Rose [Tue, 23 Jul 2013 02:15:11 +0000 (02:15 +0000)]
Revert "[analyzer] Add very limited support for temporary destructors"
The analyzer doesn't currently expect CFG blocks with terminators to be
empty, but this can happen when generating conditional destructors for
a complex logical expression, such as (a && (b || Temp{})). Moreover,
the branch conditions for these expressions are not persisted in the
state. Even for handling noreturn destructors this needs more work.
Matt Arsenault [Tue, 23 Jul 2013 01:23:36 +0000 (01:23 +0000)]
Error on more illegal kernel argument types for OpenCL
bool, half, pointers and structs / unions containing any
of these are not allowed. Does not yet reject size_t and
related integer types that are also disallowed.
Eli Friedman [Tue, 23 Jul 2013 00:25:18 +0000 (00:25 +0000)]
Integers which are too large should be an error.
Switch some warnings over to errors which should never have been warnings
in the first place. (Also, a minor fix to the preprocessor rules for
integer literals while I'm here.)
Douglas Gregor [Mon, 22 Jul 2013 20:48:33 +0000 (20:48 +0000)]
Make modules depend on the compiler's own module.map, as a proxy for the compiler itself.
The headers in the compiler's own resource include directory are
system headers, which means we don't stat() them eagerly when loading
a module. Use module.map as a proxy for these headers and the compiler
itself. Fixes <rdar://problem/13856838>.
Daniel Jasper [Mon, 22 Jul 2013 16:22:13 +0000 (16:22 +0000)]
Fix bug in clang-format's vim integration cause by r186789.
After the first operation, the buffer contents has changed and thus all
other operations would be invalid. Executing the operations in reversed
order should fix this.
[ms-cxxabi] Emit linkonce complete dtors in TUs that need them
Based on Peter Collingbourne's destructor patches.
Prior to this change, clang was considering ?1 to be the complete
destructor and the base destructor, which was wrong. This lead to
crashes when clang tried to emit two LLVM functions with the same name.
In this ABI, TUs with non-inline dtors might not emit a complete
destructor. They are emitted as inline thunks in TUs that need them,
and they always delegate to the base dtors of the complete class and its
virtual bases. This change uses the DeferredDecls machinery to emit
complete dtors as needed.
Currently in clang try body destructors can catch exceptions thrown by
virtual base destructors. In the Microsoft C++ ABI, clang may not have
the destructor definition, in which case clang won't wrap the virtual
virtual base destructor calls in a try-catch. Diagnosing this in user
code is TODO.
Finally, for classes that don't use virtual inheritance, MSVC always
calls the base destructor (?1) directly. This is a useful code size
optimization that avoids emitting lots of extra thunks or aliases.
Implementing it also means our existing tests continue to pass, and is
consistent with MSVC's output.
We can do the same for Itanium by tweaking GetAddrOfCXXDestructor, but
it will require further testing.
Improve clarity/consistency of a few UsingDecl methods and related helpers.
No functionality change.
In Sema helper functions:
* renamed isTypeName as HasTypenameKeyword
In UsingDecl:
* renamed get/setUsingLocation to get/setUsingLoc
* renamed is/setTypeName as has/setTypename
Richard Smith [Mon, 22 Jul 2013 02:56:56 +0000 (02:56 +0000)]
Implement DR257 / fix PR16659:
A constructor for an abstract class does not call constructors for virtual
base classes, so it is not an error if no initializer is present for the
virtual base and the virtual base cannot be default initialized.
Also provide a (disabled by default, for now) warning for the case where a
virtual base class's initializer is ignored in an abstract class's constructor,
and address a defect in DR257 where it was not carried through to C++11's rules
for implicit deletion of special member functions.