Commit Graph

54986 Commits

Author SHA1 Message Date
Daniel Dunbar 214671f98c [Analysis] Add missing newlines at end of file.
llvm-svn: 219439
2014-10-09 20:34:45 +00:00
Samuel Benzaquen 96039d727b Special case 0 and 1 matcher in makeAllOfComposite().
Summary:
Remove unnecessary wrapping for the 0 and 1 matcher cases of
makeAllOfComposite(). We don't need a variadic wrapper for those cases.
Refactor TrueMatcher to take advandage of the new conversions between
DynTypedMatcher and Matcher<T>. Also, make it a singleton.
This change improves our clang-tidy related benchmarks by ~12%.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219431
2014-10-09 19:28:18 +00:00
Ulrich Weigand 55f66f77fe [SystemZ] Turn on the integrated assembler by default
llvm-svn: 219426
2014-10-09 18:46:38 +00:00
Fariborz Jahanian ed6de56c77 Objective-C SDK modernization. convert message expression
to Objective-C dot-syntax. rdar://18498572

llvm-svn: 219424
2014-10-09 18:30:56 +00:00
Kostya Serebryany aed71a89bc Add experimental clang/driver flag -fsanitize-address-field-padding=N
Summary:
This change adds an experimental flag -fsanitize-address-field-padding=N (0, 1, 2)
to clang and driver. With this flag ASAN will be able to detect some cases of
intra-object-overflow bugs,
see https://code.google.com/p/address-sanitizer/wiki/IntraObjectOverflow

There is no actual functionality here yet, just the flag parsing.
The functionality is being reviewed at http://reviews.llvm.org/D5687

Test Plan: Build and run SPEC, LLVM Bootstrap, Chrome with this flag.

Reviewers: samsonov

Reviewed By: samsonov

Subscribers: cfe-commits

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

llvm-svn: 219417
2014-10-09 17:53:04 +00:00
Manuel Klimek 20c1c890b3 Separated RecursiveASTVisitorTest into multiple files.
Patch by Marek Kurdej.

llvm-svn: 219410
2014-10-09 15:02:06 +00:00
Manuel Klimek 7735e40a87 Implement various matchers around template argument handling.
llvm-svn: 219408
2014-10-09 13:06:22 +00:00
Aaron Ballman 201b94e63f Escaping a special character in the documentation.
llvm-svn: 219407
2014-10-09 13:03:12 +00:00
Alexey Bataev 9b280eab66 Fix compatibility issues in tests for PredefinedExpr with MSVC.
llvm-svn: 219405
2014-10-09 11:58:26 +00:00
Daniel Jasper 18210d7d2f clang-format: Add option to control call argument bin-packing separately
This is desirable for the Chromium style guide:
http://www.chromium.org/developers/coding-style

llvm-svn: 219400
2014-10-09 09:52:05 +00:00
Alexey Bataev ec4747802a Fix for bug http://llvm.org/PR17427.
Assertion failed: "Computed __func__ length differs from type!"
Reworked PredefinedExpr representation with internal StringLiteral field for function declaration.
Differential Revision: http://reviews.llvm.org/D5365

llvm-svn: 219393
2014-10-09 08:45:04 +00:00
Alexey Bataev 13314bf526 [OPENMP] 'omp teams' directive basic support.
Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive.  

llvm-svn: 219385
2014-10-09 04:18:56 +00:00
Kostya Serebryany b21aa76a8c Replace a destructor of EHCleanupScope with a Destroy() method to reflect the current usage.
Summary:
The current code uses memset to re-initialize EHCleanupScope objects
with breaks the assumptions of the upcoming asan's intra-object-overflow checker.
If there is no DTOR, the new checker will refuse to work.

Test Plan: bootstrap with asan

Reviewers: rnk

Reviewed By: rnk

Subscribers: cfe-commits

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

llvm-svn: 219331
2014-10-08 18:31:54 +00:00
Robert Khasanov 33e7685b2a Added new headers to CMakeLists.txt.
Fix for rev219319

llvm-svn: 219325
2014-10-08 17:37:51 +00:00
Ehsan Akhgari 4292443101 ms-inline-asm: Correctly mark MS inline ASM labels as used
Summary: This fixes PR21155.

Test Plan: The patch includes a test.

Reviewers: rnk

Subscribers: cfe-commits

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

llvm-svn: 219322
2014-10-08 17:28:34 +00:00
Robert Khasanov b9f3a911c9 [AVX512] Added VPCMPEQ intrinisics to headers.
Added tests.

Patch by Maxim Blumenthal <maxim.blumenthal@intel.com>

llvm-svn: 219319
2014-10-08 17:18:13 +00:00
Alexey Bataev 25cdd1598e Fixed OpenMP/parallel_firstprivate_codegen.cpp
Fixed compatibility issues on ARM.

llvm-svn: 219315
2014-10-08 15:39:06 +00:00
Alexey Bataev ae03d07024 Fix test OpenMP/parallel_firstprivate_codegen.cpp
Fixed compatibility issues with MSVC mode and ARM target.

llvm-svn: 219309
2014-10-08 14:34:59 +00:00
Arnaud A. de Grandmaison e69ec55cda Revert "Remove threshold on object size for inserting lifetime begin / end"
Revert this patch while I investigate some sanitizer failures off-line.

llvm-svn: 219307
2014-10-08 14:04:26 +00:00
Alexey Bataev 4a5bb772c3 [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219306
2014-10-08 14:01:46 +00:00
Arnaud A. de Grandmaison 1b175e4098 Remove threshold on object size for inserting lifetime begin / end
Boostrapping LLVM+Clang+LLDB without threshold on object size for
lifetime markers insertion has shown there was no significant change
in compile time, so let the stack slot colorizer do its optimization
for all slots.

llvm-svn: 219303
2014-10-08 12:49:16 +00:00
Alexey Bataev 8068b643c4 Revert commit r219297.
Still troubles with OpenMP/parallel_firstprivate_codegen.cpp (now in ARM buildbots).

llvm-svn: 219298
2014-10-08 12:00:22 +00:00
Alexey Bataev 3854f63aaf [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219297
2014-10-08 11:35:04 +00:00
Alexey Bataev bdef50e1ad Revert back r219295.
To fix issues with test OpenMP/parallel_firstprivate_codegen.cpp

llvm-svn: 219296
2014-10-08 11:12:35 +00:00
Alexey Bataev e7a5517a58 [OPENMP] Codegen for 'firstprivate' clause.
This patch generates some helper variables that used as private copies of the corresponding original variables inside an OpenMP 'parallel' directive. These generated variables are initialized by copy using values of the original variables (with the copy constructor, if any). For arrays, initializator is generated for single element and in the codegen procedure this initial value is automatically propagated between all elements of the private copy.
In outlined function, references to original variables are replaced by the references to these private helper variables. At the end of the initialization of the private variables an implicit barier is generated by calling __kmpc_barrier(...) runtime function to be sure that all threads were initialized using original values of the variables.
Differential Revision: http://reviews.llvm.org/D5140

llvm-svn: 219295
2014-10-08 10:42:55 +00:00
Renato Golin 9804fa5d48 Revert "[OPENMP] 'omp teams' directive basic support. Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive."
This reverts commit r219197 because it broke ARM self-hosting buildbots with
segmentation fault errors in many tests.

llvm-svn: 219289
2014-10-08 09:06:45 +00:00
Justin Bogner 2ca9a4a7ef AST: Fix a typo (NFC)
llvm-svn: 219279
2014-10-08 05:45:39 +00:00
Hans Wennborg e9d240af44 Disallow using function parameters in extended asm inputs or outputs in naked functions (PR21178)
Clang won't emit any prologues for such functions, so it would assert trying to
codegen the parameter references.

This patch makes Clang check the extended asm inputs and outputs for
references to function parameters.

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

llvm-svn: 219272
2014-10-08 01:58:02 +00:00
Reid Kleckner 026e874a97 Fix test case in no asserts build
llvm-svn: 219266
2014-10-08 01:13:51 +00:00
Reid Kleckner 453e056467 Fix IRGen for referencing a static local before emitting its decl
Summary:
Previously CodeGen assumed that static locals were emitted before they
could be accessed, which is true for automatic storage duration locals.
However, it is possible to have CodeGen emit a nested function that uses
a static local before emitting the function that defines the static
local, breaking that assumption.

Fix it by creating the static local upon access and ensuring that the
deferred function body gets emitted. We may not be able to emit the
initializer properly from outside the function body, so don't try.

Fixes PR18020.  See also previous attempts to fix static locals in
PR6769 and PR7101.

Reviewers: rsmith

Subscribers: cfe-commits

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

llvm-svn: 219265
2014-10-08 01:07:54 +00:00
Rafael Espindola fcfbcc6d10 Avoid code duplication by calling setAliasAttributes in EmitAliasDefinition.
llvm-svn: 219258
2014-10-08 00:00:09 +00:00
Fariborz Jahanian 80ebf8da7e Objective-C SDK modernization. When modernizing to
use NS_ENUM/NS_OPTIONS macros, add an import of
Foundation.h (or its module) as necessary.
rdar://18498550

llvm-svn: 219225
2014-10-07 19:01:46 +00:00
Richard Smith 640775b428 PR21180: Lambda closure types are neither aggregates nor literal types.
llvm-svn: 219222
2014-10-07 18:01:33 +00:00
Jonathan Roelofs 2b00d54676 Emit diagnostic for -munaligned-access on v6m
Patch by: Charlie Turner <charlie.turner@arm.com>

llvm-svn: 219211
2014-10-07 15:11:32 +00:00
Daniel Jasper 4281c5ae01 clang-format: Fix bug with comments between non-trival parameters.
Before:
  SomeFunction(a, a,
               // comment
                      b + x);

After:
  SomeFunction(a, a,
               // comment
               b + x);

llvm-svn: 219209
2014-10-07 14:45:34 +00:00
Rafael Espindola e04a17da81 Allow dllexport alias to base destructors.
We used to avoid these, but it looks like we did so just because we were
not handling dllexport alias correctly.

Dario Domizioli fixed that, so allow these aliases.

Based on a patch by Dario Domizioli!

llvm-svn: 219206
2014-10-07 13:34:42 +00:00
Daniel Jasper d8b4ec0dad clang-format: Add documentation about disabling formatting.
Patch by Marek Kurdej, thanks!

llvm-svn: 219204
2014-10-07 12:15:15 +00:00
Alexey Bataev 941bbec6f4 [OPENMP] 'omp teams' directive basic support.
Includes parsing and semantic analysis for 'omp teams' directive support from OpenMP 4.0. Adds additional analysis to 'omp target' directive with 'omp teams' directive.

llvm-svn: 219197
2014-10-07 10:13:33 +00:00
Alexander Musman d196ef2124 [OPENMP] Small refactoring of EmitOMPSimdLoop helper routine.
No functional changes intended.
Renamed EmitOMPSimdLoop to EmitOMPInnerLoop, I plan to re-use
it to emit inner loop in the future patches for CodeGen of the
worksharing loop directives (omp for, omp for simd).

llvm-svn: 219195
2014-10-07 08:57:09 +00:00
David Majnemer 3349872cf3 driver: Map closed standard file descriptors to /dev/null
Utilize Process::FixupStandardFileDescriptors, introduced in r219170, to
guard against files from being treated as one of the standard file
descriptors.

llvm-svn: 219174
2014-10-06 23:52:23 +00:00
Fariborz Jahanian 35ee87debe Objective-C SDK modernizer. Patch to support modernization
to NS_ENUM/NS_OPTION macros when typedef names are other
than NSInteger/NSUInteger (int8_t, etc.).
rdar://18532199

llvm-svn: 219173
2014-10-06 23:50:37 +00:00
Eli Bendersky 11b6badd7b Update title of the ReleaseNodes doc.
It was still "3.5 (In-Progress)" - should be 3.6

llvm-svn: 219153
2014-10-06 22:45:17 +00:00
Bill Schmidt cad3a5f7d4 [PATCH][Power] Fix (and deprecate) vec_lvsl and vec_lvsr for little endian
The use of the vec_lvsl and vec_lvsr interfaces are discouraged for
little endian targets since Power8 hardware is a minimum requirement,
and Power8 provides reasonable performance for unaligned vector loads
and stores.  Up till now we have not provided "correct" (i.e., big-
endian-compatible) code generation for these interfaces, as to do so
produces poorly performing code.  However, this has become the source
of too many questions.

With this patch, LLVM will now produce compatible code for these
interfaces, but will also produce a deprecation warning message for
PPC64LE when one of them is used.  This should make the porting direction
clearer to programmers.  A similar patch has recently been committed to
GCC.

This patch includes a test for the warning message.  There is a companion
patch that adds two unit tests to projects/test-suite.

llvm-svn: 219137
2014-10-06 19:02:20 +00:00
Rafael Espindola 6ff5f2e13b Remove cases that are now handled by the parent class implementation.
llvm-svn: 219132
2014-10-06 17:45:47 +00:00
Eric Christopher 7647109917 Turn on the integrated assembler by default for ppc64 and
ppc64le.

Reviewed by Hal Finkel and Bill Schmidt.

llvm-svn: 219129
2014-10-06 17:33:18 +00:00
Fariborz Jahanian 2618dbaf5f Patch to wrap up '_' as separator in version numbers
in availability attribute by preserving this info.
in VersionTuple and using it in pretty printing of attributes
and yet using '.' as separator when diagnosing unavailable 
message calls. rdar://18490958

llvm-svn: 219124
2014-10-06 16:46:02 +00:00
Daniel Jasper a45eb4c000 clang-format: If in doubt, assume '+' is a binary operator.
Before:
  #define LENGTH(x, y) (x) - (y)+1

After:
  #define LENGTH(x, y) (x) - (y) + 1

llvm-svn: 219119
2014-10-06 13:16:43 +00:00
Samuel Benzaquen a117002d93 Fix bug in DynTypedMatcher::constructVariadic() that would cause false negatives.
Summary:
DynTypedMatcher::constructVariadic() where the restrict kind of the
different matchers are not related causes the matcher to have a "None"
restrict kind. This causes false negatives for anyOf and eachOf.
Change the logic to get a common ancestor if there is one.
Also added regression tests that fail without the fix.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 219118
2014-10-06 13:14:30 +00:00
Aaron Ballman d2a3f4765b Using an explicit cast to work around MSVC 2013 not picking the conversion operator as expected. NFC, should fix the MSVC build bots.
llvm-svn: 219116
2014-10-06 12:42:31 +00:00
Alexander Musman 81e652f86e [OPENMP] Fix target triple of a test, which uses __int128 type
llvm-svn: 219114
2014-10-06 11:36:48 +00:00
Alexander Musman 174b3ca682 [OPENMP] Limit the loop counters to 64 bits for the worksharing loops
llvm-svn: 219113
2014-10-06 11:16:29 +00:00
David Blaikie 6dddfe30d6 Add FIXME/notes to the future.
llvm-svn: 219104
2014-10-06 05:52:27 +00:00
David Blaikie fd58072675 DebugInfo: Don't include implicit special members in the list of class members
By leaving these members out of the member list, we avoid them being
emitted into type unit definitions - while still allowing the
definition/declaration to be injected into the compile unit as expected.

llvm-svn: 219101
2014-10-06 05:18:55 +00:00
David Blaikie 56cfbe841f DebugInfo: Don't include member function template specializations in the list of class members
By leaving these members out of the member list, we avoid them being
emitted into type unit definitions - while still allowing the
definition/declaration to be injected into the compile unit as expected.

llvm-svn: 219100
2014-10-06 05:06:54 +00:00
David Majnemer a00381fb73 MS ABI: Make comment more accurate
The ABI for function-scope statics changed in VS "14", not MSVC 2013.

llvm-svn: 219076
2014-10-05 06:44:55 +00:00
David Majnemer 040fa34bec MS ABI: Use '1' (instead of '0') relative scope discriminators
This changes the scope discriminator's behavior to start at '1' instead
of '0'.  Symbol table diffing, for ABI compatibility testing, kept
finding these as false positives.

llvm-svn: 219075
2014-10-05 06:44:53 +00:00
David Majnemer b3341ea453 MS ABI: Implement thread_local for global variables
Summary:
This add support for the C++11 feature, thread_local global variables.
The ABI Clang implements is an improvement of the MSVC ABI.  Sadly,
further improvements could be made but not without sacrificing ABI
compatibility.

The feature is implemented as follows:
- All thread_local initialization routines are pointed to from the
  .CRT$XDU section.
- All non-weak thread_local variables have their initialization routines
  call from a single function instead of getting their own .CRT$XDU
  section entry.  This is done to open up optimization opportunities to
  the compiler.
- All weak thread_local variables have their own .CRT$XDU section entry.
  This entry is in a COMDAT with the global variable it is initializing;
  this ensures that we will initialize the global exactly once.
- Destructors are registered in the initialization function using
  __tlregdtor.

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

llvm-svn: 219074
2014-10-05 05:05:40 +00:00
Benjamin Kramer 07935294be Return a reference instead of vector copy for parentmap queries.
The map is immutable until the whole ASTContext dies. While there
movify a couple of copies in ASTMatchFinder away. NFC.

llvm-svn: 219062
2014-10-04 17:01:26 +00:00
Hal Finkel 64567a80d2 Emit @llvm.assume for non-parameter lvalue align_value-attribute loads
We already add the align parameter attribute for function parameters that have
the align_value attribute (or those with a typedef type having that attribute),
which is an important special case, but does not handle pointers with value
alignment assumptions that come into scope in any other way. To handle the
general case, emit an @llvm.assume-based alignment assumption whenever we load
the pointer-typed lvalue of an align_value-attributed variable (except for
function parameters, which we already deal with at entry).

I'll also note that this is more general than Intel's described support in:
  https://software.intel.com/en-us/articles/data-alignment-to-assist-vectorization
which states that the compiler inserts __assume_aligned directives in response
to align_value-attributed variables only for function parameters and for the
initializers of local variables. I think that we can make the optimizer deal
with this more-general scheme (which could lead to a lot of calls to
@llvm.assume inside of loop bodies, for example), but if not, I'll rework this
to be less aggressive.

llvm-svn: 219052
2014-10-04 15:26:49 +00:00
Nikola Smiljanic 905bfda957 -ms-extensions: Allow __super in return stements.
llvm-svn: 219050
2014-10-04 10:17:57 +00:00
David Majnemer 5da21da4f6 MS ABI: Disallow dllimported/exported variables from having TLS
Windows TLS relies on indexing through a tls_index in order to get at
the DLL's thread local variables.  However, this index is not exported
along with the variable: it is assumed that all accesses to thread local
variables are inside the same module which created the variable in the
first place.

While there are several implementation techniques we could adopt to fix
this (notably, the Itanium ABI gets this for free), it is not worth the
heroics.

Instead, let's just ban this combination.  We could revisit this in the
future if we need to.

This fixes PR21111.

llvm-svn: 219049
2014-10-04 06:51:54 +00:00
David Majnemer 7656f41809 Sema: Simplify checkAttributesAfterMerging
Use getDLLAttr to factor out some common dllimport/dllexport code.

llvm-svn: 219048
2014-10-04 06:16:45 +00:00
Richard Smith a9d100178c PR20991: ::decltype is not valid.
llvm-svn: 219043
2014-10-04 01:57:39 +00:00
Benjamin Kramer 719772c269 Remove stray enum keywords. MSVC sees this as a redeclaration at global scope.
llvm-svn: 219031
2014-10-03 22:20:30 +00:00
Justin Bogner fa9df7af07 test: Disable standard system includes in %clang_cc1
This adds -nostdsysteminc to the %clang_cc1 expansion, which should
make it harder to accidentally write tests that depend on headers in
/usr/include. It also updates a few tests that use -isysroot <x> and a
darwin triple to omit the triple and use -isystem <x>/usr/include
instead, making them a little bit more general.

Incidentally, this fixes a test failure I'm seeing on darwin in
Modules/stddef.c, that happens because my system finds a stddef.h in
/usr/include.

llvm-svn: 219030
2014-10-03 22:18:49 +00:00
Jingyue Wu 3c3b48805f Suppress defined-but-unused warnings
by adding a fake use

llvm-svn: 219029
2014-10-03 22:16:40 +00:00
Jonathan Roelofs b140a100a0 CFE Knob for: Add a thread-model knob for lowering atomics on baremetal & single threaded systems
http://reviews.llvm.org/D4985

llvm-svn: 219027
2014-10-03 21:57:44 +00:00
Anna Zaks 0820e13e2a [analyzer] Refactor and cleanup IsCompleteType
There are three copies of IsCompleteType(...) functions in CSA and all
of them are incomplete (I experienced  crashes in some CSA's test cases).
I have replaced these function calls with Type::isIncompleteType() calls.

A patch by Aleksei Sidorin!

llvm-svn: 219026
2014-10-03 21:49:03 +00:00
Anna Zaks d79b840716 [analyzer] Make Malloc Checker track memory allocated by if_nameindex
The MallocChecker does currently not track the memory allocated by
if_nameindex. That memory is dynamically allocated and should be freed
by calling if_freenameindex. The attached patch teaches the checker
about these functions.

Memory allocated by if_nameindex is treated as a separate allocation
"family". That way the checker can verify it is freed by the correct
function.

A patch by Daniel Fahlgren!

llvm-svn: 219025
2014-10-03 21:48:59 +00:00
Anna Zaks 2d2f137ed4 [analyzer] Make CStringChecker correctly calculate return value of mempcpy
The return value of mempcpy is only correct when the destination type is
one byte in size. This patch casts the argument to a char* so the
calculation is also correct for structs, ints etc.

A patch by Daniel Fahlgren!

llvm-svn: 219024
2014-10-03 21:48:54 +00:00
Benjamin Kramer de952d1180 Initialize MCObjectFileInfo when parsing ms-style asm.
Otherwise we're left with an half-initialized bag of variables that may or may
not explode later on. Should bring the MSVC buildbot back to life.

llvm-svn: 219023
2014-10-03 21:48:23 +00:00
Fariborz Jahanian aae7fefce8 Objective-C. Assortment of improvements pretty printing
objective-C declarations, including printing of availability
attributes on methods.

llvm-svn: 219013
2014-10-03 20:05:33 +00:00
Duncan P. N. Exon Smith 3c51fa6aae Revert "Revert "DI: LLVM schema change: fold constants into string""
This reverts commit r218917, effectively reapplying r218913.  Original
commit message follows.

--

Update debug info testcases for an LLVM metadata schema change to fold
metadata constant operands into a single `MDString`.

Part of PR17891.

llvm-svn: 219011
2014-10-03 20:01:52 +00:00
Benjamin Kramer 1a6e0a9b40 ASTUnit: Replace out parameter with return value, we have NRVO for this.
And elide the copy when pushing the return value into a vector. NFC.

llvm-svn: 219001
2014-10-03 18:52:54 +00:00
Benjamin Kramer d0eed3a006 Format: ArrayRefize some implicit copies away.
NFC.

llvm-svn: 219000
2014-10-03 18:52:48 +00:00
Hal Finkel 92e31a5ead Add getOpenMPSimdDefaultAlignment for PowerPC
When the aligned clause of an OpenMP simd pragma is not provided with an
explicit alignment, a target-dependent default must be used. This adds such a
default of PPC targets.

This will become slightly more complicated when BG/Q support is added (because
then it will depend on the type). For now, 16 is a correct value for all
systems, and covers Altivec and VSX vectors.

llvm-svn: 218994
2014-10-03 17:45:20 +00:00
Fariborz Jahanian b6161611b1 Add comment about separators must match in
version numbers.

llvm-svn: 218993
2014-10-03 17:21:12 +00:00
Hal Finkel 0dd05d4b59 constexpr evaluation for __builtin_assume_aligned
Richard noted in the review of r217349 that extra handling of
__builtin_assume_aligned inside of the expression evaluator was needed. He was
right, and this should address the concerns raised, namely:

 1. The offset argument to __builtin_assume_aligned can have side effects, and
    we need to make sure that all arguments are properly evaluated.

 2. If the alignment assumption does not hold, that introduces undefined
    behavior, and undefined behavior cannot appear inside a constexpr.

and hopefully the diagnostics produced are detailed enough to explain what is
going on.

llvm-svn: 218992
2014-10-03 17:18:37 +00:00
Dan Liew fe7268600d [sphinx clean up] Fix warning introduced by r218957
llvm-svn: 218983
2014-10-03 12:36:20 +00:00
Asiri Rathnayake 9e3c7cbfa1 Revert changes in r218863, r218864
Summary: The changes introduced in the above two commits are giving
a rough time to one of the build bots. Reverting the changes for the
moment so that the bot can go green again.

Change-Id: Id19f6cb2a8bc292631fac2262268927563d820c2
llvm-svn: 218970
2014-10-03 09:11:41 +00:00
Alexander Potapenko e2e8b0e009 Revert r218925 - "Patch to warn if 'override' is missing"
This CL has caused bootstrap failures on Linux and OSX buildbots running with -Werror.

Example report from http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/13183/steps/bootstrap%20clang/logs/stdio:

================================================================
[ 91%] Building CXX object tools/clang/tools/diagtool/CMakeFiles/diagtool.dir/ShowEnabledWarnings.cpp.o
In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/AMDGPUISelDAGToDAG.cpp:20:
In file included from /home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIISelLowering.h:19:
/home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/lib/Target/R600/SIInstrInfo.h:71:8: error: 'getLdStBaseRegImmOfs' overrides a member function but is not marked 'override' [-Werror,-Winconsistent-missing-override]
  bool getLdStBaseRegImmOfs(MachineInstr *LdSt,
       ^
/home/dtoolsbot/build/sanitizer-x86_64-linux/build/llvm/include/llvm/Target/TargetInstrInfo.h:815:16: note: overridden virtual function is here
  virtual bool getLdStBaseRegImmOfs(MachineInstr *LdSt,
               ^
================================================================

llvm-svn: 218969
2014-10-03 09:02:53 +00:00
David Majnemer 749b68630b MS ABI: Move test from virtual-inheritance to single-inheritance
The test didn't actually use virtual inheritance.

llvm-svn: 218966
2014-10-03 08:03:23 +00:00
David Majnemer 312c8049f2 MS ABI: Add a vftable test for pure virtual methods
llvm-svn: 218965
2014-10-03 07:54:12 +00:00
David Majnemer 22718651af MS ABI: Clean up test to not use dllexport, check vftable entries
llvm-svn: 218964
2014-10-03 07:48:27 +00:00
David Majnemer ba7f49a23d MS ABI: Add an additional test for empty structs in C
Empty structs in C differ from those in C++.
- C++ requires that empty types have size 1; alignment requirements may
  increase the size of the struct.
- The C implementation doesn't let empty structs have a size under 4
  bytes.  Again, alignment requirements may increase the struct's size.

Add a test to stress these differences.

llvm-svn: 218963
2014-10-03 07:41:09 +00:00
Hal Finkel 189c699cad Make test/CodeGen/atomic-ops.c free-standing
This test includes stdint.h (via stdatomic.h), which might include system
headers (and that might not work, depending on the system configuration).
Attempting to fix llvm-clang-lld-x86_64-debian-fast.

llvm-svn: 218960
2014-10-03 05:04:49 +00:00
Hal Finkel 16c54d7186 Make test/Sema/atomic-ops.c free-standing
This test includes stdint.h, which might include system headers (and that might
not work, depending on the system configuration). Attempting to fix
llvm-clang-lld-x86_64-debian-fast.

llvm-svn: 218959
2014-10-03 04:46:48 +00:00
Hal Finkel 92b9b49f61 Revert useless part of r217349
Adding handling of __builtin_assume_aligned to IntExprEvaluator does not make
sense because __builtin_assume_aligned returns a pointer (not an integer).
Thanks to Richard for figuring out why this was not doing anything.

I'll add this back in a better place (PointerExprEvaluator perhaps).

llvm-svn: 218958
2014-10-03 04:46:46 +00:00
Hal Finkel 6970ac8b0a Add an implementation of C11's stdatomic.h
Adds a Clang-specific implementation of C11's stdatomic.h header. On systems,
such as FreeBSD, where a stdatomic.h header is already provided, we defer to
that header instead (using our __has_include_next technology). Otherwise, we
provide an implementation in terms of our __c11_atomic_* intrinsics (that were
created for this purpose).

C11 7.1.4p1 requires function declarations for atomic_thread_fence,
atomic_signal_fence, atomic_flag_test_and_set,
atomic_flag_test_and_set_explicit, and atomic_flag_clear, and requires that
they have external linkage. Accordingly, we provide these declarations, but if
a user elides the shadowing macros and uses them, then they must have a libc
(or similar) that actually provides definitions.

atomic_flag is implemented using _Bool as the underlying type. This is
consistent with the implementation provided by FreeBSD and also GCC 4.9 (at
least when __GCC_ATOMIC_TEST_AND_SET_TRUEVAL == 1).

Patch by Richard Smith (rebased and slightly edited by me -- Richard said I
should drive at this point).

llvm-svn: 218957
2014-10-03 04:29:40 +00:00
Justin Bogner 4075f6ce21 Driver: Update clang-interpreter example for r218938
llvm-svn: 218942
2014-10-03 01:08:27 +00:00
Justin Bogner aab9792b6c Driver: Use pointee_iterator rather than iterating over unique_ptrs
There's probably never a good reason to iterate over unique_ptrs. This
lets us use range-for and say Job.foo instead of (*it)->foo in a few
places.

llvm-svn: 218938
2014-10-03 01:04:53 +00:00
Richard Smith ef99e4d88a Fix interaction of max_align_t and modules.
When building with modules enabled, we were defining max_align_t as a typedef
for a different anonymous struct type each time it was included, resulting in
an error if <stddef.h> is not covered by a module map and is included more than
once in the same modules-enabled compilation of C11 or C++11 code.

llvm-svn: 218931
2014-10-03 00:31:35 +00:00
Fariborz Jahanian b91c5d6a79 Patch to warn if 'override' is missing
for an overriding method if class has at least one
'override' specified on one of its methods.
Reviewed by Doug Gregor. rdar://18295240
(I have already checked in all llvm files with missing 'override'
 methods and Bob Wilson has fixed a TableGen of FastISel so
 no warnings are expected from build of llvm after this patch.
 I have already verified this). 

llvm-svn: 218925
2014-10-02 23:13:51 +00:00
Duncan P. N. Exon Smith 834c265e85 Revert "DI: LLVM schema change: fold constants into string"
This reverts commit r218913 while I investigate some bots.

llvm-svn: 218917
2014-10-02 22:15:09 +00:00
Duncan P. N. Exon Smith 02b418a875 DI: LLVM schema change: fold constants into string
Update debug info testcases for an LLVM metadata schema change to fold
metadata constant operands into a single `MDString`.

Part of PR17891.

llvm-svn: 218913
2014-10-02 21:56:07 +00:00
Aaron Ballman 0d725e2fd2 Reflowing some comments, NFC.
llvm-svn: 218912
2014-10-02 21:41:27 +00:00
Hal Finkel 1b0d24e03a Initial support for the align_value attribute
This adds support for the align_value attribute. This attribute is supported by
Intel's compiler (versions 14.0+), and several of my HPC users have requested
support in Clang. It specifies an alignment assumption on the values to which a
pointer points, and is used by numerical libraries to encourage efficient
generation of vector code.

Of course, we already have an aligned attribute that can specify enhanced
alignment for a type, so why is this additional attribute important? The
problem is that if you want to specify that an input array of T is, say,
64-byte aligned, you could try this:

  typedef double aligned_double attribute((aligned(64)));
  void foo(aligned_double *P) {
    double x = P[0]; // This is fine.
    double y = P[1]; // What alignment did those doubles have again?
  }

the access here to P[1] causes problems. P was specified as a pointer to type
aligned_double, and any object of type aligned_double must be 64-byte aligned.
But if P[0] is 64-byte aligned, then P[1] cannot be, and this access causes
undefined behavior. Getting round this problem requires a lot of awkward
casting and hand-unrolling of loops, all of which is bad.

With the align_value attribute, we can accomplish what we'd like in a well
defined way:

  typedef double *aligned_double_ptr attribute((align_value(64)));
  void foo(aligned_double_ptr P) {
    double x = P[0]; // This is fine.
    double y = P[1]; // This is fine too.
  }

This attribute does not create a new type (and so it not part of the type
system), and so will only "propagate" through templates, auto, etc. by
optimizer deduction after inlining. This seems consistent with Intel's
implementation (thanks to Alexey for confirming the various Intel-compiler
behaviors).

As a final note, I would have chosen to call this aligned_value, not
align_value, for better naming consistency with the aligned attribute, but I
think it would be more useful to users to adopt Intel's name.

llvm-svn: 218910
2014-10-02 21:21:25 +00:00
Hal Finkel d2208b59cf Add __sync_fetch_and_nand (again)
Prior to GCC 4.4, __sync_fetch_and_nand was implemented as:

  { tmp = *ptr; *ptr = ~tmp & value; return tmp; }

but this was changed in GCC 4.4 to be:

  { tmp = *ptr; *ptr = ~(tmp & value); return tmp; }

in response to this change, support for sync_fetch_and_nand (and
sync_nand_and_fetch) was removed in r99522 in order to avoid miscompiling code
depending on the old semantics. However, at this point:

  1. Many years have passed, and the amount of code relying on the old
     semantics is likely smaller.

  2. Through the work of many contributors, all LLVM backends have been updated
     such that "atomicrmw nand" provides the newer GCC 4.4+ semantics (this process
     was complete July of 2014 (added to the release notes in r212635).

  3. The lack of this intrinsic is now a needless impediment to porting codes
     from GCC to Clang (I've now seen several examples of this).

It is true, however, that we still set GNUC_MINOR to 2 (corresponding to GCC
4.2). To compensate for this, and to address the original concern regarding
code relying on the old semantics, I've added a warning that specifically
details the fact that the semantics have changed and that we provide the newer
semantics.

Fixes PR8842.

llvm-svn: 218905
2014-10-02 20:53:50 +00:00
Fariborz Jahanian ce72e63d11 Diagnose mixed use of '_' and '.' as version
separators in my previous patch. 

llvm-svn: 218895
2014-10-02 17:57:26 +00:00
Jan Wen Voung 01c21e8f45 [x32/NaCl] Check if method pointers straddle an eightbyte to classify Hi
Summary:
Currently, with struct my_struct { int x; method_ptr y; };
a call to foo(my_struct s) may end up dropping the last 4 bytes
of the method pointer for x86_64 NaCl and x32.

When checking Has64BitPointers, also check if the method pointer
straddles an eightbyte boundary and classify Hi as well as Lo if needed.

Test Plan: test/CodeGenCXX/x86_64-arguments-nacl-x32.cpp

Reviewers: dschuff, pavel.v.chupin

Subscribers: jfb

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

llvm-svn: 218889
2014-10-02 16:56:57 +00:00