Aaron Ballman [Mon, 4 Nov 2013 12:55:56 +0000 (12:55 +0000)]
Attributes which accept a type as their sole argument are no longer hard coded into the parser. Instead, they are automatically listed through tablegen.
Richard Smith [Mon, 4 Nov 2013 04:26:14 +0000 (04:26 +0000)]
Issue a diagnostic if an implicitly-defined move assignment operator would move
the same virtual base class multiple times (and the move assignment is used,
and the move assignment for the virtual base is not trivial).
Richard Smith [Mon, 4 Nov 2013 01:48:18 +0000 (01:48 +0000)]
Implement final resolution of DR1402: implicitly-declared move operators that
would be deleted are still declared, but are ignored by overload resolution.
Also, don't delete such members if a subobject has no corresponding move
operation and a non-trivial copy. This causes us to implicitly declare move
operations in more cases, but risks move-assigning virtual bases multiple
times in some circumstances (a warning for that is to follow).
David Majnemer [Sun, 3 Nov 2013 23:51:28 +0000 (23:51 +0000)]
Sema: Do not allow overloading between methods based on restrict
If the sole distinction between two declarations is that one has a
__restrict qualifier then we should not consider it to be an overload.
Instead, we will consider it as an incompatible redeclaration which is
similar to how MSVC, ICC and GCC would handle it.
This fixes PR17786.
N.B. We must not mangle in __restrict into method qualifiers becase we
don't allow overloading between such declarations anymore. To do
otherwise would be a violation of the Itanium ABI.
David Majnemer [Sat, 2 Nov 2013 12:00:36 +0000 (12:00 +0000)]
Sema: Disallow inheriting from classes with flexible array members
Flexible array members inherently index off of the end of their parent
type.
We shouldn't allow this type to be used as a base, virtual or otherwise,
because indexing off the end may find us inside of another base or the
derived types members.
David Majnemer [Sat, 2 Nov 2013 11:19:13 +0000 (11:19 +0000)]
Sema: Disallow derived classes with virtual bases from having flexible array members
Flexible array members only work out if they are the last field of a
record, however virtual bases would give us many situations where the
flexible array member would overlap with the virtual base fields.
It is unlikely in the extreme that this behavior was intended by the
user so raise a diagnostic instead of accepting. This is will not
reject conforming code because flexible array members are an extension
in C++ mode.
David Majnemer [Sat, 2 Nov 2013 10:38:05 +0000 (10:38 +0000)]
Sema: Cleanup and simplify anonymous union diagnostics
The determination of which diagnostics would be issued for certain
anonymous unions started to get a little ridiculous. Clean this up by
inverting the condition-tree's logic from dialect -> issue to
issue -> diagnostic.
As part of this cleanup, move ext_c99_flexible_array_member from
DiagnosticParseKinds.td to DiagnosticSemaKinds.td because it's driven by
Sema, not Parse.
Also, the liberty was taken to edit ext_c99_flexible_array_member to
match other, similar, diagnostics.
Richard Trieu [Sat, 2 Nov 2013 02:11:23 +0000 (02:11 +0000)]
Change the other -Wtautological-compare warnings to not trigger in template
specializations. Also switch to -Wuninitialized for a test case that depended
on a warning firing in template specializations.
Warren Hunt [Sat, 2 Nov 2013 00:12:15 +0000 (00:12 +0000)]
Fixes lit test that doesn't fail on windows
long in linux 64 is 64 bits but is always 32 bits on windows. The lit test was modified
to use long long instead of long and check for 64-bit mangling.
Clang was "improperly" over-aligning arrays with sizes are not a multiple of
their alignment.
This behavior was removed in microsoft 32 bit mode.
In addition, after examination of ASTContext::getTypeInfoImpl, a redundant code block in
MicrosoftRecordLayoutBuilder::getAdjustedFieldInfo was deleted.
Adds a lang_c LinkageSpecDecl to lazily generated builtins. This enforces correct
behavior for builtins in a variety of cases without special treatment elsewhere within
the compiler (special treatment is removed by the patch). It also allows for C++
overloads of builtin functions, which Microsoft uses in their headers e.g.
_InterlockedExchangeAdd is an extern C builtin for the long type but an inline wrapper
for int type.
ObjectiveC. Define a new cc1 flag
-fobjc-subscripting-legacy-runtime which is off
by default and on only when using ObjectiveC
legacy runtime. Use this flag to allow
array and dictionary subscripting and disallow
objectiveC pointer arithmatic in ObjectiveC
legacy runtime. // rdar://15363492
SanitizerArgs: add ability to filter/diagnose unsupported sanitizers.
The thread, memory, dataflow and function sanitizers are now diagnosed if
enabled explicitly on an unsupported platform. Unsupported sanitizers which
are enabled implicitly (as part of a larger group) are silently disabled. As a
side effect, this makes SanitizerArgs parsing toolchain-dependent (and thus
essentially reverts r188058), and moves SanitizerArgs ownership to ToolChain.
ObjectiveC migrator. When inferring readwrite property,
do not remove the setter if its availability differs
from availability of the getter (which is now turned into
a property). Otherwise, synthesized setter will
inherit availability of the property (which is incorrect).
// rdar://15300059
Dmitri Gribenko [Thu, 31 Oct 2013 22:24:10 +0000 (22:24 +0000)]
Clang modules: collect exports recursively
This change makes Module::buildVisibleModulesCache() collect exported modules
recursively.
While computing a set of exports, getExportedModules() iterates over the set of
imported modules and filters it. But it does not consider the set of exports
of those modules -- it is the responsibility of the caller to do this.
Here is a certain instance of this issue. Module::isModuleVisible says that
CoreFoundation.CFArray submodule is not visible from Cocoa. Why?
- Cocoa imports Foundation.
- Foundation has an export restriction: "export *".
- Foundation imports CoreFoundation. (Just the top-level module.)
- CoreFoundation exports CoreFoundation.CFArray.
To decide which modules are visible from Cocoa, we collect all exported modules
from immediate imports in Cocoa:
Because Foundation imports CoreFoundation (not CoreFoundation.CFArray), the
CFArray submodule is considered not exported from Foundation, and is not
visible from Cocoa (according to Module::isModuleVisible).
Chris Wailes [Thu, 31 Oct 2013 15:38:12 +0000 (15:38 +0000)]
Fixed bug with checking the kind of types.
The isLValueReferenceType function checks to see if the QualType's
canonical type is an LValue reference, and not if the QualType
itself is an LValue reference. This caused a segfault when trying
to cast the QualType's Type to a LValueReference. This is now
fixed by casting the result of getCanonicalType().
In addition, a test was added to isConsumableType to prevent
segfaults when a type being tested by the analysis is a reference
to a pointer or a pointer to a reference.
Amara Emerson [Thu, 31 Oct 2013 09:32:33 +0000 (09:32 +0000)]
[AArch64] Add some CPU targets for "generic", A-53 and A-57.
Enables the clang driver to begin targeting specific CPUs. Introduced a
"generic" CPU which will ensure that the optional FP feature is enabled
by default when it gets to LLVM, without needing any extra arguments.
Cortex-A53 and A-57 are also introduced with tests, although backend
handling of them does not yet exist.
Richard Smith [Thu, 31 Oct 2013 01:56:18 +0000 (01:56 +0000)]
Factor out custom parsing for iboutletcollection and vec_type_hint attributes
into a separate "parse an attribute that takes a type argument" codepath. This
results in both codepaths being a lot cleaner and simpler, and fixes some bugs
where the type argument handling bled into the expression argument handling and
caused us to both accept invalid and reject valid attribute arguments.
Mark Lacey [Wed, 30 Oct 2013 23:40:28 +0000 (23:40 +0000)]
Fix Windows build by including CGFunctionInfo.h.
CodeGenTypes.h instantiates llvm::FoldingSet<> with CGFunctionInfo,
and VC++ doesn't like the static_cast from FoldingSetImpl::Node* to
CGFunctionInfo* since it hasn't seen the definition of CGFunctionInfo
and that it inherits from FoldingSetImpl::Node.
Mark Lacey [Wed, 30 Oct 2013 21:53:58 +0000 (21:53 +0000)]
Add CodeGenABITypes.h for use in LLDB.
CodeGenABITypes is a wrapper built on top of CodeGenModule that exposes
some of the functionality of CodeGenTypes (held by CodeGenModule),
specifically methods that determine the LLVM types appropriate for
function argument and return values.
I addition to CodeGenABITypes.h, CGFunctionInfo.h is introduced, and the
definitions of ABIArgInfo, RequiredArgs, and CGFunctionInfo are moved
into this new header from the private headers ABIInfo.h and CGCall.h.
Exposing this functionality is one part of making it possible for LLDB
to determine the actual ABI locations of function arguments and return
values, making it possible for it to determine this for any supported
target without hard-coding ABI knowledge in the LLDB code.
Daniel Sanders [Wed, 30 Oct 2013 15:20:38 +0000 (15:20 +0000)]
[mips][msa] Added support for matching bmnz, bmnzi, bmz, and bmzi from normal IR (i.e. not intrinsics)
Also corrected the definition of the intrinsics for these instructions (the
result register is also the first operand), and added intrinsics for bsel and
bseli to clang (they already existed in the backend).
These four operations are mostly equivalent to bsel, and bseli (the difference
is which operand is tied to the result). As a result some of the tests changed
as described below.
bitwise.ll:
- bsel.v test adapted so that the mask is unknown at compile-time. This stops
it emitting bmnzi.b instead of the intended bsel.v.
- The bseli.b test now tests the right thing. Namely the case when one of the
values is an uimm8, rather than when the condition is a uimm8 (which is
covered by bmnzi.b)
compare.ll:
- bsel.v tests now (correctly) emits bmnz.v instead of bsel.v because this
is the same operation (see MSA.txt).
i8.ll
- CHECK-DAG-ized test.
- bmzi.b test now (correctly) emits equivalent bmnzi.b with swapped operands
because this is the same operation (see MSA.txt).
- bseli.b still emits bseli.b though because the immediate makes it
distinguishable from bmnzi.b.
vec.ll:
- CHECK-DAG-ized test.
- bmz.v tests now (correctly) emits bmnz.v with swapped operands (see
MSA.txt).
- bsel.v tests now (correctly) emits bmnz.v with swapped operands (see
MSA.txt).
Daniel Sanders [Wed, 30 Oct 2013 14:45:14 +0000 (14:45 +0000)]
[mips][msa] Added support for matching bins[lr]i.[bhwd] from normal IR (i.e. not intrinsics)
This required correcting the definition of the bins[lr]i intrinsics because
the result is also the first operand.
It also required removing the (arbitrary) check for 32-bit immediates in
MipsSEDAGToDAGISel::selectVSplat().
Currently using binsli.d with 2 bits set in the mask doesn't select binsli.d
because the constant is legalized into a ConstantPool. Similar things can
happen with binsri.d with more than 10 bits set in the mask. The resulting
code when this happens is correct but not optimal.
Richard Smith [Wed, 30 Oct 2013 01:02:04 +0000 (01:02 +0000)]
PR17731: When determining whether a tag and a non-tag were declared in the same
scope, be careful about function-scope declarations (which are not declared in
their semantic context).
Akira Hatanaka [Tue, 29 Oct 2013 18:41:15 +0000 (18:41 +0000)]
[mips] Use the distance between the current argument's starting address and
the previous argument's ending address to compute the type of the padding
argument.
Sylvestre Ledru [Tue, 29 Oct 2013 13:01:41 +0000 (13:01 +0000)]
Use LLVMLibsOptions intead of LDFLAGS when setting the libclang soname. This allows 'make LDFLAGS=foo' to be set correctly (and matches the way it is done with libllvm and liblldb)
Tim Northover [Tue, 29 Oct 2013 12:32:58 +0000 (12:32 +0000)]
ARM: fix AST for __builtin_arm_strex call
The AST was constructed so that this builtin returned the default BoolTy and
since I'd opted for custom SemaChecking, I should have set it properly at that
point.
This caused an assertion failure when the types didn't match up with what we
generated. This makes it return an IntTy, which is as good as anything.
Chandler Carruth [Tue, 29 Oct 2013 10:27:30 +0000 (10:27 +0000)]
Teach the driver to not try to use 'lib32' multilib spellings on ARM
which doesn't use that multilib. As a consequence, fix Clang's support
for cross compiling environments that were relying on this quirk to
ensure the correct library search path ordering.
This also re-instates the new test cases from Rafael's r193528 for
cross-compiling to ARM on Ubuntu 13.10 without any of the changes to the
existing test cases (they were no longer needed).
This solution was the result of a lot of IRC debugging and trying to
understand *exactly* what quirk was being relied upon. It took some time
for me to figure out that it was the use of 'lib32' is a multilib that
was throwing a wrench in the works.
In case you are thinking that its silly to use a multilib of 'lib' at
all, entertainingly, GCC does so as well (you can see it with the
.../lib/../lib/crt1.o pattern it uses), and the 2-phase sequence of
search paths (multilib followed by non-multilib) has observable (if
dubious) consequences. =/ Yuck.
Chandler Carruth [Tue, 29 Oct 2013 08:53:03 +0000 (08:53 +0000)]
Clean up the deeply misleading name of the "MultiLibSuffix". This is
actually a MIPS-only hack to shim in random ABI directory suffixes in
numerous places throughout the toolchain's path search. It shouldn't
appear to be anything more general or useful.
Alp Toker [Tue, 29 Oct 2013 08:32:41 +0000 (08:32 +0000)]
Use Rewriter::overwriteChangedFiles() directly
This replaces the custom code in RefactoringTool::saveRewrittenFiles() which
lacked atomic file saving and error diagnostics, resolving an old FIXME from
r157331.
Landing this time with the proper return code, plus a very unhelpful comment
cleared up.
Chandler Carruth [Tue, 29 Oct 2013 02:27:56 +0000 (02:27 +0000)]
Cleanup comments and braces. No functionality changed, just trying to
record what is *actually* going on here as the comments existing in the
code are confusing at best, and in places outright misleading.