Robert Lytton [Tue, 11 Feb 2014 10:34:51 +0000 (10:34 +0000)]
XCore target: add section information.
Xcore target ABI requires const data that is externally visible
to be handled differently if it has C-language linkage rather than
C++ language linkage.
Oliver Stannard [Tue, 11 Feb 2014 09:25:50 +0000 (09:25 +0000)]
AAPCS: Do not split structs after CPRC allocated on stack
According to the AAPCS, we can split structs between GPRs and the stack,
except for when an argument has already been allocated on the stack. This
can occur when a large number of floating-point arguments fill up the VFP
registers, and are alllocated on the stack before the general-purpose argument
registers are full.
Ted Kremenek [Tue, 11 Feb 2014 06:29:29 +0000 (06:29 +0000)]
Fix PCH deserialization bug with local static symbols being treated as local extern.
This triggered a miscompilation of code using Boost's function_template.hpp
when it was included inside a PCH file. A local static within
that header would be treated as local extern, resulting in the wrong
mangling. This only occurred during PCH deserialization.
Josh Magee [Tue, 11 Feb 2014 01:35:14 +0000 (01:35 +0000)]
[stackprotector] Add command line option -fstack-protector-strong
This option has the following effects:
* It adds the sspstrong IR attribute to each function within the CU.
* It defines the macro __SSP_STRONG__ with the value of 2.
David Majnemer [Mon, 10 Feb 2014 19:50:15 +0000 (19:50 +0000)]
MS ABI: Add support for #pragma pointers_to_members
Introduce a notion of a 'current representation method' for
pointers-to-members.
When starting out, this is set to 'best case' (representation method is
chosen by examining the class, selecting the smallest representation
that would work given the class definition or lack thereof).
This pragma allows the translation unit to dictate exactly what
representation to use, similar to how the inheritance model keywords
operate.
Tim Northover [Mon, 10 Feb 2014 16:20:36 +0000 (16:20 +0000)]
ARM: move vshll NEON implementation to common code
Now that both ARM backends use the same implementation for vshll operations,
the code can be shared. This is also a necessary LLVM/Clang interface update.
NAKAMURA Takumi [Mon, 10 Feb 2014 10:51:09 +0000 (10:51 +0000)]
Fix Clang install rules to not set permissions on include/
The CMake install(DIRECTORY) command documents that it sets permissions
on directories it is asked to install. Since the <prefix>/include
directory may not be exclusive to the LLVM/Clang installation, we should
not ask CMake to manage permissions of that directory for us. Instead,
give only our own include/clang and include/clang-c subdirectories to
the install(DIRECTORY) command.
Kaelyn Uhrain [Sun, 9 Feb 2014 21:47:04 +0000 (21:47 +0000)]
PR18685: Ignore class template specializations as potential
nested-name-specifiers for typos unless the typo already has
a nested-name-specifier that is a template specialization.
David Blaikie [Sun, 9 Feb 2014 06:54:23 +0000 (06:54 +0000)]
Improve diagnostic for using non-class/namespace/scoped enum in a nested name specifier.
Rather than simply saying "X is not a class or namespace", clarify what
X is by providing the aka type in the case where X is a type, or
pointing to the named declaration if there's an unambiguous one to refer
to. In the ambiguous case, the ambiguities are already enumerated
(though could be clarified by describing what kind of entities they are)
Included a few FIXMEs in tests where some further improvements could be
made.
Richard Smith [Sun, 9 Feb 2014 00:54:43 +0000 (00:54 +0000)]
PR16519, PR18009: When checking a partial specialization for uses of its own
template parameters, don't look for parameters of outer templates. If a problem
is found in a default template argument, point the diagnostic at the partial
specialization (with a note pointing at the default argument) instead of
pointing it at the default argument and leaving it unclear which partial
specialization os problematic.
John McCall [Sat, 8 Feb 2014 03:26:05 +0000 (03:26 +0000)]
type_info objects are not unnamed_addr: the ABI requires us to
unique them and permits the implementation of dynamic_cast (and
anything else which knows it's working with a complete class
type) to compare their addresses directly.
Reid Kleckner [Sat, 8 Feb 2014 02:40:20 +0000 (02:40 +0000)]
Move the -fms-compatibility using decl check after real access checking
Summary:
This avoids false positives from -Wmicrosoft when name lookup would
normally succeed in standard C++. This triggered on a common CRTP
pattern in clang, where a derived class would have a private using decl
to pull in members of a dependent base:
class Verifier : InstVisitor<Verifier> {
private:
using InstVisitor<Verifier>::visit;
...
void anything() {
visit(); // warned here
}
};
Real access checks pass here because we're in the context of the
Verifier, but the -Wmicrosoft extension was just looking for the private
access specifier.
Richard Smith [Fri, 7 Feb 2014 22:51:16 +0000 (22:51 +0000)]
PR16638, DR1552: the exception specification on an implicitly-declared
'operator delete' or 'operator delete[]' is an explicit exception
specification. Therefore we should diagnose 'void operator delete(void*)'
instead of 'void operator delete(void*) noexcept'.
This diagnostic remains an ExtWarn, since in practice people don't always
include the exception specification in such a declaration.
Ben Langmuir [Fri, 7 Feb 2014 17:31:11 +0000 (17:31 +0000)]
Stat system dependencies when using -verify-pch
We don't stat the system headers to check for stalenes during regular
PCH loading for performance reasons. When explicitly saying
-verify-pch, we want to check all the dependencies - user or system.
Oliver Stannard [Fri, 7 Feb 2014 11:25:57 +0000 (11:25 +0000)]
Fix AAPCS compliance for HFAs containing doubles and long doubles
An HFA is defined as a struct containing floating point values of the
same machine type. In the 32-bit ABI, double and long double have the
same machine type, so a struct with a mixture of these types must be an
HFA (assuming it meets the other criteria).
Revert r194097: "With this patch -Wwrite-strings is still implemented with the terrible
hack of passing -fconst-strings to -cc1"
Passing or not a language option based on diagnostic settings is a bad idea, it breaks
using a PCH that was compiled with different diagnostic settings.
Also add a test case to make sure we don't regress.
David Majnemer [Fri, 7 Feb 2014 00:43:07 +0000 (00:43 +0000)]
MS ABI: Don't be so hasty to judge an inheritance model
If we are in the middle of defining the class, don't attempt to
validate previously annotated declarations. We may not have seen base
specifiers or virtual method declarations yet.
Richard Smith [Thu, 6 Feb 2014 23:35:16 +0000 (23:35 +0000)]
Temporary fix for PR18473: Don't try to evaluate the initializer for a
type-dependent variable, even if the initializer isn't value-dependent. This
happens for ParenListExprs composed of non-value-dependent subexpressions, for
instance.
We should really give ParenListExprs (and InitListExprs) the type of the
initialized entity if they're used to represent a dependent initialization (and
if so, set them to be type-, value- and instantiation-dependent).
Ben Langmuir [Thu, 6 Feb 2014 18:53:25 +0000 (18:53 +0000)]
Move -verify-pch to use VerifyJobAction
Use the verify hook rather than the compile hook to represent the
-verify-pch action, and move the exising --verify-debug-info action
into its own subclass of VerifyJobAction. Incidentally change the name
printed by -ccc-print-phases for --verify-debug-info.
David Majnemer [Thu, 6 Feb 2014 10:59:19 +0000 (10:59 +0000)]
MS ABI: Tweak pointer-to-member mangling/inheritance model selection
Properly determine the inheritance model when dealing with nullptr:
- If a nullptr template argument is being checked against
pointer-to-member parameter, nail down an inheritance model.
N.B. We will chose an inheritance model even if we won't ultimately
choose the template to instantiate! Cooky, right?
- Null pointer-to-datamembers have a virtual base table offset of -1,
not zero. Previously, we chose an offset of 0.
NAKAMURA Takumi [Thu, 6 Feb 2014 07:15:59 +0000 (07:15 +0000)]
check-clang: Introduce the feature "utf8-capable-terminal".
clang/test/FixIt/fixit-unicode-with-utf8-output.c has begun complained since LLVM r200885.
Although it is changes for StringRef, it brought LLVM_ON_WIN32 to Support/Locale.cpp.
Before r200885, LLVM_ON_WIN32 was undefined in Locale.cpp!
Serge Pavlov [Thu, 6 Feb 2014 03:49:11 +0000 (03:49 +0000)]
Allow transformation of VariableArray to ConstantArray.
In the following code:
struct A { static const int sz; };
template<class T> void f() { T arr[A::sz]; }
the array 'arr' is represented as a variable size array in the template.
If 'A::sz' gets value below in the translation unit, the array in
instantiation can turn into constant size array.
Richard Smith [Thu, 6 Feb 2014 01:31:33 +0000 (01:31 +0000)]
DR101, PR12770: If a function is declared in the same context as a
using-declaration, and they declare the same function (either because
the using-declaration is in the same namespace as the declaration it
imports, or because they're both extern "C"), they do not conflict.
Manman Ren [Wed, 5 Feb 2014 20:40:15 +0000 (20:40 +0000)]
PGO: instrumentation based profiling sets function attributes.
We collect a maximal function count among all functions in the pgo data file.
For functions that are hot, we set its InlineHint attribute. For functions that
are cold, we set its Cold attribute.
We currently treat functions with >= 30% of the maximal function count as hot
and functions with <= 1% of the maximal function count are treated as cold.
These two numbers are from preliminary tuning on SPEC.
This commit should not affect non-PGO builds and should boost performance on
instrumentation based PGO.
Kaelyn Uhrain [Wed, 5 Feb 2014 18:57:51 +0000 (18:57 +0000)]
Don't consider records with a NULL identifier as a name for typo correction.
Because in C++, "anonymous" doesn't mean "nameless" for records. In
other words, RecordDecl::isAnonymousStructOrUnion only returns true if
the record lacks a name *and* is not used as the type in an object's
declaration.
Reid Kleckner [Wed, 5 Feb 2014 17:27:08 +0000 (17:27 +0000)]
MS ABI: Mangle member pointer template arguments
Member pointers are mangled as they would be represented at runtime.
They can be a single integer literal, single decl, or a tuple with some
more numbers tossed in. With Clang today, most of those numbers will be
zero because we reject pointers to members of virtual bases.
This change required moving VTableContextBase ownership from
CodeGenVTables to ASTContext, because mangling now depends on vtable
layout.
I also hoisted the inheritance model helpers up to be inline static
methods of MSInheritanceAttr. This makes the AST code that deals with
member pointers much more readable.
MSVC doesn't appear to have stable manglings of null member pointers:
- Null data memptrs in function templates have a mangling collision with
the first field of a non-polymorphic single inheritance class.
- The mangling of null data memptrs changes if you add casts.
- Large null function memptrs in class templates crash MSVC.
Clang uses the class template mangling for null data memptrs and the
function template mangling for null function memptrs to deal with this.
Added the hasLoopVariable sub-matcher for forRangeStmt.
Summary:
This sub-matcher makes it possible to access directly the range-based for
loop variable: forRangeStmt(hasLoopVariable(anything()).bind(...)).
I've tried to re-generate the docs, but the diffs seem to include much more than
this change could cause, so I'd better leave docs update to someone who knows
the intended changes in the contents better.
John McCall [Tue, 4 Feb 2014 23:58:19 +0000 (23:58 +0000)]
Tighten lax vector-conversion rules and enforce them consistently.
When a lax conversion featured a vector and a non-vector, we were
only requiring the non-vector to be a scalar type, but really it
needs to be a real type (i.e. integral or real floating); it is
not reasonable to allow a pointer, member pointer, or complex
type here.
r198474 required lax conversions to match in "data size", i.e.
element size * element count, forbidding matches that happen
only because a vector is rounded up to the nearest power of two
in size. Unfortunately, the erroneous logic was repeated in
several different places; unify them to use the new condition,
so that it triggers for arbitrary conversions and not just
those performed as part of binary operator checking.
Justin Bogner [Tue, 4 Feb 2014 19:18:37 +0000 (19:18 +0000)]
Clean up whitespace checks
In TokenLexer::ExpandFunctionArguments(), CurTok.hasLeadingSpace() is
checked in multiple locations, each time subtly differently. Checking it
early, when the token is seen, and using NextTokGetsSpace exclusively
after that makes the code simpler.
Justin Bogner [Tue, 4 Feb 2014 19:18:35 +0000 (19:18 +0000)]
Fix whitespace handling in empty macro expansions
When a macro expansion does not result in any tokens, and the macro name
is preceded by whitespace, the whitespace should be passed to the first
token that follows the macro expansion. Similarly when a macro expansion
ends with a placemarker token, and that placemarker token is preceded by
whitespace. This worked already for top-level macro expansions, but is
now extended to also work for nested macro expansions.
Justin Bogner [Tue, 4 Feb 2014 19:18:32 +0000 (19:18 +0000)]
Fix whitespace handling in empty macro arguments
When a function-like macro definition ends with one of the macro's
parameters, and the argument is empty, any whitespace before the
parameter name in the macro definition needs to be preserved. Promoting
the existing NextTokGetsSpace to a preserved bit-field and checking it
at the end of the macro expansion allows it to be moved to the first
token following the macro expansion result.
Justin Bogner [Tue, 4 Feb 2014 19:18:28 +0000 (19:18 +0000)]
Fix whitespace handling in ## operator
In x ## y, where x and y are regular tokens, whitespace between x and ##
is ignored, and whitespace between ## and y is also ignored. When either
x or y is a function argument, whitespace was preserved, but it should
not be. This patch removes the checks for whitespace before ## and
before y, and in the special case where x is an empty macro argument and
y is a regular token, actively removes whitespace before y.
One existing test is affected by that change, but as clang's output now
matches the standard's requirements and that of GCC, I've tweaked the
testcase.
Tim Northover [Tue, 4 Feb 2014 14:55:52 +0000 (14:55 +0000)]
ARM & AArch64: combine implementation of vcaXYZ intrinsics
Now that the back-end intrinsics are more regular, there's no need for the
special handling these got in the front-end, so they can be moved to
EmitCommonNeonBuiltinExpr.
Richard Smith [Tue, 4 Feb 2014 01:14:30 +0000 (01:14 +0000)]
Add implicit declarations of allocation functions when looking them up for
redeclaration, not just when looking them up for a use -- we need the implicit
declaration to appropriately check various properties of them (notably, whether
they're deleted).