Commit Graph

21223 Commits

Author SHA1 Message Date
Hans Wennborg 3d79154aec [Win32 ABI] Defer operator delete checks until vtable is marked used
We were previously checking at every destructor declaration, but that was a bit
excessive. Since the deleting destructor is emitted with the vtable, do the
check when the vtable is marked used.

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

llvm-svn: 202046
2014-02-24 15:58:24 +00:00
Alp Toker 8587f0ca99 Add driver test for multiple preprocessor inputs
Fix an unintentional stdin read in the darwin-asan-nofortify.c test and replace
it with an explicit test for multiple -E inputs passed to the driver.

Noticed while working on the in-process driver patch.

llvm-svn: 202007
2014-02-24 08:17:02 +00:00
Kevin Qin ad64f6d4e5 [AArch64] Change int64_t from 'long long int' to 'long int' for AArch64 target.
Most 64-bit targets define int64_t as long int, and AArch64 should
make same definition to follow LP64 model. In GNU tool chain, int64_t
is defined as long int for 64-bit target. So to get consistent with GNU,
it's better Changing int64_t from 'long long int' to 'long int',
otherwise clang will get different name mangling suffix compared with g++.

llvm-svn: 202004
2014-02-24 02:45:03 +00:00
Richard Smith 51bacfd9c7 Update __cplusplus to match the value in the C++14 DIS preview (D3937).
llvm-svn: 202003
2014-02-24 01:35:45 +00:00
Bob Wilson 8ab1691091 Do not put instrumentation counters before phis in ObjC for-in loops.
We still don't use the PGO to set branch weights for these loops, but at
least this keeps the compiler from crashing. <rdar://problem/16137778>

llvm-svn: 202002
2014-02-24 01:13:09 +00:00
Argyrios Kyrtzidis d3ba410356 [Index] Make the USRs more stable.
- Only include offsets with local (in function scope) symbols, where we don't encode scoping
- Only include the filename with non-system symbols. Presumably the system headers will not provide conflicting definitions.

rdar://15976823

llvm-svn: 201990
2014-02-23 18:23:29 +00:00
Alp Toker f2b6e79393 Fix crash when both ExpectAndConsume and ConsumeAnyToken emit diagnostics
The DiagnosticBuilder's lifetime in parser typo recovery was overlapping with
the subsequent consume which can itself emit PP diagnostics.

Patch by Olivier Goffart!

llvm-svn: 201965
2014-02-23 03:45:03 +00:00
Saleem Abdulrasool cfeb90d7a8 clang: add -f{no-,}integrate-as as consistent parameters
The integrated assembler is a feature.  This makes the new flags the default
option, and the previous versions aliases.  Ideally, at some point the aliases
would be entirely removed.

llvm-svn: 201963
2014-02-23 00:40:30 +00:00
Bob Wilson 39265b96b5 Remove support for the QA_OVERRIDE_GCC3_OPTIONS environment variable.
In r199283 I switched the name of this variable to CCC_OVERRIDE_OPTIONS, but
I kept some code to continue recognizing the old name temporarily. As far as
I know, the only use of this was for some internal testing at Apple, and we've
now switched to use the new name. If anyone else is still using this and needs
more time to switch names, I guess we'll find out! <rdar://problem/15821425>

llvm-svn: 201962
2014-02-23 00:11:56 +00:00
Saleem Abdulrasool 42e4b5997a clang: forward -no-integrated-as from the driver
Forward the -no-integrated-as option to -cc1 rather than simply invoking the
appropriate tool.  This is useful since this option has been overloaded to
permit disabling of parsing inline assembly at the MC layer.

This re-applies the previous version of the patch with a renaming of the driver
option to the public name rather than the internal name (-target vs -triple).
The actual failure is fixed separately of an overly aggressive negative pattern
match in the MIPS driver tests.  It also fixes the incorrect test for targets
that have the integrated assembler disabled by default.

llvm-svn: 201960
2014-02-22 23:37:58 +00:00
Saleem Abdulrasool a56fc7c42c test: fix MIPS driver tests
The tests attempt to validate the invocation of the assembler program with the
integrated assembler disabled.  However, the match pattern for the negative
tests are lax and will match both the driver invocation as well as the assembler
invocation.  Make the tests more strict by ensuring that we only match the
assembler invocation.

llvm-svn: 201959
2014-02-22 23:37:54 +00:00
Saleem Abdulrasool 59106827c4 Revert "clang: forward -no-integrated-as from the driver"
This seems to break a MIPS test.  Revert until I figure out the root cause.

llvm-svn: 201954
2014-02-22 22:24:00 +00:00
Saleem Abdulrasool 87a7fda237 clang: forward -no-integrated-as from the driver
Forward the -no-integrated-as option to -cc1 rather than simply invoking the
appropriate tool.  This is useful since this option has been overloaded to
permit disabling of parsing inline assembly at the MC layer.

llvm-svn: 201952
2014-02-22 21:50:09 +00:00
Nico Rieck 6047866232 Reorganize and improve semantic tests for dllexport/import
llvm-svn: 201947
2014-02-22 19:47:30 +00:00
Aaron Ballman 7c19ab17c7 Exposing the noduplicate attribute within Clang, which marks functions so that the optimizer does not duplicate code.
Patch thanks to Marcello Maggioni!

llvm-svn: 201941
2014-02-22 16:59:24 +00:00
Peter Collingbourne fa1d4e1067 Do not add enums to prototype scope in C++ modes.
The language forbids defining enums in prototypes, so this check is normally
redundant, but if an enum is defined during template instantiation it should
not be added to the prototype scope.

While at it, clean up the code that deals with tag definitions in prototype
scope and expand the visibility warning to cover the case where an anonymous
enum is defined.

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

llvm-svn: 201927
2014-02-22 03:05:49 +00:00
Peter Collingbourne b8d17e7a3b Correctly set brace range for CXXConstructExprs formed by list initialization.
Differential Revision: http://llvm-reviews.chandlerc.com/D2711

llvm-svn: 201926
2014-02-22 02:59:41 +00:00
Warren Hunt c85942038a [MS-ABI] Fix MSRecordLayout to handel MultiDimensionalArrays
A recent change caused multi-dimensional arrays not to be handled 
correctly, this patch fixes that.  Also, it adds a lit test for 
multi-dimensional arrays.

llvm-svn: 201917
2014-02-22 00:40:37 +00:00
David Majnemer a64cb5a019 Sema: Don't crash when trying to instantiate a local class with an invalid base specifier
It was previously thought that Sema::InstantiateClass could not fail
from within this point in instantiate.

However, it can happen if the class is invalid some way (i.e. invalid
base specifier).

This fixes PR18907.

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

llvm-svn: 201913
2014-02-22 00:17:46 +00:00
Ted Kremenek 204c3c50b9 [ObjC] Make attribute 'objc_protocol_requires_explicit_implementation' behave correctly with default property synthesis.
In particular, if we see an @property within the @interface of a class
conforming to a protocol with this attribute, we treat that as
if the implementation were available, per the rules of default
property synthesis.

llvm-svn: 201911
2014-02-22 00:02:03 +00:00
Warren Hunt fb00c88703 Complete Rewrite of CGRecordLayoutBuilder
CGRecordLayoutBuilder was aging, complex, multi-pass, and shows signs of 
existing before ASTRecordLayoutBuilder.  It redundantly performed many 
layout operations that are now performed by ASTRecordLayoutBuilder and 
asserted that the results were the same.  With the addition of support 
for the MS-ABI, such as placement of vbptrs, vtordisps, different 
bitfield layout and a variety of other features, CGRecordLayoutBuilder 
was growing unwieldy in its redundancy.

This patch re-architects CGRecordLayoutBuilder to not perform any 
redundant layout but rather, as directly as possible, lower an 
ASTRecordLayout to an llvm::type.  The new architecture is significantly 
smaller and simpler than the CGRecordLayoutBuilder and contains fewer 
ABI-specific code paths.  It's also one pass.

The architecture of the new system is described in the comments. For the 
most part, the new system simply takes all of the fields and bases from 
an ASTRecordLayout, sorts them, inserts padding and dumps a record. 
Bitfields, unions and primary virtual bases make this process a bit more 
complicated.  See the inline comments.

In addition, this patch updates a few lit tests due to the fact that the 
new system computes more accurate llvm types than CGRecordLayoutBuilder. 
Each change is commented individually in the review.

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

llvm-svn: 201907
2014-02-21 23:49:50 +00:00
Ted Kremenek 27cfe10df8 Add requirement that attribute 'objc_protocol_requires_explicit_implementation' can only be applied to protocol definitions.
llvm-svn: 201899
2014-02-21 22:49:04 +00:00
Joerg Sonnenberger 695fdb3bc2 Default to ARMv5e for NetBSD/EABI, ARMv4 for APCS.
llvm-svn: 201894
2014-02-21 21:53:33 +00:00
Ted Kremenek 5748bc9c06 Add test that -Wunreachable-code warnings are suppressed in headers.
llvm-svn: 201893
2014-02-21 21:41:23 +00:00
Aaron Ballman 9e9d184133 Adding role-based capability attributes that allow you to express role management: asserting a capability is held, acquiring a capability and releasing a capability. Also includes some skeleton documentation for these new attributes.
This functionality should be considered a WIP.

llvm-svn: 201890
2014-02-21 21:05:14 +00:00
Ted Kremenek 38882022af [ObjC] add support for properties in attribute 'objc_protocol_requires_explicit_implementation'.
llvm-svn: 201880
2014-02-21 19:41:39 +00:00
Oliver Stannard 96601cad2f Add support for FPv4-SP to the clang driver
Added two new options for -mfpu when targetting ARM:
* fpv4-sp-d16
* fp4-sp-d16

The first is the same spelling as gcc.

The lack of a leading `v' is correct, this is consistent with ARM's
documentation and gcc's spelling of the option.

llvm-svn: 201846
2014-02-21 10:39:15 +00:00
Rafael Espindola 33ebd2171e Accept -no-integrated-as in -cc1 and forward it to llvm.
llvm-svn: 201837
2014-02-21 03:14:07 +00:00
Reid Kleckner e4a5220d7c MS ABI: Include the vfptr offset in memptrs to virtual methods
Virtual methods expect 'this' to point to the vfptr containing the
virtual method, and this extends to virtual member pointer thunks.  The
relevant vfptr is always at offset zero on entry to the thunk, and no
this adjustment is needed.

Previously we would not include the vfptr adjustment in the member
pointer, and we'd look at the vfptr offset when loading from the vftable
in the thunk.

Fixes PR18917.

llvm-svn: 201835
2014-02-21 02:27:32 +00:00
Warren Hunt f6ec74826e [MS-ABI] Update to zero-sized padding algorithm
Slight change to the way zero-sized sub-objects are tracked in the 
presence of virtual bases.
In addition we correctly distinguish between dsize and nvsize.
addresses http://llvm.org/bugs/show_bug.cgi?id=18826
Unit tests are included.

llvm-svn: 201832
2014-02-21 01:40:35 +00:00
Bob Wilson f8cf1611e3 Fix an assertion failure when invoking dsymutil.
There is no bound architecture for the dsymutil action in the driver. Trying
to check various properties of the target will cause an assertion failure
because the target doesn't get initialized without a bound architecture.
<rdar://problem/16111555>

llvm-svn: 201830
2014-02-21 00:20:07 +00:00
Jordan Rose 45d71a2715 [analyzer] Fix a bug in IdenticalExprChecker concerning while loops.
Somehow both Daniel and I missed the fact that while loops are only identical
if they have identical bodies.

Patch by Daniel Fahlgren!

llvm-svn: 201829
2014-02-21 00:18:31 +00:00
David Majnemer 2b0d66df24 Sema: Do not assert when dereferencing member pointer using virtual inheritance with an incomplete class type
The MS ABI requires that we determine the vbptr offset if have a
virtual inheritance model.  Instead, raise an error pointing to the
diagnostic when this happens.

This fixes PR18583.

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

llvm-svn: 201824
2014-02-20 23:22:07 +00:00
Reid Kleckner 0e73ec4550 Expand macros in pragmas with -fms-extensions and -E
gcc never expands macros in pragmas and MSVC always expands macros
before processing pragmas.  Clang usually allows macro expansion, except
in a handful of pragmas, most of which are handled by the lexer.

Also remove PPCallbacks for pragmas that are currently handled in the
parser.  Without a Parser, such as with clang -E, these callbacks would
never be called.

Fixes PR18576.

llvm-svn: 201821
2014-02-20 22:59:51 +00:00
Adrian Prantl 0e79c0002e Clarify comment.
llvm-svn: 201807
2014-02-20 19:51:46 +00:00
Adrian Prantl 259c617888 add a comment.
llvm-svn: 201801
2014-02-20 17:57:37 +00:00
Adrian Prantl 4e2292eb1e Revert "Remove dead option."
Some tests in debuginfo-tests require the system-darwin feature.

This reverts commit 179670.

llvm-svn: 201800
2014-02-20 17:53:17 +00:00
Benjamin Kramer 6c6a4f4081 Sema: Emit a warning for non-null terminated format strings and other pathological cases.
PR18905.

llvm-svn: 201795
2014-02-20 17:05:38 +00:00
Rafael Espindola f9e1e5e9a3 Remove really old "APPLE LOCAL" markers.
llvm-svn: 201791
2014-02-20 14:09:04 +00:00
Alexey Samsonov 7811d19515 Get rid of obsolete addProfileRT(), generalize the relevant addProfileRTLinux() to all OS
llvm-svn: 201789
2014-02-20 13:57:37 +00:00
Pekka Jaaskelainen 8690a6860a OpenCL: fix for the restriction on pointers to functions.
Patch from Anastasia Stulova!

llvm-svn: 201788
2014-02-20 13:52:08 +00:00
Daniel Jasper 2f0f297bdb Revert r201734 and r201742.
This breaks backwards compatibility with existing code. Previously, this
was defined as

  #define _mm_prefetch(a, sel) (__builtin_prefetch((void *)(a), 0, (sel)))

Which basically accepts any pointer. Changing this to char* simply
breaks a lot of existing code. I have tried changing char* to
"const void*", which seems to be the right thing as per Intel
specification this should work on basically any pointer. However,
apparently this breaks windows compatibility (because of a conflicting
declaration in windows.h).

So, we probably need to #ifdef this based on whether clang is compiling
for windows. According to Chandler, this might be done by introducing an
additional symbol to a fake type in BuiltinsX86.def and then condition
the type expansion on the platform.

llvm-svn: 201775
2014-02-20 11:10:48 +00:00
Timur Iskhodzhanov 1f2ce39006 Revert r201772 as it breaks things on Windows
We should probably use different argument types on different platforms?

llvm-svn: 201774
2014-02-20 10:46:28 +00:00
Daniel Jasper 5a02bf26fc Change parameter type of _mm_prefetch to "const void *".
Otherwise, this is not backwards compatible to the existing macro and
can break existing code.

llvm-svn: 201772
2014-02-20 10:04:07 +00:00
Daniel Jasper 2b05fd96d5 Don't actually emit output in test/Headers/mmprefetch.c.
The test directory cannot assumed to be writable.

llvm-svn: 201768
2014-02-20 08:45:49 +00:00
Argyrios Kyrtzidis 7bbb881ad4 [code-completion] Style guideline for Cocoa has custom accessor in property declarations without spaces around '='.
rdar://16059171

llvm-svn: 201765
2014-02-20 07:55:15 +00:00
Warren Hunt 7281928be6 Updated to r201734. Removed unused declaration from lit test.
Also updating lit test to be more roboust (changing fixed offsets to 
flexible offsets)

llvm-svn: 201742
2014-02-19 23:57:54 +00:00
Warren Hunt 40d6f29ad8 Add _mm_prefetch and some others as MS builtins
This patch adds several built-ins that are required for ms 
compatibility. _mm_prefetch must be a built-in because it takes a 
compile-time constant argument and our prior approach of using a #define 
to the current built-in doesn't work in the presence of re-declaration 
of _mm_prefetch. The others can be obtained by including the windows 
system headers. If a user includes the windows system headers but not 
intrin.h they still need to work and therefore must be built-in because 
we don't get a chance to implement them in intrin.h in this case.

llvm-svn: 201734
2014-02-19 23:20:20 +00:00
Joerg Sonnenberger ed3f0693cb Hook up NetBSD/sparc and NetBSD/sparc64 as and ld invocations.
llvm-svn: 201730
2014-02-19 22:40:18 +00:00
Chandler Carruth e813984b43 Teach Clang to provide ::max_align_t in C11 and C++11 modes.
This definition is not chosen idly. There is an unfortunate reality with
max_align_t -- the specific nature of its definition leaks into the ABI
almost immediately. Because it is part of C11 and C++11 it becomes
essential for it to match with other systems on that ABI. There is an
effort to discourage any further use of this construct as a consequence
-- using max_align_t introduces an immediate ABI problem. We can never
update it to have larger alignment even as the microarchitecture changes
to necessitate higher alignment. =/

The particular definition here exactly matches the ABI of GCC's chosen
::max_align_t definition, for better or worse. This was written with the
help of Richard Smith who was decoding the exact ABI implications of the
selected definition in GCC. Notably, in-register arguments are impacted
by the particular definition chosen. =/

No one is under the illusion that this is a "good" or "useful"
definition of max_align_t, and we are working with the standards
committee to specify a more useful interface to address this need.

llvm-svn: 201729
2014-02-19 22:35:01 +00:00