Simon Atanasyan [Tue, 19 Nov 2013 12:22:38 +0000 (12:22 +0000)]
[Mips] Do not adjust float-abi flags in case of MIPS16 mode. This code
should be isolated in the backend (r195123). From the frontend point
of view in case of "-mhard-float -mips16" combination of flags the float
ABI mode should remain unchanged.
Aaron Ballman [Tue, 19 Nov 2013 04:08:34 +0000 (04:08 +0000)]
Improving calling convention test coverage by adding tests for things not currently handled. Specifically: the diagnostics in SemaDeclAttr.cpp, and ensuring that calling convention attributes are applied to ObjC method declarations. No functional changes.
Kevin Enderby [Mon, 18 Nov 2013 23:30:29 +0000 (23:30 +0000)]
Change the clang driver with the use of -no-integrated-as for darwin to use
the -Q flag to the as(1) assembler driver.
We will soon be switching the darwin as(1) assembler driver to call clang(1)
and use the intergated assembler by default. To do this and still support
clang(1)'s -no-integrated-as flag, when clang(1) runs the as(1) assembler
driver and -no-integrated-as is used it needs to pass the -Q flag to as(1)
so it uses its GNU based assembler, and not turn around and call clag(1)'s
integrated assembler.
Rafael Espindola [Mon, 18 Nov 2013 22:40:04 +0000 (22:40 +0000)]
The attached patch is a follow up from my previous one. The existing
logic was not handling typedefs as free functions. This was not
causing problems with the existing tests, but does with the microsoft
abi where they have to get a different calling convention.
I will try to refactor this into a method on Declarator in a second.
Aaron Ballman [Mon, 18 Nov 2013 20:11:50 +0000 (20:11 +0000)]
The code using the StmtPrinterHelper object failed to account for a null object in many cases, which could have led to crashes were it ever to be null. Now passing the object by reference instead of by pointer because it is never null in practice. No functional changes intended.
Rafael Espindola [Mon, 18 Nov 2013 20:05:33 +0000 (20:05 +0000)]
Use the default method CC in GetFullTypeForDeclarator.
Before this patch explicit template instatiations of member function templates
were failing with the microsoft abi and 32 bits. This was happening because
the expected and computed function types had different calling conventions.
This patch fixes it by considering the default calling convention in
GetFullTypeForDeclarator.
Samuel Benzaquen [Mon, 18 Nov 2013 14:53:42 +0000 (14:53 +0000)]
Add partial support for the hasDeclaration() matcher in the dynamic layer.
Summary:
Add partial support for the hasDeclaration() matcher in the dynamic layer.
This matcher has some special logic to allow any type that has a getDecl() method. We do not support this right now.
Alp Toker [Sun, 17 Nov 2013 18:13:43 +0000 (18:13 +0000)]
RewriteBuffer::write(): Add a doc comment about non-portable use
The function isn't strictly at fault but there are callers using it
incorrectly, causing crashes with in-place edits of 64KB or larger files on
Windows.
Alp Toker [Sun, 17 Nov 2013 16:49:24 +0000 (16:49 +0000)]
Remove a bad string compare from r194968
lib/Tooling/CompilationDatabase.cpp:275:34: warning: result of comparison against a string literal is unspecified (use strncmp instead) [-Wstring-compare]
This assert() should probably be fixed and added back at some point.
Edwin Vane [Sun, 17 Nov 2013 16:08:04 +0000 (16:08 +0000)]
Relax some preconditions for using FixedCompilationDatabase.
FixedCompilationDatabase (FCD) requires that the arguments it consumes after
'--' must not include positional parameters or the argv[0] of the tool. This
patch relaxes those restrictions.
Hal Finkel [Sun, 17 Nov 2013 16:03:29 +0000 (16:03 +0000)]
Add -freroll-loops to enable loop rerolling
This adds -freroll-loops (and -fno-reroll-loops in the usual way) to enable
loop rerolling as part of the optimization pass manager. This transformation
can enable vectorization, reduce code size (or both).
Briefly, loop rerolling can transform a loop like this:
Anton Yartsev [Sun, 17 Nov 2013 09:18:48 +0000 (09:18 +0000)]
[analyzer] Better modeling of memcpy by the CStringChecker (PR16731).
New rules of invalidation/escape of the source buffer of memcpy: the source buffer contents is invalidated and escape while the source buffer region itself is neither invalidated, nor escape.
In the current modeling of memcpy the information about allocation state of regions, accessible through the source buffer, is not copied to the destination buffer and we can not track the allocation state of those regions anymore. So we invalidate/escape the source buffer indirect regions in anticipation of their being invalidated for real later. This eliminates false-positive leaks reported by the unix.Malloc and alpha.cplusplus.NewDeleteLeaks checkers for the cases like
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.