Hans Wennborg [Thu, 16 Jan 2014 23:59:08 +0000 (23:59 +0000)]
Relax the ms-intrin.cpp test
The part that checks that certain functions are marked deprecated doesn't
seem that useful, and it has the bad effect that the test hard-coded the
locations of the notes from that test.
Bob Wilson [Thu, 16 Jan 2014 21:50:37 +0000 (21:50 +0000)]
Remove an unnecessary special case to check for a few Darwin-specific options.
Using -mmacosx-version-min (etc.) on non-Darwin platforms should be a warning,
not a hard error. There is no reason to add a special check for these options
in the default toolchain. This just removes the special check and then we get
the usual -Wunused-command-line-argument warning if someone tries to use one
of these options for a target where they are not supported.
<rdar://problem/15569346>
David Majnemer [Thu, 16 Jan 2014 20:05:57 +0000 (20:05 +0000)]
MS ABI: Improve selection of an inheritance model
The MSVC ABI is rather finicky about the exact representation of it's
pointer-to-member representation. The exact position of when and where
it will go with one representation versus another appears to be when it
desires the pointer-to-member to be complete.
To properly implement this in clang, do several things:
- Give up on tracking the polymorphic nature of the class. It isn't
useful to Sema and is only pertinent when choosing CodeGen-time
details like whether the field-offset can be 0 instead of -1.
- Insist on locking-in the inheritance model when we ask our
pointer-to-member type to be complete. From there, grab the
underlying CXXRecordDecl and try to make *that* complete. Once we've
done this, we can calculate it's inheritance model and apply it using
an attribute.
N.B. My first bullet point is a lie. We will eventually care about the
specifics of whether or not a CXXRecordDecl is or is not polymorphic
because MSVC compatible mangling of such things depends on it. However,
I believe we will handle this in a rather different way.
Aaron Ballman [Thu, 16 Jan 2014 19:44:01 +0000 (19:44 +0000)]
When generating Spelling enumeration values, do not generate identifiers in the reserved namespace. Strip underscores as appropriate, taking care to not create duplicate identifiers.
Aaron Ballman [Thu, 16 Jan 2014 19:00:04 +0000 (19:00 +0000)]
Giving a spelling to the Override attribute, and commenting on the absence of a spelling for a few implicitly-only attributes. No functional change intended.
Alp Toker [Thu, 16 Jan 2014 16:29:02 +0000 (16:29 +0000)]
www: link to the planet clang newsfeed
Also shuffle the Communication section so the bug tracker comes first.
(The sidebar isn't scrollable at the moment so this gives a better chance of
the bug tracker being seen. The links further down are basically invisible --
we should look into that.)
Aaron Ballman [Thu, 16 Jan 2014 14:32:03 +0000 (14:32 +0000)]
Fixing a warning that causes the sanitizer build disliked about mixing && and ||. Since this is generated code, the && has been removed from the expression entirely.
Aaron Ballman [Thu, 16 Jan 2014 13:55:42 +0000 (13:55 +0000)]
Factored some function-like type reasoning out of SemaDeclAttr and onto Decl itself. This allows for more declarative subjects in attribute tablegen where the attribute appertains to something function-like, but not strictly a FunctionDecl.
Aaron Ballman [Thu, 16 Jan 2014 13:03:14 +0000 (13:03 +0000)]
Distinguish between attributes explicitly written at the request of the user, and attributes implicitly generated to assist in bookkeeping by the compiler. This is done so by table generating a CreateImplicit method for each attribute.
Additionally, remove the optional nature of the spelling list index when creating attributes. This is supported by table generating a Spelling enumeration when the spellings for an attribute are distinct enough to warrant it.
David Majnemer [Thu, 16 Jan 2014 12:02:55 +0000 (12:02 +0000)]
Sema: Fix crash during member pointer conversion involving incomplete classes
We would attempt to determine the inheritance relationship between
classes 'A' and 'B' during static_cast if we tried to convert from 'int
A::*' to 'int B::*'. However, the question "does A derive from B" is
not meaningful when 'A' isn't defined.
Handle this case by requiring that 'A' be defined.
Evgeniy Stepanov [Thu, 16 Jan 2014 10:19:31 +0000 (10:19 +0000)]
[asan] Remove -fsanitize-address-zero-base-shadow command line
flag from clang, and disable zero-base shadow support on all platforms
where it is not the default behavior.
- It is completely unused, as far as we know.
- It is ABI-incompatible with non-zero-base shadow, which means all
objects in a process must be built with the same setting. Failing to
do so results in a segmentation fault at runtime.
- It introduces a backward dependency of compiler-rt on user code,
which is uncommon and complicates testing.
Tim Northover [Thu, 16 Jan 2014 08:48:16 +0000 (08:48 +0000)]
MachO: use *-*-*-macho for MachO embedded targets.
Previously we had bodged together some hacks mapping MachO embedded
targets (i.e. mainly ARM v6M and v7M) to the "*-*-darwin-eabi" triple.
This is incorrect in both details (they don't run Darwin and they're
not EABI in any real sense).
This commit appropriates the existing "MachO" environment for the
purpose instead.
Alp Toker [Thu, 16 Jan 2014 02:37:08 +0000 (02:37 +0000)]
Forbid driver use in Sema tests
This ports the last Sema tests over to use the frontend directly, and adds a
local lit substitution to disable inappropriate %clang usage under this
directory.
Roman Divacky [Wed, 15 Jan 2014 19:07:16 +0000 (19:07 +0000)]
Make -fno-inline attach NoInline attribute to all functions that are not
marked as AlwaysInline or ForceInline.
This moves us to what gcc does with -fno-inline. The attribute approach
was discussed to be better than switching to InlineAlways inliner in presence
of LTO.
Jordan Rose [Wed, 15 Jan 2014 17:25:15 +0000 (17:25 +0000)]
[analyzer] BlockCall shouldn't really be an AnyFunctionCall.
Per discussion with Anna a /long/ time ago, it was way too easy to misuse
BlockCall: because it inherited from AnyFunctionCall (through SimpleCall),
getDecl() was constrained to return a FunctionDecl, and you had to call
getBlockDecl() instead. This goes against the whole point of CallEvent
(to abstract over different ways to invoke bodies of code).
Now, BlockCall just inherits directly from CallEvent. There's a bit of
duplication in getting things out of the origin expression (which is still
known to be a CallExpr), but nothing significant.
Chandler Carruth [Wed, 15 Jan 2014 09:08:07 +0000 (09:08 +0000)]
Move a bunch of tests to directly use the CC1 layer. This at least saves
a subprocess invocation which is pretty significant on Windows. It also
likely saves a bunch of thrashing the host machine needlessly. Finally
it makes the tests much more predictable and less dependent on the host.
For example 'header_lookup1.c' was passing '-fno-ms-extensions' just to
thwart the host detection adding it into the compilation. By runnig CC1
directly we don't have to deal with such oddities.
Chandler Carruth [Wed, 15 Jan 2014 09:07:56 +0000 (09:07 +0000)]
Switch this test from needlessly running the clang driver to directly
test the CC1 layer.
This actually uncovered that the test semes to no longer be passing for
the reasons intended. =[ The name of the test would lead me to believe
that it should be testing the semantics of noreturn in the static
analyzer.... but there are in fact no -verify assertions about noreturn
that i can find. And the noreturn checker is no longer in 'alpha.core'.
It is in 'core.builtins'. The test *does* have one assertion for a null
dereference warning. This *also* isn't in 'alpha.core', but the driver
inserts a pile of other checker packages, including 'core' which has
this warning.
So I have switch the RUN line to actually do the minimal thing that this
test currently exercises, but someone who works on the static analyzer
should probably look at this and either nuke it or move it to actually
check the noreturn behavior.
replace LeakSanitizerIsTurnedOffForTheCurrentProcess with __lsan_is_turned_off, but this time hide it under __has_feature(address_sanitizer); also include <sanitizer/lsan_interface.h>
Justin Bogner [Wed, 15 Jan 2014 07:30:30 +0000 (07:30 +0000)]
CodeGen: Simplify CodeGenFunction::EmitCaseStmt
Way back in r129652 we tried to avoid emitting an empty block at -O0
for switch cases that did nothing but break. This led to a poor
debugging experience as reported in PR9796, so we disabled the
optimization for -O0 but left it in for higher optimization levels in
r154420.
Since the whole point of this was to improve -O0, it's silly to keep
the complexity at all.
Nick Lewycky [Wed, 15 Jan 2014 06:34:12 +0000 (06:34 +0000)]
Fix the attribute enable_if example in the docs to be 100% real-world, instead of merely being close to the real world to mislead people. This now matches the test.
Alp Toker [Wed, 15 Jan 2014 04:11:24 +0000 (04:11 +0000)]
Fix cxx_variable_templates feature check and documentation
This C++ feature has been marked complete since r191549, but the documentation
claimed it wasn't supported at all and the extension check misreported it as
being available in C.
Serge Pavlov [Wed, 15 Jan 2014 01:53:39 +0000 (01:53 +0000)]
Fixed error recovery if sizeof is used without parenthesis
Changes made in r192200 fixed PR16992, which requested fixit suggesting
parenthesis if sizeof is followed by type-id. However expression in form
T() followed by ')' was incorrectly considered as a type-id if 'T' is
typedef name. This change fixes this case.
Hans Wennborg [Wed, 15 Jan 2014 01:08:42 +0000 (01:08 +0000)]
lit.cfg: Don't expand %ms_abi_triple to non-X86 triples
This is a follow-up to r199260. On ARM hosts, we were attempting to run
tests with triples such as armv7l-unknown-win32. This expands that fix to
cover all non-x86 targets since we only support MS ABI on x86.
Hans Wennborg [Tue, 14 Jan 2014 19:35:09 +0000 (19:35 +0000)]
Remove the -cxx-abi command-line flag.
This makes the C++ ABI depend entirely on the target: MS ABI for -win32 triples,
Itanium otherwise. It's no longer possible to do weird combinations.
To be able to run a test with a specific ABI without constraining it to a
specific triple, new substitutions are added to lit: %itanium_abi_triple and
%ms_abi_triple can be used to get the current target triple adjusted to the
desired ABI. For example, if the test suite is running with the i686-pc-win32
target, %itanium_abi_triple will expand to i686-pc-mingw32.
Tim Northover [Tue, 14 Jan 2014 19:26:03 +0000 (19:26 +0000)]
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.
Alp Toker [Tue, 14 Jan 2014 19:13:00 +0000 (19:13 +0000)]
Clarify driver/frontend -fms-compatibility help text
Better describe the flag that enables drop-in MSVC compatibility, including
ability to parse MS standard headers. This is intended to distinguish it from
-fms-extensions, the more established and 'gentler' flag also supported by GCC.
The new wording matches up with the internal description introduced in r198936.
Still room for improvement (e.g. C++ is part of the product name, yet the flag
also applies to C) but it's a step forward from "Microsoft mode".
Aaron Ballman [Tue, 14 Jan 2014 17:41:53 +0000 (17:41 +0000)]
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.
Jordan Rose [Tue, 14 Jan 2014 17:29:00 +0000 (17:29 +0000)]
Use a proper lvalue-to-rvalue conversion in Objective-C++ property accessors.
Previously, the synthesized AST contained an rvalue DeclRefExpr for 'self'.
Now, it has an lvalue DeclRefExpr wrapped in an lvalue-to-rvalue
ImplicitCastExpr, which is what's generated when an ivar access is written
in the source.
Alp Toker [Tue, 14 Jan 2014 12:51:41 +0000 (12:51 +0000)]
Rename language option MicrosoftMode to MSVCCompat
There's been long-standing confusion over the role of these two options. This
commit makes the necessary changes to differentiate them clearly, following up
from r198936.
MicrosoftExt (aka. fms-extensions):
Enable largely unobjectionable Microsoft language extensions to ease
portability. This mode, also supported by gcc, is used for building software
like FreeBSD and Linux kernel extensions that share code with Windows drivers.
MSVCCompat (aka. -fms-compatibility, formerly MicrosoftMode):
Turn on a special mode supporting 'heinous' extensions for drop-in
compatibility with the Microsoft Visual C++ product. Standards-compilant C and
C++ code isn't guaranteed to work in this mode. Implies MicrosoftExt.
Note that full -fms-compatibility mode is currently enabled by default on the
Windows target, which may need tuning to serve as a reasonable default.
See cfe-commits for the full discourse, thread 'r198497 - Move MS predefined
type_info out of InitializePredefinedMacros'
Daniel Jasper [Tue, 14 Jan 2014 09:53:07 +0000 (09:53 +0000)]
clang-format: Fix bug introduced in r198871.
We cannot simply change the start column to accomodate for the @ in an
ObjC string literal as that will make clang-format happily violate the
column limit.
Use a different workaround instead. However, a better long-term
solution might be to join the @ and the rest of the literal into a
single token.
David Majnemer [Tue, 14 Jan 2014 08:18:49 +0000 (08:18 +0000)]
Switch to ssize_t from size_t to unbreak windows builders.
Builders that have -fms-compatibility on by default define size_t implicitly.
Tests that provide conflicting definitions would cause unintended failures.
David Majnemer [Tue, 14 Jan 2014 06:19:35 +0000 (06:19 +0000)]
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.
Aaron Ballman [Tue, 14 Jan 2014 01:29:54 +0000 (01:29 +0000)]
Removing some attribute magic related to the OpenCL keyword attributes. Instead of mapping them to their semantics as a custom part of the parser, they instead map declaratively through the rest of the attribute system.
Warren Hunt [Tue, 14 Jan 2014 00:54:36 +0000 (00:54 +0000)]
[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.
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.
Warren Hunt [Tue, 14 Jan 2014 00:31:30 +0000 (00:31 +0000)]
[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
Reid Kleckner [Mon, 13 Jan 2014 22:57:31 +0000 (22:57 +0000)]
[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.
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.
Chandler Carruth [Mon, 13 Jan 2014 22:23:58 +0000 (22:23 +0000)]
LLVM's CMake is now using a feature that wasn't preasant in CMake 2.8.7,
so bump the minimum version in the standalone Clang CMake project as
well.
As I mentioned on the LLVM commit version of this, if this causes any
trouble for folks, just let me know. I'm trying to avoid re-implementing
functionality in CMake, but I will if there are problems using the newer
versions.
Chandler Carruth [Mon, 13 Jan 2014 22:22:24 +0000 (22:22 +0000)]
Teach the standalone Clang CMake bits about the flag to force using an
old toolchain to build. The toolchain version is now checked in
HandleLLVMOptions.
Aaron Ballman [Mon, 13 Jan 2014 21:42:39 +0000 (21:42 +0000)]
When determining the attribute's parsed kind, pay attention to the syntax used. This fixes bugs where an attribute has differing GNU and Declspec spellings, but they are treated as the same. Eg) __declspec(aligned) when it should be __attribute__((aligned)), and __attribute__((align)) when it should be __declspec(align).
Aaron Ballman [Mon, 13 Jan 2014 21:40:16 +0000 (21:40 +0000)]
__forceinline is a keyword, and not a GNU-style attribute. This FIXME appears to be out-dated, and the attribute syntax is becoming more important these days.
Aaron Ballman [Mon, 13 Jan 2014 21:32:48 +0000 (21:32 +0000)]
Updating the attribute declarations to have the correct syntaxes. This means giving a __declspec spelling to: deprecated, naked, noinline, noreturn, and nothrow. uuid has no GNU spelling, so it was switched to __declspec. dllexport and dllimport both are now supported with GNU spellings.
There are a number of places where we do PGO.setCurrentRegionCount(0)
directly after an unconditional branch. Give this operation a name so
that it's clearer why we're doing this.
Justin Bogner [Mon, 13 Jan 2014 21:24:15 +0000 (21:24 +0000)]
CodeGen: Remove a superfluous setCurrentRegionCount
This call looks like it was an artifact of an earlier change, and
doesn't actually make sense. We begin a new region immediately anyway,
so it was mostly harmless.
Warren Hunt [Mon, 13 Jan 2014 19:55:52 +0000 (19:55 +0000)]
[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.
Hans Wennborg [Mon, 13 Jan 2014 19:48:18 +0000 (19:48 +0000)]
Use the MS ABI for Win32 targets by default
In addition to being a sensible default, this is a huge improvement
in test coverage for the MS ABI: any bot that targets Win32 will
now run the test suite using the MS ABI by default.