Commit Graph

58496 Commits

Author SHA1 Message Date
Manuel Klimek f0c95b32ec Fix crash in clang-format.
The following example used to crash clang-format.
 #define a\
  /**/}

Adjusting the indentation level cache for the line starting with the
comment would lead to an out-of-bounds array read.

llvm-svn: 239521
2015-06-11 10:14:13 +00:00
Daniel Jasper 229628b39e clang-format: Don't add spaces in foreach macro definition.
Before clang-format would e.g. add a space into

   #define Q_FOREACH(x, y)

which turns this into a non-function-like macro.

Patch by Strager Neds, thank you!

llvm-svn: 239513
2015-06-11 08:38:19 +00:00
David Majnemer e0e228a380 Reinstate r239499 and r239503
They were reverted because the FileCheck patterns didn't match on
release builds.

llvm-svn: 239512
2015-06-11 08:12:44 +00:00
Manuel Klimek aad3b8486d Revert "[MS ABI] Allow fastcall member function pointers to get CodeGen'd"
Revert "[MS ABI] Allow memfn pointers with unconvertible types to be formed"

This reverts r239499 and r239503; the former breaks tests [1] and the
latter is based on the former.

[1]
http://lab.llvm.org:8080/green/job/clang-stage2-configure-Rlto_check/4473/testReport/Clang/CodeGenCXX/microsoft_abi_virtual_member_pointers_cpp/

llvm-svn: 239511
2015-06-11 07:54:35 +00:00
Nemanja Ivanovic b17f1129fa Clang support for vector quad bit permute and gather instructions through builtins
This patch corresponds to review:
http://reviews.llvm.org/D10095

This is for just two instructions and related builtins:
vbpermq
vgbbd

llvm-svn: 239506
2015-06-11 06:25:36 +00:00
Richard Smith 00be6d0ff8 [modules] Fix a few places where merging wasn't performed if modules was disabled but local module visibilty was enabled.
llvm-svn: 239504
2015-06-11 03:05:39 +00:00
David Majnemer 9321f926b0 [MS Compatibility] Handle cleanups we create for a ctor closure
This fixes PR23801.

llvm-svn: 239503
2015-06-11 02:38:06 +00:00
David Majnemer ac936ff5ab [MS ABI] Allow fastcall member function pointers to get CodeGen'd
This restriction appears unnecessary and most likely came about during
early work for musttail.

llvm-svn: 239500
2015-06-11 00:45:44 +00:00
David Majnemer 01b9bb42d4 [MS ABI] Allow memfn pointers with unconvertible types to be formed
Remove the restriction which forbade forming pointers to member
functions which had parameter types or return types which were not
convertible.

llvm-svn: 239499
2015-06-11 00:20:57 +00:00
Alexei Starovoitov f657ca8d78 [bpf] add support for BPF backend
add support for bpfel/bpfeb targets

llvm-svn: 239496
2015-06-10 22:59:13 +00:00
Richard Smith ae7c04f065 Work around MSVC miscompilation.
llvm-svn: 239494
2015-06-10 22:49:14 +00:00
Richard Smith 95d83959d8 [modules] Don't allow use of non-visible (inherited) default template arguments.
llvm-svn: 239487
2015-06-10 20:36:34 +00:00
Richard Smith e7bd6defd7 [modules] Track all default template arguments for a given parameter across
modules, and allow use of a default template argument if any of the parameters
providing it is visible.

llvm-svn: 239485
2015-06-10 20:30:23 +00:00
Serge Pavlov 47ebb75cf9 Do not parse members of incomplete class.
If definition of a class is unknown and out-of-line definition of its
member is encountered, do not parse the member declaration.
This change fixes PR18542.

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

llvm-svn: 239483
2015-06-10 19:06:59 +00:00
Teresa Johnson 88c3c67997 Pass down the -flto option to the -cc1 job, and from there into the
CodeGenOptions and onto the PassManagerBuilder. This enables gating
the new EliminateAvailableExternally module pass on whether we are
preparing for LTO.

If we are preparing for LTO (e.g. a -flto -c compile), the new pass is not
included as we want to preserve available externally functions for possible
link time inlining.

llvm-svn: 239481
2015-06-10 17:49:45 +00:00
Scott Douglass cc01359cfe some StmtExprs do not have side-effects
Differential Revision: http://reviews.llvm.org/D10211

llvm-svn: 239476
2015-06-10 15:18:23 +00:00
Scott Douglass 503fc39d1f add ConstEvaluatedExprVisitor
Differential Revision: http://reviews.llvm.org/D10210

llvm-svn: 239474
2015-06-10 13:53:15 +00:00
Alexander Musman 70e9f5fcb3 PR5172: Fix for a bug in pragma redefine_extname implementation:
it doesn't work correctly when a structure is declared before pragma
and then a function with the same name declared after pragma.

Patch by Andrey Bokhanko

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

llvm-svn: 239466
2015-06-10 11:20:26 +00:00
Daniel Jasper 11ca263994 clang-format: [JS] Only special case top level object literal
assignments as enums.

Top level object literals are treated as enums, and their k/v pairs are put on
separate lines:

  X.Y = {
    A: 1,
    B: 2
  };

However assignments within blocks should not be affected:

  function x() {
    y = {a:1, b:2};
  }

This change fixes the second case. Patch by Martin Probst.

llvm-svn: 239462
2015-06-10 09:21:09 +00:00
Yunzhong Gao d290eb4565 Fix the test case to handle different IR variable names.
llvm-svn: 239457
2015-06-10 03:19:08 +00:00
Richard Smith 8346e52f89 [modules] Reconstruct template default argument inheritance on reload rather
than wasting storage and triggering eager deserializations by serializing it.

llvm-svn: 239454
2015-06-10 01:47:58 +00:00
Sean Silva 4881e8b239 [cleanup] Remove unused default argument and tidy up.
The RequestingModule argument was unused and always its default value of
nullptr.

Also move a declaration closer to its use, and range-for'ify.

llvm-svn: 239453
2015-06-10 01:37:59 +00:00
Richard Smith 8dbe7e236c Revert accidentally-committed test change from r239447.
llvm-svn: 239452
2015-06-10 01:36:14 +00:00
Richard Smith 1469b9196c Refactor storage of default template arguments.
This is just a preparatory step towards fixing visibility for default template
arguments in modules builds.

llvm-svn: 239447
2015-06-10 00:29:03 +00:00
Yunzhong Gao cb77930d6b Implementing C99 partial re-initialization behavior (DR-253)
Based on previous discussion on the mailing list, clang currently lacks support
for C99 partial re-initialization behavior:
Reference: http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-April/029188.html
Reference: http://www.open-std.org/jtc1/sc22/wg14/www/docs/dr_253.htm

This patch attempts to fix this problem.

Given the following code snippet,

struct P1 { char x[6]; };
struct LP1 { struct P1 p1; };

struct LP1 l = { .p1 = { "foo" }, .p1.x[2] = 'x' };
// this example is adapted from the example for "struct fred x[]" in DR-253;
// currently clang produces in l: { "\0\0x" },
//   whereas gcc 4.8 produces { "fox" };
// with this fix, clang will also produce: { "fox" };


Differential Review: http://reviews.llvm.org/D5789

llvm-svn: 239446
2015-06-10 00:27:52 +00:00
Akira Hatanaka 262a4c4ec0 Attach attribute "disable-tail-calls" to the functions in the IR.
This commit adds back the code that seems to have been dropped unintentionally
in r176985.

rdar://problem/13752163

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

llvm-svn: 239426
2015-06-09 19:04:36 +00:00
David Majnemer 2617ea6756 [ItaniumMangle] Mangle long double as __float128 for some Power targets
GCC mangles long double like __float128 in order to support
compatibility with ABI variants which had a different interpretation of
long double.

This fixes PR23791.

llvm-svn: 239421
2015-06-09 18:05:33 +00:00
Reid Kleckner 0b9bbbfc13 Revert "Re-land r236052, "[SEH] Add 32-bit lowering code for __try""
This reverts commit r239415. This was committed accidentally, LLVM isn't
ready for this.

llvm-svn: 239417
2015-06-09 17:49:42 +00:00
Reid Kleckner f8439940ef Disable style-on-command-line test on Windows
llvm-svn: 239416
2015-06-09 17:47:59 +00:00
Reid Kleckner 65870442b3 Re-land r236052, "[SEH] Add 32-bit lowering code for __try"
This reverts r236167.

LLVM should be ready for this now.

llvm-svn: 239415
2015-06-09 17:47:50 +00:00
Bill Seurer 703e8486ec [PowerPC] Reformat altivec.h with clang-format
This revision just fixes the formatting of altivec.h.

llvm-svn: 239408
2015-06-09 14:39:47 +00:00
Jonathan Roelofs 6eef12f06f Move target-specific Sema test to its own file.
Fixing the build-break introduced in r239406.

llvm-svn: 239407
2015-06-09 14:30:17 +00:00
Jonathan Roelofs 78f9e038e0 Fix printing of GCCAsmExprs with input or output arguments.
Patch by Nick Sumner!

llvm-svn: 239406
2015-06-09 14:13:31 +00:00
Daniel Jasper dee894f6bb clang-format: Support //!-comments, increase test coverage.
llvm-svn: 239404
2015-06-09 13:16:54 +00:00
Benjamin Kramer fea47d418a Remove rm invocations where the file is immediately rewritten later.
This may or may not help making this test less flaky on windows. There's
a race condition in lit somewhere.

llvm-svn: 239402
2015-06-09 12:41:02 +00:00
Benjamin Kramer a242aaa501 Remove unused diagnostics.
-Wreceiver-is-weak is unused but should be ignored, move it to the list
of diagnostic groups.

llvm-svn: 239401
2015-06-09 12:17:19 +00:00
Aaron Ballman 825fb3c9d4 Removing spurious semi colons; NFC.
llvm-svn: 239400
2015-06-09 12:04:17 +00:00
Daniel Jasper c83d76991c clang-format: [JS] Hotfix for runtime issue with deeply nested JS code.
I have not succeeded in writing a proper test case for this yet and we
also need to solve the underlying fundamental problem of trying too
many combinations with nested blocks (basically this somewhat works
around our Dijkstra algorithm). Preventing this linebreak is good
anyways as usually the penalties never make us choose it (that's why I
can't create a test) and it also looks ugly.

Also cleaned up state comparison code that I discovered while hunting
this down.

llvm-svn: 239398
2015-06-09 11:39:22 +00:00
Greg Bedwell 065f70ae80 clang-cl: Ignore the /o option when /P is specified.
This matches the cl.exe behavior (tested with 18.00.31101).  In order to
specify an output file for /P, use the /Fi option instead.

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

llvm-svn: 239393
2015-06-09 10:24:06 +00:00
David Majnemer c7ee97d696 Reenable Misc/interpreter.c as r239388 correctly handles such targets
llvm-svn: 239389
2015-06-09 06:33:13 +00:00
David Majnemer 75fdd6b888 [Driver] Preserve the object file format in ComputeEffectiveClangTriple
The object file format is sometimes overridden for MSVC targets to use
ELF instead of COFF.  Make sure we preserve this choice when setting the
msvc version number in the triple.

llvm-svn: 239388
2015-06-09 06:30:01 +00:00
NAKAMURA Takumi b21e942ac1 Disable clang/test/Misc/interpreter.c, for now, since r239273 mishandled *-msvc-elf.
llvm-svn: 239387
2015-06-09 06:27:21 +00:00
David Majnemer 78324f2bce [MSVC Compatibility] Don't diagnose c-style cast from void-ptr to fn-ptr
The machinery added to permit a static_cast from void-ptr to fn-ptr
unintentionally gets triggered for c-style casts and function-style
casts.  The observable effect was a diagnostic issued inappropriately.

llvm-svn: 239382
2015-06-09 02:41:08 +00:00
Sean Silva 14facf307c range-for'ify Args->filtered_begin(...) loops
We already have Args->filtered(...) which is a drop-in range-for
replacement.

llvm-svn: 239381
2015-06-09 01:57:17 +00:00
Sean Silva ab70cfa3af Simplify this code a bit.
We weren't using the short-circuiting property anyway.

llvm-svn: 239376
2015-06-09 00:47:20 +00:00
Hans Wennborg fce87cae44 Enable DLL attribute propagation on explicit instantiation definitions (PR23770)
This is a follow-up to r225570 which enabled adding DLL attributes when a
class template goes from explicit instantiation declaration to explicit
instantiation definition.

llvm-svn: 239375
2015-06-09 00:39:09 +00:00
Hans Wennborg c0875507be MinGW: don't allow adding DLL attribute if template already has explicit instantiation declaration
This is a follow-up to r238266 which failed to take MinGW into account.

llvm-svn: 239374
2015-06-09 00:39:05 +00:00
Hans Wennborg bb1983cf3a Enable propagation of dll attributes to previously instantiated base class templates in some cases
It is safe to add a dll attribute if the base class template previously only had
an explicit instantiation declaration, or was implicitly instantiated.

I both those cases, the members would not have been codegenned yet. In the case
of explicit instantiation declaration this is natural, and for implicit
instantiations, codegen is deferred (see r225570).

This is work towards fixing PR23770.

llvm-svn: 239373
2015-06-09 00:39:03 +00:00
Hans Wennborg 29b7a93935 Narrow the -Wunsupported-dll-base-class-template warning.
Don't warn about not being able to propagate dll attribute to a base class template
when that base already has a different attribute.

MSVC doesn't actually try to do this; the first attribute that was propagated
takes precedence, so Clang is already doing the right thing and there's no
need to warn.

(This is a step towards fixing PR21718.)

llvm-svn: 239372
2015-06-09 00:38:56 +00:00
Richard Smith 87bb569844 [modules] Fix some visibility issues with default template arguments.
There are still problems here, but this is a better starting point.

The main part of the change is: when doing a lookup that would accept visible
or hidden declarations, prefer to produce the latest visible declaration if
there are any visible declarations, rather than always producing the latest
declaration.

Thus, when we inherit default arguments (and other properties) from a previous
declaration, we inherit them from the previous visible declaration; if the
previous declaration is hidden, we already suppress inheritance of default
arguments.

There are a couple of other changes here that fix latent bugs exposed by this
change.

llvm-svn: 239371
2015-06-09 00:35:49 +00:00