Commit Graph

55030 Commits

Author SHA1 Message Date
Rafael Espindola d465be8ebd Update for llvm api change.
llvm-svn: 219800
2014-10-15 16:12:57 +00:00
Rafael Espindola 146700ee64 Update for llvm api change.
llvm-svn: 219797
2014-10-15 15:44:25 +00:00
Aaron Ballman fb237520ee Turned Sema::HandleDelayedAvailabilityCheck into a static function; NFC.
Did a bit of drive-by reformatting as well since it required rearranging some other static functions in the file.

llvm-svn: 219795
2014-10-15 15:37:51 +00:00
Anton Yartsev a95ea95b5c [analyzer] Handle 'mingw32-make' in the same way as 'make' and 'gmake'.
llvm-svn: 219794
2014-10-15 15:11:45 +00:00
Samuel Benzaquen 8513d6234d Speed up hasName() matcher.
Summary:
Speed up hasName() matcher by skipping the expensive generation of the
fully qualified name unless we need it.
In the common case of matching an unqualified name, we don't need to
generate the full name. We might not even need to copy any string at
all.
This change speeds up our clang-tidy benchmark by ~10%

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5776

llvm-svn: 219792
2014-10-15 14:58:46 +00:00
Alexander Kornienko 636af924db Fixed a comment. No functional changes.
llvm-svn: 219787
2014-10-15 11:03:39 +00:00
David Majnemer b00ddf31b2 CodeGen: Use the initing member's type for a union's storage type more often
Unions are initialized with the default initialization of their first
named member.  If that member is not zero initialized, then we should
prefer that member's type.  Otherwise, we might try to make an otherwise
unsuitable type (like an array) which we cannot easily initialize with a
pointer to member.

llvm-svn: 219781
2014-10-15 07:57:41 +00:00
David Majnemer 2e29b40d5e CodeGen: Fix a typo in a comment
No functionality change intended.

llvm-svn: 219780
2014-10-15 07:57:38 +00:00
David Majnemer 1573d73367 MS ABI: Use the correct this arg when generating implicit array copy ctor
We assumed the last argument of the copy constructor was the this
pointer.  However, this is not the case under the MS ABI.

llvm-svn: 219775
2014-10-15 04:54:54 +00:00
Richard Trieu 5b993500ae Improvements to -Wnull-conversion
Split logic to separate checking function
Refine the macro checking
Catch nullptr->bool conversions
Add some explanatory comments

llvm-svn: 219774
2014-10-15 03:42:06 +00:00
Justin Bogner d512c1edf0 Frontend: Don't accept null DiagnosticsEngines when building ASTUnits
The various ways to create an ASTUnit all take a refcounted pointer to
a diagnostics engine as an argument, and if it isn't pointing at
anything they initialize it. This is a pretty confusing API, and it
really makes more sense for the caller to initialize the thing since
they control the lifetime anyway.

This fixes the one caller that didn't bother initializing the pointer
and asserts that the argument is initialized.

llvm-svn: 219752
2014-10-15 00:33:06 +00:00
Justin Bogner dbbcb11f0e Frontend: Remove some unused arguments in ASTUnit (NFC)
llvm-svn: 219747
2014-10-14 23:36:06 +00:00
Hans Wennborg 818514b718 vadefs.h: be even more conservative and only define the macros if already defined
llvm-svn: 219745
2014-10-14 23:20:25 +00:00
Ehsan Akhgari e0db196556 clang-cl: Diagnose the usage of ASAN with a debug runtime library
Summary:
AddressSanitizer currently doesn't support this configuration, and binaries
built with it will just get into an infinite loop during startup.

Test Plan: Includes an automated test.

Reviewers: samsonov

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5764

llvm-svn: 219744
2014-10-14 23:15:44 +00:00
Hans Wennborg 752b789e7b Sort files list in lib/Headers/CMakeLists.txt
majnemer pointed out that vadefs.h was added in the wrong place. Might
as well sort the rest too.

llvm-svn: 219743
2014-10-14 23:15:43 +00:00
Hans Wennborg adfd7f6ef4 MS Compat: interpose vadefs.h to fix definitions of _crt_va_{start,end,arg} (PR21247)
Differential revision: http://reviews.llvm.org/D5784

llvm-svn: 219740
2014-10-14 22:35:42 +00:00
David Blaikie 8e707bb476 DebugInfo: Lazily built static member variable declarations should use the canonical declaration for line/file information.
When lazily constructing static member variable declarations (when
the vtable optimization fires and the definition of the type is omitted
(or built later, lazily), but the out of line definition of the static
member is provided and must be described in debug info) ensure we use
the canonical declaration when computing the file, line, etc for that
declaration (rather than the definition, which is also a declaration,
but not the canonical one).

llvm-svn: 219736
2014-10-14 22:22:17 +00:00
Tim Northover 147cd2f6e5 ARM: remove ARM/Thumb distinction for preferred alignment.
Thumb1 has legitimate reasons for preferring 32-bit alignment of types
i1/i8/i16, since the 16-bit encoding of "add rD, sp, #imm" requires #imm to be
a multiple of 4. However, this is a trade-off betweem code size and RAM usage;
the DataLayout string is not the best place to represent it even if desired.

So this patch removes the extra Thumb requirements, hopefully making ARM and
Thumb completely compatible in this respect.

llvm-svn: 219735
2014-10-14 22:12:21 +00:00
Kaelyn Takata 2f448467e4 Be smarter when parsing variable declarations with unknown types.
Specifically, avoid typo-correcting the variable name into a type before
typo-correcting the actual type name in the declaration. Doing so
results in a very unpleasant cascade of errors, with the typo correction
of the actual type name being buried in the middle.

llvm-svn: 219732
2014-10-14 21:57:21 +00:00
Tim Northover b98dc4b015 ARM: set preferred aggregate alignment to 32 universally.
Before, ARM and Thumb mode code had different preferred alignments, which could
lead to some rather unexpected results. There's justification for reducing it
from the default 64-bits (wasted space), but I don't think there is for going
below 32-bits.

There's no actual ABI change here, just to reassure people.

llvm-svn: 219720
2014-10-14 20:57:29 +00:00
Reid Kleckner e7367d6bcb Factor code into CXXRecordDecl::getTemplateInstantiationPattern() helper
This moves some code from SemaType.cpp's hasVisibleDefinition() into
DeclCXX.cpp so that it can be used elsewhere. I found one other instance
of code trying to do the same thing, there are probably more. Search for
getInstantiatedFrom() to try to find more.

No functionality change.

Reviewed By: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D5783

llvm-svn: 219714
2014-10-14 20:28:40 +00:00
Fariborz Jahanian c694e693b0 Patch to warn on interger overflow in presence of
implicit casts. Reviewed by Reid Kleckner.
rdar://18405357

llvm-svn: 219712
2014-10-14 20:27:05 +00:00
Saleem Abdulrasool 3b43447619 CodeGen: correct block mangling in ObjC
Mangling for blocks defined within blocks in an ObjectiveC context were also
broken by SVN r219393.  Because the code in mangleName assumed that the code was
either C or C++, we would trigger assertions when trying to mangle the inner
blocks in an ObjectiveC context.

Add a test and use the ObjectiveC specific mangling when dealing with an
ObjectiveC method declaration.

llvm-svn: 219697
2014-10-14 17:20:18 +00:00
Saleem Abdulrasool 64ab4de443 CodeGen: correct mangling for blocks
This addresses a regression introduced with SVN r219393.  A block may be
contained within another block.  In such a scenario, we would end up within a
BlockDecl, which is not a NamedDecl (as the names are synthesised).  The cast to
a NamedDecl of the DeclContext would then assert as the types are unrelated.

Restore the mangling behaviour to that prior to SVN r219393.  If the current
block is contained within a BlockDecl, walk up to the parent DeclContext,
recursively, until we have a non-BlockDecl.  This is expected to be a NamedDecl.
Add in a couple of asserts to ensure that the assumption that we only encounter
a block within a NamedDecl or a BlockDecl.

llvm-svn: 219696
2014-10-14 17:20:14 +00:00
David Blaikie 8e90d221f1 Formatting for prior commit
llvm-svn: 219692
2014-10-14 17:09:38 +00:00
Ulrich Weigand 804a3e655f [SystemZ] Address review comments for r219679
llvm-svn: 219691
2014-10-14 16:46:45 +00:00
David Blaikie 8e6c36eb80 DebugInfo: Don't leak location information from one function into the prologue of the next function.
CodeGenFunction objects aren't really designed to be reused for more
than one function, and doing so can leak debug info location information
from one function into the prologue of the next.

Add an assertion in to catch reuses of CodeGenFunction, which
surprisingly only caught the ObjC atomic getter/setter cases. Fix those
and add a test to demonstrate the issue.

The test is a bit slim, because we're just testing for the absence of a
debug location on the prologue instructions, which by itself probably
wouldn't be the end of the world - but the particular debug location
that was ending up there was for the previous function's last
instruction. This produced debug info for another function within this
function, which is something I'm trying to remove all cases of as its a
substantial source of bugs, especially around inlining (see r219215).

llvm-svn: 219690
2014-10-14 16:43:46 +00:00
Ulrich Weigand b454930cda [SystemZ] Add test case to verify default use of integrated assembler
llvm-svn: 219679
2014-10-14 11:45:53 +00:00
Justin Bogner f884723799 Re-apply "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
I'd mispelled "Bitcode/BitCodes.h" before, and tested on a case
insensitive filesystem.

This reverts commit r219649, effectively re-applying r219647 and
r219648.

llvm-svn: 219664
2014-10-14 06:30:31 +00:00
Richard Smith 99891da71a Extend -Rmodule-build to also remark when module building finishes.
In cases of nested module builds, or when you care how long module builds take,
this information was not previously easily available / obvious.

llvm-svn: 219658
2014-10-14 02:08:30 +00:00
Richard Smith 32952e1e42 [modules] Merging for class-scope using-declarations.
llvm-svn: 219657
2014-10-14 02:00:47 +00:00
Justin Bogner d776d67268 Revert "Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)"
The bots can't seem to find an include file. Reverting for now and
I'll look into it in a bit.

This reverts commits r219647 and r219648.

llvm-svn: 219649
2014-10-14 00:57:34 +00:00
Justin Bogner 0b4ab665f9 Frontend: Try to fix cmake builders after r219647
Looks like I missed a dependency here.

llvm-svn: 219648
2014-10-14 00:51:18 +00:00
Justin Bogner e40845b0dd Frontend: Extract SerializedDiagnosticReader out of CXLoadedDiagnostic (NFC)
We currently read serialized diagnostics directly in the C API, which
makes it difficult to reuse this logic elsewhere. This extracts the
core of the serialized diagnostic parsing logic into a base class that
can be subclassed using a visitor pattern.

llvm-svn: 219647
2014-10-14 00:40:55 +00:00
Alexey Samsonov eb47d8a2c8 Sanitize upcasts and conversion to virtual base.
This change adds UBSan check to upcasts. Namely, when we
perform derived-to-base conversion, we:
1) check that the pointer-to-derived has suitable alignment
   and underlying storage, if this pointer is non-null.
2) if vptr-sanitizer is enabled, and we perform conversion to
   virtual base, we check that pointer-to-derived has a matching vptr.

llvm-svn: 219642
2014-10-13 23:59:00 +00:00
David Majnemer 3e8b6ac54c Fix the build
llvm-svn: 219637
2014-10-13 22:18:22 +00:00
Fariborz Jahanian 12f7ef39ce Objective-C [Sema]. Fixes a bug in comparing qualified
Objective-C pointer types. In this case, checker incorrectly
claims incompatible pointer types if redundant protocol conformance 
is specified. rdar://18491222

llvm-svn: 219630
2014-10-13 21:07:45 +00:00
Jordan Rose 679659f58c [analyzer] Check all 'nonnull' attributes, not just the first one.
Patch by Daniel Fahlgren!

llvm-svn: 219625
2014-10-13 19:38:02 +00:00
Samuel Benzaquen 193d87fd8c Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
Fix order of evaluation bug in DynTypedMatcher::constructVariadic().
If it evaluates right-to-left, the vector gets moved before we read the
kind from it.

llvm-svn: 219624
2014-10-13 18:17:11 +00:00
Samuel Benzaquen 2009960ea3 Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
Change r219118 fixed the bug for anyOf and eachOf, but it is still
present for unless.
The variadic wrapper doesn't have enough information to know how to
restrict the type. Different operators handle restrict failures in
different ways.

Reviewers: klimek

Subscribers: klimek, cfe-commits

Differential Revision: http://reviews.llvm.org/D5731

llvm-svn: 219622
2014-10-13 17:38:12 +00:00
Chad Rosier 76267490cb Relinquish ownership of MS-style inline assembly.
llvm-svn: 219619
2014-10-13 16:45:21 +00:00
Ulrich Weigand 799c3d3a04 More OpenMP test case compatibility fixes
Allow "signext" in a couple of more places in recently
added test cases to fix failures on SystemZ.

llvm-svn: 219615
2014-10-13 13:49:39 +00:00
Bradley Smith 76d2e24bb8 [AArch64] Fixup test from A53 erratum patch after buildbot failures
Don't include stdint.h directly, instead typedef int64_t which is all we need.

llvm-svn: 219608
2014-10-13 11:18:05 +00:00
Renato Golin 5886bc35b0 Adds support for the Cortex-A17 processor to Clang
Patch by Matthew Wahab.

llvm-svn: 219607
2014-10-13 10:22:48 +00:00
Bradley Smith 9ff64332a0 [AArch64] Add workaround for Cortex-A53 erratum (835769)
Some early revisions of the Cortex-A53 have an erratum (835769) whereby it is
possible for a 64-bit multiply-accumulate instruction in AArch64 state to
generate an incorrect result.  The details are quite complex and hard to
determine statically, since branches in the code may exist in some
circumstances, but all cases end with a memory (load, store, or prefetch)
instruction followed immediately by the multiply-accumulate operation.

The safest work-around for this issue is to make the compiler avoid emitting
multiply-accumulate instructions immediately after memory instructions and the
simplest way to do this is to insert a NOP.

This patch implements clang options to enable this workaround in the backend.

The work-around code generation is not enabled by default.

llvm-svn: 219604
2014-10-13 10:16:06 +00:00
Alexey Bataev 106f68cd97 Fix incompatibility issue in /OpenMP/parallel_num_threads_codegen.cpp
llvm-svn: 219601
2014-10-13 08:51:32 +00:00
Alexey Bataev b205978100 [OPENMP] Codegen for 'num_threads' clause in 'parallel' directive.
This patch generates call to "kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads);" library function before calling "kmpc_fork_call" each time there is an associated "num_threads" clause in the "omp parallel" directive.
Differential Revision: http://reviews.llvm.org/D5145

llvm-svn: 219599
2014-10-13 08:23:51 +00:00
Alexey Bataev c451a40e9d Fix test OpenMP/parallel_if_codegen.cpp.
llvm-svn: 219598
2014-10-13 06:21:04 +00:00
Alexey Bataev d74d060d6d [OPENMP] Codegen for 'if' clause in 'parallel' directive.
Adds codegen for 'if' clause. Currently only for 'if' clause used with the 'parallel' directive.
If condition evaluates to true, the code executes parallel version of the code by calling __kmpc_fork_call(loc, 1, microtask, captured_struct/*context*/), where loc - debug location, 1 - number of additional parameters after "microtask" argument, microtask - is outlined finction for the code associated with the 'parallel' directive, captured_struct - list of variables captured in this outlined function.
If condition evaluates to false, the code executes serial version of the code by executing the following code:

global_thread_id.addr = alloca i32
store i32 global_thread_id, global_thread_id.addr
zero.addr = alloca i32
store i32 0, zero.addr
kmpc_serialized_parallel(loc, global_thread_id);
microtask(global_thread_id.addr, zero.addr, captured_struct/*context*/);
kmpc_end_serialized_parallel(loc, global_thread_id);

Where loc - debug location, global_thread_id - global thread id, returned by __kmpc_global_thread_num() call or passed as a first parameter in microtask() call, global_thread_id.addr - address of the variable, where stored global_thread_id value, zero.addr - implicit bound thread id (should be set to 0 for serial call), microtask() and captured_struct are the same as in parallel call.

Also this patch checks if the condition is constant and if it is constant it evaluates its value and then generates either parallel version of the code (if the condition evaluates to true), or the serial version of the code (if the condition evaluates to false).
Differential Revision: http://reviews.llvm.org/D4716

llvm-svn: 219597
2014-10-13 06:02:40 +00:00
Alexey Bataev 4dcead4bc3 PredefinedExpr deserialization test in dependent context.
For commit r219561 - Fix deserialization of PredefinedExpr in dependent context.

llvm-svn: 219594
2014-10-13 03:27:35 +00:00