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

7 years agoRevert "Load lazily the template specialization in multi-module setups."
Vassil Vassilev [Thu, 15 Jun 2017 11:05:32 +0000 (11:05 +0000)]
Revert "Load lazily the template specialization in multi-module setups."

This broke our libcxx modules builds.

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

7 years agoRevert "Define _GNU_SOURCE for rtems c++"
Daniel Jasper [Thu, 15 Jun 2017 09:17:12 +0000 (09:17 +0000)]
Revert "Define _GNU_SOURCE for rtems c++"

This reverts commit r305399.

This breaks a build in libcxx:
libcxx/src/system_error.cpp:90:16: error: assigning to 'int' from incompatible type 'char *'
    if ((ret = ::strerror_r(ev, buffer, strerror_buff_size)) != 0) {
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

Which makes sense according to:
https://linux.die.net/man/3/strerror_r

Not entirely sure how this needs to be fixed.

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

7 years agoCorrect documentation about the AfterClass clang-format option
Eric Fiselier [Thu, 15 Jun 2017 03:38:08 +0000 (03:38 +0000)]
Correct documentation about the AfterClass clang-format option

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

7 years ago[ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmType
Richard Trieu [Thu, 15 Jun 2017 01:35:06 +0000 (01:35 +0000)]
[ODRHash] Hash TemplateArgument::Pack and TemplateTypeParmType

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

7 years ago[Basic] Use a static_assert instead of using the old array of size -1 trick.
Craig Topper [Thu, 15 Jun 2017 01:27:58 +0000 (01:27 +0000)]
[Basic] Use a static_assert instead of using the old array of size -1 trick.

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

7 years ago[clang-format] Allow git-clang-format to handle empty extensions.
Eric Fiselier [Thu, 15 Jun 2017 00:54:08 +0000 (00:54 +0000)]
[clang-format] Allow git-clang-format to handle empty extensions.

Most of libc++'s header files don't use extension. This prevents
using git-clang-format on them, which is frustrating.

This patch allows empty extensions to be passed using either
the --extensions option, or the clangformat.extensions git-config
value.

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

7 years agoFix LexerTest signed/unsigned comparison.
Erich Keane [Thu, 15 Jun 2017 00:28:13 +0000 (00:28 +0000)]
Fix LexerTest signed/unsigned comparison.

Werror was catching a signed/unsigned compare in
an assert, correct the signed 'expected' value to be
unsigned.

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

7 years agoHandle -ast-dump-all when passed as the only option.
Aaron Ballman [Thu, 15 Jun 2017 00:00:08 +0000 (00:00 +0000)]
Handle -ast-dump-all when passed as the only option.

Patch by Don Hinton

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

7 years ago[Preprocessor]Correct Macro-Arg allocation of StringifiedArguments,
Erich Keane [Wed, 14 Jun 2017 23:09:01 +0000 (23:09 +0000)]
[Preprocessor]Correct Macro-Arg allocation of StringifiedArguments,
correct getNumArguments

StringifiedArguments is allocated (resized) based on the size the
getNumArguments function. However, this function ACTUALLY currently
returns the amount of total UnexpArgTokens which is minimum the same as
the new implementation of getNumMacroArguments, since empty/omitted arguments
result in 1 UnexpArgToken, and included ones at minimum include 2
(1 for the arg itself, 1 for eof).

This patch renames the otherwise unused getNumArguments to be more clear
that it is the number of arguments that the Macro expects, and thus the maximum
number that can be stringified. This patch also replaces the explicit memset
(which results in value instantiation of the new tokens, PLUS clearing the
memory) with brace initialization.

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

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

7 years agoAST: Add missing break at end of switch
Duncan P. N. Exon Smith [Wed, 14 Jun 2017 21:26:31 +0000 (21:26 +0000)]
AST: Add missing break at end of switch

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

7 years ago[PPC] Enhance altivec conversion function macros implementation.
Tony Jiang [Wed, 14 Jun 2017 17:23:43 +0000 (17:23 +0000)]
[PPC] Enhance altivec conversion function macros implementation.

Add checking for the second parameter of altivec conversion builtin to make sure
it is compile-time constant int.

This patch fixes PR33212: PPC vec_cst useless at -O0
Differential Revision: https://reviews.llvm.org/D34092

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

7 years agoDefine _GNU_SOURCE for rtems c++
James Y Knight [Wed, 14 Jun 2017 17:01:18 +0000 (17:01 +0000)]
Define _GNU_SOURCE for rtems c++

This is required by the libc++ locale support.

Patch by Walter Lee.

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

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

7 years agoBe more strict when checking the -flto option value
Yuka Takahashi [Wed, 14 Jun 2017 15:37:11 +0000 (15:37 +0000)]
Be more strict when checking the -flto option value

Summary:
It seems -flto must be either "thin" or "full". I think the use of
containValue is just a typo.

Reviewers: ruiu, tejohnson

Subscribers: mehdi_amini, inglorion

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

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

7 years agoCorrected some comment typos; NFC.
Aaron Ballman [Wed, 14 Jun 2017 12:48:18 +0000 (12:48 +0000)]
Corrected some comment typos; NFC.

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

7 years agoclang-format: Add CompactNamespaces option
Francois Ferrand [Wed, 14 Jun 2017 12:29:47 +0000 (12:29 +0000)]
clang-format: Add CompactNamespaces option

Summary:
Add CompactNamespaces option, to pack namespace declarations on the
same line (somewhat similar to C++17 nested namespace definition).

With this option, consecutive namespace declarations are kept on the
same line:

  namespace foo { namespace bar {
      ...
  }} // namespace foo::bar

Reviewers: krasimir, djasper, klimek

Reviewed By: djasper

Subscribers: kimgr, cfe-commits, klimek

Tags: #clang-tools-extra

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

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

7 years agoReverted 305379 (Function with unparsed body is a definition)
Serge Pavlov [Wed, 14 Jun 2017 10:57:56 +0000 (10:57 +0000)]
Reverted 305379 (Function with unparsed body is a definition)

It broke clang-x86_64-linux-selfhost-modules-2 and some other buildbots.

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

7 years agoFunction with unparsed body is a definition
Serge Pavlov [Wed, 14 Jun 2017 10:07:02 +0000 (10:07 +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

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

7 years agoFix for Itanium mangler issue with templates
Dmitry Polukhin [Wed, 14 Jun 2017 09:47:47 +0000 (09:47 +0000)]
Fix for Itanium mangler issue with templates

Patch by Serge Preis

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

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

7 years ago[coroutines] Fix co_await for range statement
Eric Fiselier [Wed, 14 Jun 2017 03:24:55 +0000 (03:24 +0000)]
[coroutines] Fix co_await for range statement

Summary:
Currently we build the co_await expressions on the wrong implicit statements of the implicit ranged for; Specifically we build the co_await expression wrapping the range declaration, but it should wrap the begin expression.

This patch fixes co_await on range for.

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years ago[ODRHash] Remove debugging code from r305361
Richard Trieu [Wed, 14 Jun 2017 03:19:58 +0000 (03:19 +0000)]
[ODRHash] Remove debugging code from r305361

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

7 years ago[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
Richard Trieu [Wed, 14 Jun 2017 03:17:26 +0000 (03:17 +0000)]
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.

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

7 years ago[ODRHash] Hash Expr for TemplateArgument::Expression
Richard Trieu [Wed, 14 Jun 2017 01:28:00 +0000 (01:28 +0000)]
[ODRHash] Hash Expr for TemplateArgument::Expression

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

7 years ago[ODRHash] Add TemplateArgument kind to hash.
Richard Trieu [Tue, 13 Jun 2017 22:21:18 +0000 (22:21 +0000)]
[ODRHash] Add TemplateArgument kind to hash.

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

7 years agoPreserve cold attribute for function decls
Xinliang David Li [Tue, 13 Jun 2017 21:14:07 +0000 (21:14 +0000)]
Preserve cold attribute for function decls

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

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

7 years agoFix spurious Wunused-lambda-capture warning
Yi Kong [Tue, 13 Jun 2017 18:38:31 +0000 (18:38 +0000)]
Fix spurious Wunused-lambda-capture warning

Summary:
Clang emits unused-lambda-capture warning for captures in generic lambdas even though they are actually used.

Fixes PR31815.

Reviewers: malcolm.parsons, aaron.ballman, rsmith

Reviewed By: malcolm.parsons

Subscribers: ahatanak, cfe-commits

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

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

7 years agoAlign definition of DW_OP_plus with DWARF spec [2/3]
Florian Hahn [Tue, 13 Jun 2017 18:06:15 +0000 (18:06 +0000)]
Align definition of DW_OP_plus with DWARF spec [2/3]

Summary:
This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things.
 
The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack.
 
This is done in three stages:
• The first patch (LLVM) adds support for DW_OP_plus_uconst and changes all uses (and tests) of DW_OP_plus to use DW_OP_plus_uconst.
 
• The second patch (Clang) contains changes to use DW_OP_plus_uconst instead of DW_OP_plus.
 
• The third patch (LLVM) changes the semantics of DW_OP_plus to be in line with it’s DWARF meaning. It also does this for DW_OP_minus.

Patch by Sander de Smalen.

Reviewers: echristo, pcc, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits

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

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

7 years agoAdd comma to comment.
Gheorghe-Teodor Bercea [Tue, 13 Jun 2017 15:35:27 +0000 (15:35 +0000)]
Add comma to comment.

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

7 years ago[clang-format] Document the StartOfTokenColumn parameter, NFC
Krasimir Georgiev [Tue, 13 Jun 2017 14:58:55 +0000 (14:58 +0000)]
[clang-format] Document the StartOfTokenColumn parameter, NFC

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

7 years agoRevert "Revert r301742 which made ExprConstant checking apply to all full-exprs."
Diana Picus [Tue, 13 Jun 2017 12:50:06 +0000 (12:50 +0000)]
Revert "Revert r301742 which made ExprConstant checking apply to all full-exprs."

This reverts commit r305239 because it broke the buildbots (the
diag-flags.cpp test is failing).

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

7 years agoclang-format: add option to merge empty function body
Francois Ferrand [Tue, 13 Jun 2017 07:02:43 +0000 (07:02 +0000)]
clang-format: add option to merge empty function body

Summary:
This option supplements the AllowShortFunctionsOnASingleLine flag, to
merge empty function body at the beginning of the line: e.g. when the
function is not short-enough and breaking braces after function.

  int f()
  {}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[docs] Add some ubsan changes to the release notes
Vedant Kumar [Tue, 13 Jun 2017 02:52:31 +0000 (02:52 +0000)]
[docs] Add some ubsan changes to the release notes

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

7 years agoRevert r301742 which made ExprConstant checking apply to all full-exprs.
Nick Lewycky [Mon, 12 Jun 2017 21:59:18 +0000 (21:59 +0000)]
Revert r301742 which made ExprConstant checking apply to all full-exprs.

This patch also exposed pre-existing bugs in clang, see PR32864 and PR33140#c3 .

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

7 years ago[ODRHash] Add diagnostic messages for typedef and type alias.
Richard Trieu [Mon, 12 Jun 2017 21:58:22 +0000 (21:58 +0000)]
[ODRHash] Add diagnostic messages for typedef and type alias.

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

7 years agoRevert r303316, a change to ExprConstant to evaluate function arguments.
Nick Lewycky [Mon, 12 Jun 2017 21:15:44 +0000 (21:15 +0000)]
Revert r303316, a change to ExprConstant to evaluate function arguments.

The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140.

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

7 years agoIR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.
Peter Collingbourne [Mon, 12 Jun 2017 20:10:48 +0000 (20:10 +0000)]
IR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.

The new metadata is easier to manipulate than module flags.

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

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

7 years agoCorrect debug info bit offset calculation for big-endian targets
Reid Kleckner [Mon, 12 Jun 2017 19:57:56 +0000 (19:57 +0000)]
Correct debug info bit offset calculation for big-endian targets

Summary:
The change "[CodeView] Implement support for bit fields in
Clang" (r274201, https://reviews.llvm.org/rL274201) broke the
calculation of bit offsets for the debug info describing bitfields on
big-endian targets.

Prior to commit r274201 the debug info for bitfields got their offsets
from the ASTRecordLayout in CGDebugInfo::CollectRecordFields(), the
current field offset was then passed on to
CGDebugInfo::CollectRecordNormalField() and used directly in the
DIDerivedType.

Since commit r274201, the bit offset ending up in the DIDerivedType no
longer comes directly from the ASTRecordLayout. Instead
CGDebugInfo::CollectRecordNormalField() calls the new method
CGDebugInfo::createBitFieldType(), which in turn calls
CodeGenTypes::getCGRecordLayout().getBitFieldInfo() to fetch a
CGBitFieldInfo describing the field. The 'Offset' member of
CGBitFieldInfo is then used to calculate the bit offset of the
DIDerivedType. Unfortunately the previous and current method of
calculating the bit offset are only equivalent for little endian
targets, as CGRecordLowering::setBitFieldInfo() reverses the bit
offsets for big endian targets as the last thing it does.

A simple reproducer for this error is the following module:

struct fields {
  unsigned a : 4;
  unsigned b : 4;
} flags = {0x0f, 0x1};

Compiled for Mips, with commit r274200 both the DIDerivedType bit
offsets on the IR-level and the DWARF information on the ELF-level
will have the expected values: the offsets of 'a' and 'b' are 0 and 4
respectively. With r274201 the offsets are switched to 4 and 0. By
noting that the static initialization of 'flags' in both cases is the
same, we can eliminate a change in record layout as the cause of the
change in the debug info. Also compiling this example with gcc,
produces the same record layout and debug info as commit r274200.

In order to restore the previous function we extend
CGDebugInfo::createBitFieldType() to compensate for the reversal done
in CGRecordLowering::setBitFieldInfo().

Patch by Frej Drejhammar!

Reviewers: cfe-commits, majnemer, rnk, aaboud, echristo, aprantl

Reviewed By: rnk, aprantl

Subscribers: aprantl, arichardson, frej

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

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

7 years agoRecommit r305117: [libclang] Merge multiple availability clauses when
Alex Lorenz [Mon, 12 Jun 2017 19:06:30 +0000 (19:06 +0000)]
Recommit r305117: [libclang] Merge multiple availability clauses when
getting the platform's availability

Patch by Ronald Wampler!

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

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

7 years ago[ubsan] Detect invalid unsigned pointer index expression (clang)
Vedant Kumar [Mon, 12 Jun 2017 18:42:51 +0000 (18:42 +0000)]
[ubsan] Detect invalid unsigned pointer index expression (clang)

Adding an unsigned offset to a base pointer has undefined behavior if
the result of the expression would precede the base. An example from
@regehr:

  int foo(char *p, unsigned offset) {
    return p + offset >= p; // This may be optimized to '1'.
  }

  foo(p, -1); // UB.

This patch extends the pointer overflow check in ubsan to detect invalid
unsigned pointer index expressions. It changes the instrumentation to
only permit non-negative offsets in pointer index expressions when all
of the GEP indices are unsigned.

Testing: check-llvm, check-clang run on a stage2, ubsan-instrumented
build.

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

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