Commit Graph

52888 Commits

Author SHA1 Message Date
Joey Gouly 5798b26c65 When an inline-asm diagnostic is reported by the backend, report it with the
correct severity.

Previously all inline-asm diagnostics were reported as errors.

llvm-svn: 210286
2014-06-05 21:23:42 +00:00
Alexey Samsonov 8f4f1cf778 Mangle predefined string constants names to merge them at link-time
Summary:
This change generalizes the code used to create global LLVM
variables referencing predefined strings (e.g. __FUNCTION__): now it
just calls GetAddrOfConstantStringFromLiteral method. As a result,
global variables for these predefined strings may get mangled names
and linkonce_odr linkage. Fix the test accordingly.

Test Plan: clang regression tests

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: cfe-commits

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

llvm-svn: 210284
2014-06-05 20:53:34 +00:00
Richard Smith 8eb1d322e2 Cleanup, and always create a DecltypeType for a decltype expression, rather
than omitting it the first time we see a decltype type with a particular
expression.

llvm-svn: 210283
2014-06-05 20:13:13 +00:00
Bill Schmidt f7e289c0f2 [PPC64LE] Implement little-endian semantics for vec_perm
The PowerPC vperm (vector permute) instruction is defined
architecturally with a big-endian bias, in that the two input vectors
are assumed to be concatenated "left to right" and the elements of the
combined input vector are assumed to be numbered from "left to right"
(i.e., with element 0 referencing the high-order element).  This
definition is unnatural for little-endian code generation.

To facilitate ease of porting, the vec_perm interface is designed to
use natural element ordering, so that elements are numbered according
to little-endian design principles when code is generated for a
little-endian target.  The desired semantics can be achieved with the
vperm instruction provided that the two input vector registers are
reversed, and the permute control vector is complemented.  The
complementing is performed using an xor with a vector containing all
one bits.

Only the rightmost 5 bits of each element of the permute control
vector are relevant, so it would be possible to complement the vector
with respect to a <16xi8> vector containing all 31s.  However, when
the permute control vector is not a constant, using 255 instead has
the advantage that the vec_xor can be recognized during code
generation as a vnor instruction.  (Power8 introduces a vnand
instruction which could alternatively be generated.)

The correctness of this code is tested by the new perm.c test added in
a previous patch.  I plan to later make the existing ppc32 Altivec
compile-time tests work for ppc64 and ppc64le as well.

llvm-svn: 210279
2014-06-05 19:07:40 +00:00
Samuel Benzaquen f56a29924f Add hasLocalStorage/hasGlobalStorage matchers.
Summary:
Add hasLocalStorage/hasGlobalStorage matchers for VarDecl nodes.
Update the doc. Also add them to the dynamic registry.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210278
2014-06-05 18:22:14 +00:00
Renato Golin 0d2f580200 Fix bot for named register test
llvm-svn: 210275
2014-06-05 16:52:20 +00:00
Renato Golin 2e31e4e47b Add pointer types to global named register
This patch adds support for pointer types in global named registers variables.
It'll be lowered as a pair of read/write_register and inttoptr/ptrtoint calls.
Also adds some early checks on types on SemaDecl to avoid the assert.

Tests changed accordingly. (PR19837)

llvm-svn: 210274
2014-06-05 16:45:22 +00:00
Matheus Almeida b84b37d606 [mips] Add macros _MIPS_ISA and __mips_isa_rev (same expansion as defined by GCC).
Summary: The Linux Kernel is one example of a piece of software that relies on them.

Reviewers: atanasyan

Reviewed By: atanasyan

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

llvm-svn: 210270
2014-06-05 14:59:18 +00:00
Samuel Benzaquen 93d68595a9 Fix equalsNode() to accept pointers to derived types.
Summary:
Move the 'const' in the AST_*MATCHER_P* macros to the right of ParamType to
avoiad applying the constness on the wrong level when ParamType is a pointer.
Change equalsNode() to explicitly accept 'const Decl*' or 'const Stmt*'.

Reviewers: klimek

Subscribers: klimek, cfe-commits

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

llvm-svn: 210269
2014-06-05 14:47:08 +00:00
Evgeniy Stepanov dad9206564 Fix driver warning about -pthread on Android.
-pthread is no-op on Android. Suppress the unused argument warning.

llvm-svn: 210253
2014-06-05 11:41:39 +00:00
Evgeniy Stepanov 6f0ae18a59 Fix driver warning about -shared-libasan on Android.
Asan runtime library is always shared on Android, and -shared-libasan is no-op.
Suppress the unused argument warning.

llvm-svn: 210252
2014-06-05 11:14:00 +00:00
Robert Lytton 6adb20f720 XCore target: Fix 'typestring' binding qualifier to the array and not the type
Differential Revision: http://reviews.llvm.org/D3949

llvm-svn: 210250
2014-06-05 09:06:21 +00:00
Puyan Lotfi 54741fe603 Changing this line of code back to the way it was before Alp's config.h clean up changes.
I've already spoken to Alp and he signed off on making this one change, so that our buildbots
go green in the short term.

llvm-svn: 210238
2014-06-05 04:29:21 +00:00
Richard Smith 599bed75ed Bugfix: don't assert if someone manages to declare an operator new/delete template before the builtin operator new/delete.
llvm-svn: 210230
2014-06-05 00:43:02 +00:00
Reid Kleckner e931c06b21 Flush C stdio streams upon process termination
Due to what can only be described as a CRT bug, stdout and amazingly
even stderr are not always flushed upon process termination, especially
when the system is under high threading pressure.  I have found two
repros for this:

1) In lib\Support\Threading.cpp, change sys::Mutex to an
std::recursive_mutex and run check-clang.  Usually between 30 and 40
tests will fail.

2) Add OutputDebugStrings in code that runs during static initialization
and static shutdown.  This will sometimes generate similar failures.

After a substantial amount of troubleshooting and debugging, I found
that I could reproduce this from the command line without running
check-clang.  Simply make the mutex change described in #1, then
manually run the following command many times by running it once, then
pressing Up -> Enter very quickly:

D:\src\llvm\build\vs2013\Debug\bin\c-index-test.EXE -cursor-at=D:\src\llvm\tools\clang\test\Index\targeted-preamble.h:2:15 D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -include D:\src\llvm\build\vs2013\tools\clang\test\Index\Output\targeted-cursor.c.tmp.h -Xclang -error-on-deserialized-decl=NestedVar1      -Xclang -error-on-deserialized-decl=TopVar    | D:\src\llvm\build\vs2013\Debug\bin\FileCheck.EXE D:\src\llvm\tools\clang\test\Index\targeted-cursor.c -check-prefix=PREAMBLE-CURSOR1

Sporadically they will fail, and attaching a debugger to a failed
instance indicates that stdin of FileCheck.exe is empty.

Note that due to the repro in #2, we can rule out a bug in the STL's
mutex implementation, and instead conclude that this is a real flake in
the windows test harness.

Test Plan:
Without patch: Ran check-clang 10 times and saw over 30 Unexpected failures on every run.
With patch: Ran check-clang 10 times and saw 0 unexpected failures across all runs.

Reviewers: rnk

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

Patch by Zachary Turner!

llvm-svn: 210225
2014-06-05 00:13:43 +00:00
Richard Smith 4244ea9ca1 [ubsan] Don't add a --dynamic-list for ubsan symbols when building a shared
library. That results in the linker resolving all references to weak symbols in
the DSO to the definition from within that DSO. Ironically, this rarely causes
observable problems, except that it causes ubsan's own dynamic type check to
spuriously fail (because we fail to properly merge type_info object names).

llvm-svn: 210220
2014-06-04 23:28:46 +00:00
Richard Smith 5659c866f4 Formatting cleanup.
llvm-svn: 210219
2014-06-04 23:26:06 +00:00
Hans Wennborg 910640b5d8 Don't dynamically initialize dllimport vars (PR19933)
They should be initialized when they're exported.

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

llvm-svn: 210217
2014-06-04 21:09:46 +00:00
Alexey Samsonov adc9037b88 Remove the overload of GetAddrOfConstantString method
llvm-svn: 210214
2014-06-04 20:25:57 +00:00
Alexey Samsonov 175e52f57b Refactor and generalize GetAddrOfConstantString and GetAddrOfConstantStringFromLiteral.
Share mode code between these functions and re-structure them in a way
which shows how similar they actually are. The latter function works well
with literals of multi-byte chars and does a GlobalVariable name mangling
(if global strings are non-writable).

No functionality change.

llvm-svn: 210212
2014-06-04 19:56:57 +00:00
Rafael Espindola e11f40a9a4 This cast is not necessary any more (llvm api change).
llvm-svn: 210206
2014-06-04 19:03:20 +00:00
Rafael Espindola bb9e7a3d06 Update for llvm api change.
llvm-svn: 210204
2014-06-04 18:51:46 +00:00
David Majnemer 06fa05ae90 MS-ABI: Mangle empty template parameter packs correctly
Tested for compatibility with VS2013.

llvm-svn: 210198
2014-06-04 16:46:32 +00:00
David Majnemer e31a3ed3d4 MS-ABI: Implement user defined literals
Straightforward implementation of UDLs, it's compatible with VS "14".

This nearly completes our implementation of C++ name mangling for the
MS-ABI.

llvm-svn: 210197
2014-06-04 16:46:26 +00:00
Alexander Musman 1bb328cca5 [OPENMP] Parsing/Sema for OMPLasprivateClause.
Parsing this clause, allowing it on directive ‘omp simd’ and semantic checks.

llvm-svn: 210184
2014-06-04 13:06:39 +00:00
Daniel Jasper a69ca9be12 clang-format: Leave empty lines within UnwrappedLines.
These are commonly used to structure things like enums or long braced
lists. There doesn't seem to be a good reason to have the behavior in
such structures be different from the behavior between statements.

llvm-svn: 210183
2014-06-04 12:40:57 +00:00
Alexander Musman 64d33f1d46 [OPENMP] Small comment and reformatting fixes.
Fix post-commit review comments by Carlo Bertolli
for commit r209660 - OMP collapse clause.

Re-formatted TransformOMP* functions in TreeTransform.h with clang-format.

llvm-svn: 210169
2014-06-04 07:53:32 +00:00
Alp Toker 1d257e1d0a Remove the last remaining llvm/Config/config.h includes
This corrects long-standing misuses of LLVM's internal config.h.

In most cases the public llvm-config.h header was intended and we can now
remove the old hacks thanks to LLVM r210144.

The config.h header is private, won't be installed and should no longer be
included by clang or other modules.

llvm-svn: 210145
2014-06-04 03:28:55 +00:00
Hans Wennborg e9af316423 Downgrade "definition of dllimport static field" error to warning for class templates (PR19902)
This allows us to compile the following kind of code, which occurs in MSVC
headers:

  template <typename> struct S {
    __declspec(dllimport) static int x;
  };
  template <typename T> int S<T>::x;

The definition works similarly to a dllimport inline function definition and
gets available_externally linkage.

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

llvm-svn: 210141
2014-06-04 00:18:41 +00:00
Richard Smith 760520bcb7 Add __builtin_operator_new and __builtin_operator_delete, which act like calls
to the normal non-placement ::operator new and ::operator delete, but allow
optimizations like new-expressions and delete-expressions do.

llvm-svn: 210137
2014-06-03 23:27:44 +00:00
Richard Smith 8de08a9627 Update DR page for latest revision of CWG issues list.
llvm-svn: 210130
2014-06-03 21:58:55 +00:00
Alp Toker ea04672c82 Fix leak from r210059
Also revert r210096 which temporarily disabled the test while this was being
investigated.

llvm-svn: 210115
2014-06-03 17:23:34 +00:00
Rafael Espindola 8c557283c0 Use IntrusiveRefCntPtr's == and != nullptr operators.
This is a partial revert of r210075.

llvm-svn: 210101
2014-06-03 13:27:48 +00:00
Daniel Jasper 114a2bc9d2 clang-format: Refactor indentation behavior for multiple nested blocks.
This fixes a few oddities when formatting multiple nested JavaScript
blocks, e.g.:

Before:
  promise.then(
      function success() {
        doFoo();
        doBar();
      },
      [], function error() {
        doFoo();
        doBaz();
      });
  promise.then([],
               function success() {
                 doFoo();
                 doBar();
               },
               function error() {
    doFoo();
    doBaz();
  });

After:
  promise.then(
      function success() {
        doFoo();
        doBar();
      },
      [],
      function error() {
        doFoo();
        doBaz();
      });
  promise.then([],
               function success() {
                 doFoo();
                 doBar();
               },
               function error() {
                 doFoo();
                 doBaz();
               });

llvm-svn: 210097
2014-06-03 12:02:45 +00:00
Kostya Serebryany be6d91f1ba temporary disable part of a test because it causes clang to leak memory (want to have the sanitizer bot green)
llvm-svn: 210096
2014-06-03 11:45:37 +00:00
Alexander Musman a8e9d2eccc [OPENMP] Loop canonical form analysis (Sema)
This patch implements semantic analysis to make sure that the loop is in OpenMP canonical form.
This is the form required for 'omp simd', 'omp for' and other loop pragmas.

Differential revision: http://reviews.llvm.org/D3778

llvm-svn: 210095
2014-06-03 10:16:47 +00:00
Richard Smith 9213a6bfa4 Remove incorrect assertion.
llvm-svn: 210092
2014-06-03 08:40:27 +00:00
Richard Smith 454a7cdfb3 Implement DR990 and DR1070. Aggregate initialization initializes uninitialized
elements from {}, rather than value-initializing them. This permits calling an
initializer-list constructor or constructing a std::initializer_list object.
(It would also permit initializing a const reference or rvalue reference if
that weren't explicitly prohibited by other rules.)

llvm-svn: 210091
2014-06-03 08:26:00 +00:00
Richard Smith f051496804 Teach AST dumper to dump the array filler in an initializer list.
llvm-svn: 210090
2014-06-03 08:24:28 +00:00
Richard Smith 6c3bbf4271 PR11410: Extend diagnostic to cover all cases of aggregate initialization, not
just the extremely specific case of a trailing array element that couldn't be
initialized because the default constructor for the element type is deleted.

Also reword the diagnostic to better match our other context diagnostics and to
prepare for the implementation of core issue 1070.

llvm-svn: 210083
2014-06-03 07:28:54 +00:00
Nikola Smiljanic b226964e25 List DR532 as implemented on the defect report status page by renaming the namespace.
llvm-svn: 210080
2014-06-03 07:06:20 +00:00
Richard Smith 06a67e2c6f When emitting a multidimensional array new, emit the initializers for the
trailing elements as a single loop, rather than sometimes emitting a nest of
several loops. This fixes a bug where CodeGen would sometimes try to emit an
expression with the wrong type for the element being initialized. Plus various
other minor cleanups to the IR produced for array new initialization.

llvm-svn: 210079
2014-06-03 06:58:52 +00:00
Rafael Espindola 507f1bc37e Don't assume an implicit IntrusiveRefCntPtr -> bool operator.
llvm-svn: 210075
2014-06-03 05:04:52 +00:00
Nikola Smiljanic b8f8099895 Move DR532 test where it belongs.
llvm-svn: 210064
2014-06-03 02:56:59 +00:00
Rafael Espindola 27c60b512a Update for llvm API change.
Aliases in llvm now hold an arbitrary expression.

llvm-svn: 210063
2014-06-03 02:42:01 +00:00
Alp Toker cf2048bbb3 Fix -emit-codegen-only to not generate binaries
llvm-svn: 210059
2014-06-03 02:14:20 +00:00
Alp Toker 0e64e0d4fd Eliminate redundant MangleBuffer class
The only remaining user didn't actually use the non-dynamic storage facility
this class provides.

The std::string is transitional and likely to be StringRefized shortly.

llvm-svn: 210058
2014-06-03 02:13:57 +00:00
Hans Wennborg da24e9cee3 Itanium ABI: Update getAddrOfVTable to set the DLL storage class for vtables
This corresponds to the same change for the MS ABI in r209908.

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

llvm-svn: 210054
2014-06-02 23:13:03 +00:00
Will Schmidt 22b065c748 allow optional signext attribute
Allow the tests to succeed with tne signext (or other) attribute is present.  The attributes
show up for Power, but not for x86*, so need to be appropriately wildcarded.

llvm-svn: 210050
2014-06-02 21:47:14 +00:00
Alexey Samsonov 3c6b0c078e Delete apparently unused method
llvm-svn: 210047
2014-06-02 21:05:54 +00:00