Commit Graph

31428 Commits

Author SHA1 Message Date
Simon Dardis 7cd5876e60 [Sema] Support implicit scalar to vector conversions
This patch teaches clang to perform implicit scalar to vector conversions
when one of the operands of a binary vector expression is a scalar which
can be converted to the element type of the vector without truncation
following GCC's implementation.

If the (constant) scalar is can be casted safely, it is implicitly casted to the
vector elements type and splatted to produce a vector of the same type.

Contributions from: Petar Jovanovic

Reviewers: bruno, vkalintiris

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

llvm-svn: 302935
2017-05-12 19:11:06 +00:00
Alex Lorenz d43f75b54a [index] Index template specialization arguments for function templats
Also ensure that class template specialization arguments are covered

rdar://31812032

llvm-svn: 302918
2017-05-12 16:32:26 +00:00
James Y Knight eb96e44aea [SPARC] Support 'f' and 'e' inline asm constraints.
Patch by Patrick Boettcher.

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

llvm-svn: 302913
2017-05-12 16:01:23 +00:00
Krzysztof Parzyszek 408b272a00 [Hexagon] Make sure to pass empty struct arguments with nontrivial ctors
Thanks to Richard Smith for the suggested fix.

This fixes llvm.org/PR33009

llvm-svn: 302895
2017-05-12 13:18:07 +00:00
Gabor Horvath 3a00b41e43 [analyzer] Add modelling of __builtin_assume
Differential Revision: https://reviews.llvm.org/D33092

llvm-svn: 302880
2017-05-12 07:02:54 +00:00
Adrian Prantl d88705587f Module Debug Info: Emit namespaced C++ forward decls in the correct module.
The AST merges NamespaceDecls, but for module debug info it is
important to put a namespace decl (or rather its children) into the
correct (sub-)module, so we need to use the parent module of the decl
that triggered this namespace to be serialized as a second key when
looking up DINamespace nodes.

rdar://problem/29339538

llvm-svn: 302840
2017-05-11 22:59:19 +00:00
Reid Kleckner 43bbeb4c9f Issue diagnostics when returning FP values on x86_64 without SSE1/2
Avoid using report_fatal_error, because it will ask the user to file a
bug. If the user attempts to disable SSE on x86_64 and them use floating
point, that's a bug in their code, not a bug in the compiler.

This is just a start. There are other ways to crash the backend in this
configuration, but they should be updated to follow this pattern.

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

llvm-svn: 302835
2017-05-11 22:43:02 +00:00
Richard Smith 74df05471e XFAIL this test for Hexagon.
It's failing due to Hexagon calling convention lowering being broken (empty
structs are not passed even if they have nontrivial destructors / copy ctors).

llvm-svn: 302825
2017-05-11 21:18:27 +00:00
Richard Smith 2cbd1f6c9f Work around different -std= default for PS4 target.
llvm-svn: 302818
2017-05-11 19:17:54 +00:00
Richard Smith 722363727d PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

Re-commit of r302750, reverted in r302776.

llvm-svn: 302817
2017-05-11 18:58:24 +00:00
Adrian Prantl 40b201c326 Add a test that local submodule visibility has no effect on debug info
rdar://problem/27876262

llvm-svn: 302809
2017-05-11 16:40:48 +00:00
Alex Lorenz e6afa397c6 [CodeCompletion] Provide member completions for dependent expressions whose
type is a TemplateSpecializationType or InjectedClassNameType

Fixes PR30847. Partially fixes PR20973 (first position only).

PR17614 is still not working, its expression has the dependent
builtin type. We'll have to teach the completion engine how to "resolve"
dependent expressions to fix it.

rdar://29818301

llvm-svn: 302797
2017-05-11 13:48:57 +00:00
Serge Pavlov 738d3b97af Reverted r302775
llvm-svn: 302777
2017-05-11 08:25:22 +00:00
Diana Picus 1f53d03a15 Revert "PR22877: When constructing an array via a constructor with a default argument in list-initialization, run cleanups for the default argument after each iteration of the initialization loop."
Revert "clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc."

This reverts commit r302750 and its fixup r302757 because the test is
still breaking on some of the ARM bots.

array-default-argument.cpp:20:12: error: expected string not found in input
 // CHECK: {{call|invoke}}[[THISCALL:( x86_thiscallcc)?]] void @_ZN1AC1Ev([[TEMPORARY:.*]])
           ^
<stdin>:18:1: note: scanning from here
arrayctor.loop: ; preds = %arrayctor.loop, %entry
^
<stdin>:28:2: note: possible intended match here
 call void @_Z1fv()
 ^

--

llvm-svn: 302776
2017-05-11 08:10:41 +00:00
Serge Pavlov c5cc230587 Driver must return non-zero code on errors in command line
Now if clang driver is given wrong arguments, in some cases it
continues execution and returns zero code. This change fixes this
behavior.

The fix revealed some errors in clang test set.

File test/Driver/gfortran.f90 added in r118203 checks forwarding
gfortran flags to GCC. Now driver reports error on this file, because
the option -working-directory implemented in clang differs from the
option with the same name implemented in gfortran, in clang the option
requires argument, in gfortran does not.

In the file test/Driver/arm-darwin-builtin.c clang is called with
options -fbuiltin-strcat and -fbuiltin-strcpy. These option were removed
in r191435 and now clang reports error on this test.

File arm-default-build-attributes.s uses option -verify, which is not
supported by driver, it is cc1 option.

Similarly, the file split-debug.h uses options -fmodules-embed-all-files
and -fmodule-format=obj, which are not supported by driver.

Other revealed errors are mainly mistypes.

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

llvm-svn: 302775
2017-05-11 08:00:33 +00:00
Bruno Cardoso Lopes f3fde7e851 Make tests from r302765 windows friendly
and appease:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/2030

llvm-svn: 302771
2017-05-11 07:06:52 +00:00
Bruno Cardoso Lopes 0ad3182179 [Sema] Improve redefinition errors pointing to the same header
Diagnostics related to redefinition errors that point to the same header
file do not provide much information that helps users fixing the issue.

- In the modules context, it usually happens because of non modular
includes.
- When modules aren't involved it might happen because of the lack of
header guards.

Enhance diagnostics in these scenarios.

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

rdar://problem/31669175

llvm-svn: 302765
2017-05-11 06:20:07 +00:00
NAKAMURA Takumi 26b3eec258 clang/test/CodeGenCXX/array-default-argument.cpp: Satisfy targets that have x86_thiscallcc.
llvm-svn: 302757
2017-05-11 02:39:30 +00:00
Richard Smith 97a2cdbff3 PR22877: When constructing an array via a constructor with a default argument
in list-initialization, run cleanups for the default argument after each
iteration of the initialization loop.

We previously only ran the destructor for any temporary once, at the end of the
complete loop, rather than once per iteration!

llvm-svn: 302750
2017-05-11 00:17:17 +00:00
James Y Knight 86a8df74f5 [Myriad] Pass -Xclang and -mllvm flags to moviCompile
Patch by Walter Lee.

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

llvm-svn: 302738
2017-05-10 21:48:13 +00:00
Richard Smith 52f8d19ced Improve diagnosis of unknown template name.
When an undeclared identifier in a context that requires a type is followed by
'<', only look for type templates when typo-correcting, tweak the diagnostic
text to say that a template name (not a type name) was undeclared, and parse
the template arguments when recovering from the error.

llvm-svn: 302732
2017-05-10 21:32:16 +00:00
Erich Keane 7300119abb Fix errored return value in CheckFunctionReturnType and add a fixit hint
As discovered by ChenWJ and listed on cfe-dev, the error for Objective C 
return type ended up being wrong. This fixes that. Additionally, as a 
"while we're there", the other usages of this error and the usage of the 
FP above both use a FixItHint, so I'll add it here.

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

llvm-svn: 302720
2017-05-10 20:03:16 +00:00
Erik Pilkington 07f8c439b3 [Sema] Objective-C++ support for type trait __is_base_of
rdar://24308607

Differential revision: https://reviews.llvm.org/D32891

llvm-svn: 302695
2017-05-10 17:18:56 +00:00
Argyrios Kyrtzidis 0381cc74c7 [libclang] Introduce clang_Cursor_isExternalSymbol that provides info about decls marked with external_source_symbol attribute
llvm-svn: 302677
2017-05-10 15:10:36 +00:00
Petar Jovanovic 6f4cdb8912 Reland: [mips] Impose a threshold for coercion of aggregates
Modified MipsABIInfo::classifyArgumentType so that it now coerces
    aggregate structures only if the size of said aggregate is less than
    16/64 bytes, depending on the ABI.

    Patch by Stefan Maksimovic.

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

with minor changes (use regexp instead of the hardcoded values) to the test.

llvm-svn: 302670
2017-05-10 14:28:18 +00:00
Egor Churaev 45fe70f845 [OpenCL] Handle OpenCL specific subelement types
Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

llvm-svn: 302633
2017-05-10 10:28:34 +00:00
Alex Lorenz 4e1377aff0 [index] Index simple dependent declaration references
This commit implements basic support for indexing of dependent declaration
references. Now the indexer tries to find a suitable match in the base template
for a dependent member ref/decl ref/dependent type.

rdar://29158210

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

llvm-svn: 302632
2017-05-10 09:47:41 +00:00
Richard Smith 42bc73a3f1 When we see a '<' operator, check whether it's a probable typo for a template-id.
The heuristic that we use here is:
 * the left-hand side must be a simple identifier or a class member access
 * the right-hand side must be '<' followed by either a '>' or by a type-id that
   cannot be an expression (in particular, not followed by '(' or '{')
 * there is a '>' token matching the '<' token

The second condition guarantees the expression would otherwise be ill-formed.

If we're confident that the user intended the name before the '<' to be
interpreted as a template, diagnose the fact that we didn't interpret it
that way, rather than diagnosing that the template arguments are not valid
expressions.

llvm-svn: 302615
2017-05-10 02:30:28 +00:00
Richard Smith f3597653fb When instantiating a friend function template, don't forget to inherit default template arguments from other declarations.
llvm-svn: 302603
2017-05-10 00:01:13 +00:00
Vedant Kumar 4b62b5cddd [ubsan] Mark overflow checks with !nosanitize
Sanitizer instrumentation generally needs to be marked with !nosanitize,
but we're not doing this properly for ubsan's overflow checks.

r213291 has more information about why this is needed.

llvm-svn: 302598
2017-05-09 23:34:49 +00:00
Richard Smith 77e9e84a8e Don't mark a member as a member specialization until we know we're keeping the specialization.
This improves our behavior in a few ways:

 * We now guarantee that if a member is marked as being a member
   specialization, there will actually be a member specialization declaration
   somewhere on its redeclaration chain. This fixes a crash in modules builds
   where we would try to check that there was a visible declaration of the
   member specialization and be surprised to not find any declaration of it at
   all.

 * We don't set the source location of the in-class declaration of the member
   specialization to the out-of-line declaration's location until we have
   actually finished merging them. This fixes some very silly looking
   diagnostics, where we'd point a "previous declaration is here" note at the
   same declaration we're complaining about. Ideally we wouldn't mess with the
   prior declaration's location at all, but too much code assumes that the
   first declaration of an entity is a reasonable thing to use as an indication
   of where it was declared, and that's not really true for a member
   specialization unless we fake it like this.

llvm-svn: 302596
2017-05-09 23:02:10 +00:00
Evgeniy Stepanov c39f67bb2e Fix clang_cl argument in fsanitize.c driver test.
llvm-svn: 302594
2017-05-09 22:28:57 +00:00
Eric Fiselier b0bac2dafb [Sema] Implement Core 2094: Trivial copy/move constructor for class with volatile member
Summary: This patch implements http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2094 which reverts Core 496.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 302593
2017-05-09 22:21:24 +00:00
Evgeniy Stepanov d991cdd50b [asan] A clang flag to enable ELF globals-gc.
This feature is subtly broken when the linker is gold 2.26 or
earlier. See the following bug for details:
  https://sourceware.org/bugzilla/show_bug.cgi?id=19002

Since the decision needs to be made at compilation time, we can not
test the linker version. The flag is off by default on ELF targets,
and on otherwise.

llvm-svn: 302591
2017-05-09 21:57:43 +00:00
Adrian Prantl dfa7f613ed Update testcase for upstream LLVM changes (r302469).
llvm-svn: 302577
2017-05-09 19:47:41 +00:00
Sam Clegg 8f0129c407 [WebAssembly] Fix failing wasm-toolchain test
This test was broken in r302558.

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

llvm-svn: 302569
2017-05-09 18:44:23 +00:00
Petar Jovanovic 753267b750 Revert r302547 ([mips] Impose a threshold for coercion of aggregates)
Reverting
  Modified MipsABIInfo::classifyArgumentType so that it now coerces
  aggregate structures only if the size of said aggregate is less than 16/64
  bytes, depending on the ABI.
as it broke clang-with-lto-ubuntu builder.

llvm-svn: 302555
2017-05-09 17:20:06 +00:00
Petar Jovanovic 125c03070e [mips] Impose a threshold for coercion of aggregates
Modified MipsABIInfo::classifyArgumentType so that it now coerces aggregate
structures only if the size of said aggregate is less than 16/64 bytes,
depending on the ABI.

Patch by Stefan Maksimovic.

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

llvm-svn: 302547
2017-05-09 16:24:03 +00:00
Alex Lorenz f7f6f823a4 [CodeCompletion] Complete platform names in @available expressions
rdar://32074504

llvm-svn: 302545
2017-05-09 16:05:04 +00:00
Hans Wennborg fb82abd845 Revert r302476 "Update testcase for upstream LLVM changes."
That test update was for r302469, which was reverted in r302533 due to PR32977.

llvm-svn: 302542
2017-05-09 15:55:39 +00:00
Alex Lorenz e1fb64e5e2 Add support for pretty platform names to `@available`/
`__builtin_available`

This commit allows us to use the macOS/iOS/tvOS/watchOS platform names in
`@available`/`__builtin_available`.

rdar://32067795

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

llvm-svn: 302540
2017-05-09 15:34:46 +00:00
Vassil Vassilev 64e1e1ea0a Reland "Warn about unused static file scope function template declarations."
This patch reinstates r299930, reverted in r299956, as a separate diagnostic
option (-Wunused-template). 

llvm-svn: 302518
2017-05-09 11:25:41 +00:00
Faisal Vali 40fd4cebf8 Fix PR32638 : Make sure we switch Sema's CurContext to the substituted FunctionDecl when instantiating the exception specification.
This fixes the bug: https://bugs.llvm.org/show_bug.cgi?id=32638

  int main()
  {
    [](auto x) noexcept(noexcept(x)) { } (0);
  }

In the above code, prior to this patch, when substituting into the noexcept expression, i.e. transforming the DeclRefExpr that represents 'x' - clang attempts to capture 'x' because Sema's CurContext is still pointing to the pattern FunctionDecl (i.e. the templated-decl set in FinishTemplateArgumentDeduction) which does not match the substituted 'x's DeclContext, which leads to an attempt to capture and an assertion failure.  

We fix this by adjusting Sema's CurContext to point to the substituted FunctionDecl under which the noexcept specifier's argument should be transformed, and so the ParmVarDecl that 'x' refers to has the same declcontext and no capture is attempted. 

I briefly investigated whether the SwitchContext should occur right after VisitMethodDecl creates the new substituted FunctionDecl, instead of only during instantiating the exception specification - but seeing no other code that seemed to rely on that, I decided to leave it just for the duration of the exception specification instantiation.

llvm-svn: 302507
2017-05-09 04:17:15 +00:00
George Burgess IV 1dbfa856b1 [Sema] Make typeof(OverloadedFunctionName) not a pointer.
We were sometimes doing a function->pointer conversion in
Sema::CheckPlaceholderExpr, which isn't the job of CheckPlaceholderExpr.

So, when we saw typeof(OverloadedFunctionName), where
OverloadedFunctionName referenced a name with only one function that
could have its address taken, we'd give back a function pointer type
instead of a function type. This is incorrect.

I kept the logic for doing the function pointer conversion in
resolveAndFixAddressOfOnlyViableOverloadCandidate because it was more
consistent with existing ResolveAndFix* methods.

llvm-svn: 302506
2017-05-09 04:06:24 +00:00
Richard Trieu b35ef2a599 [ODRHash] Loosen checks on typedefs.
When a type in a class is from a typedef, only check the canonical type.  Skip
checking the intermediate underlying types.  This is in response to PR 32965

llvm-svn: 302505
2017-05-09 03:24:34 +00:00
Akira Hatanaka 855d70cb67 [CodeGen][ObjC] Emit @objc_retain at -O0 for variables captured by
blocks.

r302270 made changes to avoid emitting clang.arc.use at -O0 and instead
emit @objc_release. We also have to emit @objc_retain for the captured
variable at -O0 to match the @objc_release instead of just storing the
pointer to the capture field.

llvm-svn: 302495
2017-05-09 01:20:05 +00:00
Dean Michael Berris 42af651358 [XRay] Add __xray_customeevent(...) as a clang-supported builtin
Summary:
We define the `__xray_customeevent` builtin that gets translated to
IR calls to the correct intrinsic. The default implementation of this is
a no-op function. The codegen side of this follows the following logic:

- When `-fxray-instrument` is not provided in the driver, we elide all
calls to `__xray_customevent`.
- When `-fxray-instrument` is enabled and a function is marked as "never
instrumented", we elide all calls to `__xray_customevent` in that
function; if either marked as "always instrumented" or subject to
threshold-based instrumentation, we emit a call to the
`llvm.xray.customevent` intrinsic from LLVM for each
`__xray_customevent` occurrence in the function.

This change depends on D27503 (to land in LLVM first).

Reviewers: echristo, rsmith

Subscribers: mehdi_amini, pelikan, lrl, cfe-commits

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

llvm-svn: 302492
2017-05-09 00:45:40 +00:00
Bruno Cardoso Lopes d6e3289cb2 [Modules] Allow umbrella frameworks to define private submodules for subframeworks
In r298391 we fixed the umbrella framework model to work when submodules
named "Private" are used. This complements the work by allowing the
umbrella framework model to work in general.

rdar://problem/31790067

llvm-svn: 302491
2017-05-09 00:41:38 +00:00
Adrian Prantl 4fa6a33ff6 Update testcase for upstream LLVM changes.
llvm-svn: 302476
2017-05-08 22:44:00 +00:00
Vedant Kumar a9d8be68c1 [Driver] Don't enable -fsanitize-use-after-scope when ASan is disabled
When enabling any sanitizer, -fsanitize-use-after-scope is enabled by
default. This doesn't actually turn ASan on, because we've been getting
lucky and there are extra checks in BackendUtil that stop this from
happening.

However, this has been causing a behavior change: extra lifetime markers
are emitted in some cases where they aren't needed or expected.

llvm-svn: 302468
2017-05-08 21:11:55 +00:00
Richard Smith 4a3751ff24 If we are building a module, and we read a second description of the same
module from a different module map, ignore it.

This happens during builds of preprocessed modules (where it is harmless).

llvm-svn: 302463
2017-05-08 20:30:47 +00:00
Simon Pilgrim 0fd1b6c0dc [X86][LWP] Add __LWP__ macro tests
Missed in rL302418

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

llvm-svn: 302445
2017-05-08 17:25:48 +00:00
Jonathan Roelofs f358d48f23 Fix grammar in comment. NFC
llvm-svn: 302443
2017-05-08 17:06:17 +00:00
Anastasia Stulova f16634c884 [Sema] Fix typos handling in an overloadable call.
In C typos in arguments in a call of an overloadable function lead
to a failure of construction of CallExpr and following recovery does
not handle created delayed typos. This causes an assertion fail in
Sema::~Sema since Sema::DelayedTypos remains not empty.

The patch fixes that behavior by handling a call with arguments
having dependant types in the way that C++ does.

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

Patch by Dmitry Borisenkov!

llvm-svn: 302435
2017-05-08 16:05:54 +00:00
Simon Pilgrim 3511348dbb [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

llvm-svn: 302418
2017-05-08 12:09:45 +00:00
Sven van Haastregt 511f0b8d02 [OpenCL] Check that global samplers are const
Patch by Simon Perretta.

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

llvm-svn: 302411
2017-05-08 09:29:06 +00:00
Kostya Serebryany 50fb618b93 [sanitizer-coverage] implement -fsanitize-coverage=no-prune,... instead of a hidden -mllvm flag. clang part.
llvm-svn: 302320
2017-05-05 23:28:18 +00:00
Tim Northover 23bcad226c 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).

llvm-svn: 302313
2017-05-05 22:36:06 +00:00
Richard Smith ce03732ec8 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).

llvm-svn: 302312
2017-05-05 22:34:07 +00:00
Richard Smith 8128f3327f 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.

llvm-svn: 302309
2017-05-05 22:18:51 +00:00
Weiming Zhao be380c711c [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

llvm-svn: 302274
2017-05-05 19:25:29 +00:00
Saleem Abdulrasool d95f625000 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.

llvm-svn: 302270
2017-05-05 18:39:06 +00:00
Nico Weber 469891e7a2 Warn that the [] spelling of uuid(...) is deprecated.
https://reviews.llvm.org/D32879

llvm-svn: 302255
2017-05-05 17:05:56 +00:00
Alex Lorenz 9c5c2bfe54 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

llvm-svn: 302253
2017-05-05 16:42:44 +00:00
Alex Lorenz 9282483b11 [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

llvm-svn: 302250
2017-05-05 16:15:17 +00:00
Nico Weber d7ba86b6bf 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

llvm-svn: 302247
2017-05-05 16:11:08 +00:00
Alex Lorenz 921ab75854 [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

llvm-svn: 302240
2017-05-05 14:52:48 +00:00
Jonathan Roelofs 55bec44c9c 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.

llvm-svn: 302207
2017-05-05 00:18:27 +00:00
James Y Knight 7f3190118b 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

llvm-svn: 302195
2017-05-04 21:31:17 +00:00
Reid Kleckner f1deb837ee 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

llvm-svn: 302188
2017-05-04 19:51:05 +00:00
Saleem Abdulrasool c5728ca3e1 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.

llvm-svn: 302184
2017-05-04 19:18:21 +00:00
Reid Kleckner 6d2ea6ec80 [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

llvm-svn: 302179
2017-05-04 18:19:52 +00:00
Peter Collingbourne 9667b91b13 Re-apply r302108, "IR: Use pointers instead of GUIDs to represent edges in the module summary. NFCI."
with a fix for the clang backend.

llvm-svn: 302176
2017-05-04 18:03:25 +00:00
Alex Lorenz ce4518f21d 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

llvm-svn: 302151
2017-05-04 13:56:51 +00:00
Alex Lorenz 9e2fea198c [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.

llvm-svn: 302136
2017-05-04 10:42:06 +00:00
Sam Parker b9ea36f9c1 [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

llvm-svn: 302131
2017-05-04 08:37:59 +00:00
Xiuli Pan be6da4bbdb [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

llvm-svn: 302125
2017-05-04 07:31:20 +00:00
Richard Smith d13863008b 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).

llvm-svn: 302098
2017-05-04 00:29:54 +00:00
Ahmed Bougacha 7e131f02c8 [Driver] Update AArch64 testcase to match llvm r302078.
llvm-svn: 302079
2017-05-03 20:34:32 +00:00
Tim Northover 4c1104e199 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.

llvm-svn: 302066
2017-05-03 19:20:45 +00:00
Alex Lorenz 5191e80b87 Revert r302037
The commit caused the following two buildbot failures:

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

llvm-svn: 302046
2017-05-03 16:22:16 +00:00
Alex Lorenz d7dfec818b 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

llvm-svn: 302037
2017-05-03 15:41:16 +00:00
Carlo Bertolli d8844b9d43 [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.

llvm-svn: 302031
2017-05-03 15:28:48 +00:00
Oren Ben Simhon bada0d4628 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

llvm-svn: 302024
2017-05-03 14:05:00 +00:00
Artem Dergachev b6a513d1b2 [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

llvm-svn: 302016
2017-05-03 11:47:13 +00:00
Daniel Jasper 6e254b5f38 Fix tests after speculatable intrinsics patch
These were relying on the attribute group numbering

llvm-svn: 302009
2017-05-03 10:04:25 +00:00
Yuka Takahashi 5511fc2eb3 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.

llvm-svn: 302000
2017-05-03 06:02:45 +00:00
Yuka Takahashi 79d310713a 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

llvm-svn: 301998
2017-05-03 04:58:39 +00:00
Matt Arsenault 7c4c1cb2f5 Fix tests after speculatable intrinsics patch
These were relying on the attribute group numbering

llvm-svn: 301996
2017-05-03 03:04:40 +00:00
Kostya Serebryany 8955efc36f [sanitizer-coverage] add a deprecation warning to the old sanitizer-coverage flag combinations
llvm-svn: 301994
2017-05-03 01:27:28 +00:00
Richard Smith e37391c4fe [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.

llvm-svn: 301992
2017-05-03 00:28:49 +00:00
Richard Trieu 0255227a58 [ODRHash] Add support for array and decayed types, and parameter names and types.
llvm-svn: 301989
2017-05-02 23:58:52 +00:00
Vedant Kumar d919115983 [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.

llvm-svn: 301988
2017-05-02 23:46:56 +00:00
Faisal Vali 9a2df95d85 [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 )

llvm-svn: 301973
2017-05-02 21:02:46 +00:00
Faisal Vali 999f27e373 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.

 

llvm-svn: 301972
2017-05-02 20:56:34 +00:00
Reid Kleckner 2b0fa129d6 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

llvm-svn: 301968
2017-05-02 20:10:03 +00:00
Daniel Jasper ffdee09350 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.

llvm-svn: 301963
2017-05-02 19:21:42 +00:00
Sanjay Patel 77f3b188a2 [CodeGen] remove/fix checks that will fail when r301923 is recommitted
Don't test the optimizer as part of front-end verification.

llvm-svn: 301928
2017-05-02 15:20:18 +00:00
Daniel Jasper 7a28368fab 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_;
  };

llvm-svn: 301916
2017-05-02 12:38:27 +00:00
Daniel Marjamaki a43a8f5c5e [analyzer] Detect bad free of function pointers
Differential Revision: https://reviews.llvm.org/D31650

llvm-svn: 301913
2017-05-02 11:46:12 +00:00
Emilio Cobos Alvarez b7247b25bd Remove leftover test expectation from rL301902.
llvm-svn: 301906
2017-05-02 09:57:30 +00:00
Emilio Cobos Alvarez c7ed9d9f1c [libclang] Revert rL301328 and add tests for the regressions introduced.
Differential Revision: https://reviews.llvm.org/D32566

llvm-svn: 301902
2017-05-02 08:32:15 +00:00
NAKAMURA Takumi 9378752b67 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?
llvm-svn: 301898
2017-05-02 05:12:55 +00:00
Nick Lewycky c190f96b7d 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.

llvm-svn: 301891
2017-05-02 01:06:16 +00:00
Richard Smith 941a205119 New file missed from r301846.
llvm-svn: 301847
2017-05-01 22:11:08 +00:00
Richard Smith ea74148f9f 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.

llvm-svn: 301846
2017-05-01 22:10:47 +00:00
Richard Smith b35fc3df5d 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.)

llvm-svn: 301840
2017-05-01 21:49:54 +00:00
Richard Smith eec904f849 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!

llvm-svn: 301822
2017-05-01 18:49:04 +00:00
Adrian Prantl 3b243608f5 Relax testcase to fix a PS4 buildbot failure.
llvm-svn: 301805
2017-05-01 15:49:40 +00:00
Nick Lewycky 49675ac409 Fix test that was incorrected merged between patches.
llvm-svn: 301787
2017-05-01 02:20:06 +00:00
David Blaikie 1c7df0f3f0 Fix line endings (dos -> unix) and clang-format while I'm here
llvm-svn: 301786
2017-05-01 02:11:39 +00:00
Nick Lewycky 499968f8a5 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.

llvm-svn: 301785
2017-05-01 02:03:23 +00:00
Simon Pilgrim 96d02f5503 [X86][AVX] Added support for _mm256_zext* helper intrinsics (PR32839)
llvm-svn: 301749
2017-04-29 17:17:06 +00:00
Nick Lewycky e7d6fbdfb7 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.

llvm-svn: 301742
2017-04-29 09:33:46 +00:00
Faisal Vali 1f961df10c 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

llvm-svn: 301735
2017-04-29 03:49:17 +00:00
Richard Smith f893cc6bd3 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.)

llvm-svn: 301732
2017-04-29 01:38:29 +00:00
Richard Smith d3935ae1f2 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).

llvm-svn: 301731
2017-04-29 01:29:44 +00:00
Richard Smith c7cacdc332 PR26771: don't forget the " 2" (returning from #included file) linemarker after including an empty file with -frewrite-includes.
llvm-svn: 301727
2017-04-29 00:54:03 +00:00
Richard Smith c51c38b4ec 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.)

llvm-svn: 301725
2017-04-29 00:34:47 +00:00
Nick Lewycky 19ae6dc853 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.

llvm-svn: 301721
2017-04-29 00:07:27 +00:00
Adrian Prantl 6ee72d743b Adapt to LLVM API change (DINamespace no longer takes line/file info).
rdar://problem/17484998
https://reviews.llvm.org/D32648

llvm-svn: 301707
2017-04-28 22:25:53 +00:00
Richard Trieu 157ed94ee7 [ODRHash] Add testcase with different paramter names. NFC
llvm-svn: 301701
2017-04-28 22:03:28 +00:00
David Blaikie 9bb296cb05 Enable -fno-split-dwarf-inlining even when -gsplit-dwarf isn't specified.
Since -gsplit-dwarf is specified on a backend compile (in ThinLTO
parlance) it isn't passed during the frontend compile (because no ELF
object/dwo file is produced then), yet the -fno-split-dwarf-inlining
value needs to be encoded in the LLVM DebugInfo metadata to have
effect...

So let it be specified & it'll be silently ignored if -gsplit-dwarf
isn't used in the end, otherwise it'll be used on a per-cu basis
depending on where it's specified in the frontend compile actions.

llvm-svn: 301684
2017-04-28 20:50:25 +00:00
Akira Hatanaka a6b6dcc123 [CodeGen][ObjC] Don't retain captured Objective-C pointers at block
creation that are const-qualified.

When a block captures an ObjC object pointer, clang retains the pointer
to prevent prematurely destroying the object the pointer points to
before the block is called or copied.

When the captured object pointer is const-qualified, we can avoid
emitting the retain/release pair since the pointer variable cannot be
modified in the scope in which the block literal is introduced.

For example:

void test(const id x) {
    callee(^{ (void)x; });
}

This patch implements that optimization.

rdar://problem/28894510

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

llvm-svn: 301667
2017-04-28 18:50:57 +00:00
Emilio Cobos Alvarez 485ad42521 [libclang] Expose some target information via the C API.
This allows users to query the target triple and target pointer width, which
would make me able to fix https://github.com/servo/rust-bindgen/issues/593 and
other related bugs in an elegant way (without having to manually parse the
target triple in the command line arguments).

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

llvm-svn: 301648
2017-04-28 15:56:39 +00:00
Alex Lorenz 499de32ad0 Use the -Wunknown-warning-option group for the "unknown warning group"
diagnostic in #pragma diagnostic

This matches the warning group that's specified for the unknown warning options
that are passed-in as command line arguments.

rdar://29526025

llvm-svn: 301647
2017-04-28 14:45:25 +00:00
Alex Lorenz baa9030de2 [Sema] Avoid an invalid redefinition error that was presented for
of a function whose previous definition was typo-corrected

rdar://28550928

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

llvm-svn: 301643
2017-04-28 12:30:05 +00:00
Simon Pilgrim 99ed27053d [X86][SSE] Add _mm_set_pd1 (PR32827)
Matches _mm_set_ps1 implementation

llvm-svn: 301637
2017-04-28 10:28:32 +00:00
Alex Lorenz 45c423bcdc [index] Handle vector types in USR generator
rdar://25339187

llvm-svn: 301635
2017-04-28 09:46:36 +00:00
NAKAMURA Takumi 6e256873e4 clang/test/ARCMT/remap-applying.c: Use %/s on the command line of echo(1).
llvm-svn: 301619
2017-04-28 05:02:52 +00:00
NAKAMURA Takumi 49e58e766b clang/test/Index/index-module.m: Relax expressions to satisfy DOSish path separator \\, since r301597.
llvm-svn: 301613
2017-04-28 04:17:31 +00:00
Richard Smith f74d946624 Move functionality for handling module maps as inputs from the -emit-module
action to the general FrontendAction infrastructure.

This permits applying -E, -ast-dump, -fsyntax-only, and so on to a module map
compilation. (The -E form is not currently especially useful yet as there's no
good way to take the output and use it to actually build a module.)

In order to support this, -cc1 now accepts -x <lang>-module-map in all cases
where it accepts -x <lang> for a language we can parse (not ir/ast). And for
uniformity, we also accept -x <lang>-header for all such languages (we used
to reject for cuda and renderscript), and -x <lang>-cpp-output for all such
languages (we used to reject for c, cl, and renderscript).

(None of these new alternatives are accepted by the driver yet, so no
user-visible changes.)

llvm-svn: 301610
2017-04-28 01:49:42 +00:00
Argyrios Kyrtzidis 5312b667a8 [ARCMigrate] When applying changes from remap files, disable the 'adjustRemovals' functionality of EditedSource
'adjustRemovals' is used to avoid situation when removing a range inadvertently causes 2 separate identifiers to get joined into one.
But it is not useful when the edits are character precise, as is the case with the remap files.

llvm-svn: 301602
2017-04-28 00:25:06 +00:00
Bruno Cardoso Lopes b907563fbc [Modules] Improve diagnostics for incomplete umbrella
One of the -Wincomplete-umbrella warnings diagnoses when a header is present in
the directory but it's not present in the umbrella header. Currently, this
warning only happens on top level modules; any submodule using an umbrella
header does not get this warning. Fix that by also considering the submodules.

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

rdar://problem/22623686

llvm-svn: 301597
2017-04-27 22:29:14 +00:00
Duncan P. N. Exon Smith e77a3aff6f Headers: Make the type of SIZE_MAX the same as size_t
size_t is usually defined as unsigned long, but on 64-bit platforms,
stdint.h currently defines SIZE_MAX using "ull" (unsigned long long).
Although this is the same width, it doesn't necessarily have the same
alignment or calling convention.  It also triggers printf warnings when
using the format flag "%zu" to print SIZE_MAX.

This changes SIZE_MAX to reuse the compiler-provided __SIZE_MAX__, and
provides similar fixes for the other integers:

  - INTPTR_MIN
  - INTPTR_MAX
  - UINTPTR_MAX
  - PTRDIFF_MIN
  - PTRDIFF_MAX
  - INTMAX_MIN
  - INTMAX_MAX
  - UINTMAX_MAX
  - INTMAX_C()
  - UINTMAX_C()

... and fixes the typedefs for intptr_t and uintptr_t to use
__INTPTR_TYPE__ and __UINTPTR_TYPE__ instead of int32_t, effectively
reverting r89224, r89226, and r89237 (r89221 already having been
effectively reverted).

We can probably also kill __INTPTR_WIDTH__, __INTMAX_WIDTH__, and
__UINTMAX_WIDTH__ in a follow-up, but I was hesitant to delete all the
per-target CHECK lines in this commit since those might serve their own
purpose.

rdar://problem/11811377

llvm-svn: 301593
2017-04-27 21:49:45 +00:00
Duncan P. N. Exon Smith cfc1f6a6ee Preprocessor: Suppress -Wnonportable-include-path for header maps
If a file search involves a header map, suppress
-Wnonportable-include-path.  It's firing lots of false positives for
framework authors internally, and it's not trivial to fix.

Consider a framework called "Foo" with a main (installed) framework header
"Foo/Foo.h".  It's atypical for "Foo.h" to actually live inside a
directory called "Foo" in the source repository.  Instead, the
build system generates a header map while building the framework.
If Foo.h lives at the top-level of the source repository (common), and
the git repo is called ssh://some.url/foo.git, then the header map will
have something like:

    Foo/Foo.h -> /Users/myname/code/foo/Foo.h

where "/Users/myname/code/foo" is the clone of ssh://some.url/foo.git.

After #import <Foo/Foo.h>, the current implementation of
-Wnonportable-include-path will falsely assume that Foo.h was found in a
nonportable way, because of the name of the git clone (.../foo/Foo.h).
However, that directory name was not involved in the header search at
all.

This commit adds an extra parameter to Preprocessor::LookupFile and
HeaderSearch::LookupFile to track if the search used a header map,
making it easy to suppress the warning.  Longer term, once we find a way
to avoid the false positive, we should turn the warning back on.

rdar://problem/28863903

llvm-svn: 301592
2017-04-27 21:41:51 +00:00
Sean Callanan 84dfb56926 Added an Importer test for in-class member initializers.
llvm-svn: 301573
2017-04-27 18:10:29 +00:00
Vedant Kumar 96d6ca7e8c [Profile] Add off-by-default -Wprofile-instr-missing warning
Clang warns that a profile is out-of-date if it can't find a profile
record for any function in a TU. This warning became noisy after llvm
started allowing dead-stripping of instrumented functions.

To fix this, this patch changes the existing profile out-of-date warning
(-Wprofile-instr-out-of-date) so that it only complains about mismatched
data. Further, it introduces a new, off-by-default warning about missing
function data (-Wprofile-instr-missing).

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

llvm-svn: 301570
2017-04-27 17:30:58 +00:00
Argyrios Kyrtzidis 2a68486c8f [libclang] Enhance clang_Cursor_isDynamicCall and clang_Cursor_getReceiverType to handle ObjC property references
Also enhance clang_Cursor_getReceiverType to handle C++ method calls.

llvm-svn: 301568
2017-04-27 17:23:04 +00:00
Hans Wennborg 883522b1fa clang-cl: Alias /d1reportAllClassLayout to -fdump-record-layouts (PR32826)
llvm-svn: 301567
2017-04-27 17:19:07 +00:00
Argyrios Kyrtzidis e594707dfb [index] Mark the ObjC implicit accessor method definitions as 'dynamic' as well
llvm-svn: 301548
2017-04-27 15:05:18 +00:00
Alex Lorenz cb00640c05 [libclang] Pass in the -fallow-editor-placeholders option
This will suppress any live diagnostics caused by editor placeholders in Xcode.

rdar://31833579

llvm-svn: 301542
2017-04-27 13:47:03 +00:00
NAKAMURA Takumi 742c5fce67 clang/test/Modules/malformed-overload.m: Make sure module cache is clean.
llvm-svn: 301539
2017-04-27 13:08:48 +00:00
Oren Ben Simhon 318a6eae06 [X86] Support of no_caller_saved_registers attribute
Implements the Clang part for no_caller_saved_registers attribute as appears here: 
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=5ed3cc7b66af4758f7849ed6f65f4365be8223be.

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

llvm-svn: 301535
2017-04-27 12:01:00 +00:00
Alex Lorenz a8a372d85e [ObjC] Disallow vector parameters and return values in Objective-C methods
for iOS < 9 and OS X < 10.11 X86 targets

This commit adds a new error that disallows methods that have parameters/return
values with a vector type for some older X86 targets. This diagnostic is
needed because objc_msgSend doesn't support SIMD vector registers/return values
on X86 in iOS < 9 and OS X < 10.11. Note that we don't necessarily know if the
vector argument/return value will use a SIMD register, so instead we chose to
be conservative and prohibit all vector types.

rdar://21662309

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

llvm-svn: 301532
2017-04-27 10:43:48 +00:00
Haojian Wu 838c60f405 Don't hard-code "modules-cache-path" in the test.
llvm-svn: 301525
2017-04-27 09:20:46 +00:00
Nick Lewycky ad8886896e In the expression evaluator, visit the index of an ArraySubscriptExpr even if we can't evaluate the base, if the evaluation mode tells us to continue evaluation.
llvm-svn: 301522
2017-04-27 07:27:36 +00:00
Nick Lewycky 20edee6a3e In the expression evaluator, descend into both the true and false expressions of a ConditionalOperator when the condition can't be evaluated and we're in an evaluation mode that says we should continue evaluating.
llvm-svn: 301520
2017-04-27 07:11:09 +00:00
Duncan P. N. Exon Smith 16b1ac950b Darwin: Define __STDC_NO_THREADS__ on Darwin targets
Darwin doesn't support C11 threads.h.  Define `__STDC_NO_THREADS__` so
that users can check for it.

rdar://problem/18461003

llvm-svn: 301508
2017-04-27 01:47:22 +00:00
Richard Smith 8c8fb80490 Improve diagnostics for bad -std= flag.
Don't list deprecated -std= values (c++0x etc). Only produce one line of output
per standard, even if we know it by multiple names.

In passing, add missing -std=gnu++03 alias (supported by GCC), and add new
spelling '-std=cl1.0' for OpenCL 1.0 for consistency with the other values,
with the same meaning as the preexisting '-std=cl'.

llvm-svn: 301507
2017-04-27 01:17:05 +00:00
Richard Smith b0fe70451e Don't accept -std= values that would switch us to a different source language.
We already prohibited this in most cases (in r130710), but had some bugs in our
enforcement of this rule. Specifically, this prevents the following
combinations:

 * -x c -std=clN.M, which would previously effectively act as if -x cl were
   used, despite the input being a C source file. (-x cl -std=cNN continues
   to be disallowed.)

 * -x c++ -std=cuda, which would previously select C++98 + CUDA, despite that
   not being a C++ standard. (-x cuda -std=c++NN is still permitted, and
   selects CUDA with the given C++ standard as its base language.
   -x cuda -std=cuda is still supported with the meaning of CUDA + C++98.)

 * -x renderscript -std=c++NN, which would previously form a hybrid "C++ with
   RenderScript extensions" language. We could support such a thing, but
   shouldn't do so by accident.

llvm-svn: 301497
2017-04-26 23:44:33 +00:00
Rui Ueyama 0fcbb2893e Revert r301487: Replace HashString algorithm with xxHash64
This reverts commit r301487 to make buildbots green.

llvm-svn: 301491
2017-04-26 23:15:10 +00:00
Rui Ueyama 87b30ac9d3 Replace HashString algorithm with xxHash64
The previous algorithm processed one character at a time, which is very
painful on a modern CPU. Replace it with xxHash64, which both already
exists in the codebase and is fairly fast.

Patch from Scott Smith!

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

llvm-svn: 301487
2017-04-26 22:45:04 +00:00
Vedant Kumar 6b22dda5a3 [ubsan] nullability-assign: Check assignments into C++ structs
Fix the nullability-assign check so that it can handle assignments into
C++ structs. Previously, such assignments were not instrumented.

Testing: check-clang, check-ubsan, enabling the existing test in ObjC++
mode, and building some Apple frameworks with -fsanitize=nullability.

llvm-svn: 301482
2017-04-26 21:55:17 +00:00
Bruno Cardoso Lopes 370296302d [Modules] Fix a crash-on-invalid with overloaded functions
Do not add an overload if the function doesn't have a prototype; this
can happen if, for instance, a misplaced/malformed call site is
considered like a declaration for recovery purposes.

rdar://problem/31306325

llvm-svn: 301453
2017-04-26 20:13:45 +00:00
Vedant Kumar 25b6a7db2f [Sema] Avoid using a null type pointer (fixes PR32750)
isMicrosoftMissingTypename() uses a Type pointer without first checking
that it's non-null. PR32750 reports a case where the pointer is in fact
null. This patch adds in a defensive check and a regression test.

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

llvm-svn: 301420
2017-04-26 15:40:21 +00:00
Alexey Bataev b435a5ff5e [OPENMP] Fix failing test.
llvm-svn: 301417
2017-04-26 15:30:36 +00:00
Alexey Bataev 4b46539ef3 [OPENMP] Fix handling of OpenMP code during template instantiation.
If some function template is instantiated during handling of OpenMP
code, currently it may cause crash of compiler because of trying of
capturing variables in non-capturing function scopes. Patch fixes this
bug.

llvm-svn: 301416
2017-04-26 15:06:24 +00:00
Alex Lorenz 28559ceece -Wunguarded-availability should support if (@available) checks in top-level
blocks and lambdas

Prior to this commit Clang emitted the old "partial availability" warning for
expressions that referred to declarations that were not yet introduced in
blocks and lambdas that were not in a function/method. This commit ensures that
top-level blocks and lambdas use the new unguarded availability checks.

rdar://31835952

llvm-svn: 301409
2017-04-26 14:20:02 +00:00
Alex Lorenz 00353a0bf9 -Wdocumentation should not check the @returns command for Objective-C
function/block pointer properties

The commit r300981 allowed @param/@return commands for function/block
pointer property declarations. This meant that -Wdocumentation started warning
about @return that was used to document properties whose function/block type
returned void. However, prior to that commit, we allowed @return for all
property declarations, because it can be used to document the value that's
returned by the property getter. This commit restores the previous behaviour:
now the @return command can be used to document all properties without warnings.

rdar://24978538

llvm-svn: 301402
2017-04-26 13:09:28 +00:00
Alex Lorenz 6246cc6c0e [AST] Look through attribute type locs when searching for function type
loc

Prior to this commit -Wdocumentation crashed when checking the @returns command
for declarations whose function/block pointer type included an attribute like
_Nullable.

rdar://31818195

llvm-svn: 301400
2017-04-26 12:46:27 +00:00
Leslie Zhai e3986c544d [analyzer] Teach the MallocChecker about Glib API for two arguments
Reviewers: zaks.anna, NoQ, danielmarjamaki

Reviewed By: zaks.anna, NoQ, danielmarjamaki

Subscribers: cfe-commits, kalev, pwithnall

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

llvm-svn: 301384
2017-04-26 05:33:14 +00:00
Bruno Cardoso Lopes faaeae5d6e [Modules][ObjC] Check definition from canonical decl on designated initializers
Use definition from canonical decl when checking for designated
initializers. This is necessary since deserialization of a interface
might reuse the definition from the canonical one (see r281119).

rdar://problem/29360655

llvm-svn: 301382
2017-04-26 05:06:20 +00:00
Vedant Kumar e859ebbd06 [ubsan] Skip alignment checks on allocas with known alignment
It's possible to determine the alignment of an alloca at compile-time.
Use this information to skip emitting some runtime alignment checks.

Testing: check-clang, check-ubsan.

This significantly reduces the amount of alignment checks we emit when
compiling X86ISelLowering.cpp. Here are the numbers from patched/unpatched
clangs based on r301361.

  ------------------------------------------
  | Setup          | # of alignment checks |
  ------------------------------------------
  | unpatched, -O0 |                 47195 |
  | patched, -O0   |                 30876 | (-34.6%)
  ------------------------------------------

llvm-svn: 301377
2017-04-26 02:17:21 +00:00
Evgeniy Stepanov c7b90947bd [asan] Unconditionally enable GC of globals on COFF.
This change restores pre-r301225 behavior, where linker GC compatible global
instrumentation was used on COFF targets disregarding -f(no-)data-sections and/or
/Gw flags.

This instrumentation puts each global in a COMDAT with an ASan descriptor for that global.
It effectively enables -fdata-sections, but limits it to ASan-instrumented globals.

llvm-svn: 301374
2017-04-26 00:51:06 +00:00
Krzysztof Parzyszek dcda945971 [Hexagon] Set -ffp-contract=fast at -O3 unless explicitly specified
llvm-svn: 301361
2017-04-25 20:51:51 +00:00
Carlo Bertolli 356822fe7b Minor fix for distribute_parallel_for_num_threads_codegen on AARCH64
llvm-svn: 301348
2017-04-25 18:59:37 +00:00
Davide Italiano e2ff98d9f8 [PGO/tests] Update comment to reflect reality.
llvm-svn: 301344
2017-04-25 18:04:31 +00:00
Carlo Bertolli b0ff0a69c3 Recommit of
[OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host

https://reviews.llvm.org/D29508

This patch makes the following additions:

It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation.
It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses.
It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code.

llvm-svn: 301340
2017-04-25 17:52:12 +00:00
Davide Italiano 44f6ea8818 [PGO] Update test now that we don't call IndirectCallPromotion.
llvm-svn: 301339
2017-04-25 17:48:10 +00:00
Alex Lorenz 3c0ede7f7a [libclang] Check for a record declaration before a template specialization
Fixes PR32539.

Patch by Emilio Cobos Álvarez!

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

llvm-svn: 301328
2017-04-25 16:59:07 +00:00
Alex Lorenz f41b21e384 [index] Index type source info for class specializations
rdar://31758344

llvm-svn: 301315
2017-04-25 15:13:42 +00:00
Alex Lorenz 5bf767c548 [index] Record the 'SpecializationOf' relation for function specializations
rdar://31603531

llvm-svn: 301310
2017-04-25 14:22:29 +00:00
Ismail Donmez b971198ea2 Fix fuzzer.c test on platforms where CLANG_DEFAULT_CXX_STDLIB is libc++
llvm-svn: 301302
2017-04-25 11:24:14 +00:00
Richard Smith 145e15a37b [modules ts] Diagnose 'export' declarations outside of a module interface.
llvm-svn: 301271
2017-04-24 23:12:30 +00:00
Bruno Cardoso Lopes 7bd3d9f0d7 [Modules] Fix test to wipe out the cache before using it
This should appease bots:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental_check/35914

rdar://problem/31796737

llvm-svn: 301261
2017-04-24 21:58:13 +00:00
Artem Dergachev cbd7cd8360 [analyzer] Improve subscripting null arrays for catching null dereferences.
Array-to-pointer cast now works correctly when the pointer to the array
is concrete, eg. null, which allows further symbolic calculations involving
such values.

Inlined defensive checks are now detected correctly when the resulting null
symbol is being array-subscripted before dereference.

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

llvm-svn: 301251
2017-04-24 20:55:07 +00:00
Vedant Kumar bc370f0c18 [Coverage] Avoid null deref in skipRegionMappingForDecl (fixes PR32761)
Patch by Adam Folwarczny!

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

llvm-svn: 301249
2017-04-24 20:52:04 +00:00
George Karpenkov d4fec71b9b Specify a target explicitly in libfuzzer driver flag test
llvm-svn: 301246
2017-04-24 20:38:56 +00:00
Carlo Bertolli f09daae75d Revert r301223
llvm-svn: 301233
2017-04-24 19:50:35 +00:00
Evgeniy Stepanov df217a2f3c [asan] Disable ASan global-GC depending on the target and compiler flags.
llvm-svn: 301225
2017-04-24 19:34:12 +00:00
Artem Dergachev 37de888867 [analyzer] Improve suppression for inlined defensive checks before operator &.
Null dereferences are suppressed if the lvalue was constrained to 0 for the
first time inside a sub-function that was inlined during analysis, because
such constraint is a valid defensive check that does not, by itself,
indicate that null pointer case is anyhow special for the caller.

If further operations on the lvalue are performed, the symbolic lvalue is
collapsed to concrete null pointer, and we need to track where does the null
pointer come from.

Improve such tracking for lvalue operations involving operator &.

rdar://problem/27876009

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

llvm-svn: 301224
2017-04-24 19:30:33 +00:00
Carlo Bertolli 4287d65c10 [OpenMP] Initial implementation of code generation for pragma 'distribute parallel for' on host
https://reviews.llvm.org/D29508

This patch makes the following additions:

1. It abstracts away loop bound generation code from procedures associated with pragma 'for' and loops in general, in such a way that the same procedures can be used for 'distribute parallel for' without the need for a full re-implementation.
2. It implements code generation for 'distribute parallel for' and adds regression tests. It includes tests for clauses.

It is important to notice that most of the clauses are implemented as part of existing procedures. For instance, firstprivate is already implemented for 'distribute' and 'for' as separate pragmas. As the implementation of 'distribute parallel for' is based on the same procedures, then we automatically obtain implementation for such clauses without the need to add new code. However, this requires regression tests that verify correctness of produced code.

Looking forward to comments.

llvm-svn: 301223
2017-04-24 19:26:11 +00:00
George Karpenkov 38b0d82b2d Remove erroneous driver test for -fsanitize=fuzzer flag
libfuzzer is not available on all platforms, and hence we can not always
rely that it was compiled.

llvm-svn: 301216
2017-04-24 18:36:31 +00:00
George Karpenkov f2fc5b068e Flag -fsanitize=fuzzer to enable libfuzzer
Previously, adding libfuzzer to a project was a multi-step procedure,
involving libfuzzer compilation, linking the library, and specifying
coverage flags.
With this change,libfuzzer can be enabled by adding a single
-fsanitize=fuzzer flag instead.

llvm-svn: 301212
2017-04-24 18:23:24 +00:00
Argyrios Kyrtzidis b4b85f2033 [index] If the 'external_source_symbol' attribute indicates 'Swift' as the language then report it accordingly
llvm-svn: 301183
2017-04-24 14:52:00 +00:00
Alex Lorenz a352ba0cbe [index] The relation between the declarations in template specializations
that 'override' declarations in the base template should be recorded

This can be used for improved "go to definition" feature in Xcode.

rdar://31604739

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

llvm-svn: 301180
2017-04-24 14:04:58 +00:00
Piotr Padlewski 34046bd358 [Devirtualization] Emit invariant.group loads with empty group md
Summary:
As discussed here
http://lists.llvm.org/pipermail/llvm-dev/2017-January/109332.html
having different groups doesn't solve the problem entirly.

Reviewers: rjmccall, rsmith

Subscribers: amharc, cfe-commits

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

llvm-svn: 301178
2017-04-24 12:58:43 +00:00
Richard Smith 645386cf4b Rearrange some Modules TS testcases into test/CXX/modules-ts.
llvm-svn: 301066
2017-04-22 00:47:53 +00:00
David Blaikie 8150355498 Move Split DWARF handling to an MC option/command line argument rather than using metadata
Since Split DWARF needs to name the actual .dwo file that is generated,
it can't be known at the time the llvm::Module is produced as it may be
merged with other Modules before the object is generated and that object
may be generated with any name.

By passing the Split DWARF file name when LLVM is producing object code
the .dwo file name in the object file can match correctly.

The support for Split DWARF for implicit modules remains the same -
using metadata to store the dwo name and dwo id so that potentially
multiple skeleton CUs referring to different dwo files can be generated
from one llvm::Module.

llvm-svn: 301063
2017-04-21 23:35:36 +00:00
Richard Smith 81328ac3a5 P0629R0: Switch to latest proposal for distinguishing module interface from implementation.
This switches from the prototype syntax in P0273R0 ('module' and 'module
implementation') to the consensus syntax 'export module' and 'module'.

In passing, drop the "module declaration must be first" enforcement, since EWG
seems to have changed its mind on that.

llvm-svn: 301056
2017-04-21 22:39:18 +00:00
Argyrios Kyrtzidis f363474996 [index] Take into account the category's external_symbol attr for namespacing its methods
llvm-svn: 301051
2017-04-21 22:27:06 +00:00
Nico Weber 7beed8544a [ms] Give -Wmicrosoft-enum-forward-reference a chance to fire in clang-cl, PR32736
clang-cl sets MicrosoftCompat. In that mode, we always give enums a fixed
underlying type, and for enums with fixed underlying type we never enter the
block that tries to emit ext_ms_forward_ref_enum. Fix this by requiring an
explicit underlying type when we're skipping this diagnostic.

We had a test for this warning, but it only ran in C++98 mode. clang-cl always
enables -std=c++14, so MicrosoftCompatibiliy-cxx98.cpp is a fairly useless
test. Fold it into MicrosoftCompatibility.cpp -- that way, the test checks if
-Wmicrosoft-enum-forward-reference can fire in clang-cl builds.

https://reviews.llvm.org/D32369

llvm-svn: 301032
2017-04-21 20:12:26 +00:00
Anastasia Stulova b42f3c03bf [OpenCL] Fix semantic check of ndrange_t for device_side_enqueue.
Check unqualified type for ndrange argument in device_side_enqueue so
device_side_enqueue accept const and volatile qualified ndranges.

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

Patch by Dmitry Borisenkov!

llvm-svn: 300988
2017-04-21 15:13:24 +00:00
Krasimir Georgiev bcda54b69d [clang-format] Replace IncompleteFormat by a struct with Line
Summary: This patch replaces the boolean IncompleteFormat that is used to notify the client if an unrecoverable syntax error occurred by a struct that also contains a line number.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

llvm-svn: 300985
2017-04-21 14:35:20 +00:00
Alex Lorenz 6b82a75df5 [PR32667] -Wdocumentation should allow @param/@returns for fields/variables
that have a function/block pointer type

This commit improves the -Wdocumentation warning by making sure that @param and
@returns commands won't trigger warnings when used for fields, variables,
or properties whose type is a function/block pointer type. The
function/block pointer type must be specified directly with the declaration,
and when a typedef is used the warning is still emitted.

In the future we might also want to handle the std::function type as well.

rdar://24978538

llvm-svn: 300981
2017-04-21 14:17:49 +00:00
Ismail Donmez ca9cdadeab Add support for openSUSE ARM Triples
Summary: Add support for armv6hl-suse-linux-gnueabi and armv7hl-suse-linux-gnueabi triples used by openSUSE/SUSE.

Reviewers: cfe-commits, rovka, compnerd, rengolin

Reviewed By: rengolin

Subscribers: aemerson, rengolin, bkramer, chandlerc

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

llvm-svn: 300969
2017-04-21 12:26:43 +00:00
Argyrios Kyrtzidis 6e5ca5be53 [index] Take advantage of 'external_source_symbol' attribute for indexing purposes
- Ignore decls marked as 'generated_declaration'
- Include the 'defined_in' in the USR for additional namespacing

llvm-svn: 300949
2017-04-21 05:42:46 +00:00
Argyrios Kyrtzidis f932612fdf [index] For 'transparent' tag typedefs, ignore their tag reference
llvm-svn: 300948
2017-04-21 05:42:40 +00:00
Richard Smith 2195ec9ad4 [modules] Properly look up the owning module for an instantiation of a merged template.
When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

This reinstates r300650, reverted in r300659, with a fix for a regression
reported by Chandler after commit.

llvm-svn: 300938
2017-04-21 01:15:13 +00:00
Alexander Shaposhnikov 015da3534a [analyzer] Fix assert in ExprEngine::processSwitch
This diff replaces getTypeSize(CondE->getType())) 
with getIntWidth(CondE->getType())) in ExprEngine::processSwitch.
These calls are not equivalent for bool, see ASTContext.cpp
Add a test case.

Test plan:
make check-clang-analysis
make check-clang

Differential revision: https://reviews.llvm.org/D32328

llvm-svn: 300936
2017-04-21 01:05:26 +00:00
Eric Fiselier 56be04284f Use __CLANG_ATOMIC_TYPE_LOCK_FREE macros in `stdatomic.h`
Summary: This patch makes the header `stdatomic.h` work when `-fms-compatibility` is specified.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

llvm-svn: 300919
2017-04-20 23:07:38 +00:00
Eric Fiselier 4b2c8f75a1 Add __CLANG_ATOMIC_<TYPE>_LOCK_FREE macros for use in MSVC compatibility mode.
Summary:
Libc++ currently implements the `ATOMIC_<TYPE>_LOCK_FREE` macros using the `__GCC_ATOMIC_<TYPE>_LOCK_FREE` macros. However these are not available when MSVC compatibility is enabled even though C11 `_Atomic` is.  This prevents libc++ from correctly implementing `ATOMIC_<TYPE>_LOCK_FREE`.

This patch adds an alternative spelling `__CLANG_ATOMIC_<TYPE>_LOCK_FREE` that is enabled with `-fms-compatibility`.

Reviewers: rsmith, aaron.ballman, majnemer, zturner, compnerd, jfb, rnk

Reviewed By: rsmith

Subscribers: BillyONeal, smeenai, jfb, cfe-commits, dschuff

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

llvm-svn: 300914
2017-04-20 22:53:57 +00:00
Saleem Abdulrasool 1f5f5c2c2f Sema: protect against ObjC++ typo-correction failure
ObjC++ has two different types of "pointer" types (ObjCClassPointerType
and PointerType).  Both can be indirected through.  However, the former
is not a member expression.  Ensure that we do not try to rebuild the
MRE in that case.

llvm-svn: 300909
2017-04-20 22:23:10 +00:00
Francis Ricci 8e63e54177 Enable leak sanitizer builds for darwin
Summary:
Support for leak sanitizer on darwin has been added to
compiler-rt, this patch adds compiler support.

Reviewers: dexonsmith, compnerd

Subscribers: alekseyshl, kubamracek, cfe-commits

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

llvm-svn: 300894
2017-04-20 21:11:51 +00:00
Benjamin Kramer b12345c04c [Driver] Add a missing -no-canonical-prefixes to test.
llvm-svn: 300873
2017-04-20 19:06:24 +00:00
Adam Nemet 03af42444b Don't pass FPOpFusion::Strict to the backend
This restores the behavior prior to D31167 where the code-gen default was
FPC_On which mapped to FPOpFusion::Standard.  After merging the FE
state (on/off) and the code-gen state (on/fast/off), the default became off to
match the front-end.

In other words, the front-end controls when to fuse along the language
standards and the backend shouldn't override this by splitting fused
intrinsics as FPOpFusion::Strict would imply.

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

llvm-svn: 300858
2017-04-20 17:09:35 +00:00
Alex Lorenz f6071c34a5 [index] Record class template specializations using a new 'SpecializationOf'
relationship

rdar://31603531

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

llvm-svn: 300832
2017-04-20 10:43:22 +00:00
Alex Lorenz 472cc79086 Add #pragma clang attribute support to the availability attribute
rdar://31707804

llvm-svn: 300826
2017-04-20 09:35:02 +00:00
Leslie Zhai ff04109ca2 [AVR] Add -mmcu option to the driver
A patch by Peter Wu!

Reviewers: jroelofs, xiangzhai

Reviewed By: jroelofs, dylanmckay, xiangzhai

Subscribers: dlj, dylanmckay, cfe-commits

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

llvm-svn: 300818
2017-04-20 04:23:24 +00:00
Richard Trieu fe56405467 [ODRHash] clean up test and add new examples. NFC
Use a macro to generate the struct with all decls.  Previously, four identical
changes would be needed to update this test.  This macro reduces that to one
location.  Added two other tests for issues that triggered false positives
during testing.

llvm-svn: 300814
2017-04-20 02:53:53 +00:00
Richard Smith 479ba8ee0e PR32673: Don't wrap parameter packs in SubstTemplateTypeParmPackType nodes when forming implicit deduction guides.
Doing so thwarts template type deduction. Instead, substitute the pack directly
by picking "slice 0" of the resulting expansion.

llvm-svn: 300805
2017-04-20 01:15:31 +00:00
Shoaib Meenai a90474544e [Sema] Use MSVC inner class behavior on Itanium
Windows Itanium aims to use MSVC export and import semantics. Inner
class members shouldn't be exported on a dllexport explicit
instantiation definition of the outer class, and they shouldn't be
imported on a dllimport explicit instantiation declaration of the outer
class (instead a local copy should be emitted). We were doing the first
but not the second, and this mismatch can lead to link errors. Fix the
behavior and add tests for both.

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

llvm-svn: 300804
2017-04-20 01:11:42 +00:00
Richard Smith 2b0d6134c7 Add a triple to codegen test.
llvm-svn: 300803
2017-04-20 01:02:29 +00:00
Carlo Bertolli ffafe10fac [OpenMP] Prepare sema to support combined constructs with omp distribute and omp for
https://reviews.llvm.org/D32237

This patch prepares sema with additional fields to support all those composite and combined constructs of OpenMP that include pragma 'distribute' and 'for', such as 'distribute parallel for'. It also extends the regression tests for 'distribute parallel for' and adds a new one.

llvm-svn: 300802
2017-04-20 00:39:39 +00:00
Kostya Serebryany 1c0e9e98c0 [sanitizer-coverage] deprecate -fsanitize-coverage=trace-bb
llvm-svn: 300767
2017-04-19 21:31:11 +00:00
Erich Keane 4b87d81068 Corrrect warn_unused_result attribute
The original idea was that if the attribute on an operator, 
that the return-value unused-ness wouldn't matter. However, 
all of the operators except postfix inc/dec return 
references! References don't result in this warning 
anyway, so those are already excluded.

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

llvm-svn: 300764
2017-04-19 21:24:55 +00:00
Richard Smith ada0888a11 Fix assertion failure in codegen on non-template deduction guide.
llvm-svn: 300762
2017-04-19 21:15:45 +00:00
Kostya Serebryany 1a02d8bc8d [sanitizer-coverage] deprecate -fsanitize-coverage=8bit-counters
llvm-svn: 300744
2017-04-19 20:15:58 +00:00
David Blaikie 6e2ec5f10e Parse backend options during thinlto backend compile actions
llvm-svn: 300741
2017-04-19 20:08:21 +00:00
Kostya Serebryany 9d1ed13b53 [sanitizer-coverage] deprecate some of the stale coverage variants
llvm-svn: 300738
2017-04-19 19:57:16 +00:00
Vedant Kumar f224d707df [Coverage] Don't emit mappings for functions in dependent contexts (fixes PR32679)
The coverage implementation marks functions which won't be emitted as
'deferred', so that it can emit empty coverage regions for them later
(once their linkages are known).

Functions in dependent contexts are an exception: if there isn't a full
instantiation of a function, it shouldn't be marked 'deferred'. We've
been breaking that rule without much consequence because we just ended
up with useless, extra, empty coverage mappings. With PR32679, this
behavior finally caused a crash, because clang marked a partial template
specialization as 'deferred', causing the MS mangler to choke in its
delayed-template-parsing mode:

  error: cannot mangle this template type parameter type yet
  (http://bugs.llvm.org/show_bug.cgi?id=32679)

Fix this by checking if a decl's context is a dependent context before
marking it 'deferred'.

Based on a patch by Adam Folwarczny!

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

llvm-svn: 300723
2017-04-19 17:58:30 +00:00
Akira Hatanaka 3901377c22 [Sema][ObjC] Disallow jumping into ObjC fast enumeration loops.
rdar://problem/31635406

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

llvm-svn: 300722
2017-04-19 17:54:08 +00:00
Alex Lorenz 24952fbc6f Add #pragma clang attribute support to the external_source_symbol attribute
Prior to this commit the external_source_symbol attribute wasn't supported by
#pragma clang attribute for the following two reasons:

- The Named attribute subject hasn't been supported by TableGen.
- There was no way to specify a subject match rule for #pragma clang attribute
 that could operate on a set of attribute subjects (e.g. the ones that derive
 from NamedDecl).

This commit fixes the two issues and thus adds external_source_symbol support to
#pragma clang attribute.

rdar://31169028

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

llvm-svn: 300712
2017-04-19 15:52:11 +00:00
Jonas Hahnfeld 8ea76fa9b4 [Driver] Unify linking of OpenMP runtime. NFCI.
While at it, extend test for FreeBSD and check for -lrt iff on Linux.

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

llvm-svn: 300689
2017-04-19 13:55:39 +00:00
Roger Ferrer Ibanez cb89513bc7 Avoid assert when a non-static member function is qualified with __unaligned
Under -fms-extensions __unaligned is a type-qualifier that can be applied to a
non-static member function declaration.

This causes an assertion when mangling the name under Itanium, where that
qualifier is not mangled.

This patch justs makes the minimal change to avoid the crash and avoid mangling
__unaligned, as it currently happens with non-member functions.

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

llvm-svn: 300686
2017-04-19 12:23:28 +00:00
Alex Lorenz 1be800c511 Add support for editor placeholders to Clang
This commit teaches Clang to recognize editor placeholders that are produced
when an IDE like Xcode inserts a code-completion result that includes a
placeholder. Now when the lexer sees a placeholder token, it emits an
'editor placeholder in source file' error and creates an identifier token
that represents the placeholder. The parser/sema can now recognize the
placeholders and can suppress the diagnostics related to the placeholders. This
ensures that live issues in an IDE like Xcode won't get spurious diagnostics
related to placeholders.

This commit also adds a new compiler option named '-fallow-editor-placeholders'
that silences the 'editor placeholder in source file' error. This is useful
for an IDE like Xcode as we don't want to display those errors in live issues.

rdar://31581400

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

llvm-svn: 300667
2017-04-19 08:58:56 +00:00
Chandler Carruth bd186c0787 Revert r300653 and r300650. The underlying commit fixes one issue with
modules but exposes much more widespread issues. Example and more
information is on the review thread for r300650.

Original commit summary:
[modules] Properly look up the owning module for an instantiation of a merged template.

llvm-svn: 300659
2017-04-19 05:25:13 +00:00
Richard Smith 5aacc4021b [modules] Properly look up the owning module for an instantiation of a merged template.
When looking for the template instantiation pattern of a templated entity,
consistently select the definition of the pattern if there is one. This means
we'll pick the same owning module when we start instantiating a template that
we'll later pick when determining which modules are visible during that
instantiation.

llvm-svn: 300650
2017-04-19 01:36:43 +00:00
Richard Smith 34e485f922 [modules-ts] Fold together -x c++ and -x c++-module at -cc1 level.
The driver needs to know whether it's building a module interface or
implementation unit because it affects which outputs it produces and how it
builds the command pipeline. But the frontend doesn't need to know and should
not care: all it needs to know is what action it is being asked to perform on
the input.

(This is in preparation for permitting -emit-obj to be used on a module
interface unit to produce object code without going via a "full" PCM file.)

llvm-svn: 300611
2017-04-18 21:55:37 +00:00
Richard Smith 4c132e576b Do not warn about whitespace between ??/ trigraph and newline in line comments if trigraphs are disabled in the current language.
llvm-svn: 300609
2017-04-18 21:45:04 +00:00
Vassil Vassilev a0320b97fa PR30508: Downgrade error to warning if the umbrella folder doesn't exist.
Patch by Yuka Takahashi (D32119)!

llvm-svn: 300594
2017-04-18 20:57:29 +00:00
Manoj Gupta bb75b35811 [AArch64][clang] Pass cpu/arch information to assembler for AArch64.
Summary:
Pass Cpu/Arch options to assembler for AArch64 with no-integrated-as.
This fixes PR20019.

Reviewers: richard.barton.arm, kristof.beyls, rengolin

Reviewed By: rengolin

Subscribers: srhines, pirama, aemerson, rengolin, cfe-commits

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

llvm-svn: 300571
2017-04-18 17:36:10 +00:00
Martell Malone 3e573bea31 mingw-w64: enable support for __declspec(selectany)
Add selectany as a GCC spelling for mingw-w64

Reviewers: rnk

Differential revision: https://reviews.llvm.org/D32083

llvm-svn: 300562
2017-04-18 15:56:24 +00:00
Alex Lorenz 47fd10c3b5 [ASTPrinter] Print template parameter lists for out-of-line functions
llvm-svn: 300560
2017-04-18 15:12:34 +00:00
Alex Lorenz 9e7bf161ea Add #pragma clang attribute
This is a recommit of r300539 that was reverted in r300543 due to test failures.
The original commit message is displayed below:

The new '#pragma clang attribute' directive can be used to apply attributes to
multiple declarations. An attribute must satisfy the following conditions to
be supported by the pragma:
- It must have a subject list that's defined in the TableGen file.
- It must be documented.
- It must not be late parsed.
- It must have a GNU/C++11 spelling.

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

llvm-svn: 300556
2017-04-18 14:33:39 +00:00
Oliver Stannard 692dc54b0d [ARM] Add hardware build attributes in assembler
This passes an option to the ARM assembly parser to emit build
attributes for the hardware selected by command line options, when
assembling an assembly file.

This is not enabled for C/C++, as this would result in duplicate build
attribute directives being emitted in each inline assembly block, when
emitting assembly.

This also adds an option to allow disabling this behaviour for assembly
files, for users who were relying on the old behaviour.

Differential revision: https://reviews.llvm.org/D31813

llvm-svn: 300550
2017-04-18 13:21:05 +00:00
Oliver Stannard 233310f3e6 [ARM,AArch64] Define __ELF__ for arm-none-eabihf and AArch64
This macro is defined for arm-none-eabi as of r266625, but it should also be
defined for eabihf and aarch64.

llvm-svn: 300549
2017-04-18 13:12:36 +00:00
Alex Lorenz 3bfe962afa Revert r300539 - Add #pragma clang attribute
Some tests fail on the Windows buildbots. I will have to investigate more.
This commit reverts r300539, r300540 and r300542.

llvm-svn: 300543
2017-04-18 10:46:41 +00:00
Alex Lorenz 0a849f47d2 Add #pragma clang attribute
The new '#pragma clang attribute' directive can be used to apply attributes to
multiple declarations. An attribute must satisfy the following conditions to
be supported by the pragma:
- It must have a subject list that's defined in the TableGen file.
- It must be documented.
- It must not be late parsed.
- It must have a GNU/C++11 spelling.

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

llvm-svn: 300539
2017-04-18 09:41:47 +00:00
Eric Fiselier f692e7db51 [coroutines] Fix building of new/delete expressions when get_return_object_on_allocation_failure() is present.
Summary:
This patch implements [dcl.fct.def.coroutine]p8:
> The unqualified-id get_return_object_on_allocation_failure is looked up in the scope of
> class P by class member access lookup (3.4.5). If a declaration is found, ..., and if a 
> global allocation function is selected, the ::operator new(size_t, nothrow_t) form shall be used.
> [...]
> The allocation function used in this case must have a non-throwing noexcept-specification.

Reviewers: GorNishanov, rsmith, majnemer, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 300524
2017-04-18 03:12:48 +00:00
Adrian Prantl c3782a1a6f Debug Info: Remove special-casing of indirect function argument handling.
LLVM has changed the semantics of dbg.declare for describing function
arguments. After this patch a dbg.declare always takes the *address*
of a variable as the first argument, even if the argument is not an
alloca.

https://bugs.llvm.org/show_bug.cgi?id=32382
rdar://problem/31205000

llvm-svn: 300523
2017-04-18 01:22:01 +00:00
Richard Smith 1d2ae94b5d Fix mishandling of escaped newlines followed by newlines or nuls.
Previously, if an escaped newline was followed by a newline or a nul, we'd lex
the escaped newline as a bogus space character. This led to a bunch of
different broken corner cases:

For the pattern "\\\n\0#", we would then have a (horizontal) space whose
spelling ends in a newline, and would decide that the '#' is at the start of a
line, and incorrectly start preprocessing a directive in the middle of a
logical source line. If we were already in the middle of a directive, this
would result in our attempting to process multiple directives at the same time!
This resulted in crashes, asserts, and hangs on invalid input, as discovered by
fuzz-testing.

For the pattern "\\\n" at EOF (with an implicit following nul byte), we would
produce a bogus trailing space character with spelling "\\\n". This was mostly
harmless, but would lead to clang-format getting confused and misformatting in
rare cases. We now produce a trailing EOF token with spelling "\\\n",
consistent with our handling for other similar cases -- an escaped newline is
always part of the token containing the next character, if any.

For the pattern "\\\n\n", this was somewhat more benign, but would produce an
extraneous whitespace token to clients who care about preserving whitespace.
However, it turns out that our lexing for line comments was relying on this bug
due to an off-by-one error in its computation of the end of the comment, on the
slow path where the comment might contain escaped newlines.

llvm-svn: 300515
2017-04-17 23:44:51 +00:00
Eric Fiselier a9b3d0975a Rename coroutine warning when unhandled_exception() is missing
llvm-svn: 300513
2017-04-17 23:28:02 +00:00
Eric Fiselier 47ee0f4d31 Revert r300504 - [coroutines] Fix rebuilding of implicit and dependent coroutine statements.
I have no idea what's happening here. The tests that fail on all of the bots
pass on my machine. Further investigation needed.

llvm-svn: 300511
2017-04-17 22:40:44 +00:00
Vedant Kumar dbbdda4d23 [ubsan] Skip null checks if they are constant-folded away
The IR builder can constant-fold null checks if the pointer operand
points to a constant. If the "is-non-null" check is folded away to
"true", don't emit the null check + branch.

Testing: check-clang, check-ubsan.

This slightly reduces the amount of null checks we emit when compiling
X86ISelLowering.cpp. Here are the numbers from patched/unpatched clangs
based on r300371.

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            25251 |
  | patched, -O0   |            23925 | (-5.3%)
  -------------------------------------

llvm-svn: 300509
2017-04-17 22:26:10 +00:00
Vedant Kumar 379d9c1dc6 [ubsan] Skip null checks on pointers to the start of an alloca
Pointers to the start of an alloca are non-null, so we don't need to
emit runtime null checks for them.

Testing: check-clang, check-ubsan.

This significantly reduces the amount of null checks we emit when
compiling X86ISelLowering.cpp. Here are the numbers from patched /
unpatched clangs based on r300371.

  -------------------------------------
  | Setup          | # of null checks |
  -------------------------------------
  | unpatched, -O0 |            45439 |
  | patched, -O0   |            25251 | (-44.4%)
  -------------------------------------

llvm-svn: 300508
2017-04-17 22:26:07 +00:00
Eric Fiselier fb289ecde0 [coroutines] Fix rebuilding of implicit and dependent coroutine statements.
Summary:
Certain implicitly generated coroutine statements, such as the calls to 'return_value()' or `return_void()` or `get_return_object_on_allocation_failure()`, cannot be built until the promise type is no longer dependent. This means they are not built until after the coroutine body statement has been transformed.

This patch fixes an issue where these statements would never be built for coroutine templates.

It also fixes a small issue where diagnostics about `get_return_object_on_allocation_failure()` were incorrectly suppressed. 

Reviewers: rsmith, majnemer, GorNishanov, aaron.ballman

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

llvm-svn: 300504
2017-04-17 22:06:13 +00:00
Hans Wennborg 21793a617a clang-cl: Support the /Zc:twoPhase[-] command-line option (PR32680)
It sounds like MSVC is adding support for two-phase name lookup in a
future version, enabled by this flag (see bug).

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

llvm-svn: 300501
2017-04-17 21:28:36 +00:00
Benjamin Kramer dcb52b167a Revert "Address http://bugs.llvm.org/pr30994 so that a non-friend can properly replace a friend, and a visible friend can properly replace an invisible friend but not vice verse, and definitions are not replaced. This fixes the two FIXME in SemaTemplate/friend-template.cpp."
This reverts commit r300443. Breaks compiling libc++ with modules in
some configurations.

llvm-svn: 300497
2017-04-17 20:57:40 +00:00