Richard Smith [Sat, 16 Nov 2013 01:57:09 +0000 (01:57 +0000)]
If a replaceable global operator new/delete is marked inline, don't warn if
it's also __attribute__((used)), since that undoes the problematic part of
'inline'.
Jim Grosbach [Sat, 16 Nov 2013 00:53:35 +0000 (00:53 +0000)]
X86: Make specifying avx2 simpler on Darwin with '-arch'
Teach the '-arch' command line option to enable the compiler-friendly
features of core-avx2 CPUs on Darwin. Pass the information along in the
target triple like Darwin+ARM does.
Richard Smith [Sat, 16 Nov 2013 00:47:38 +0000 (00:47 +0000)]
Downgrade the Error on an 'inline' operator new or delete to an ExtWarn. Some
projects are relying on such (questionable) practices, so we should give them
a way to opt out of this diagnostic.
Consumed analysis: track state of temporary objects.
Earlier versions discarded the state too soon, and did not track state changes,
e.g. when passing a temporary to a move constructor. Patch by
chris.wailes@gmail.com; review and minor fixes by delesley.
Tim Northover [Fri, 15 Nov 2013 23:12:44 +0000 (23:12 +0000)]
Darwin(ish): enable embedded compiler-rt builds on Darwin.
This builds extra versions of compiler-rt targeting various unhosted targets.
Only built on Darwin since even though they're not iOS or OSX, they share some
quirks.
Richard Smith [Fri, 15 Nov 2013 22:45:29 +0000 (22:45 +0000)]
PR8455: Handle an attribute between a goto label and a variable declaration per
the GNU documentation: the attribute only appertains to the label if it is
followed by a semicolon. Based on a patch by Aaron Ballman!
ObjectiveC ARC. Lookup type associated with objc_bridage at
the point of CF object type-cast and issue diagnostic
if it is not a valid ObjectiveC class. // rdar//15454846.
This is wip.
Alp Toker [Fri, 15 Nov 2013 20:40:58 +0000 (20:40 +0000)]
Revert "Using an invalid -O falls back on -O3 instead of an error"
Trying to fix test failures since earlier today.
One of the tests added in this commit is outputting test/Driver/clang_f_opts.s
which the builders that build in-tree (eg. clang-native-arm-cortex-a9) are
trying to run as a test case, causing failures.
clang_f_opts.c:
If -### doesn't emit the warning then this test probably shouldn't be in
here in the first place. Frontend maybe?
invalid-o-level.c:
Running %clang_cc1 in the Driver tests doesn't make sense because -cc1
bypasses the driver. (I'm not reverting the commit that introduced this but
please fix instead of keeping it this way.)
Reverting to fix the build failures and also so that the tests can be thought
out more thoroughly.
Hans Wennborg [Fri, 15 Nov 2013 18:29:58 +0000 (18:29 +0000)]
clang-cl: Make the driver parse all(?) msvc flags
Even if we don't support a flag, we should be able to parse it
to provide a better error message than the current default
"error: no such file or directory: '/foo'" (which we should probably
also tweak, btw).
Justin Bogner [Fri, 15 Nov 2013 18:07:59 +0000 (18:07 +0000)]
Darwin: Look for libc++ headers in include/, rather than lib/
Up until now we were expecting that when libc++ is installed alongside
clang the headers would be in lib/, which was true if the configure
build was used and false if the cmake build was.
We've now corrected the configure build to install in include/, and
with this change we'll be able to find the correct headers with both
build systems.
Justin Bogner [Fri, 15 Nov 2013 18:07:57 +0000 (18:07 +0000)]
libc++: Install headers in include/, rather than lib/
When using the configure build system, the libc++ headers were being
installed in lib/, whereas cmake installs them in include/. Since
include/ makes more sense for headers, we'll make both systems install
headers there.
ObjectiveC. Fixes a bogus warning of unused backing
ivar when property belongs to a super class and
currnt class happens to have a method with same name as
property. // rdar//15473432
Hans Wennborg [Fri, 15 Nov 2013 17:24:45 +0000 (17:24 +0000)]
[-cxx-abi microsoft] Emit thunks for pointers to virtual member functions
Instead of storing the vtable offset directly in the function pointer and
doing a branch to check for virtualness at each call site, the MS ABI
generates a thunk for calling the function at a specific vtable offset,
and puts that in the function pointer.
This patch adds support for emitting such thunks. However, it doesn't support
pointers to virtual member functions that are variadic, have an incomplete
aggregate return type or parameter, or are overriding a function in a virtual
base class.
Richard Smith [Fri, 15 Nov 2013 04:24:58 +0000 (04:24 +0000)]
When we hit a #include directive that maps to a module import, emit a token
representing the module import rather than making the module immediately
visible. This serves two goals:
* It avoids making declarations in the module visible prematurely, if we
walk past the #include during a tentative parse, for instance, and
* It gives a diagnostic (although, admittedly, not a very nice one) if
a header with a corresponding module is included anywhere other than
at the top level.
Richard Smith [Fri, 15 Nov 2013 02:58:23 +0000 (02:58 +0000)]
PR17533 and duplicates: don't compute the return type of an overloaded operator
until after we've referenced the operator; otherwise, we might pick up a
not-yet-deduced type.
Jordan Rose [Fri, 15 Nov 2013 02:11:19 +0000 (02:11 +0000)]
[analyzer] Silence warnings coming from allocators used by std::basic_string.
This is similar to r194004: because we can't reason about the data structure
invariants of std::basic_string, the analyzer decides it's possible for an
allocator to be used to deallocate the string's inline storage. Just ignore
this by walking up the stack, skipping past methods in classes with
"allocator" in the name, and seeing if we reach std::basic_string that way.
Jordan Rose [Fri, 15 Nov 2013 02:11:11 +0000 (02:11 +0000)]
[analyzer] Include bug column numbers in HTML output (in a comment).
This has no effect on user-visible output, but can be used by post-processing
tools that work with the generated HTML, rather than using CmpRuns.py's
interface to work with plists.
Richard Smith [Fri, 15 Nov 2013 02:10:04 +0000 (02:10 +0000)]
Modern gcc is happy to constant evaluate __builtin_strlen in various cases
where we didn't. Extend our constant evaluation for __builtin_strlen to handle
any constant array of chars, not just string literals, to match.
Richard Smith [Thu, 14 Nov 2013 22:40:45 +0000 (22:40 +0000)]
DR408: If a static data member of incomplete array type is declared in a class
template, that member has a dependent type (even if we can see the definition
of the member of the primary template), because the array size could change in
a member specialization.
Warren Hunt [Thu, 14 Nov 2013 22:34:59 +0000 (22:34 +0000)]
Makes A Microsoft Layout CodeGen Test Explicit
This patch tests introduces a proper codegen test in place of the
"codegen no longer crashes" test introduced in r193664. The test is also
moved from layout to CodeGenCXX.
This options accepts a path to a directory, collects the filenames of the files
it contains, and the migrator will only modify files with the same filename.
Serge Pavlov [Thu, 14 Nov 2013 02:13:03 +0000 (02:13 +0000)]
Added warning on structures/unions that are empty or contain only
bit fields of zero size. Warnings are generated in C++ mode and if
only such type is defined inside extern "C" block.
The patch fixed PR5065.
ObjectiveC ARC. Introduce a new attribute, 'objc_bridge'
that teaches the compiler about a subset of toll-free
bridging semantics. This is wip. // rdar://15454846
[objcmt] Transfer the objcmt flags from the driver to cc1 invocation and
instantiate ObjCMigrateASTConsumer with the specific options that were enabled.
Chad Rosier [Wed, 13 Nov 2013 20:05:44 +0000 (20:05 +0000)]
[AArch64] Tests for legacy AArch32 NEON scalar shift by immediate instructions.
A number of non-overloaded intrinsics have been replaced by thier overloaded
counterparts.
Manuel Klimek [Wed, 13 Nov 2013 13:23:27 +0000 (13:23 +0000)]
Add an optional mapping from source paths to source contents.
This allows compilation database implementations for distributed build
systems to hand all data to the client to make parsing independent of
the file system.
Diego Novillo [Wed, 13 Nov 2013 12:22:39 +0000 (12:22 +0000)]
Add -fprofile-sample-use to Clang's driver.
This adds a new option -fprofile-sample-use=filename to Clang. It
tells the driver to schedule the SampleProfileLoader pass and passes
on the name of the profile file to use.
We would produce a alias, creating a comdat with D0 and D1, since the symbols
have to be weak. Another TU is not required to have a explicit template
instantiation definition or an explict template instantiation declaration and
for