]> granicus.if.org Git - clang/log
clang
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

7 years agoCodeGen: make the type match the comment for a libcall
Saleem Abdulrasool [Sat, 17 Jun 2017 17:30:31 +0000 (17:30 +0000)]
CodeGen: make the type match the comment for a libcall

Fix the type for a (runtime) library call to match both the comment and
the runtime implementation.  As it happens, the type being used matched,
this just makes it more precise.

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

7 years agoCall setMustBuildLookupTable on TagDecls in ExternalASTMerger
Lang Hames [Sat, 17 Jun 2017 00:12:38 +0000 (00:12 +0000)]
Call setMustBuildLookupTable on TagDecls in ExternalASTMerger

Summary:
setMustBuildLookupTable should be called on imported TagDecls otherwise we may fail
to import their member decls (if they have any).

Not calling the setMustBuildLookupTable method results in a failure in the attached test
case when lookup for the 'x' member fails on struct S, which hasn't had its decls imported
elsewhere. (By contrast the member-in-struct testcase hasn't run into this issue
because the import of its decls is triggered when the struct instance is defined, and the
member access follows this).

Reviewers: spyffe, rsmith

Reviewed By: spyffe, rsmith

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

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

7 years ago[Driver] Do a PATH lookup if needed when using -no-canonical-prefixes
Petr Hosek [Fri, 16 Jun 2017 22:40:18 +0000 (22:40 +0000)]
[Driver] Do a PATH lookup if needed when using -no-canonical-prefixes

When -no-canonical-prefixes option is used and argv0 contains only
a program name, we need to do a PATH lookup to get an executable path,
otherwise the return value won't be a valid path and any subsequent
uses of it (e.g. when invoking -cc1) will fail with an error.

This patch fixes PR9576.

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

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

7 years ago[index] Fix typo: inferface -> interface
Marc-Andre Laperle [Fri, 16 Jun 2017 20:58:26 +0000 (20:58 +0000)]
[index] Fix typo: inferface -> interface

Reviewers: arphaman

Reviewed By: arphaman

Subscribers: cfe-commits

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

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

7 years agoKilling a tab and some other spurious whitespace; NFC.
Aaron Ballman [Fri, 16 Jun 2017 20:52:59 +0000 (20:52 +0000)]
Killing a tab and some other spurious whitespace; NFC.

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

7 years ago[PR33394] Avoid lexing editor placeholders when Clang is used only
Alex Lorenz [Fri, 16 Jun 2017 20:13:39 +0000 (20:13 +0000)]
[PR33394] Avoid lexing editor placeholders when Clang is used only
for preprocessing

r300667 added support for editor placeholder to Clang. That commit didn’t take
into account that users who use Clang for preprocessing only (-E) will get the
"editor placeholder in source file" error when preprocessing their source
(PR33394). This commit ensures that Clang doesn't lex editor placeholders when
running a preprocessor only action.

rdar://32718000

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

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

7 years agoIgnore return value in test.
Daniel Jasper [Fri, 16 Jun 2017 19:29:20 +0000 (19:29 +0000)]
Ignore return value in test.

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

7 years ago[ubsan] docs: Add a note about pointers to volatile
Vedant Kumar [Fri, 16 Jun 2017 18:38:43 +0000 (18:38 +0000)]
[ubsan] docs: Add a note about pointers to volatile

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

7 years agoFix a bug that warnings generated with -M or -MM flags
Yuka Takahashi [Fri, 16 Jun 2017 16:01:13 +0000 (16:01 +0000)]
Fix a bug that warnings generated with -M or -MM flags

This is a patch for bug: https://bugs.llvm.org/show_bug.cgi?id=6817

Warnings should not be emitted with -M and -MM flags, because this mode
is only used for generate MakeFiles.

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

7 years agoExpand vector oparation to as IR constants, PR28129.
Dinar Temirbulatov [Fri, 16 Jun 2017 12:09:52 +0000 (12:09 +0000)]
Expand vector oparation to as IR constants, PR28129.

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

7 years ago[ubsan] PR33081: Skip the standard type checks for volatile
Vedant Kumar [Fri, 16 Jun 2017 03:27:36 +0000 (03:27 +0000)]
[ubsan] PR33081: Skip the standard type checks for volatile

Skip checks for null dereference, alignment violation, object size
violation, and dynamic type violation if the pointer points to volatile
data.

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

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

7 years ago[XRay][clang] Support capturing the implicit `this` argument to C++ class member...
Dean Michael Berris [Fri, 16 Jun 2017 03:22:09 +0000 (03:22 +0000)]
[XRay][clang] Support capturing the implicit `this` argument to C++ class member functions

Summary:
Before this change, we couldn't capture the `this` pointer that's
implicitly the first argument of class member functions. There are some
interesting things we can do with capturing even just this single
argument for zero-argument member functions.

Reviewers: rnk, pelikan

Subscribers: cfe-commits

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

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

7 years ago[ODRHash] Hash VarDecl members.
Richard Trieu [Fri, 16 Jun 2017 02:44:29 +0000 (02:44 +0000)]
[ODRHash] Hash VarDecl members.

These VarDecl's are static data members of classes.  Since the initializers are
also hashed, this also provides checking for default arguments to methods.

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

7 years ago[Completion] Code complete the members for a dependent type after a '::'
Alex Lorenz [Thu, 15 Jun 2017 21:40:54 +0000 (21:40 +0000)]
[Completion] Code complete the members for a dependent type after a '::'

This commit is a follow up to r302797 which added support for dependent
completions after the '.' and '->' operators. This commit adds support for
dependent completions after the '::' operator.

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

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

7 years ago[index] Record C++17 global binding declarations
Alex Lorenz [Thu, 15 Jun 2017 21:19:01 +0000 (21:19 +0000)]
[index] Record C++17 global binding declarations

The global C++17 binding declarations should be indexed as variable symbols.

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

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

7 years agoAdded braces to work around gcc warning in googletest: suggest explicit braces to...
Galina Kistanova [Thu, 15 Jun 2017 21:01:24 +0000 (21:01 +0000)]
Added braces to work around gcc warning in googletest: suggest explicit braces to avoid ambiguous 'else'. NFC.

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

7 years ago[index] Index static_assert declarations
Alex Lorenz [Thu, 15 Jun 2017 20:50:43 +0000 (20:50 +0000)]
[index] Index static_assert declarations

static_assert declarations have to be visited while indexing so that we can
gather the references to declarations that are present in their assert
expression.

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

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

7 years ago[coroutines] Remove pass-through operator co_await; Replace it with the input expression
Eric Fiselier [Thu, 15 Jun 2017 20:00:54 +0000 (20:00 +0000)]
[coroutines] Remove pass-through operator co_await; Replace it with the input expression

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

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

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

7 years ago[coroutines] Allow co_await and co_yield expressions that return an lvalue to compile
Eric Fiselier [Thu, 15 Jun 2017 19:43:36 +0000 (19:43 +0000)]
[coroutines] Allow co_await and co_yield expressions that return an lvalue to compile

Summary:
The title says it all.

Reviewers: GorNishanov, rsmith

Reviewed By: GorNishanov

Subscribers: rjmccall, cfe-commits

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

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

7 years agoLexerTest memory leak fix-
Erich Keane [Thu, 15 Jun 2017 18:34:47 +0000 (18:34 +0000)]
LexerTest memory leak fix-

A new LexerTest unittest introduced a memory leak.  This patch
uses a unique_ptr with a custom deleter to ensure it is properly
deleted.

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

7 years agoApply summary-based dead stripping to regular LTO modules with summaries.
Peter Collingbourne [Thu, 15 Jun 2017 17:26:13 +0000 (17:26 +0000)]
Apply summary-based dead stripping to regular LTO modules with summaries.

If a regular LTO module has a summary index, then instead of linking
it into the combined regular LTO module right away, add it to the
combined summary index and associate it with a special module that
represents the combined regular LTO module.

Any such modules are linked during LTO::run(), at which time we use
the results of summary-based dead stripping to control whether to
link prevailing symbols.

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

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

7 years ago[analyzer]: Improve test handling with multiple constraint managers
Dominic Chen [Thu, 15 Jun 2017 17:05:07 +0000 (17:05 +0000)]
[analyzer]: Improve test handling with multiple constraint managers

Summary: Modify the test infrastructure to properly handle tests that require z3, and merge together the output of all tests on success. This is required for D28954.

Reviewers: dcoughlin, zaks.anna, NoQ, xazax.hun

Subscribers: cfe-commits

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

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