Commit Graph

20835 Commits

Author SHA1 Message Date
Tim Northover 8799445065 Darwin: add __sinpi (etc) and __exp10 libbuiltins
These functions have the same constness properties of the normal libm
functions, which allows LLVM to optimise code better in general. There
are also a couple of specific optimisations that only trigger when
these are properly marked.

rdar://problem/13729466

llvm-svn: 199249
2014-01-14 19:26:03 +00:00
Aaron Ballman 2689133805 Simplifying the OpenCL image attribute. It does not need a semantic integer parameter because the required information is encoded in the spelling. Added an appropriate subject to the attribute, and simplified the semantic checking (which will likely be expanded upon in a future patch). Also, removed the GNU spelling since it was unsupported in the first place.
llvm-svn: 199229
2014-01-14 17:41:53 +00:00
Jordan Rose 6f5f719806 CFG: use Visit instead of VisitStmt to look through parens.
PR18472

llvm-svn: 199227
2014-01-14 17:29:12 +00:00
Jordan Rose a3f2781259 [analyzer] Use synthesized ASTs for property getters when available.
This allows the analyzer to handle properties with C++ class type,
finishing up the FIXME from r198953.

llvm-svn: 199226
2014-01-14 17:29:06 +00:00
Nico Rieck bb0554f959 Update CodeGen to use DLL storage class for dllimport/dllexport
With the old linkage types removed, set the linkage to external for both
dllimport and dllexport to reflect what's currently supported.

llvm-svn: 199220
2014-01-14 15:23:53 +00:00
Joey Gouly 8fc32f01dc [OpenCL] Disallow casts between address spaces.
llvm-svn: 199208
2014-01-14 12:47:29 +00:00
NAKAMURA Takumi ba6ea6024c clang/test/Index/recursive-cxx-member-calls.cpp: Add "-target" rather than XFAILing.
llvm-svn: 199201
2014-01-14 11:07:55 +00:00
David Majnemer a5b0999e4d Disable this test for windows builders
This test provides definitions of size_t which are at odds with
-fms-compatibility.  Disable this test on those builders (for now).

llvm-svn: 199196
2014-01-14 08:19:51 +00:00
David Majnemer 1de36917d3 Sema: Predefine size_t in MSVC Compatibility mode
MSVC defines size_t without any explicit declarations.  This change
allows us to be compatible with TUs that depend on this declaration
appearing from nowhere.

llvm-svn: 199190
2014-01-14 06:19:35 +00:00
Jakob Stoklund Olesen 899b4f3624 This test is passing on SPARC.
llvm-svn: 199189
2014-01-14 06:19:29 +00:00
Jakob Stoklund Olesen 6e1aaf27c1 Puny 24-byte structs are returned by value on SPARC.
Pad these structs up so they are sret-returned even on that
architecture.

llvm-svn: 199188
2014-01-14 06:19:26 +00:00
Warren Hunt 26b944274e [ms-abi] Small Change to pack+alignment interaction.
This patch makes a small behavioral change to the interaction between 
pack and alignment.  Specifically it makes __declspec(align()) on a 
field change that field's alignment without respect to pack but the 
alignment change to the record alignment as a whole still obeys pack.

llvm-svn: 199172
2014-01-14 00:54:36 +00:00
DeLesley Hutchins f28bbec90e Consumed analysis: add two new attributes which fine-tune the behavior of
consumable objects.  These are useful for implementing error codes that
must be checked.  Patch also includes some significant refactoring, which was
necesary to implement the new behavior.

llvm-svn: 199169
2014-01-14 00:36:53 +00:00
Warren Hunt 6eba907102 [ms-abi] Report VBPtrOffset correctly
Although VBPtrs were being placed correctly by the ms-abi layout engine, 
their offsets were being improperly reported to the ASTRecordLayout 
builder due to a bug.  This patch fixes that and fixes the test cases to 
use the correct values.
y

llvm-svn: 199168
2014-01-14 00:31:30 +00:00
Reid Kleckner 340ad862d9 [ms-abi] Always generate complete constructors in the Microsoft C++ ABI
Fixes PR18435, where we generated a base ctor instead of a complete
ctor, and so failed to construct virtual bases when constructing the
complete object.

llvm-svn: 199160
2014-01-13 22:57:31 +00:00
Warren Hunt 4c73e59475 [ms-abi] Reordering __declspec(align) pragma pack handling
This patch moves the check for pragma pack until after the application 
of __declspec align to before pragma pack.  This causes observable 
changes in the use of tail padding for bases.  A test case is included.

llvm-svn: 199154
2014-01-13 22:25:55 +00:00
Hans Wennborg 859422a867 clang-cl: Ignore /fallback when not actually compiling (PR18456)
For example, don't fall back in /P (preprocess) mode.

llvm-svn: 199153
2014-01-13 22:24:42 +00:00
Aaron Ballman 87e7dea2cd There is no such thing as __attribute__((align)); that's a __declspec attribute. Fixing these test cases to use the proper spelling for their syntax.
llvm-svn: 199141
2014-01-13 21:30:03 +00:00
Warren Hunt badf9e0f84 [ms-abi] Leading VFPtrs don't suppress the leading zero sized flag
The MS-ABI tracks a bit that asserts that the first sub-object is zero 
sized.  This bit is used to add padding between objects if there's the 
potential for zero sized objects to alias.  The bit is still true even 
if the zero sized base is lead by a VFPtr.  This patch makes clang mimic 
that behavior.

llvm-svn: 199132
2014-01-13 19:55:52 +00:00
Hans Wennborg 9125b08b52 Update tests in preparation for using the MS ABI for Win32 targets
In preparation for making the Win32 triple imply MS ABI mode,
make all tests pass in this mode, or make them use the Itanium
mode explicitly.

Differential Revision: http://llvm-reviews.chandlerc.com/D2401

llvm-svn: 199130
2014-01-13 19:48:13 +00:00
Reid Kleckner 4f017ceeda [ms-abi] Quick fix layout of an array of records
This fixes llvm::SmallVector, which fixes lots of TUs in the MS ABI self
host.

llvm-svn: 199129
2014-01-13 19:25:00 +00:00
Joerg Sonnenberger 9853439b5b Hook up NetBSD/aarch64.
llvm-svn: 199124
2014-01-13 18:25:15 +00:00
Jordan Rose c9176072e6 [analyzer] Add a CFG node for the allocator call in a C++ 'new' expression.
In an expression like "new (a, b) Foo(x, y)", two things happen:
- Memory is allocated by calling a function named 'operator new'.
- The memory is initialized using the constructor for 'Foo'.

Currently the analyzer only models the second event, though it has special
cases for both the default and placement forms of operator new. This patch
is the first step towards properly modeling both events: it changes the CFG
so that the above expression now generates the following elements.

1. a
2. b
3. (CFGNewAllocator)
4. x
5. y
6. Foo::Foo

The analyzer currently ignores the CFGNewAllocator element, but the next
step is to treat that as a call like any other.

The CFGNewAllocator element is not added to the CFG for analysis-based
warnings, since none of them take advantage of it yet.

llvm-svn: 199123
2014-01-13 17:59:19 +00:00
Hans Wennborg 0f3c10cb8a [ms-cxxabi] Elide dtor access checks for pass-by-val objects in callees
The ABI requires the destructor to be invoked in the callee, but the
standard does not require access checks here so we avoid doing direct
access checks on the destructor.

If we end up needing to define an implicit destructor, we don't skip
access checks for the base class, etc. Those checks are effectively part
of generating the destructor definition, and aren't affected by which TU
the check is performed in.

Differential Revision: http://llvm-reviews.chandlerc.com/D2409

llvm-svn: 199120
2014-01-13 17:23:24 +00:00
Alexey Bataev 75db8c386d Rename target i386-linux-android to i686-linux-android
llvm-svn: 199073
2014-01-13 03:49:38 +00:00
Alp Toker 44e3905987 Clarify warn_cxx98_compat_attribute diagnostic
Various attribute flavours are supported in C++98. Make it clear that this
compatibility warning relates specifically to C++11-style generalized
attributes.

llvm-svn: 199053
2014-01-12 15:18:06 +00:00
Jakob Stoklund Olesen b81eb3eb51 SPARC passes non-trivial C++ objects indirectly like everybody else.
llvm-svn: 199037
2014-01-12 06:54:56 +00:00
Jakob Stoklund Olesen 8d7f5066bf MIPS and SPARC assemblers both take the -KPIC flag.
llvm-svn: 199034
2014-01-12 04:53:36 +00:00
Benjamin Kramer 06e0dadede test case hygiene.
llvm-svn: 199017
2014-01-11 21:22:35 +00:00
Jakob Stoklund Olesen 58801bf1dc Select the UltraSPARC instruction set when invoking the assembler.
llvm-svn: 199012
2014-01-11 18:25:01 +00:00
Nick Lewycky 35a6ef4c35 Add a new attribute 'enable_if' which can be used to control overload resolution based on the values of the function arguments at the call site.
llvm-svn: 198996
2014-01-11 02:50:57 +00:00
Nick Lewycky 5641233047 Use the appropriate SourceLocation for the template backtrace when doing
template argument deduction.

llvm-svn: 198995
2014-01-11 02:37:12 +00:00
Richard Smith 454b4af0b0 PR12208: Under -fno-elide-constructors, don't forget to actually copy an NRVO
variable to the return slot. Patch by David Wiberg, with test case alterations
by me.

llvm-svn: 198991
2014-01-11 01:24:05 +00:00
Warren Hunt 9425891f28 [ms-abi] Change the way alignment is tracked
This patch more cleanly seperates the concepts of Preferred Alignment 
and Required Alignment.  Most notable that changes to Required Alignment 
do *not* impact preferred alignment until late in struct layout.  This 
is observable when using pragma pack and non-virtual bases and the use 
of tail padding when laying them out.

Test cases included.

llvm-svn: 198988
2014-01-11 01:16:40 +00:00
Richard Smith 6fa28ffd5a Fix "regression" caused by updating our notion of POD to better match the C++11
rules: instead of requiring flexible array members to be POD, require them to
be trivially-destructible. This seems to be the only constraint that actually
matters here (and even then, it's questionable whether this matters).

llvm-svn: 198983
2014-01-11 00:53:35 +00:00
Warren Hunt 87c2b0400d [ms-abi] Adjusting Rules for Padding Between Bases
The presence of a VBPtr suppresses the presence of zero sized 
sub-objects in the non-virtual portion of the object in the context of 
determining if two base objects need alias-avoidance padding placed 
between them.

Test cases included.

llvm-svn: 198975
2014-01-10 23:32:32 +00:00
Richard Smith c0a5d5bc4f Downgrade bogus ExtWarn on duplicate 'friend' specifier to a Warning, and add a
Warning for a duplicate 'constexpr' specifier.

llvm-svn: 198956
2014-01-10 21:27:55 +00:00
Jordan Rose 1a866cd54b [analyzer] Model getters of known-@synthesized Objective-C properties.
...by synthesizing their body to be "return self->_prop;", with an extra
nudge to RetainCountChecker to still treat the value as +0 if we have no
other information.

This doesn't handle weak properties, but that's mostly correct anyway,
since they can go to nil at any time. This also doesn't apply to properties
whose implementations we can't see, since they may not be backed by an
ivar at all. And finally, this doesn't handle properties of C++ class type,
because we can't invoke the copy constructor. (Sema has actually done this
work already, but the AST it synthesizes is one the analyzer doesn't quite
handle -- it has an rvalue DeclRefExpr.)

Modeling setters is likely to be more difficult (since it requires
handling strong/copy), but not impossible.

<rdar://problem/11956898>

llvm-svn: 198953
2014-01-10 20:06:06 +00:00
Fariborz Jahanian 26cb6d90b8 ObjectiveC. Remove warning on mismatched methods
which may belong to unrelated classes. It was
primarily intended for miuse of @selector expression.
But warning is too noisy and will be issued when
an actual @selector is used. // rdar://15740134

llvm-svn: 198952
2014-01-10 19:27:21 +00:00
Jakob Stoklund Olesen 0e38aade94 Implement -m32 and -m64 with llvm::Triple functions.
Don't repeat the 32 <-> 64 architecture mapping incompletely.

llvm-svn: 198943
2014-01-10 15:25:23 +00:00
Kristof Beyls fb38729d78 Enable -fuse-init-array for all AArch64 ELF targets by default, not just linux.
llvm-svn: 198940
2014-01-10 13:44:34 +00:00
Rafael Espindola 26d0f7ce7d Use 'w' instead of 'c' to represent the win32 mangling.
This change was requested to avoid confusion if we ever support non windows
coff systems.

llvm-svn: 198939
2014-01-10 13:42:17 +00:00
Jakob Stoklund Olesen 73cb84c271 Use the right dynamic linker for SPARC Linux executables.
llvm-svn: 198923
2014-01-10 08:18:34 +00:00
Richard Trieu c38786be00 Make the tautological out of range warning use Sema::DiagRuntimeBehavior so that
the warning will not trigger on code protected by compile time checks.

llvm-svn: 198913
2014-01-10 04:38:09 +00:00
Jakob Stoklund Olesen 91a8e03af0 Give the linker the right ELF type for SPARC targets.
llvm-svn: 198912
2014-01-10 03:51:33 +00:00
Jakob Stoklund Olesen 2490e553c0 Pass -32/-64 to the assembler when building for sparc/sparc64.
llvm-svn: 198911
2014-01-10 03:51:29 +00:00
Warren Hunt f4518def33 [ms-abi] Handle __declspec(align) on bitfields "properly"
__declspec(align), when applied to bitfields affects their perferred 
alignment instead of their required alignment.  We don't know why.  
Also, #pragma pack(n) turns packing *off* if n is greater than the 
pointer size.  This is now observable because of the impact of 
declspec(align) on bitfields.

llvm-svn: 198907
2014-01-10 01:28:05 +00:00
Fariborz Jahanian 65b1377911 ObjectiveC. 1) Warn when @dynamic (as well as synthesize)
property has the naming convention that implies 'ownership'.
2) improve on diagnostic and make it property specific.
3) fix the line number in the case of default property
synthesis. // rdar://15757510

llvm-svn: 198905
2014-01-10 00:53:48 +00:00
Warren Hunt 640015cbc3 [ms-abi] Fixing CGRecordLayoutBuilder w.r.t. MS NonVirutalBase Layout
The MS abi lays out *all* non-virtual bases with leading vfptrs before 
laying out non-virutal bases without vfptrs.  This guarantees that the 
primary base is laid out first.  r198818 fixed RecordLayoutBuilder to 
produce compatiable layouts.  This patch fixes CGRecordLayoutBuilder to 
be able to consume those layouts and produce meaningful output without 
tripping any asserts about assumed incoming layout.

A test case is included that shows CGRecordLayoutBuilder in fact 
produces output in the compatiable order.

llvm-svn: 198900
2014-01-09 23:51:31 +00:00
Aaron Ballman 0fa06d879a __has_attribute now understands target-specific attributes. So when you ask whether an ARM target has the "interrupt" attribute, it will return true for ARM and MSP430 targets, and false for others.
llvm-svn: 198897
2014-01-09 22:57:44 +00:00