]> granicus.if.org Git - clang/log
clang
7 years ago[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
Daniel Jasper [Mon, 8 May 2017 15:08:00 +0000 (15:08 +0000)]
[clang-format] Convert AlignEscapedNewlinesLeft to an enum, adding
DontAlign

This converts the clang-format option AlignEscapedNewlinesLeft from a
boolean to an enum, named AlignEscapedNewlines, with options Left (prev.
true), Right (prev. false), and a new option DontAlign.

When set to DontAlign, the backslashes are placed just after the last token in each line:
  #define EXAMPLE \
    do { \
        int x = aaaaa; \
        int b; \
        int dddddddddd; \
    } while (0)

Patch by jtbandes. Thank you!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302428 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[clang-format] Don’t propagate AvoidBinPacking into argument
Daniel Jasper [Mon, 8 May 2017 15:07:52 +0000 (15:07 +0000)]
[clang-format] Don’t propagate AvoidBinPacking into argument
subexpressions

This is an attempt to fix the issue described in a recent email:
http://lists.llvm.org/pipermail/cfe-dev/2017-April/053632.html

Patch by jtbandes. Thank you!
Review: https://reviews.llvm.org/D32475

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302427 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCorrect the attribute spelling for guarded_var and pt_guarded_var.
Aaron Ballman [Mon, 8 May 2017 12:39:17 +0000 (12:39 +0000)]
Correct the attribute spelling for guarded_var and pt_guarded_var.

Patch by Roman Lebedev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302419 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][LWP] Add clang support for LWP instructions.
Simon Pilgrim [Mon, 8 May 2017 12:09:45 +0000 (12:09 +0000)]
[X86][LWP] Add clang support for LWP instructions.

This patch adds support for the the LightWeight Profiling (LWP) instructions which are available on all AMD Bulldozer class CPUs (bdver1 to bdver4).

Differential Revision: https://reviews.llvm.org/D32770

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302418 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Check that global samplers are const
Sven van Haastregt [Mon, 8 May 2017 09:29:06 +0000 (09:29 +0000)]
[OpenCL] Check that global samplers are const

Patch by Simon Perretta.

Differential Revision: https://reviews.llvm.org/D32856

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302411 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUpdate LanguageExtensions doc to refer to C++14 instead of C++1y
Eric Fiselier [Sat, 6 May 2017 23:26:04 +0000 (23:26 +0000)]
Update LanguageExtensions doc to refer to C++14 instead of C++1y

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302364 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden...
Kostya Serebryany [Fri, 5 May 2017 23:28:18 +0000 (23:28 +0000)]
[sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. clang part.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302320 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAArch64: fix weird edge case in ABI.
Tim Northover [Fri, 5 May 2017 22:36:06 +0000 (22:36 +0000)]
AArch64: fix weird edge case in ABI.

It turns out there are some sort-of-but-not-quite empty structs that break all
the rules. For example:

struct SuperEmpty { int arr[0]; };
struct SortOfEmpty { struct SuperEmpty e; };

Both of these have sizeof == 0, even in C++ mode, for GCC compatibility. The
first one also doesn't occupy a register when passed by value in GNU C++ mode,
unlike everything else.

On Darwin, we want to ignore the lot (and especially don't want to try to use
an i0 as we were).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302313 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPermit keywords in module names in #pragma clang module *.
Richard Smith [Fri, 5 May 2017 22:34:07 +0000 (22:34 +0000)]
Permit keywords in module names in #pragma clang module *.

This is necessary to be able to build a libc++ module from preprocessed source
(due to the submodule std.new).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302312 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support for building modules from preprocessed source.
Richard Smith [Fri, 5 May 2017 22:18:51 +0000 (22:18 +0000)]
Add support for building modules from preprocessed source.

To support this, an optional marker "#pragma clang module contents" is
recognized in module map files, and the rest of the module map file from that
point onwards is treated as the source of the module. Preprocessing a module
map produces the input module followed by the marker and then the preprocessed
contents of the module.

Ignoring line markers, a preprocessed module might look like this:

  module A {
    header "a.h"
  }
  #pragma clang module contents
  #pragma clang module begin A
  // ... a.h ...
  #pragma clang module end

The preprocessed output generates line markers, which are not accepted by the
module map parser, so -x c++-module-map-cpp-output should be used to compile
such outputs.

A couple of major parts do not work yet:

1) The files that are listed in the module map must exist on disk, in order to
   build the on-disk header -> module lookup table in the PCM file. To fix
   this, we need the preprocessed output to track the file size and other stat
   information we might use to build the lookup table.

2) Declaration ownership semantics don't work properly yet, since mapping from
   a source location to a module relies on mapping from FileIDs to modules,
   which we can't do if module transitions can occur in the middle of a file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302309 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMultilib: add dump methods
Jonathan Roelofs [Fri, 5 May 2017 21:30:13 +0000 (21:30 +0000)]
Multilib: add dump methods

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302296 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd cxxStdInitializerListExpr AST matcher
Jakub Kuderski [Fri, 5 May 2017 21:01:12 +0000 (21:01 +0000)]
Add cxxStdInitializerListExpr AST matcher

Summary:
This adds a new ASTMatcher for CXXStdInitializerListExprs that matches C++ initializer list expressions.

The primary motivation is to use it to fix [[ https://bugs.llvm.org/show_bug.cgi?id=32896 | PR32896 ]] (review here [[ https://reviews.llvm.org/D32767 | D32767 ]]).

Reviewers: alexfh, Prazek, aaron.ballman

Reviewed By: alexfh, aaron.ballman

Subscribers: malcolm.parsons, cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D32810

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302287 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ODRHash] Fix typo, NFC
Richard Trieu [Fri, 5 May 2017 20:47:50 +0000 (20:47 +0000)]
[ODRHash] Fix typo, NFC

NestedNameSpecifer to NestedNameSpecifier.  This was not a problem before since
one of the included headers transitively brought in the definition of the class
and only manifested as a problem when using the typoed NestedNameSpecifer and
getting an incomplete type error instead of a typo correction.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302284 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDo not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.
Aaron Ballman [Fri, 5 May 2017 19:56:09 +0000 (19:56 +0000)]
Do not redefine the THREAD_ANNOTATION_ATTRIBUTE__ macro in the documentation.

Patch by Roman Lebedev.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302275 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] Limit the diagnose when an ISR calls a regular function
Weiming Zhao [Fri, 5 May 2017 19:25:29 +0000 (19:25 +0000)]
[ARM] Limit the diagnose when an ISR calls a regular function

Summary:
When the function is compiled with soft-float or on CPU with no FPU, we
don't need to diagnose for a call from an ISR to a regular function.

Reviewers: jroelofs, eli.friedman

Reviewed By: jroelofs

Subscribers: aemerson, rengolin, javed.absar, cfe-commits

Differential Revision: https://reviews.llvm.org/D32918

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302274 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoCodeGen: avoid use of @clang.arc.use intrinsic at O0
Saleem Abdulrasool [Fri, 5 May 2017 18:39:06 +0000 (18:39 +0000)]
CodeGen: avoid use of @clang.arc.use intrinsic at O0

The clang.arc.use intrinsic is removed via the ARC Contract Pass.  This
pass is only executed in optimized builds (>= opt level 1).  Prevent the
optimization implemented in SVN r301667 from triggering at optimization
level 0 like every other ARC use intrinsic usage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302270 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoANSIfy more. Still no behavior change.
Nico Weber [Fri, 5 May 2017 17:16:58 +0000 (17:16 +0000)]
ANSIfy more. Still no behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302259 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoANSIfy. No behavior change.
Nico Weber [Fri, 5 May 2017 17:15:08 +0000 (17:15 +0000)]
ANSIfy. No behavior change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302258 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoWarn that the [] spelling of uuid(...) is deprecated.
Nico Weber [Fri, 5 May 2017 17:05:56 +0000 (17:05 +0000)]
Warn that the [] spelling of uuid(...) is deprecated.

https://reviews.llvm.org/D32879

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302255 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd a fix-it for -Wunguarded-availability
Alex Lorenz [Fri, 5 May 2017 16:42:44 +0000 (16:42 +0000)]
Add a fix-it for -Wunguarded-availability

This patch adds a fix-it for the -Wunguarded-availability warning. This fix-it
is similar to the Swift one: it suggests that you wrap the statement in an
`if (@available)` check. The produced fixits are indented (just like the Swift
ones) to make them look nice in Xcode's fix-it preview.

rdar://31680358

Differential Revision: https://reviews.llvm.org/D32424

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302253 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ObjC] Don't disallow vector parameters/return values in methods
Alex Lorenz [Fri, 5 May 2017 16:15:17 +0000 (16:15 +0000)]
[ObjC] Don't disallow vector parameters/return values in methods
whose introduced version is lower than the allowed version.

We should just rely on the target version as this introduced version can lead
to false positives (e.g. deprecated declarations).

rdar://31964333

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302250 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIntroduce Wzero-as-null-pointer-constant.
Nico Weber [Fri, 5 May 2017 16:11:08 +0000 (16:11 +0000)]
Introduce Wzero-as-null-pointer-constant.

Add an opt-in warning that fires when 0 is used as a null pointer.
gcc has this warning, and there's some demand for it.

https://reviews.llvm.org/D32914

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302247 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Add a "-mmacos_version_min" option that's an alias for
Alex Lorenz [Fri, 5 May 2017 14:52:48 +0000 (14:52 +0000)]
[Driver] Add a "-mmacos_version_min" option that's an alias for
"-mmacosx_version_min"

The option -mmacosx_version_min will still be the canonical option for now, but
in the future we will switch over to -mmacos_version_min and make
-mmacosx_version_min an alias instead.

rdar://27043820

Differential Revision: https://reviews.llvm.org/D32796

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302240 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Tooling] Remove redundant check, NFCi
Krasimir Georgiev [Fri, 5 May 2017 14:07:23 +0000 (14:07 +0000)]
[Tooling] Remove redundant check, NFCi

Summary: The Database check looks redundant.

Reviewers: bkramer

Subscribers: klimek, cfe-commits

Differential Revision: https://reviews.llvm.org/D32909

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302236 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDocument that Multilib flags must be actual flags
Jonathan Roelofs [Fri, 5 May 2017 00:18:27 +0000 (00:18 +0000)]
Document that Multilib flags must be actual flags

This is because -print-multi-lib depends on them being flags for correctness.

Fixes a case of this in the arm-android multilib selection logic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302207 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix whitespace before token-paste of an argument.
James Y Knight [Thu, 4 May 2017 21:31:17 +0000 (21:31 +0000)]
Fix whitespace before token-paste of an argument.

The whitespace should come from the argument name in the macro
expansion, rather than from the token passed to the macro (same as it
does when not pasting).

Added a new test case for the change in behavior to stringize_space.c.

FileCheck'ized macro_paste_commaext.c, tweaked the test case, and
added a comment; no behavioral change to this test.

Differential Revision: https://reviews.llvm.org/D30427

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302195 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTurn on -Wmicrosoft-enum-forward-reference by default.
Nico Weber [Thu, 4 May 2017 19:54:50 +0000 (19:54 +0000)]
Turn on -Wmicrosoft-enum-forward-reference by default.

clang-cl already errs or warns on everything that cl
warns on in /permissive- mode, except for enum foward
declarations (and ATL attributes).
So warn on enum forward declarations by default.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302190 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix bugs checking va_start in lambdas and erroneous contexts
Reid Kleckner [Thu, 4 May 2017 19:51:05 +0000 (19:51 +0000)]
Fix bugs checking va_start in lambdas and erroneous contexts

Summary:
First, getCurFunction looks through blocks and lambdas, which is wrong.
Inside a lambda, va_start should refer to the lambda call operator
prototype. This fixes PR32737.

Second, we shouldn't use any of the getCur* methods, because they look
through contexts that we don't want to look through (EnumDecl,
CapturedStmtDecl). We can use CurContext directly as the calling
context.

Finally, this code assumed that CallExprs would never appear outside of
code contexts (block, function, obj-c method), which is wrong. Struct
member initializers are an easy way to create and parse exprs in a
non-code context.

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: https://reviews.llvm.org/D32761

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302188 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTurn -Wmicrosoft-enum-value off by default.
Nico Weber [Thu, 4 May 2017 19:36:26 +0000 (19:36 +0000)]
Turn -Wmicrosoft-enum-value off by default.

The warning is currently way too noisy to be useful. The plan is
to make it warn when an MS enum that's negative is compared to
something, but until that's done the warning shouldn't default
to on.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302187 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDriver: only inject libstdc++ paths when needed on CrossWindows
Saleem Abdulrasool [Thu, 4 May 2017 19:18:21 +0000 (19:18 +0000)]
Driver: only inject libstdc++ paths when needed on CrossWindows

When building with libc++ don't bother with injecting the libstdc++
search paths into the linker search path.  This will make it easier to
switch between ld and lld.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302184 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ms-inline-asm] Use the frontend size only for ambiguous instructions
Reid Kleckner [Thu, 4 May 2017 18:19:52 +0000 (18:19 +0000)]
[ms-inline-asm] Use the frontend size only for ambiguous instructions

This avoids problems on code like this:
  char buf[16];
  __asm {
    movups xmm0, [buf]
    mov [buf], eax
  }

The frontend size in this case (1) is wrong, and the register makes the
instruction matching unambiguous. There are also enough bytes available
that we shouldn't complain to the user that they are potentially using
an incorrectly sized instruction to access the variable.

Supersedes D32636 and D26586 and fixes PR28266

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302179 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module...
Peter Collingbourne [Thu, 4 May 2017 18:03:25 +0000 (18:03 +0000)]
Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302176 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Tooling] add a createReplacement overload for StringRef
Alexander Kornienko [Thu, 4 May 2017 15:34:06 +0000 (15:34 +0000)]
[Tooling] add a createReplacement overload for StringRef

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302159 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang-format: [JS] exponentiation operator
Martin Probst [Thu, 4 May 2017 15:04:04 +0000 (15:04 +0000)]
clang-format: [JS] exponentiation operator

Summary: While its precedence should be higher than multiplicative, LLVM does not have a level for that, so for the time being just treat it as multiplicative.

Reviewers: djasper

Subscribers: cfe-commits, klimek

Differential Revision: https://reviews.llvm.org/D32864

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302156 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Thu, 4 May 2017 13:56:51 +0000 (13:56 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This fix avoids an infinite recursion that was uncovered in one of our internal
tests by r301992. The testcase is the most reduced version of that
auto-generated test.

This is an improved version of the reverted commit r302037. The previous fix
actually managed to expose another subtle bug whereby `fatal_too_many_errors`
error was reported twice, with the second report setting the
`FatalErrorOccurred` flag. That prevented the notes that followed the diagnostic
the caused `fatal_too_many_errors` to be emitted. This commit ensures that notes
that follow `fatal_too_many_errors` but that belong to the diagnostic that
caused `fatal_too_many_errors` won't be emitted by setting the
`FatalErrorOccurred` when emitting `fatal_too_many_errors`.

rdar://31962618

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302151 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)
Sylvestre Ledru [Thu, 4 May 2017 12:46:38 +0000 (12:46 +0000)]
Add support of the next Ubuntu (Ubuntu 17.10 - Artful Aardvark)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302143 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "IR: Use pointers instead of GUIDs to represent edges in the module summary...
Eric Liu [Thu, 4 May 2017 12:05:40 +0000 (12:05 +0000)]
Revert "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."

This reverts commit r302108.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302141 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Index] The relation between the declarations in template
Alex Lorenz [Thu, 4 May 2017 10:42:06 +0000 (10:42 +0000)]
[Index] The relation between the declarations in template
specializations that 'override' declarations in the base template should use
the 'specializationOf' relation instead of 'specializationOf | overrideOf'.

The indexer relations are meant to be orthogonal, so 'specializationOf' is
better than the combined relation.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302136 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ARM] ACLE Chapter 9 intrinsics
Sam Parker [Thu, 4 May 2017 08:37:59 +0000 (08:37 +0000)]
[ARM] ACLE Chapter 9 intrinsics

Implemented the remaining integer data processing intrinsics from
the ARM ACLE v2.1 spec, such as parallel arithemtic and DSP style
multiplications.

Differential Revision: https://reviews.llvm.org/D32282

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302131 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenCL] Add intel_reqd_sub_group_size attribute support
Xiuli Pan [Thu, 4 May 2017 07:31:20 +0000 (07:31 +0000)]
[OpenCL] Add intel_reqd_sub_group_size attribute support

Summary:
Add intel_reqd_sub_group_size attribute support as intel extension  cl_intel_required_subgroup_size from
https://www.khronos.org/registry/OpenCL/extensions/intel/cl_intel_required_subgroup_size.txt

Reviewers: Anastasia, bader, hfinkel, pxli168

Reviewed By: Anastasia, bader, pxli168

Subscribers: cfe-commits, yaxunl

Differential Revision: https://reviews.llvm.org/D30805

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302125 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoIR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.
Peter Collingbourne [Thu, 4 May 2017 03:36:16 +0000 (03:36 +0000)]
IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI.

When profiling a no-op incremental link of Chromium I found that the functions
computeImportForFunction and computeDeadSymbols were consuming roughly 10% of
the profile. The goal of this change is to improve the performance of those
functions by changing the map lookups that they were previously doing into
pointer dereferences.

This is achieved by changing the ValueInfo data structure to be a pointer to
an element of the global value map owned by ModuleSummaryIndex, and changing
reference lists in the GlobalValueSummary to hold ValueInfos instead of GUIDs.
This means that a ValueInfo will take a client directly to the summary list
for a given GUID.

Differential Revision: https://reviews.llvm.org/D32471

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302108 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd #pragma clang module begin/end pragmas and generate them when preprocessing a...
Richard Smith [Thu, 4 May 2017 00:29:54 +0000 (00:29 +0000)]
Add #pragma clang module begin/end pragmas and generate them when preprocessing a module.

These pragmas are intended to simulate the effect of entering or leaving a file
with an associated module. This is not completely implemented yet: declarations
between the pragmas will not be attributed to the correct module, but macro
visibility is already functional.

Modules named by #pragma clang module begin must already be known to clang (in
some module map that's either loaded or on the search path).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302098 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Driver] Update AArch64 testcase to match llvm r302078.
Ahmed Bougacha [Wed, 3 May 2017 20:34:32 +0000 (20:34 +0000)]
[Driver] Update AArch64 testcase to match llvm r302078.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302079 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoTests: strengthen CHECK line to avoid picking up stray path.
Tim Northover [Wed, 3 May 2017 19:20:45 +0000 (19:20 +0000)]
Tests: strengthen CHECK line to avoid picking up stray path.

A bot had "-LTO" in its working directory, which matched the regex used in this
test. Since the arg is quoted, we can exploit that instead. Still broken if
there's a path with a quote in, but I think that's pretty niche.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302066 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[IR] Abstract away ArgNo+1 attribute indexing as much as possible
Reid Kleckner [Wed, 3 May 2017 18:17:31 +0000 (18:17 +0000)]
[IR] Abstract away ArgNo+1 attribute indexing as much as possible

Summary:
Do three things to help with that:
- Add AttributeList::FirstArgIndex, which is an enumerator currently set
  to 1. It allows us to change the indexing scheme with fewer changes.
- Add addParamAttr/removeParamAttr. This just shortens addAttribute call
  sites that would otherwise need to spell out FirstArgIndex.
- Remove some attribute-specific getters and setters from Function that
  take attribute list indices.  Most of these were only used from
  BuildLibCalls, and doesNotAlias was only used to test or set if the
  return value is malloc-like.

I'm happy to split the patch, but I think they are probably easier to
review when taken together.

This patch should be NFC, but it sets the stage to change the indexing
scheme to this, which is more convenient when indexing into an array:
  0: func attrs
  1: retattrs
  2...: arg attrs

Reviewers: chandlerc, pete, javed.absar

Subscribers: david2050, llvm-commits

Differential Revision: https://reviews.llvm.org/D32811

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302060 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r302037
Alex Lorenz [Wed, 3 May 2017 16:22:16 +0000 (16:22 +0000)]
Revert r302037

The commit caused the following two buildbot failures:

    Clang :: Misc/error-limit-multiple-notes.cpp
    Clang :: Misc/error-limit.c

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302046 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoDiagnosticsEngine should clear DelayedDiagID before reporting the
Alex Lorenz [Wed, 3 May 2017 15:41:16 +0000 (15:41 +0000)]
DiagnosticsEngine should clear DelayedDiagID before reporting the
delayed diagnostic

This avoids an infinite loop that was uncovered in one of our internal tests
by r301992. The testcase is the most reduced version of that auto-generated
test.

rdar://31962618

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302037 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[OpenMP] Extended parse for 'always' map modifier
Carlo Bertolli [Wed, 3 May 2017 15:28:48 +0000 (15:28 +0000)]
[OpenMP] Extended parse for 'always' map modifier

https://reviews.llvm.org/D32807

This patch allows the map modifier 'always' to be separated by the map type (to, from, tofrom) only by a whitespace, rather than strictly by a comma as in current trunk.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302031 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoReusing an existing attribute diagnostic
Oren Ben Simhon [Wed, 3 May 2017 14:05:00 +0000 (14:05 +0000)]
Reusing an existing attribute diagnostic

In a previous patch, a new generic error diagnostic for inconsistent attributes was added.
In this commit I reuse this diagnostic for ns_returns_retained attribute check.

Differential Revision: https://reviews.llvm.org/D32697

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302024 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Fix memory error bug category capitalization.
Artem Dergachev [Wed, 3 May 2017 11:47:13 +0000 (11:47 +0000)]
[analyzer] Fix memory error bug category capitalization.

It was written as "Memory Error" in most places and as "Memory error" in a few
other places, however it is the latter that is more consistent with
other categories (such as "Logic error").

rdar://problem/31718115

Differential Revision: https://reviews.llvm.org/D32702

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302016 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoUndo turning ExtBehavior into a bitfield.
Daniel Jasper [Wed, 3 May 2017 11:27:34 +0000 (11:27 +0000)]
Undo turning ExtBehavior into a bitfield.

This produces warnings that I can't explain in a GCC build:

In file included from ../tools/clang/include/clang/Lex/LexDiagnostic.h:13:0,
                 from /usr/local/google/home/djasper/llvm/tools/clang/lib/Lex/PTHLexer.cpp:19:
../tools/clang/include/clang/Basic/Diagnostic.h:219:34: warning: ‘clang::DiagnosticsEngine::DiagState::ExtBehavior’ is too small to hold all values of ‘enum class clang::diag::Severity’ [enabled by default]
     diag::Severity ExtBehavior : 4;     // Map extensions to warnings or errors?
                                  ^

While I don't think this warning makes sense, I'd like to get this back to being
warning-free. This only seems to trigger for "enum class".

Reproducer:
https://godbolt.org/g/P2ekVd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302012 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix tests after speculatable intrinsics patch
Daniel Jasper [Wed, 3 May 2017 10:04:25 +0000 (10:04 +0000)]
Fix tests after speculatable intrinsics patch

These were relying on the attribute group numbering

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302009 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilences gcc's -Wnarrowing.
Daniel Jasper [Wed, 3 May 2017 07:48:27 +0000 (07:48 +0000)]
Silences gcc's -Wnarrowing.

I think this is a false positive in GCC's warning, but nonetheless, we
should try to be warning-free. Smaller reproducer (reproduces with GCC
6.3):
https://godbolt.org/g/cJuO2z

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302003 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"
Yuka Takahashi [Wed, 3 May 2017 06:02:45 +0000 (06:02 +0000)]
Revert rL301998: "Fix a bug that -isysroot is completely ignored on Unix"

This reverts commit because it broke
sanitizer-x86_64-linux-autoconf bot and
clang-ppc64be-linux-multistage  bot.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@302000 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix a bug that -isysroot is completely ignored on Unix
Yuka Takahashi [Wed, 3 May 2017 04:58:39 +0000 (04:58 +0000)]
Fix a bug that -isysroot is completely ignored on Unix

-isysroot is the flag which set the system root directory.
This bug report https://bugs.llvm.org//show_bug.cgi?id=11503
shows that -isysroot is not handled at all on Unix, so fixed this bug.

After this diff, I could get this result https://pastebin.com/TeCmn9mj .

Differential Revision: https://reviews.llvm.org/D31495

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301998 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix tests after speculatable intrinsics patch
Matt Arsenault [Wed, 3 May 2017 03:04:40 +0000 (03:04 +0000)]
Fix tests after speculatable intrinsics patch

These were relying on the attribute group numbering

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301996 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag...
Kostya Serebryany [Wed, 3 May 2017 01:27:28 +0000 (01:27 +0000)]
[sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag combinations

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301994 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[modules] Round-trip -Werror flag through explicit module build.
Richard Smith [Wed, 3 May 2017 00:28:49 +0000 (00:28 +0000)]
[modules] Round-trip -Werror flag through explicit module build.

The intent for an explicit module build is that the diagnostics produced within
the module are those that were configured when the module was built, not those
that are enabled within a user of the module. This includes diagnostics that
don't actually show up until the module is used (for instance, diagnostics
produced during template instantiation and weird cases like -Wpadded).

We serialized and restored the diagnostic state for individual warning groups,
but previously did not track the state for flags like -Werror and -Weverything,
which are implemented as separate bits rather than as part of the diagnostics
mapping information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301992 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ODRHash] Add support for array and decayed types, and parameter names and types.
Richard Trieu [Tue, 2 May 2017 23:58:52 +0000 (23:58 +0000)]
[ODRHash] Add support for array and decayed types, and parameter names and types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301989 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)
Vedant Kumar [Tue, 2 May 2017 23:46:56 +0000 (23:46 +0000)]
[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)

Currently, ubsan emits overflow checks for arithmetic that is known to
be safe at compile-time, e.g:

  1 + 1 => CheckedAdd(1, 1)

This leads to breakage when using the __builtin_prefetch intrinsic. LLVM
expects the arguments to @llvm.prefetch to be constant integers, and
when ubsan inserts unnecessary checks on the operands to the intrinsic,
this contract is broken, leading to verifier failures (see PR32874).

Instead of special-casing __builtin_prefetch for ubsan, this patch fixes
the underlying problem, i.e that clang currently emits unnecessary
overflow checks.

Testing: I ran the check-clang and check-ubsan targets with a stage2,
ubsan-enabled build of clang. I added a regression test for PR32874, and
some extra checking to make sure we don't regress runtime checking for
unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also
provides coverage for this change.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301988 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRe-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of Attribute...
Reid Kleckner [Tue, 2 May 2017 22:07:37 +0000 (22:07 +0000)]
Re-land r301697 "[IR] Make add/remove Attributes use AttrBuilder instead of AttributeList"

This time, I fixed, built, and tested clang.

This reverts r301712.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301981 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[NFC] Add original test that triggered crash post r301735
Faisal Vali [Tue, 2 May 2017 21:02:46 +0000 (21:02 +0000)]
[NFC] Add original test that triggered crash post r301735
- this is added just for completeness sake (though the general case should be represented by the test added in the revision to that patch:  https://reviews.llvm.org/rL301972 )

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301973 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PR32831 (Try Again): 'this' capture while instantiating generic lambda call opera...
Faisal Vali [Tue, 2 May 2017 20:56:34 +0000 (20:56 +0000)]
Fix PR32831 (Try Again): 'this' capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

https://bugs.llvm.org/show_bug.cgi?id=32831

This patch was initially committed here: https://reviews.llvm.org/rL301735
Then reverted here: https://reviews.llvm.org/rL301916

The issue with the original patch was a failure to check that the closure type has been created within the LambdaScopeInfo before querying its DeclContext - instead of just assuming it has (silly!).  A reduced example such as this highlights the problem:
  struct X {
     int data;
     auto foo() { return [] { return [] -> decltype(data) { return 0; }; }; }
  };

When 'data' within decltype(data) tries to determine the type of 'this', none of the LambdaScopeInfo's have their closure types created at that point.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301972 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[Sema] Update function doc; NFC
George Burgess IV [Tue, 2 May 2017 20:24:56 +0000 (20:24 +0000)]
[Sema] Update function doc; NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301970 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSimplify some va_start checking logic
Reid Kleckner [Tue, 2 May 2017 20:10:03 +0000 (20:10 +0000)]
Simplify some va_start checking logic

Combine the logic doing the ms_abi/sysv_abi checks into one function so
that each check and its logical opposite are near each other. Now we
don't need two Sema entry points for MS va_start and regular va_start.

Refactor the code that checks if the va_start caller is a function,
block, or obj-c method. We do this in three places, and they are all
buggy for variadic lambdas (PR32737). After this change, I have one
place to apply the functional fix.

NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301968 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r301822 (and dependent r301825), which tried to improve the
Daniel Jasper [Tue, 2 May 2017 19:21:42 +0000 (19:21 +0000)]
Revert r301822 (and dependent r301825), which tried to improve the
handling of constexprs with unknown bounds.

This triggers a corner case of the language where it's not yet clear
whether this should be an error:

  struct A {
    static void *const a[];
    static void *const b[];
  };
  constexpr void *A::a[] = {&b[0]};
  constexpr void *A::b[] = {&a[0]};

When discovering the initializer for A::a, the bounds of A::b aren't known yet.
It is unclear whether warning about errors should be deferred until the end of
the translation unit, possibly resolving errors that can be resolved. In
practice, the compiler can know the bounds of all arrays in this example.

Credits for reproducers and explanation go to Richard Smith. Richard, please
add more info in case my explanation is wrong.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301963 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"
Vedant Kumar [Tue, 2 May 2017 18:51:41 +0000 (18:51 +0000)]
Revert "[docs] UBSan: Mention that print_stacktrace=1 is unsupported on Darwin"

This reverts commit r300295.

It's no longer true, print_stacktrace=1 is supported on Darwin/Windows
as of r301839.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301960 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[CodeGen] remove/fix checks that will fail when r301923 is recommitted
Sanjay Patel [Tue, 2 May 2017 15:20:18 +0000 (15:20 +0000)]
[CodeGen] remove/fix checks that will fail when r301923 is recommitted

Don't test the optimizer as part of front-end verification.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301928 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r301735 (and subsequent r301786).
Daniel Jasper [Tue, 2 May 2017 12:38:27 +0000 (12:38 +0000)]
Revert r301735 (and subsequent r301786).

It leads to clang crashing, e.g. on this short code fragment (added to
test/SemaCXX/warn-thread-safety-parsing.cpp):

  class SomeClass {
  public:
    void foo() {
      auto l = [this] { auto l = [] EXCLUSIVE_LOCKS_REQUIRED(mu_) {}; };
    }
    Mutex mu_;
  };

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301916 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[analyzer] Detect bad free of function pointers
Daniel Marjamaki [Tue, 2 May 2017 11:46:12 +0000 (11:46 +0000)]
[analyzer] Detect bad free of function pointers

Differential Revision: https://reviews.llvm.org/D31650

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301913 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove leftover test expectation from rL301902.
Emilio Cobos Alvarez [Tue, 2 May 2017 09:57:30 +0000 (09:57 +0000)]
Remove leftover test expectation from rL301902.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301906 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[libclang] Revert rL301328 and add tests for the regressions introduced.
Emilio Cobos Alvarez [Tue, 2 May 2017 08:32:15 +0000 (08:32 +0000)]
[libclang] Revert rL301328 and add tests for the regressions introduced.

Differential Revision: https://reviews.llvm.org/D32566

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301902 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoclang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple...
NAKAMURA Takumi [Tue, 2 May 2017 05:12:55 +0000 (05:12 +0000)]
clang/test/Modules/diag-flags.cpp: Appease targeting *-win32 with explicit triple. Fixes r301846.

MicrosoftRecordLayoutBuilder doesn't have ability of -Wpadded.

FIXME: Would other diag be available here?

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301898 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRevert r301785 (and r301787) because they caused PR32864.
Nick Lewycky [Tue, 2 May 2017 01:06:16 +0000 (01:06 +0000)]
Revert r301785 (and r301787) because they caused PR32864.

The fix is that ExprEvaluatorBase::VisitInitListExpr should handle transparent exprs instead of exprs with one element. Fixing that uncovers one testcase failure because the AST for "constexpr _Complex float test2 = {1};" is wrong (the _Complex prvalue should not be const-qualified), and a number of test failures in test/OpenMP where the captured stmt contains an InitListExpr that is in syntactic form.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301891 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state
Kostya Serebryany [Tue, 2 May 2017 00:32:57 +0000 (00:32 +0000)]
[sanitizer-coverage] update the SanitizerCoverage docs to reflect the current state

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301888 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoNew file missed from r301846.
Richard Smith [Mon, 1 May 2017 22:11:08 +0000 (22:11 +0000)]
New file missed from r301846.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301847 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix initial diagnostic state setup for an explicit module with no diagnostic pragmas.
Richard Smith [Mon, 1 May 2017 22:10:47 +0000 (22:10 +0000)]
Fix initial diagnostic state setup for an explicit module with no diagnostic pragmas.

If a file has no diagnostic pragmas, we build its diagnostic state lazily, but
in this case we never set up the root state to be the diagnostic state in which
the module was originally built, so the diagnostic flags for files in the
module with no diagnostic pragmas were incorrectly based on the user of the
module rather than the diagnostic state when the module was built.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301846 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPut back REQUIRES: system-darwin to fix asan bot.
Richard Smith [Mon, 1 May 2017 21:49:54 +0000 (21:49 +0000)]
Put back REQUIRES: system-darwin to fix asan bot.

These tests do not appear to be Darwin-specific, and this REQUIRES: appears to
be hiding a real bug; this change is just restoring the prior state to get the
buildbots happy again while we investigate. (The system-darwin requirement is
covered by PR32851.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301840 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObject: Remove ModuleSummaryIndexObjectFile class.
Peter Collingbourne [Mon, 1 May 2017 20:42:32 +0000 (20:42 +0000)]
Object: Remove ModuleSummaryIndexObjectFile class.

Differential Revision: https://reviews.llvm.org/D32195

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301832 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoSilence unused variable warning. NFC.
Benjamin Kramer [Mon, 1 May 2017 20:00:23 +0000 (20:00 +0000)]
Silence unused variable warning. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301825 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[sanitizer-coverage] add a deprecation note to coverage_direct=1
Kostya Serebryany [Mon, 1 May 2017 19:52:01 +0000 (19:52 +0000)]
[sanitizer-coverage] add a deprecation note to coverage_direct=1

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301824 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoImprove handling of arrays of unknown bound in constant expressions.
Richard Smith [Mon, 1 May 2017 18:49:04 +0000 (18:49 +0000)]
Improve handling of arrays of unknown bound in constant expressions.

Do not spuriously reject constexpr functions that access elements of an array
of unknown bound; this may later become valid once the bound is known. Permit
array-to-pointer decay on such arrays, but disallow pointer arithmetic (since
we do not know whether it will have defined behavior).

The standard is not clear on how this should work, but this seems to be a
decent answer.

Patch by Robert Haberlach!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301822 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC
Sanjoy Das [Mon, 1 May 2017 17:08:00 +0000 (17:08 +0000)]
Adapt to LLVM's rename of WeakVH to WeakTrackingVH; NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301815 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRelax testcase to fix a PS4 buildbot failure.
Adrian Prantl [Mon, 1 May 2017 15:49:40 +0000 (15:49 +0000)]
Relax testcase to fix a PS4 buildbot failure.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301805 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoThe -coverage-file flag was removed in r280306, and this piece was missed; NFC.
Aaron Ballman [Mon, 1 May 2017 13:05:04 +0000 (13:05 +0000)]
The -coverage-file flag was removed in r280306, and this piece was missed; NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301796 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unneeded struct; NFC
Sanjoy Das [Mon, 1 May 2017 06:12:13 +0000 (06:12 +0000)]
Remove unneeded struct; NFC

Summary:
Unless I'm missing something, the DeferredGlobal struct's GV field is
unused, removing which makes the struct itself trivial.

Reviewers: rafael, chandlerc

Subscribers: mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D32691

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301789 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix test that was incorrected merged between patches.
Nick Lewycky [Mon, 1 May 2017 02:20:06 +0000 (02:20 +0000)]
Fix test that was incorrected merged between patches.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301787 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix line endings (dos -> unix) and clang-format while I'm here
David Blaikie [Mon, 1 May 2017 02:11:39 +0000 (02:11 +0000)]
Fix line endings (dos -> unix) and clang-format while I'm here

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301786 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoHandle expressions with non-literal types like ignored expressions if we are supposed...
Nick Lewycky [Mon, 1 May 2017 02:03:23 +0000 (02:03 +0000)]
Handle expressions with non-literal types like ignored expressions if we are supposed to continue evaluating them.

Also fix a crash casting a derived nullptr to a virtual base.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301785 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoutils: Silence -Wpedantic warning
Saleem Abdulrasool [Mon, 1 May 2017 00:26:59 +0000 (00:26 +0000)]
utils: Silence -Wpedantic warning

llvm/tools/clang/utils/TableGen/ClangAttrEmitter.cpp:1673:67: warning: default argument specified for lambda parameter [-Wpedantic]
                    const Record *Constraint = nullptr) {
                                               ^~~~~~~

Found by gcc 5.4.0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301783 91177308-0d34-0410-b5e6-96231b3b80d8

7 years ago[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)
Simon Pilgrim [Sat, 29 Apr 2017 17:17:06 +0000 (17:17 +0000)]
[X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301749 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove Sema::CheckForIntOverflow, and instead check all full-expressions.
Nick Lewycky [Sat, 29 Apr 2017 09:33:46 +0000 (09:33 +0000)]
Remove Sema::CheckForIntOverflow, and instead check all full-expressions.

CheckForIntOverflow used to implement a whitelist of top-level expressions to
send to the constant expression evaluator, which handled many more expressions
than the CheckForIntOverflow whitelist did.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301742 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix PR32831: 'this capture while instantiating generic lambda call operator specializ...
Faisal Vali [Sat, 29 Apr 2017 03:49:17 +0000 (03:49 +0000)]
Fix PR32831: 'this capture while instantiating generic lambda call operator specialization

When computing the appropriate cv-qualifiers for the 'this' capture, we have to examine each enclosing lambda - but when using the FunctionScopeInfo stack we have to ensure that the lambda below (outer) is the decl-context of the closure-class of the current lambda.

https://bugs.llvm.org/show_bug.cgi?id=32831

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301735 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.
Richard Smith [Sat, 29 Apr 2017 01:38:29 +0000 (01:38 +0000)]
Remove some apparently-unnecessary 'REQUIRES: system-darwin' from tests.

Let's see if any buildbots actually have trouble with these. (They at least pass on Linux.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301732 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoFix "REQUIRES: system-darwin" failing tests after r301725.
Richard Smith [Sat, 29 Apr 2017 01:29:44 +0000 (01:29 +0000)]
Fix "REQUIRES: system-darwin" failing tests after r301725.

Also remove the apparently-unneeded REQUIRES (the tests also pass on at least
Linux, and don't appear to have anything Darwin-specific in them).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301731 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoPR26771: don't forget the " 2" (returning from #included file) linemarker after inclu...
Richard Smith [Sat, 29 Apr 2017 00:54:03 +0000 (00:54 +0000)]
PR26771: don't forget the " 2" (returning from #included file) linemarker after including an empty file with -frewrite-includes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301727 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoRemove unused, empty test directories.
Richard Smith [Sat, 29 Apr 2017 00:46:27 +0000 (00:46 +0000)]
Remove unused, empty test directories.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301726 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdd pragma to perform module import and use it in -E output.
Richard Smith [Sat, 29 Apr 2017 00:34:47 +0000 (00:34 +0000)]
Add pragma to perform module import and use it in -E output.

Many of our supported configurations support modules but do not have any
first-class syntax to perform a module import. This leaves us with a problem:
there is no way to represent the expansion of a #include that imports a module
in the -E output for such languages. (We don't want to just leave it as a
#include because that requires the consumer of the preprocessed source to have
the same file system layout and include paths as the creator.)

This patch adds a new pragma:

  #pragma clang module import MODULE.NAME.HERE

that imports a module, and changes -E and -frewrite-includes to use it when
rewriting a #include that maps to a module import. We don't make any attempt
to use a native language syntax import if one exists, to get more consistent
output. (If in the future, @import and #include have different semantics in
some way, the pragma will track the #include semantics.)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301725 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoObjCBoxedExpr can't be evaluated by the constant expression evaluator.
Nick Lewycky [Sat, 29 Apr 2017 00:07:27 +0000 (00:07 +0000)]
ObjCBoxedExpr can't be evaluated by the constant expression evaluator.

A boxed expression evaluates its subexpr and then calls an objc method to transform it into another value with pointer type. The objc method can never be constexpr and therefore this expression can never be evaluated. Fixes a miscompile boxing expressions with side-effects.

Also make ObjCBoxedExpr handling a normal part of the expression evaluator instead of being the only case besides full-expression where we check for integer overflow.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301721 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoAdapt to LLVM API change (DINamespace no longer takes line/file info).
Adrian Prantl [Fri, 28 Apr 2017 22:25:53 +0000 (22:25 +0000)]
Adapt to LLVM API change (DINamespace no longer takes line/file info).

rdar://problem/17484998
https://reviews.llvm.org/D32648

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@301707 91177308-0d34-0410-b5e6-96231b3b80d8