]> granicus.if.org Git - clang/log
clang
7 years ago[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.
Akira Hatanaka [Tue, 27 Jun 2017 04:34:04 +0000 (04:34 +0000)]
[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.

According to the documentation, when encoding a bit-field, GNU runtime
needs its starting position in addition to its type and size.

https://gcc.gnu.org/onlinedocs/gcc/Type-encoding.html

Prior to r297702, the starting position information was not being
encoded, which is incorrect, and after r297702, an assertion started to
fail because an ObjCIvarDecl was being passed to a function expecting a
FieldDecl.

This commit moves LookupFieldBitOffset to ASTContext and uses the
function to encode the starting position of bit-fields.

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

7 years agoRemove redundant check.
Richard Smith [Tue, 27 Jun 2017 00:29:32 +0000 (00:29 +0000)]
Remove redundant check.

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

7 years agoFix this test to use a construct that actually forces struct layout to happen when...
Richard Smith [Tue, 27 Jun 2017 00:22:07 +0000 (00:22 +0000)]
Fix this test to use a construct that actually forces struct layout to happen when testing -Wpadded.

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

7 years agoAST: enhance mangling for blocks with MS ABI
Saleem Abdulrasool [Mon, 26 Jun 2017 23:28:42 +0000 (23:28 +0000)]
AST: enhance mangling for blocks with MS ABI

When generating the decorated name for a static variable inside a
BlockDecl, construct a scope for the block invocation function that
homes the parameter. This allows for arbitrary nesting of the blocks
even if the variables are shadowed. Furthermore, using this for the name
allows for undname to properly undecorated the name for us. It shows up
as the synthetic __block_invocation function that the compiler emitted
in the local scope.

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

7 years agoRevert r301742, which caused us to try to evaluate all full-expressions.
Richard Smith [Mon, 26 Jun 2017 23:19:32 +0000 (23:19 +0000)]
Revert r301742, which caused us to try to evaluate all full-expressions.

Also add testcases for a bunch of expression forms that cause our evaluator to
crash. See PR33140 and PR32864 for crashes that this was causing.

This reverts r305287, which reverted r305239, which reverted r301742. The
previous revert claimed that buildbots were broken, but did not add any
testcases and the buildbots have lost all memory of what was wrong here.

Changes to test/OpenMP are not reverted; another change has triggered those
tests to change their output in the same way that r301742 did.

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

7 years ago[clang] Enable printf check for CFIndex
Alexander Shaposhnikov [Mon, 26 Jun 2017 23:02:27 +0000 (23:02 +0000)]
[clang] Enable printf check for CFIndex

According to
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
CFIndex and NSInteger should be treated the same way (see the section Platform Dependencies).
This diff changes the function shouldNotPrintDirectly in SemaChecking.cpp accordingly
and adds tests for the "fixit" and the warning.

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

Test plan: make check-all

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

7 years agoCheck that the initializer of a non-dependent constexpr variable is constant even...
Richard Smith [Mon, 26 Jun 2017 20:33:42 +0000 (20:33 +0000)]
Check that the initializer of a non-dependent constexpr variable is constant even within templates.

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

7 years agoRemove some redundant setup when preprocessing .pcm files.
Richard Smith [Mon, 26 Jun 2017 20:15:21 +0000 (20:15 +0000)]
Remove some redundant setup when preprocessing .pcm files.

Both of these steps are immediately overwritten by the FrontendAction setup.

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

7 years agoWhen preprocessing with -frewrite-imports and -fmodule-file=, do not pass all
Richard Smith [Mon, 26 Jun 2017 19:39:25 +0000 (19:39 +0000)]
When preprocessing with -frewrite-imports and -fmodule-file=, do not pass all
modules to preprocessing of nested .pcm files.

Making those module files available results in loading more .pcm files than
necessary, and potentially in misbehavior if a module makes itself visible
during its own compilation (as parts of that module that have not yet been
processed would then become visible).

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

7 years ago[Sema] Fix a crash-on-invalid when a template parameter list has a class
Akira Hatanaka [Mon, 26 Jun 2017 18:46:12 +0000 (18:46 +0000)]
[Sema] Fix a crash-on-invalid when a template parameter list has a class
definition or non-reference class type.

The crash occurs when there is a template parameter list in a class that
is missing the closing angle bracket followed by a definition of a
struct. For example:

class C0 {
public:
  template<typename T, typename T1 = T // missing closing angle bracket
  struct S0 {};

  C0() : m(new S0<int>) {}
  S0<int> *m;
};

This happens because the parsed struct is added to the scope of the
enclosing class without having its access specifier set, which results
in an assertion failure in SemaAccess.cpp later.

This commit fixes the crash by adding the parsed struct to the enclosing
file scope and marking structs as invalid if they are defined in
template parameter lists.

rdar://problem/31783961
rdar://problem/19570630

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

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

7 years ago[inline asm] dot operator while using imm generates wrong ir + asm - clang part
Marina Yatsina [Mon, 26 Jun 2017 16:09:55 +0000 (16:09 +0000)]
[inline asm] dot operator while using imm generates wrong ir + asm - clang part

Inline asm dot operator while using imm generates wrong ir and asm
This is the test for the llvm changes committed in revision 306300

This also fixes bugzilla 32987:
https://bugs.llvm.org//show_bug.cgi?id=32987

The llvm part of the review that contains the test can be found here:
https://reviews.llvm.org/D33039

commit on behald of zizhar

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

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

7 years ago[inline asm][gcc-compatiblity] "=i" output constraint support
Marina Yatsina [Mon, 26 Jun 2017 15:55:51 +0000 (15:55 +0000)]
[inline asm][gcc-compatiblity] "=i" output constraint support

Ignore ‘i’,’n’,’E’,’F’ as output constraints in inline assembly (gcc compatibility)

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

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

7 years agoImprove const-correctness.
Axel Naumann [Mon, 26 Jun 2017 15:06:40 +0000 (15:06 +0000)]
Improve const-correctness.

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

7 years ago[mips] Enable IAS by default for Android 64-bit MIPS target (N64)
Petar Jovanovic [Mon, 26 Jun 2017 09:58:01 +0000 (09:58 +0000)]
[mips] Enable IAS by default for Android 64-bit MIPS target (N64)

IAS is already used for MIPS64 in majority of Android projects.
Android MIPS64 uses N64 ABI. Set IAS as a default now.

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

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

7 years agoTestcase missed from r306075.
Richard Smith [Mon, 26 Jun 2017 04:41:22 +0000 (04:41 +0000)]
Testcase missed from r306075.

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

7 years agoclang-format - Also reference the list of style option of clang-format in Libformat
Sylvestre Ledru [Mon, 26 Jun 2017 03:19:05 +0000 (03:19 +0000)]
clang-format - Also reference the list of style option of clang-format in Libformat

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

7 years agoFix a typo
Sylvestre Ledru [Mon, 26 Jun 2017 02:45:08 +0000 (02:45 +0000)]
Fix a typo

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

7 years ago[bash-autocompletion] Delete space after flags which has '=' prefix
Yuka Takahashi [Mon, 26 Jun 2017 00:35:36 +0000 (00:35 +0000)]
[bash-autocompletion] Delete space after flags which has '=' prefix

Summary:
This is patch for bash completion for clang project.
We don't need space when completing options like "-stdlib=".

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

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

7 years agoAdd support for Ananas platform
Ed Schouten [Sun, 25 Jun 2017 08:29:09 +0000 (08:29 +0000)]
Add support for Ananas platform

Ananas is a home-brew operating system, mainly for amd64 machines. After
using GCC for quite some time, it has switched to clang and never looked
back - yet, having to manually patch things is annoying, so it'd be much
nicer if this was in the official tree.

More information:

https://github.com/zhmu/ananas/
https://rink.nu/projects/ananas.html

Submitted by: Rink Springer
Differential Revision: https://reviews.llvm.org/D32936

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

7 years agoAdd a warning to a group
Vedant Kumar [Fri, 23 Jun 2017 23:34:32 +0000 (23:34 +0000)]
Add a warning to a group

Add warn_drv_object_size_disabled_O0 to the invalid command line
argument group. This should fix some bot failures:

  lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13241/steps/test/logs/stdio

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

7 years ago[ubsan] Disable the object size check at -O0
Vedant Kumar [Fri, 23 Jun 2017 23:15:24 +0000 (23:15 +0000)]
[ubsan] Disable the object size check at -O0

This check currently isn't able to diagnose any issues at -O0, not is it
likely to [1]. Disabling the check at -O0 leads to substantial compile
time and binary size savings.

[1] [cfe-dev] Disabling ubsan's object size check at -O0

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

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

7 years agoRevert "[MS] Don't statically initialize dllimport member function pointers"
Reid Kleckner [Fri, 23 Jun 2017 22:39:01 +0000 (22:39 +0000)]
Revert "[MS] Don't statically initialize dllimport member function pointers"

This reverts commit r306137. It has problems on code like this:

  struct __declspec(dllimport) Foo {
    int a;
    int get_a() { return a; }
  };
  template <int (Foo::*Getter)()> struct HasValue {
    int operator()(Foo *p) { return (p->*Getter)(); }
  };
  int main() {
    Foo f;
    f.a = 3;
    int x = HasValue<&Foo::get_a>()(&f);
  }

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

7 years ago[ubsan] Improve diagnostics for return value checks (clang)
Vedant Kumar [Fri, 23 Jun 2017 21:32:38 +0000 (21:32 +0000)]
[ubsan] Improve diagnostics for return value checks (clang)

This patch makes ubsan's nonnull return value diagnostics more precise,
which makes the diagnostics more useful when there are multiple return
statements in a function. Example:

1 |__attribute__((returns_nonnull)) char *foo() {
2 |  if (...) {
3 |    return expr_which_might_evaluate_to_null();
4 |  } else {
5 |    return another_expr_which_might_evaluate_to_null();
6 |  }
7 |} // <- The current diagnostic always points here!

runtime error: Null returned from Line 7, Column 2!
With this patch, the diagnostic would point to either Line 3, Column 5
or Line 5, Column 5.

This is done by emitting source location metadata for each return
statement in a sanitized function. The runtime is passed a pointer to
the appropriate metadata so that it can prepare and deduplicate reports.

Compiler-rt patch (with more tests): https://reviews.llvm.org/D34298

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

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

7 years ago[MSP430] Fix data layout string.
Vadzim Dambrouski [Fri, 23 Jun 2017 21:12:56 +0000 (21:12 +0000)]
[MSP430] Fix data layout string.

Summary:
Change data layout string so it would be compatible with MSP430 EABI.

Depends on D34561

Reviewers: asl, awygle

Reviewed By: asl

Subscribers: cfe-commits

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

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

7 years agoAdd test for 306149, warn on throw from noexcept
Erich Keane [Fri, 23 Jun 2017 20:30:33 +0000 (20:30 +0000)]
Add test for 306149, warn on throw from noexcept

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

7 years agoEmit warning when throw exception in destruct or dealloc functions which has a
Erich Keane [Fri, 23 Jun 2017 20:22:19 +0000 (20:22 +0000)]
Emit warning when throw exception in destruct or dealloc functions which has a
(possible implicit) noexcept specifier

Throwing in the destructor is not good (C++11 change try to not allow see below).
 But in reality, those codes are exist.
C++11 [class.dtor]p3:

A declaration of a destructor that does not have an exception-specification is
implicitly considered to have the same exception specification as an implicit
declaration.

With this change, the application worked before may now run into runtime
termination. My goal here is to emit a warning to provide only possible info to
where the code may need to be changed.

First there is no way, in compile time to identify the “throw” really throw out
of the function. Things like the call which throw out… To keep this simple,
when “throw” is seen, checking its enclosing function(only destructor and
dealloc functions) with noexcept(true) specifier emit warning.

Here is implementation detail:
A new member function CheckCXXThrowInNonThrowingFunc is added for class Sema
in Sema.h. It is used in the call to both BuildCXXThrow and
TransformCXXThrowExpr.

The function basic check if the enclosing function with non-throwing noexcept
specifer, if so emit warning for it.

The example of warning message like:
k1.cpp:18:3: warning: ''~dependent_warn'' has a (possible implicit) non-throwing

    noexcept specifier. Throwing exception may cause termination.
        [-Wthrow-in-dtor]
        throw 1;
        ^

        k1.cpp:43:30: note: in instantiation of member function

        'dependent_warn<noexcept_fun>::~dependent_warn' requested here

        dependent_warn<noexcept_fun> f; // cause warning

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

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

7 years ago[MS] Don't statically initialize dllimport member function pointers
Reid Kleckner [Fri, 23 Jun 2017 18:29:13 +0000 (18:29 +0000)]
[MS] Don't statically initialize dllimport member function pointers

We were already applying the same rules to dllimport function pointers.
David Majnemer added that logic back in r211677 to fix PR20130.  We
failed to extend that logic to non-virtual member function pointers,
which are basically function pointers in a struct with some extra
offsets.

Fixes PR33570.

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

7 years ago[GSoC] Add support for CC1 options.
Yuka Takahashi [Fri, 23 Jun 2017 17:05:50 +0000 (17:05 +0000)]
[GSoC] Add support for CC1 options.

Summary:
Add value completion support for options which are defined in
CC1Options.td, because we only handled options in Options.td.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: llvm-commits

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

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

7 years agoAdd a ThinLTO cache policy for controlling the maximum cache size in bytes.
Peter Collingbourne [Fri, 23 Jun 2017 17:05:03 +0000 (17:05 +0000)]
Add a ThinLTO cache policy for controlling the maximum cache size in bytes.

This is useful when an upper limit on the cache size needs to be
controlled independently of the amount of the amount of free space.

One use case is a machine with a large number of cache directories
(e.g. a buildbot slave hosting a large number of independent build
jobs). By imposing an upper size limit on each cache directory,
users can more easily estimate the server's capacity.

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

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

7 years agodocs: Add documentation for the ThinLTO cache pruning policy string.
Peter Collingbourne [Fri, 23 Jun 2017 16:56:27 +0000 (16:56 +0000)]
docs: Add documentation for the ThinLTO cache pruning policy string.

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

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

7 years agotest: fix negative test case
Saleem Abdulrasool [Fri, 23 Jun 2017 16:52:49 +0000 (16:52 +0000)]
test: fix negative test case

Add missing -### to the driver to ensure that we dont try to run the
actual command.  The host may not support the IAS.  Should fix the SCEI
buildbots.

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

7 years agoSort the autocomplete candidates before printing them out.
Rui Ueyama [Fri, 23 Jun 2017 15:37:52 +0000 (15:37 +0000)]
Sort the autocomplete candidates before printing them out.

Currently, autocompleted options are displayed in the same order as we
wrote them in .td files. This patch sort them out in clang so that they
are sorted alphabetically. This should improve usability.

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

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

7 years agoRevert "Revert r305164/5/7."
Saleem Abdulrasool [Fri, 23 Jun 2017 15:34:16 +0000 (15:34 +0000)]
Revert "Revert r305164/5/7."

Restore the `-gz` option to the driver with some minor tweaks to handle
the additional case for `-Wa,--compress-debug-sections`.

This intends to make the compression of the debug information
controllable from the driver.  The following is the behaviour:

  -gz           enable compression (ambiguous for format, will default to zlib-gnu)
  -gz=none      disable compression
  -gz=zlib-gnu  enable compression (deprecated GNU style zlib compression)
  -gz=zlib      enable compression (zlib based compression)

Although -Wa,-compress-debug-sections works, it should be discouraged
when using the driver to invoke the assembler.  However, we permit the
assembler to accept the GNU as style argument --compress-debug-sections
to maintain compatibility.

Note, -gz/-gz= does *NOT* imply -g.  That is, you need to additionally
specific -g for debug information to be generated.

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

7 years agoRevert r306103: "PR26195: Set correct NestedNameSpecifierLoc for the
Alex Lorenz [Fri, 23 Jun 2017 15:10:54 +0000 (15:10 +0000)]
Revert r306103: "PR26195: Set correct NestedNameSpecifierLoc for the
dependent initializer"

It caused buildbot failures such as this one:
http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA/builds/3777/steps/test_clang/logs/Clang%20%3A%3A%20Index__ctor-init-source-loc.cpp

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

7 years agoPR26195: Set correct NestedNameSpecifierLoc for the dependent initializer
Alex Lorenz [Fri, 23 Jun 2017 14:10:07 +0000 (14:10 +0000)]
PR26195: Set correct NestedNameSpecifierLoc for the dependent initializer

This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:

template<typename MyBase>
struct Derived: MyBase::InnerIterator
{

Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};

Patch by Serge Preis!

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

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

7 years ago[clang-format] Add a SortUsingDeclaration option and enable it by default
Krasimir Georgiev [Fri, 23 Jun 2017 11:46:03 +0000 (11:46 +0000)]
[clang-format] Add a SortUsingDeclaration option and enable it by default

Summary:
This patch adds a `SortUsingDeclaration` style option and enables it for llvm
style.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek

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

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

7 years ago[clang-format] Update dump_format_style.py to indent nested fields
Krasimir Georgiev [Fri, 23 Jun 2017 11:29:40 +0000 (11:29 +0000)]
[clang-format] Update dump_format_style.py to indent nested fields

Summary:
This updates the format options documentation script to indent the
documentation of nested fields. The previous format caused some problems,
as when a bulleted list ends with a multiline comment. See the buildbot failure
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/10020/steps/docs-clang-html/logs/stdio

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

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

7 years ago[clang-format] Update style documentation, NFC
Krasimir Georgiev [Fri, 23 Jun 2017 08:48:00 +0000 (08:48 +0000)]
[clang-format] Update style documentation, NFC

Summary: Style documentation is generated automatically by `docs/tools/dump_format_style.py`. This hasn't been ran for a while.

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[Frontend] 'Show hotness' can be used with a sampling profile
Brian Gesiak [Fri, 23 Jun 2017 02:38:45 +0000 (02:38 +0000)]
[Frontend] 'Show hotness' can be used with a sampling profile

Summary:
Prior to this change, using `-fdiagnostics-show-hotness` with a sampling
profile specified via `-fprofile-sample-use=` would result in the Clang
frontend emitting a warning: "argument '-fdiagnostics-show-hotness' requires
profile-guided optimization information". Of course, a sampling profile
*is* profile-guided optimization information, so the warning is misleading.
Furthermore, despite the warning, hotness was displayed based on the data in
the sampling profile.

Prevent the warning from being emitted when a sampling profile is used, and
add a test that verifies this.

Reviewers: anemet, davidxl

Reviewed By: davidxl

Subscribers: danielcdh, cfe-commits

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

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

7 years agoAdd missing file from r306075.
Richard Smith [Fri, 23 Jun 2017 01:18:27 +0000 (01:18 +0000)]
Add missing file from r306075.

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

7 years agoPR33552: Distinguish between declarations that are owned by no module and
Richard Smith [Fri, 23 Jun 2017 01:04:34 +0000 (01:04 +0000)]
PR33552: Distinguish between declarations that are owned by no module and
declarations that are owned but unconditionally visible.

This allows us to set declarations as visible even if they have a local owning
module, without losing information. In turn, that means that our Objective-C
support can keep on incorrectly assuming the "hidden" bit on the declaration is
the whole story with regard to name visibility. This will also be useful once
we support the C++ Modules TS export semantics.

Objective-C name visibility is still incorrect in any case where the "hidden"
bit is not the complete story: for instance, in Objective-C++ the set of
visible categories will be wrong during template instantiation, and with local
submodule visibility enabled it will be wrong when building modules. Fixing that
will require a major overhaul of how visibility is handled for Objective-C (and
particularly for categories).

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

7 years ago[WebAssembly] Add default -allow-undefined-file to linker args
Sam Clegg [Fri, 23 Jun 2017 00:02:55 +0000 (00:02 +0000)]
[WebAssembly] Add default -allow-undefined-file to linker args

Also, don't use the outdated lib32/lib64 naming of files
within the sysroot. The more modern/flexible approach
IIUC is to use seperate sysroots or /lib/<target-tripple>
and /include/<target-tripple>.

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

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

7 years agoPR33002: When we instantiate the definition of a static data member, we might
Richard Smith [Thu, 22 Jun 2017 22:18:46 +0000 (22:18 +0000)]
PR33002: When we instantiate the definition of a static data member, we might
have attached an initializer to the in-class declaration. If so, include the
initializer in the update record for the instantiation.

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

7 years ago[Sema] Add -Wunguarded-availability-new
Alex Lorenz [Thu, 22 Jun 2017 17:02:24 +0000 (17:02 +0000)]
[Sema] Add -Wunguarded-availability-new

The new compiler warning -Wunguarded-availability-new is a subset of
-Wunguarded-availability. It is on by default. It only warns about uses of APIs
that have been introduced in macOS >= 10.13, iOS >= 11, watchOS >= 4 and
tvOS >= 11. We decided to use this kind of solution as we didn't want to turn
on -Wunguarded-availability by default, because we didn't want our users to get
warnings about uses of old APIs in their existing projects.

rdar://31054725

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

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

7 years ago[index] Add the "SpecializationOf" relation to the forward declarations
Alex Lorenz [Thu, 22 Jun 2017 11:20:07 +0000 (11:20 +0000)]
[index] Add the "SpecializationOf" relation to the forward declarations
of class template specializations

This commit fixes an issue where a forward declaration of a class template
specialization was not related to the base template. We need to relate even
forward declarations because specializations don't have to be defined.

rdar://32869409

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

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

7 years ago[analyzer] Do not continue to analyze a path if the constraints contradict with built...
Gabor Horvath [Thu, 22 Jun 2017 10:09:40 +0000 (10:09 +0000)]
[analyzer] Do not continue to analyze a path if the constraints contradict with builtin assume

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

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

7 years agoSwiftCC: Perform physical layout when computing coercion types
Arnold Schwaighofer [Wed, 21 Jun 2017 21:43:40 +0000 (21:43 +0000)]
SwiftCC: Perform physical layout when computing coercion types

We need to take type alignment padding into account whe computing physical
layouts.

The layout must be compatible with the input layout, offsets are defined in
terms of offsets within a packed struct which are computed in terms of the alloc
size of a type.

Usingthe store size we would insert padding for the following type for example:

struct {

  int3 v;
  long long l;
} __attribute((packed))

On x86-64 int3 is padded to int4 alignment. The swiftcc type would be
<{ <3 x float>, [4 x i8], i64 }> which is not compatible with <{ <3 x float>,
i64 }>.

The latter has i64 at offset 16 and the former at offset 20.

rdar://32618125

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

7 years ago[test] Make absolute line numbers relative; NFC
George Burgess IV [Wed, 21 Jun 2017 19:59:05 +0000 (19:59 +0000)]
[test] Make absolute line numbers relative; NFC

Done to remove noise from https://reviews.llvm.org/D32332 (and to make
this test more resilient to changes in general).

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

7 years ago[preprocessor] Fix assertion hit when 'SingleFileParseMode' option is enabled and...
Argyrios Kyrtzidis [Wed, 21 Jun 2017 18:52:44 +0000 (18:52 +0000)]
[preprocessor] Fix assertion hit when 'SingleFileParseMode' option is enabled and #if with an undefined identifier and without #else

'HandleEndifDirective' asserts that 'WasSkipping' is false, so switch to using 'FoundNonSkip' as the hint for 'SingleFileParseMode' to keep going with parsing.

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

7 years agoUse -NOT prefix instead of adding `not` to FileCheck.
Rui Ueyama [Wed, 21 Jun 2017 16:50:38 +0000 (16:50 +0000)]
Use -NOT prefix instead of adding `not` to FileCheck.

If we want to make sure that a particular string is not in an output,
the regular way of doing it is to add `-NOT` prefix instead of checking
if FileCheck resulted in an error.

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

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

7 years agoCorrect VectorCall x86 (32 bit) behavior for SSE Register Assignment
Erich Keane [Wed, 21 Jun 2017 16:37:22 +0000 (16:37 +0000)]
Correct VectorCall x86 (32 bit) behavior for SSE Register Assignment

In running some internal vectorcall tests in 32 bit mode, we discovered that the
behavior I'd previously implemented for x64 (and applied to x32) regarding the
assignment of SSE registers was incorrect. See spec here:
https://msdn.microsoft.com/en-us/library/dn375768.aspx

My previous implementation applied register argument position from the x64
version to both. This isn't correct for x86, so this removes and refactors that
section. Additionally, it corrects the integer/int-pointer assignments. Unlike
x64, x86 permits integers to be assigned independent of position.

Finally, the code for 32 bit was cleaned up a little to clarify the intent,
as well as given a descriptive comment.

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

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

7 years agoclang-format: introduce InlineOnly short function style
Francois Ferrand [Wed, 21 Jun 2017 13:56:02 +0000 (13:56 +0000)]
clang-format: introduce InlineOnly short function style

Summary:
This is the same as Inline, except it does not imply all empty
functions are merged: with this style, empty functions are merged only
if they also match the 'inline' criteria (i.e. defined in a class).

This is helpful to avoid inlining functions in implementations files.

Reviewers: djasper, krasimir

Reviewed By: djasper

Subscribers: klimek, rengolin, cfe-commits

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

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

7 years ago[index] Nested class declarations should be annotated with the
Alex Lorenz [Wed, 21 Jun 2017 13:51:04 +0000 (13:51 +0000)]
[index] Nested class declarations should be annotated with the
"specializationOf" relation if they pseudo-override a type in the base template

This commit fixes an issue where Xcode's renaming engine couldn't find the
reference to the second occurrence of "InnerClass" in this example:

template<typename T> struct Ts { template<typename U> struct InnerClass { }; };

template<> struct Ts<int> {
template<typename U> struct InnerClass; // This occurrence wasn't renamed
};

rdar://31884960

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

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

7 years agoFunction with unparsed body is a definition
Serge Pavlov [Wed, 21 Jun 2017 12:46:57 +0000 (12:46 +0000)]
Function with unparsed body is a definition

While a function body is being parsed, the function declaration is not considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:
```
    template<typename T> struct Somewhat {
      void internal() const {}
      friend void operator+(int const &, Somewhat<T> const &) {}
    };
void operator+(int const &, Somewhat<char> const &x) { x.internal(); }
```
When statement `x.internal()` in the body of global `operator+` is parsed, the type
of `x` must be completed, so the instantiation of `Somewhat<char>` is started. It
instantiates the declaration of `operator+` defined inline, and makes a check for
redefinition. The check does not detect another definition because the declaration
of `operator+` is still not defining as does not have a body yet.

To solves this problem the function `isThisDeclarationADefinition` considers
a function declaration as a definition if it has flag `WillHaveBody` set.

This change fixes PR14785.

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

This is a recommit of 305379, reverted in 305381, with small changes.

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

7 years agoFixed compiler warnings after r305890.
Ilya Biryukov [Wed, 21 Jun 2017 12:34:27 +0000 (12:34 +0000)]
Fixed compiler warnings after r305890.

Should fix buildbots that pass -Werror.

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

7 years ago[clang-format] Support sorting using declarations
Krasimir Georgiev [Wed, 21 Jun 2017 12:03:12 +0000 (12:03 +0000)]
[clang-format] Support sorting using declarations

Summary:
This patch adds UsingDeclarationsSorter, a TokenAnalyzer that sorts consecutive
using declarations.

Reviewers: klimek

Reviewed By: klimek

Subscribers: Typz, djasper, cfe-commits, klimek, mgorny

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

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

7 years ago[analyzer] Bump a few default performance thresholds.
Artem Dergachev [Wed, 21 Jun 2017 11:29:35 +0000 (11:29 +0000)]
[analyzer] Bump a few default performance thresholds.

This makes the analyzer around 10% slower by default,
allowing it to find deeper bugs.

Default values for the following -analyzer-config change:
max-nodes: 150000 -> 225000;
max-inlinable-size: 50 -> 100.

rdar://problem/32539666
Differential Revision: https://reviews.llvm.org/D34277

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

7 years agoFix unused-variable compilation error.
Haojian Wu [Wed, 21 Jun 2017 11:26:58 +0000 (11:26 +0000)]
Fix unused-variable compilation error.

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

7 years ago[analyzer] LocalizationChecker: Support new localizable APIs.
Artem Dergachev [Wed, 21 Jun 2017 11:12:07 +0000 (11:12 +0000)]
[analyzer] LocalizationChecker: Support new localizable APIs.

Add support for new methods that were added in macOS High Sierra & iOS 11
and require a localized string.

Patch by Kulpreet Chilana!

rdar://problem/32795210
Differential Revision: https://reviews.llvm.org/D34266

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

7 years agoRevert r305678: [driver][macOS] Pick the system version for the
Alex Lorenz [Wed, 21 Jun 2017 10:27:24 +0000 (10:27 +0000)]
Revert r305678: [driver][macOS] Pick the system version for the
deployment target if the SDK is newer than the system

This commit also reverts follow-up commits r305680 and r305685 that have
buildbot fixes.

The change in r305678 wasn't correct because it relied on
`llvm::sys::getProcessTriple`, which uses a pre-configured OS version. We should
lookup the actual macOS version of the system on which the compiler is running.

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

7 years agoMoved code hanlding precompiled preamble out of the ASTUnit.
Ilya Biryukov [Wed, 21 Jun 2017 10:24:58 +0000 (10:24 +0000)]
Moved code hanlding precompiled preamble out of the ASTUnit.

Reviewers: bkramer, krasimir, arphaman, akyrtzi, klimek

Reviewed By: klimek

Subscribers: mgorny, klimek, cfe-commits

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

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

7 years agoChanged wording in comment
Raphael Isemann [Wed, 21 Jun 2017 05:41:39 +0000 (05:41 +0000)]
Changed wording in comment

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

7 years agoSupport MS builtins using 'long' on LP64 platforms
Bruno Cardoso Lopes [Wed, 21 Jun 2017 02:20:46 +0000 (02:20 +0000)]
Support MS builtins using 'long' on LP64 platforms

This allows for -fms-extensions to work the same on LP64. For example,
_BitScanReverse is expected to be 32-bit, matching Windows/LLP64, even
though long is 64-bit on x86_64 Darwin or Linux (LP64).

Implement this by adding a new character code 'N', which is 'int' if
the target is LP64 and the same 'L' otherwise

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

rdar://problem/32599746

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

7 years agoRun dos2unix on ms-intrinsics-rotations.c test. NFC
Bruno Cardoso Lopes [Wed, 21 Jun 2017 02:20:40 +0000 (02:20 +0000)]
Run dos2unix on ms-intrinsics-rotations.c test. NFC

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

7 years ago[ODRHash] Supply more information when generic error message is emitted.
Richard Trieu [Wed, 21 Jun 2017 01:43:13 +0000 (01:43 +0000)]
[ODRHash] Supply more information when generic error message is emitted.

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

7 years agoPrevent devirtualization of calls to un-instantiated functions.
Sunil Srivastava [Tue, 20 Jun 2017 22:08:44 +0000 (22:08 +0000)]
Prevent devirtualization of calls to un-instantiated functions.

PR 27895

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

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

7 years agoSpecial-case handling of destructors in override lists when dumping ASTs.
Lang Hames [Tue, 20 Jun 2017 21:30:43 +0000 (21:30 +0000)]
Special-case handling of destructors in override lists when dumping ASTs.

Fixes a bug in r305850: CXXDestructors don't have names, so we need to handle
printing of them separately.

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

7 years agoPreserve CXX method overrides in ASTImporter
Lang Hames [Tue, 20 Jun 2017 21:06:00 +0000 (21:06 +0000)]
Preserve CXX method overrides in ASTImporter

Summary:
The ASTImporter should import CXX method overrides from the source context
when it imports a method decl.

Reviewers: spyffe, rsmith, doug.gregor

Reviewed By: spyffe

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

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

7 years ago[clang] Fix format specifiers fixits for nested macros
Alexander Shaposhnikov [Tue, 20 Jun 2017 20:46:58 +0000 (20:46 +0000)]
[clang] Fix format specifiers fixits for nested macros

ExpansionLoc was previously calculated incorrectly in the case of
nested macros expansions. In this diff we build the stack of expansions
where the last one is the actual expansion which should be used
for grouping together the edits.
The definition of MacroArgUse is adjusted accordingly.

Test plan: make check-all

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

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

7 years ago[AArch64] ADD ARMv.2-A FP16 vector intrinsics
Abderrazek Zaafrani [Tue, 20 Jun 2017 18:54:57 +0000 (18:54 +0000)]
[AArch64] ADD ARMv.2-A FP16 vector intrinsics

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

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

7 years agoFix for Bug 33471: Preventing operator auto from resolving to a template operator.
Erich Keane [Tue, 20 Jun 2017 17:38:07 +0000 (17:38 +0000)]
Fix for Bug 33471: Preventing operator auto from resolving to a template operator.

As the bug report says,
struct A
{

  template<typename T> operator T();

};

void foo()
{

  A().operator auto();

}

causes: "undeduced type in IR-generation
UNREACHABLE executed at llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:208!"

The problem is that in this case, "T" is being deduced as "auto",
which I believe is incorrect.

The 'operator auto' implementation in Clang is standards compliant, however
there is a defect report against core (1670).

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

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

7 years ago[GSoC] Flag value completion for clang
Yuka Takahashi [Tue, 20 Jun 2017 16:31:31 +0000 (16:31 +0000)]
[GSoC] Flag value completion for clang

This is patch for GSoC project, bash-completion for clang.

To use this on bash, please run `source clang/utils/bash-autocomplete.sh`.
bash-autocomplete.sh is code for bash-completion.

In this patch, Options.td was mainly changed in order to add value class
in Options.inc.

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

7 years agoAdd a missing '[' to the tests from r305719
Alex Lorenz [Tue, 20 Jun 2017 16:16:11 +0000 (16:16 +0000)]
Add a missing '[' to the tests from r305719

This clarifies the tests as the missing ']' is important, and not the '['.

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

7 years agoSplit the expectations in tests from r305719 over multiple lines to
Alex Lorenz [Tue, 20 Jun 2017 16:12:26 +0000 (16:12 +0000)]
Split the expectations in tests from r305719 over multiple lines to
enhance readability

As suggested by Duncan Exon Smith!

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

7 years agoD31187: Fix removal of out-of-line definitions.
Vassil Vassilev [Tue, 20 Jun 2017 14:59:57 +0000 (14:59 +0000)]
D31187: Fix removal of out-of-line definitions.

Consider:

struct MyClass {
  void f() {}
}
MyClass::f(){} // expected error redefinition of f. #1

Some clients (eg. cling) need to call removeDecl for the redefined (#1) decl.

This patch enables us to remove the lookup entry is registered in the semantic
decl context and not in the primary decl context of the lexical decl context
where we currently are trying to remove it from.

It is not trivial to test this piece and writing a full-blown unit test seems
too much.

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

7 years ago[OpenCL] Diagnose scoped address-space qualified variables
Anastasia Stulova [Tue, 20 Jun 2017 14:50:45 +0000 (14:50 +0000)]
[OpenCL] Diagnose scoped address-space qualified variables

Produce an error if variables qualified with a local or
a constant address space are not declared in the outermost
scope of a kernel.

Patch by Simon Perretta.

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

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

7 years ago[preprocessor] When preprocessor option 'SingleFileParseMode' is enabled, parse all...
Argyrios Kyrtzidis [Tue, 20 Jun 2017 14:36:58 +0000 (14:36 +0000)]
[preprocessor] When preprocessor option 'SingleFileParseMode' is enabled, parse all directive blocks if the condition uses undefined macros

This is useful for being able to parse the preprocessor directive blocks even if the header, that defined the macro that is checked, hasn't been included.

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

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

7 years ago[OpenCL] Fix OpenCL and SPIR version metadata generation.
Alexey Bader [Tue, 20 Jun 2017 14:30:18 +0000 (14:30 +0000)]
[OpenCL] Fix OpenCL and SPIR version metadata generation.

Summary: OpenCL and SPIR version metadata must be generated once per module instead of once per mangled global value.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: ahatanak, cfe-commits

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

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

7 years ago[analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generate...
Leslie Zhai [Tue, 20 Jun 2017 06:44:46 +0000 (06:44 +0000)]
[analyzer] Teach CloneDetection about Qt Meta-Object Compiler to filter auto generated files

Reviewers: v.g.vassilev, teemperor

Reviewed By: teemperor

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

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

7 years ago[analyzer] Check NULL pointer dereference issue for memset function
Leslie Zhai [Tue, 20 Jun 2017 06:41:06 +0000 (06:41 +0000)]
[analyzer] Check NULL pointer dereference issue for memset function

Reviewers: dcoughlin, zaks.anna, NoQ, danielmarjamaki

Reviewed By: NoQ, danielmarjamaki

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

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

7 years agoAdd a subgroup of c++1z-compat to enable and disable the warning about
Akira Hatanaka [Tue, 20 Jun 2017 06:18:46 +0000 (06:18 +0000)]
Add a subgroup of c++1z-compat to enable and disable the warning about
c++17's non-throwing exception specification in function signature.

rdar://problem/32628743

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

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

7 years agoTurn off "disable free" mode when preprocessing imported module files in
Richard Smith [Tue, 20 Jun 2017 01:31:53 +0000 (01:31 +0000)]
Turn off "disable free" mode when preprocessing imported module files in
-frewrite-imports mode.

This could end up accumulating a very large amount of intermediate state. Clear
it out after each module file is processed.

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

7 years agoSupport non-identifier module names when preprocessing modules.
Richard Smith [Mon, 19 Jun 2017 23:09:36 +0000 (23:09 +0000)]
Support non-identifier module names when preprocessing modules.

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

7 years ago[docs] Coverage: Improve the wording a bit
Vedant Kumar [Mon, 19 Jun 2017 21:26:04 +0000 (21:26 +0000)]
[docs] Coverage: Improve the wording a bit

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

7 years ago[docs] Coverage: document issue with the BFD linker
Vedant Kumar [Mon, 19 Jun 2017 21:22:05 +0000 (21:22 +0000)]
[docs] Coverage: document issue with the BFD linker

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

7 years agoTypo fix: appropo -> apropos. NFC.
Aaron Ballman [Mon, 19 Jun 2017 20:08:20 +0000 (20:08 +0000)]
Typo fix: appropo -> apropos. NFC.

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

7 years ago[Clang] Handle interaction of -pg and no_instrument_function attribute.
Manoj Gupta [Mon, 19 Jun 2017 18:45:03 +0000 (18:45 +0000)]
[Clang] Handle interaction of -pg and no_instrument_function attribute.

Summary:
Disable generation of counting-function attribute if no_instrument_function
attribute is present in function.
Interaction between -pg and no_instrument_function is the desired behavior
and matches gcc as well.
This is required for fixing a crash in Linux kernel when function tracing
is enabled.

Fixes PR33515.

Reviewers: hfinkel, rengolin, srhines, hans

Reviewed By: hfinkel

Subscribers: cfe-commits

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

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

7 years ago[Parser][ObjC] Use an artificial EOF token while parsing lexed ObjC methods
Alex Lorenz [Mon, 19 Jun 2017 17:53:21 +0000 (17:53 +0000)]
[Parser][ObjC] Use an artificial EOF token while parsing lexed ObjC methods

This change avoid a crash that occurred when skipping to EOF while parsing an
ObjC interface/implementation.

rdar://31963299

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

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

7 years agoCodeGen: Cast temporary variable to proper address space
Yaxun Liu [Mon, 19 Jun 2017 17:03:41 +0000 (17:03 +0000)]
CodeGen: Cast temporary variable to proper address space

In C++ all variables are in default address space. Previously change has been
made to cast automatic variables to default address space. However that is
not sufficient since all temporary variables need to be casted to default
address space.

This patch casts all temporary variables to default address space except those
for passing indirect arguments since they are only used for load/store.

This patch only affects target having non-zero alloca address space.

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

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

7 years agoclang-format: Fix C99 designated initializers corner cases
Francois Ferrand [Mon, 19 Jun 2017 14:41:21 +0000 (14:41 +0000)]
clang-format: Fix C99 designated initializers corner cases

Summary:
This fixes the missing space before the designated initializer when `Cpp11BracedListStyle=false` :

  const struct A a = { .a = 1, .b = 2 };
                      ^

Also, wrapping between opening brace and designated array initializers used to have an excessive penalty (like breaking between an expression and the subscript operator), leading to unexpected wrapping:

  const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa =
      {[1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
       [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};

instead of:

  const struct Aaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaa = {
      [1] = aaaaaaaaaaaaaaaaaaaaaaaaaaa,
      [2] = bbbbbbbbbbbbbbbbbbbbbbbbbbb};

Finally, designated array initializers are not binpacked, just like designated member initializers.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, krasimir, klimek

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

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

7 years agoRevert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"
Christof Douma [Mon, 19 Jun 2017 12:41:22 +0000 (12:41 +0000)]
Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc"

This reverts commit 305684.
This patch breaks extra/tools/clang-tidy

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

7 years agoMove the test from r305678 to a separte file with 'REQUIRES: system-darwin'
Alex Lorenz [Mon, 19 Jun 2017 12:13:59 +0000 (12:13 +0000)]
Move the test from r305678 to a separte file with 'REQUIRES: system-darwin'

Otherwise it will fail on non-macOS systems.

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

7 years ago[NFC] Refactor DiagnosticRenderer to use FullSourceLoc
Christof Douma [Mon, 19 Jun 2017 12:05:58 +0000 (12:05 +0000)]
[NFC] Refactor DiagnosticRenderer to use FullSourceLoc

Move the DiagnosticRenderer and its dependents to using FullSourceLocs
instead of a SourceLocation and SourceManager pointer. The changeset is
rather large but entirely mechanical.

This is step one to allow DiagnosticRenderer to take either
llvm::SMLocs or clang::SourceLocations.

Patch by Sanne Wouda

Review: https://reviews.llvm.org/D31709

Change-Id: If351a112cdf6718e2d3ef6721b8da9c6376b32dd

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

7 years agoAdd missing OS check to r305678
Alex Lorenz [Mon, 19 Jun 2017 11:25:37 +0000 (11:25 +0000)]
Add missing OS check to r305678

That commit failed on non-macOS buildbots as I've forgotten to make sure that
the system on which Clang is running on is actually macOS.

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

7 years ago[driver][macOS] Pick the system version for the deployment target
Alex Lorenz [Mon, 19 Jun 2017 10:57:27 +0000 (10:57 +0000)]
[driver][macOS] Pick the system version for the deployment target
if the SDK is newer than the system

This commit improves the driver by making sure that it picks the system version
for the deployment target when the version of the macOS SDK is newer than the
system version.

rdar://29449467

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

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

7 years ago[analyzer] Fix logical not for pointers with different bit width
Daniel Marjamaki [Mon, 19 Jun 2017 08:55:51 +0000 (08:55 +0000)]
[analyzer] Fix logical not for pointers with different bit width

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

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

7 years agoclang-format: Improve understanding of combined typedef+record declarations
Daniel Jasper [Mon, 19 Jun 2017 07:45:41 +0000 (07:45 +0000)]
clang-format: Improve understanding of combined typedef+record declarations

Fixes an issue where struct A { int X; }; would be broken onto multiple
lines, but typedef struct A { int X; } A2; was collapsed onto a single
line.

Patch by Jacob Bandes-Storch. Thank you.

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

7 years agoclang-format: Handle "if constexpr".
Daniel Jasper [Mon, 19 Jun 2017 07:40:49 +0000 (07:40 +0000)]
clang-format: Handle "if constexpr".

c++1z adds the following constructions to the language:

  if constexpr (cond)
    statement1;
  else if constexpr (cond)
    statement2;
  else if constexpr (cond)
    statement3;
  else
    statement4;

A first version of this was proposed in reviews.llvm.org/D26953 by
Francis Visoiu Mistrih, but never commited. This patch additionally
fixes the behavior when allowing short if statements on a single line
and was authored by Jacob Bandes-Storch. Thank you to both authors.

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

7 years agoclang-format: Add capability to format the diff on save in vim.
Daniel Jasper [Mon, 19 Jun 2017 07:30:04 +0000 (07:30 +0000)]
clang-format: Add capability to format the diff on save in vim.

With this patch, one can configure a BufWrite hook that will make the
clang-format integration compute a diff of the current buffer with the file
that's on disk and format all changed lines. This should create a
zero-overhead auto-format solution that doesn't require the file to
already be clang-format clean to avoid spurious diffs.

Review: https://reviews.llvm.org/D32429

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

7 years ago[analyzer] Teach CloneDetection about Qt Meta-Object Compiler
Leslie Zhai [Mon, 19 Jun 2017 01:55:50 +0000 (01:55 +0000)]
[analyzer] Teach CloneDetection about Qt Meta-Object Compiler

Reviewers: v.g.vassilev, zaks.anna, NoQ, teemperor

Reviewed By: v.g.vassilev, zaks.anna, NoQ, teemperor

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

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