]> granicus.if.org Git - clang/log
clang
5 years agoAdd Hurd target to Clang driver (2/2)
Kristina Brooks [Thu, 29 Nov 2018 03:49:14 +0000 (03:49 +0000)]
Add Hurd target to Clang driver (2/2)

This adds Hurd toolchain support to Clang's driver in addition
to handling translating the triple from Hurd-compatible form to
the actual triple registered in LLVM.

(Phabricator was stripping the empty files from the patch so I
manually created them)

Patch by sthibaul (Samuel Thibault)

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

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

5 years agoAllow cpu-dispatch forward declarations.
Erich Keane [Wed, 28 Nov 2018 21:54:04 +0000 (21:54 +0000)]
Allow cpu-dispatch forward declarations.

As a followup to r347805, allow forward declarations of cpu-dispatch and
cpu-specific for the same reasons.

Change-Id: Ic1bde9be369b1f8f1d47d58e6fbdc2f9dfcdd785

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

5 years agoEnsure sanitizer check function calls have a !dbg location
Adrian Prantl [Wed, 28 Nov 2018 21:44:06 +0000 (21:44 +0000)]
Ensure sanitizer check function calls have a !dbg location

Function calls without a !dbg location inside a function that has a
DISubprogram make it impossible to construct inline information and
are rejected by the verifier. This patch ensures that sanitizer check
function calls have a !dbg location, by carrying forward the location
of the preceding instruction or by inserting an artificial location if
necessary.

This fixes a crash when compiling the attached testcase with -Os.

rdar://problem/45311226

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

Note: This reapllies r344915, modified to reuse the IRBuilder's
DebugLoc if one exists instead of picking the one from CGDebugInfo
since the latter may get reset when emitting thunks such as block
helpers in the middle of emitting another function.

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

5 years ago[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.
Paul Robinson [Wed, 28 Nov 2018 21:18:07 +0000 (21:18 +0000)]
[DebugInfo] NFC Clang test changes for: IR/Bitcode changes for DISubprogram flags.

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

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

5 years agoCorrect 'target' default behavior on redecl, allow forward declaration.
Erich Keane [Wed, 28 Nov 2018 20:58:43 +0000 (20:58 +0000)]
Correct 'target' default behavior on redecl, allow forward declaration.

Declarations without the attribute were disallowed because it would be
ambiguous which 'target' it was supposed to be on.  For example:

void ___attribute__((target("v1"))) foo();
void foo(); // Redecl of above, or fwd decl of below?
void ___attribute__((target("v2"))) foo();

However, a first declaration doesn't have that problem, and erroring
prevents it from working in cases where the forward declaration is
useful.

Additionally, a forward declaration of target==default wouldn't properly
cause multiversioning, so this patch fixes that.

The patch was not split since the 'default' fix would require
implementing the same check for that case, followed by undoing the same
change for the fwd-decl implementation.

Change-Id: I66f2c5bc2477bcd3f7544b9c16c83ece257077b0

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

5 years ago[Coverage] Specify the Itanium ABI triple for a C++ test
Vedant Kumar [Wed, 28 Nov 2018 20:51:09 +0000 (20:51 +0000)]
[Coverage] Specify the Itanium ABI triple for a C++ test

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

5 years ago[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)
Vedant Kumar [Wed, 28 Nov 2018 20:48:07 +0000 (20:48 +0000)]
[Coverage] Do not visit artificial stmts in defaulted methods (PR39822)

There is no reason to emit coverage mappings for artificial statements
contained within defaulted methods, as these statements are not visible
to users.

Only emit a mapping for the body of the defaulted method (clang treats
the text of the "default" keyword as the body when reporting locations).
This allows users to see how often the default method is called, but
trims down the coverage mapping by skipping visitation of the children
of the method.

The immediate motivation for this change is that the lexer's
getPreciseTokenLocEnd API cannot return the correct location when given
an artificial statement (with a somewhat made-up location) as an input.

Test by Orivej Desh!

Fixes llvm.org/PR39822.

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

5 years agoRevert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."
Davide Italiano [Wed, 28 Nov 2018 19:15:23 +0000 (19:15 +0000)]
Revert "[ASTImporter] Changed use of Import to Import_New in ASTImporter."

This broke the lldb bots.

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

5 years ago[OPENMP]Fix emission of the target regions in virtual functions.
Alexey Bataev [Wed, 28 Nov 2018 19:00:07 +0000 (19:00 +0000)]
[OPENMP]Fix emission of the target regions in virtual functions.

Fixed emission of the target regions found in the virtual functions.
Previously we may end up with the situation when those regions could be
skipped.

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

5 years ago[NFC] Move MultIversioning::Type into Decl so that it can be used in
Erich Keane [Wed, 28 Nov 2018 18:34:14 +0000 (18:34 +0000)]
[NFC] Move MultIversioning::Type into Decl so that it can be used in
CodeGen

Change-Id: I32b14edca3501277e0e65672eafe3eea38c6f9ae

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

5 years ago[analyzer] Cleanup constructors in the Z3 backend
Mikhail R. Gadelha [Wed, 28 Nov 2018 17:22:49 +0000 (17:22 +0000)]
[analyzer] Cleanup constructors in the Z3 backend

Summary: Left only the constructors that are actually required, and marked the move constructors as deleted. They are not used anymore and we were never sure they've actually worked correctly.

Reviewers: george.karpenkov, NoQ

Reviewed By: george.karpenkov

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin, Szelethus, donat.nagy, dkrupp

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

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

5 years agoRe-commit r347417 "Re-Reinstate 347294 with a fix for the failures."
Hans Wennborg [Wed, 28 Nov 2018 14:04:12 +0000 (14:04 +0000)]
Re-commit r347417 "Re-Reinstate 347294 with a fix for the failures."

This was reverted in r347656 due to me thinking it caused a miscompile of
Chromium. Turns out it was the Chromium code that was broken.

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

5 years ago[ASTImporter] Changed use of Import to Import_New in ASTImporter.
Balazs Keri [Wed, 28 Nov 2018 13:21:26 +0000 (13:21 +0000)]
[ASTImporter] Changed use of Import to Import_New in ASTImporter.

Reviewers: a.sidorin, shafik, a_sidorin

Reviewed By: a_sidorin

Subscribers: gamesh411, a_sidorin, dkrupp, martong, Szelethus, cfe-commits

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

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

5 years agoPR39809: (const void*)0 is not a null pointer constant in C.
Richard Smith [Wed, 28 Nov 2018 06:25:06 +0000 (06:25 +0000)]
PR39809: (const void*)0 is not a null pointer constant in C.

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

5 years agoPR12884: Add test (bug is already fixed).
Richard Smith [Wed, 28 Nov 2018 05:15:46 +0000 (05:15 +0000)]
PR12884: Add test (bug is already fixed).

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

5 years agoMove LoopHint.h from Sema to Parse
Richard Trieu [Wed, 28 Nov 2018 04:36:31 +0000 (04:36 +0000)]
Move LoopHint.h from Sema to Parse

struct LoopHint was only used within Parse and not in any of the Sema or
Codegen files.  In the non-Parse files where it was included, it either wasn't
used or LoopHintAttr was used, so its inclusion did nothing.

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

5 years ago[CodeGen] Fix included headers.
Richard Trieu [Wed, 28 Nov 2018 04:14:29 +0000 (04:14 +0000)]
[CodeGen] Fix included headers.

Remove the included Parse header because CodeGen should not depend on Parse.
Instead, include the Lex headers that it needs instead.

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

5 years ago[diagtool] Remove unneeded header includes.
Richard Trieu [Wed, 28 Nov 2018 03:59:35 +0000 (03:59 +0000)]
[diagtool] Remove unneeded header includes.

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

5 years ago[OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)
Kelvin Li [Wed, 28 Nov 2018 00:51:08 +0000 (00:51 +0000)]
[OPENMP] remove redundant ColonExpected flag in ParseOpenMP.cpp (NFC)

The flag ColonExpected is not changed after being initialized to
false at declaration.

Patch by Ahsan Saghir

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

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

5 years ago[RISCV] Mark unit tests as "requires: riscv-registered-target"
Mandeep Singh Grang [Tue, 27 Nov 2018 22:53:57 +0000 (22:53 +0000)]
[RISCV] Mark unit tests as "requires: riscv-registered-target"

Some of these tests break if the RISCV backend has not been built.

Reland D54816.

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

5 years agoFix typo in "[clang][ARC] Fix test for commit r347699"
Tatyana Krasnukha [Tue, 27 Nov 2018 22:22:33 +0000 (22:22 +0000)]
Fix typo in "[clang][ARC] Fix test for commit r347699"

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

5 years ago[OPENMP][NVPTX]Basic support for reductions across the teams.
Alexey Bataev [Tue, 27 Nov 2018 21:24:54 +0000 (21:24 +0000)]
[OPENMP][NVPTX]Basic support for reductions across the teams.

Added basic codegen support for the reductions across the teams.

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

5 years ago[MS] Push outermost class DeclContexts only in -fdelayed-template-parsing
Reid Kleckner [Tue, 27 Nov 2018 21:20:42 +0000 (21:20 +0000)]
[MS] Push outermost class DeclContexts only in -fdelayed-template-parsing

This is more or less a complete rewrite of r347627, and it fixes PR38460
I added a reduced test case to DelayedTemplateParsing.cpp.

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

5 years ago[clang][ARC] Fix test for commit r347699
Tatyana Krasnukha [Tue, 27 Nov 2018 20:56:30 +0000 (20:56 +0000)]
[clang][ARC] Fix test for commit r347699

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

5 years ago[clang][slh] add attribute for speculative load hardening
Zola Bridges [Tue, 27 Nov 2018 19:56:46 +0000 (19:56 +0000)]
[clang][slh] add attribute for speculative load hardening

Summary:
Resubmit this with no changes because I think the build was broken
by a different diff.
-----
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

----- Summary from Previous Diff (Still Accurate) -----

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

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

5 years ago[clang][ARC] Add ARCTargetInfo
Tatyana Krasnukha [Tue, 27 Nov 2018 19:52:10 +0000 (19:52 +0000)]
[clang][ARC] Add ARCTargetInfo

Based-on-patch-by: Pete Couperus <petecoup@synopsys.com>
Differential Revision: https://reviews.llvm.org/D53100

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

5 years agoDon't speculatively emit VTTs for classes unless we are able to correctly emit refere...
Richard Smith [Tue, 27 Nov 2018 19:33:49 +0000 (19:33 +0000)]
Don't speculatively emit VTTs for classes unless we are able to correctly emit references to all the functions they will (directly or indirectly) reference.

Summary:
This fixes a miscompile where we'd emit a VTT for a class that ends up
referencing an inline virtual member function that we can't actually
emit a body for (because we never instantiated it in the current TU),
which in a corner case of a corner case can lead to link errors.

Reviewers: rjmccall

Subscribers: cfe-commits

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

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

5 years agoRevert "[RISCV] Mark unit tests as "requires: riscv-registered-target""
Mandeep Singh Grang [Tue, 27 Nov 2018 19:13:52 +0000 (19:13 +0000)]
Revert "[RISCV] Mark unit tests as "requires: riscv-registered-target""

This reverts commit 1a6a0c9ea2716378d55858c11adf5941608531f8.

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

5 years ago[RISCV] Mark unit tests as "requires: riscv-registered-target"
Mandeep Singh Grang [Tue, 27 Nov 2018 19:13:13 +0000 (19:13 +0000)]
[RISCV] Mark unit tests as "requires: riscv-registered-target"

Summary: Some of these tests break if the RISCV backend has not been built.

Reviewers: asb, apazos, sabuasal

Reviewed By: sabuasal

Subscribers: rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, cfe-commits

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

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

5 years ago[ASTImporter] Added Import functions for transition to new API.
Balazs Keri [Tue, 27 Nov 2018 18:36:31 +0000 (18:36 +0000)]
[ASTImporter] Added Import functions for transition to new API.

Summary:
These Import_New functions should be used in the ASTImporter,
and the old Import functions should not be used. Later the
Import_New should be renamed to Import again and the old Import
functions must be removed. But this can happen only after LLDB
was updated to use the new Import interface.

This commit is only about introducing the new Import_New
functions. These are not implemented now, only calling the old
Import ones.

Reviewers: shafik, rsmith, a_sidorin, a.sidorin

Reviewed By: a_sidorin

Subscribers: spyffe, a_sidorin, gamesh411, shafik, rsmith, dkrupp, martong, Szelethus, cfe-commits

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

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

5 years ago[X86] Add -march=cascadelake support in clang.
Craig Topper [Tue, 27 Nov 2018 18:05:14 +0000 (18:05 +0000)]
[X86] Add -march=cascadelake support in clang.

This is skylake-avx512 with the addition of avx512vnni ISA.

Patch by Jianping Chen

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

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

5 years agoFix linker option for -fprofile-arcs -ftest-coverage
Marco Castelluccio [Tue, 27 Nov 2018 17:31:08 +0000 (17:31 +0000)]
Fix linker option for -fprofile-arcs -ftest-coverage

Summary:
Linux toolchain accidentally added "-u__llvm_runtime_variable" when "-fprofile-arcs -ftest-coverage", this is not added when "--coverage" option is used.
Using "-u__llvm_runtime_variable" generates an empty default.profraw file while an application built with  "-fprofile-arcs -ftest-coverage" is running.

Reviewers: calixte, marco-c, sylvestre.ledru

Reviewed By: marco-c

Subscribers: vsk, cfe-commits

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

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

5 years agoRevert "[clang] - Simplify tools::SplitDebugName."
Jonas Toth [Tue, 27 Nov 2018 17:28:38 +0000 (17:28 +0000)]
Revert "[clang] - Simplify tools::SplitDebugName."

This reverts commit r347035 as it introduced assertion failures under
certain conditions. More information can be found here:
https://reviews.llvm.org/rL347035

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

5 years agoDerive builtin return type from its definition
Marco Antognini [Tue, 27 Nov 2018 14:54:58 +0000 (14:54 +0000)]
Derive builtin return type from its definition

Summary:
Prior to this patch, OpenCL code such as the following would attempt to create
a BranchInst with a non-bool argument:

    if (enqueue_kernel(get_default_queue(), 0, nd, ^(void){})) /* ... */

This patch is a follow up on a similar issue with pipe builtin
operations. See commit r280800 and https://bugs.llvm.org/show_bug.cgi?id=30219.

This change, while being conservative on non-builtin functions,
should set the type of expressions invoking builtins to the
proper type, instead of defaulting to `bool` and requiring
manual overrides in Sema::CheckBuiltinFunctionCall.

In addition to tests for enqueue_kernel, the tests are extended to
check other OpenCL builtins.

Reviewers: Anastasia, spatel, rsmith

Reviewed By: Anastasia

Subscribers: kristina, cfe-commits, svenvh

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

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

5 years agoRevert r347417 "Re-Reinstate 347294 with a fix for the failures."
Hans Wennborg [Tue, 27 Nov 2018 14:01:40 +0000 (14:01 +0000)]
Revert r347417 "Re-Reinstate 347294 with a fix for the failures."

This caused a miscompile in Chrome (see crbug.com/908372) that's
illustrated by this small reduction:

  static bool f(int *a, int *b) {
    return !__builtin_constant_p(b - a) || (!(b - a));
  }

  int arr[] = {1,2,3};

  bool g() {
    return f(arr, arr + 3);
  }

  $ clang -O2 -S -emit-llvm a.cc -o -

g() should return true, but after r347417 it became false for some reason.

This also reverts the follow-up commits.

r347417:
> Re-Reinstate 347294 with a fix for the failures.
>
> Don't try to emit a scalar expression for a non-scalar argument to
> __builtin_constant_p().
>
> Third time's a charm!

r347446:
> The result of is.constant() is unsigned.

r347480:
> A __builtin_constant_p() returns 0 with a function type.

r347512:
> isEvaluatable() implies a constant context.
>
> Assume that we're in a constant context if we're asking if the expression can
> be compiled into a constant initializer. This fixes the issue where a
> __builtin_constant_p() in a compound literal was diagnosed as not being
> constant, even though it's always possible to convert the builtin into a
> constant.

r347531:
> A "constexpr" is evaluated in a constant context. Make sure this is reflected
> if a __builtin_constant_p() is a part of a constexpr.

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

5 years ago[libclang] Fix clang_Cursor_getNumArguments and clang_Cursor_getArgument for CXXConst...
Ivan Donchevskii [Tue, 27 Nov 2018 12:02:39 +0000 (12:02 +0000)]
[libclang] Fix clang_Cursor_getNumArguments and clang_Cursor_getArgument for CXXConstructExpr

Constructors have the same methods for arguments as call expressions.
Let's provide a way to get their arguments the same way.

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

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

5 years ago[ASTImporter] Typedef import brings in the complete type
Gabor Marton [Tue, 27 Nov 2018 09:51:36 +0000 (09:51 +0000)]
[ASTImporter] Typedef import brings in the complete type

Summary:
When we already have an incomplete underlying type of a typedef in the
"To" context, and the "From" context has the same typedef, but the
underlying type is complete, then the imported type should be complete.

Fixes an assertion in CTU analysis of Xerces:
Assertion `DD && "queried property of class with no definition"' failed.
This assert is happening in the analyzer engine, because that attempts
to query an underlying type of a typedef, which happens to be
incomplete.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years ago[docs] UBSan and ASan are supported on Windows
Reid Kleckner [Tue, 27 Nov 2018 03:55:15 +0000 (03:55 +0000)]
[docs] UBSan and ASan are supported on Windows

Also fix a bullet list.

Fixes PR39775

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

5 years agoRevert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"
Reid Kleckner [Tue, 27 Nov 2018 02:54:17 +0000 (02:54 +0000)]
Revert r347627 "[MS] Push fewer DeclContexts for delayed template parsing"

It broke the Windows self-host:
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/1799/steps/stage%202%20build/logs/stdio

I can build
lib/CodeGen/CMakeFiles/LLVMCodeGen.dir/MachinePostDominators.cpp.obj to
repro.

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

5 years ago[analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expanded
Kristof Umann [Tue, 27 Nov 2018 02:28:23 +0000 (02:28 +0000)]
[analyzer][PlistMacroExpansion] Part 3.: Macro arguments are expanded

This part focuses on expanding macro arguments.

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

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

5 years agoRevert "[clang][slh] add attribute for speculative load hardening"
Zola Bridges [Tue, 27 Nov 2018 02:22:00 +0000 (02:22 +0000)]
Revert "[clang][slh] add attribute for speculative load hardening"

until I figure out why the build is failing or timing out

***************************

Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function
basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

This reverts commit a5b3c232d1e3613f23efbc3960f8e23ea70f2a79.
(r347617)

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

5 years ago[MS] Push fewer DeclContexts for delayed template parsing
Reid Kleckner [Tue, 27 Nov 2018 02:21:51 +0000 (02:21 +0000)]
[MS] Push fewer DeclContexts for delayed template parsing

Only push the outermost record as a DeclContext when parsing a function
body. See the comments in Sema::getContainingDC about the way the parser
pushes contexts. This is intended to match the behavior the parser
normally displays where it parses all method bodies from all nested
classes at the end of the outermost class, when all nested classes are
complete.

Fixes PR38460.

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

5 years ago[clang][slh] add attribute for speculative load hardening
Zola Bridges [Tue, 27 Nov 2018 00:03:44 +0000 (00:03 +0000)]
[clang][slh] add attribute for speculative load hardening

Summary:
The prior diff had to be reverted because there were two tests
that failed. I updated the two tests in this diff

clang/test/Misc/pragma-attribute-supported-attributes-list.test
clang/test/SemaCXX/attr-speculative-load-hardening.cpp

----- Summary from Previous Diff (Still Accurate) -----

LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo, kristof.beyls, aaron.ballman

Subscribers: llvm-commits

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

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

5 years agoRevert "[clang][slh] add attribute for speculative load hardening"
Zola Bridges [Mon, 26 Nov 2018 20:11:18 +0000 (20:11 +0000)]
Revert "[clang][slh] add attribute for speculative load hardening"

This reverts commit 801eaf91221ba6dd6996b29ff82659ad6359e885.

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

5 years ago[clang][slh] add attribute for speculative load hardening
Zola Bridges [Mon, 26 Nov 2018 19:41:14 +0000 (19:41 +0000)]
[clang][slh] add attribute for speculative load hardening

Summary:
LLVM IR already has an attribute for speculative_load_hardening. Before
this commit, when a user passed the -mspeculative-load-hardening flag to
Clang, every function would have this attribute added to it. This Clang
attribute will allow users to opt into SLH on a function by function basis.

This can be applied to functions and Objective C methods.

Reviewers: chandlerc, echristo

Subscribers: llvm-commits

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

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

5 years ago[OPENMP][NVPTX]Emit default locations with the correct Exec|Runtime
Alexey Bataev [Mon, 26 Nov 2018 18:37:09 +0000 (18:37 +0000)]
[OPENMP][NVPTX]Emit default locations with the correct Exec|Runtime
modes.

If the region is inside target|teams|distribute region, we can emit the
locations with the correct info for execution mode and runtime mode.
Patch adds this ability to the NVPTX codegen to help the optimizer to
produce better code.

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

5 years ago[clang][slh] Forward mSLH only to Clang CC1
Zola Bridges [Mon, 26 Nov 2018 18:13:31 +0000 (18:13 +0000)]
[clang][slh] Forward mSLH only to Clang CC1

Summary:
-mno-speculative-load-hardening isn't a cc1 option, therefore,
before this change:

clang -mno-speculative-load-hardening hello.cpp

would have the following error:

error: unknown argument: '-mno-speculative-load-hardening'

This change will only ever forward -mspeculative-load-hardening
which is a CC1 option based on which flag was passed to clang.

Also added a test that uses this option that fails if an error like the
above is ever thrown.

Thank you ericwf for help debugging and fixing this error.

Reviewers: chandlerc, EricWF

Subscribers: llvm-commits

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

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

5 years ago[NFC] Replace magic numbers with CodeGenOpt enums
Sam Parker [Mon, 26 Nov 2018 17:26:49 +0000 (17:26 +0000)]
[NFC] Replace magic numbers with CodeGenOpt enums

Use enum values from llvm/Support/CodeGen.h for the optimisation
levels in CompilerInvocation.

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

5 years ago[AArch64] Add aarch64_vector_pcs function attribute to Clang
Sander de Smalen [Mon, 26 Nov 2018 16:38:37 +0000 (16:38 +0000)]
[AArch64] Add aarch64_vector_pcs function attribute to Clang

This is the Clang patch to complement the following LLVM patches:
  https://reviews.llvm.org/D51477
  https://reviews.llvm.org/D51479

More information describing the vector ABI and procedure call standard
can be found here:

https://developer.arm.com/products/software-development-tools/\
                          hpc/arm-compiler-for-hpc/vector-function-abi

Patch by Kerry McLaughlin.

Reviewed By: rjmccall

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

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

5 years ago[ASTImporter][Structural Eq] Check for isBeingDefined
Gabor Marton [Mon, 26 Nov 2018 15:54:08 +0000 (15:54 +0000)]
[ASTImporter][Structural Eq] Check for isBeingDefined

Summary:
If one definition is currently being defined, we do not compare for
equality and we assume that the decls are equal.

Reviewers: a_sidorin, a.sidorin, shafik

Reviewed By: a_sidorin

Subscribers: gamesh411, shafik, rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years ago[Index] Expose USR generation for types
Ilya Biryukov [Mon, 26 Nov 2018 15:24:48 +0000 (15:24 +0000)]
[Index] Expose USR generation for types

Summary: Used in clangd.

Reviewers: sammccall, ioeric

Reviewed By: sammccall

Subscribers: kadircet, cfe-commits

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

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

5 years ago[PowerPC] Vector load/store builtins overstate alignment of pointers
Nemanja Ivanovic [Mon, 26 Nov 2018 14:35:38 +0000 (14:35 +0000)]
[PowerPC] Vector load/store builtins overstate alignment of pointers

A number of builtins in altivec.h load/store vectors from pointers to scalar
types. Currently they just cast the pointer to a vector pointer, but expressions
like that have the alignment of the target type. Of course, the input pointer
did not have that alignment so this triggers UBSan (and rightly so).

This resolves https://bugs.llvm.org/show_bug.cgi?id=39704

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

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

5 years agoCreate a diagnostic group for warn_call_to_pure_virtual_member_function_from_ctor_dto...
Sylvestre Ledru [Mon, 26 Nov 2018 14:29:48 +0000 (14:29 +0000)]
Create a diagnostic group for warn_call_to_pure_virtual_member_function_from_ctor_dtor, so it can be turned into an error using Werror

Summary: Patch by Arnaud Bienner

Reviewers: davide, rsmith, jkorous

Reviewed By: jkorous

Subscribers: jkorous, sylvestre.ledru, cfe-commits

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

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

5 years agoA "constexpr" is evaluated in a constant context. Make sure this is reflected
Bill Wendling [Mon, 26 Nov 2018 02:10:53 +0000 (02:10 +0000)]
A "constexpr" is evaluated in a constant context. Make sure this is reflected
if a __builtin_constant_p() is a part of a constexpr.

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

5 years ago[CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC
Fangrui Song [Sun, 25 Nov 2018 20:57:05 +0000 (20:57 +0000)]
[CodeComplete] Simplify CodeCompleteConsumer.cpp, NFC

Use range-based for loops
Use XStr.compare(YStr) < 0
Format misaligned code

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

5 years ago[CodeGen] translate MS rotate builtins to LLVM funnel-shift intrinsics
Sanjay Patel [Sun, 25 Nov 2018 17:53:16 +0000 (17:53 +0000)]
[CodeGen] translate MS rotate builtins to LLVM funnel-shift intrinsics

This was originally part of:
D50924

and should resolve PR37387:
https://bugs.llvm.org/show_bug.cgi?id=37387

...but it was reverted because some bots using a gcc host compiler
would crash for unknown reasons with this included in the patch.
Trying again now to see if that's still a problem.

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

5 years ago[analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker
Kristof Umann [Sat, 24 Nov 2018 12:24:27 +0000 (12:24 +0000)]
[analyzer] INT50-CPP. Do not cast to an out-of-range enumeration checker

This checker implements a solution to the "INT50-CPP. Do not cast to an
out-of-range enumeration value" rule [1].
It lands in alpha for now, and a number of followup patches are planned in order
to enable it by default.

[1] https://www.securecoding.cert.org/confluence/display/cplusplus/INT50-CPP.+Do+not+cast+to+an+out-of-range+enumeration+value

Patch by: Endre Fülöp and Alexander Zaitsev!

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

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

5 years agoisEvaluatable() implies a constant context.
Bill Wendling [Sat, 24 Nov 2018 10:45:55 +0000 (10:45 +0000)]
isEvaluatable() implies a constant context.

Assume that we're in a constant context if we're asking if the expression can
be compiled into a constant initializer. This fixes the issue where a
__builtin_constant_p() in a compound literal was diagnosed as not being
constant, even though it's always possible to convert the builtin into a
constant.

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

5 years ago[CodeComplete] Delete unused variable in rC342449
Fangrui Song [Sat, 24 Nov 2018 00:41:13 +0000 (00:41 +0000)]
[CodeComplete] Delete unused variable in rC342449

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

5 years ago[CodeComplete] Format SemaCodeComplete.cpp and improve code consistency
Fangrui Song [Sat, 24 Nov 2018 00:14:31 +0000 (00:14 +0000)]
[CodeComplete] Format SemaCodeComplete.cpp and improve code consistency

There are some mis-indented places and missing spaces here and there. Just format the whole file.

Also, newer code (from 2014 onwards) in this file prefers const auto *X = dyn_cast to not repeat the Decl type name. Make other occurrences consistent.
Remove two anonymous namespaces that are not very necessary: 1) a typedef 2) a local function (should use static)

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

5 years agoRemove the optional dependency from libclang to clang-tidy/include-fixer
Benjamin Kramer [Fri, 23 Nov 2018 15:02:33 +0000 (15:02 +0000)]
Remove the optional dependency from libclang to clang-tidy/include-fixer

clangd does a better job on both of these, so don't slow down everyone's build
for a poorly working libclang feature.

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

5 years agoA __builtin_constant_p() returns 0 with a function type.
Bill Wendling [Thu, 22 Nov 2018 22:58:06 +0000 (22:58 +0000)]
A __builtin_constant_p() returns 0 with a function type.

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

5 years ago[clang-format] Do not treat asm clobber [ as ObjCExpr, refined
Krasimir Georgiev [Thu, 22 Nov 2018 14:49:55 +0000 (14:49 +0000)]
[clang-format] Do not treat asm clobber [ as ObjCExpr, refined

Summary:
r346756 refined clang-format to not treat the `[` in `asm (...: [] ..)` as an
ObjCExpr. However that's not enough, as we might have a comma-separated list of
such clobbers as in the newly added test.
This updates the detection to instead look at the Line's first token being `asm`
and not mark `[`-s as ObjCExprs in this case.

Reviewers: djasper, benhamilton

Reviewed By: djasper, benhamilton

Subscribers: benhamilton, cfe-commits

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

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

5 years agoRevert rL347462 "[ASTMatchers] Add hasSideEffect() matcher."
Clement Courbet [Thu, 22 Nov 2018 14:26:33 +0000 (14:26 +0000)]
Revert rL347462 "[ASTMatchers] Add hasSideEffect() matcher."

Breaks some buildbots.

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

5 years ago[ASTMatchers] Add hasSideEffect() matcher.
Clement Courbet [Thu, 22 Nov 2018 14:00:56 +0000 (14:00 +0000)]
[ASTMatchers] Add hasSideEffect() matcher.

Summary: Exposes Expr::HasSideEffects.

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[ASTMatchers] Re-generate ast matchers doc after rL346455.
Clement Courbet [Thu, 22 Nov 2018 10:44:36 +0000 (10:44 +0000)]
[ASTMatchers] Re-generate ast matchers doc after rL346455.

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

5 years agoThe result of is.constant() is unsigned.
Bill Wendling [Thu, 22 Nov 2018 09:31:08 +0000 (09:31 +0000)]
The result of is.constant() is unsigned.

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

5 years ago[Driver] Support XRay on Fuchsia
Petr Hosek [Thu, 22 Nov 2018 02:36:47 +0000 (02:36 +0000)]
[Driver] Support XRay on Fuchsia

This enables support for XRay in Fuchsia Clang driver.

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

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

5 years agoRevert "[Driver] Use --push/pop-state with Sanitizer link deps"
Petr Hosek [Wed, 21 Nov 2018 21:59:39 +0000 (21:59 +0000)]
Revert "[Driver] Use --push/pop-state with Sanitizer link deps"

This reverts commit r347413: older versions of ld.gold that are used
by Android don't support --push/pop-state which broke sanitizer bots.

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

5 years ago[OPENMP][NVPTX]Emit default locations as constant with undefined mode.
Alexey Bataev [Wed, 21 Nov 2018 21:04:34 +0000 (21:04 +0000)]
[OPENMP][NVPTX]Emit default locations as constant with undefined mode.

For the NVPTX target default locations should be emitted as constants +
additional info must be emitted in the reserved_2 field of the ident_t
structure. The 1st bit controls the execution mode and the 2nd bit
controls use of the lightweight runtime. The combination of the bits for
Non-SPMD mode + lightweight runtime represents special undefined mode,
used outside of the target regions for orphaned directives or functions.
Should allow and additional optimization inside of the target regions.

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

5 years agoRe-Reinstate 347294 with a fix for the failures.
Bill Wendling [Wed, 21 Nov 2018 20:44:18 +0000 (20:44 +0000)]
Re-Reinstate 347294 with a fix for the failures.

Don't try to emit a scalar expression for a non-scalar argument to
__builtin_constant_p().

Third time's a charm!

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

5 years ago[Driver] Use --push/pop-state with Sanitizer link deps
Petr Hosek [Wed, 21 Nov 2018 20:33:12 +0000 (20:33 +0000)]
[Driver] Use --push/pop-state with Sanitizer link deps

Sanitizer runtime link deps handling passes --no-as-needed because of
PR15823, but it never undoes it and this flag may affect other libraries
that come later on the link line. To avoid this, wrap Sanitizer link
deps in --push/pop-state.

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

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

5 years ago[OPENMP] Refactor code for parsing omp declare target directive and its clauses ...
Kelvin Li [Wed, 21 Nov 2018 20:15:57 +0000 (20:15 +0000)]
[OPENMP] Refactor code for parsing omp declare target directive and its clauses (NFC)

This patch refactor the code for parsing omp declare target directive and
its clauses.

Patch by pjeeva01 (Jeeva P.)

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

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

5 years ago[OPENMP]Fix handling of the LCVs in loop-based directives.
Alexey Bataev [Wed, 21 Nov 2018 19:41:10 +0000 (19:41 +0000)]
[OPENMP]Fix handling of the LCVs in loop-based directives.

Loop-control variables with the default data-sharing attributes should
not be captured in the OpenMP region as they are private by default.
Also, default attributes should be emitted for such variables in the
inner OpenMP regions for the correct data sharing during codegen.

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

5 years ago[OPENMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC)
Kelvin Li [Wed, 21 Nov 2018 19:38:53 +0000 (19:38 +0000)]
[OPENMP] remove redundant MapTypeModifierSpecified flag in ParseOpenMP.cpp (NFC)

Whether the map type modifier is specified or not, the flag
MapTypeModifierSpecified is always set to true.

Patch by Ahsan Saghir

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

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

5 years ago[OPENMP] Support relational-op != (not-equal) as one of the canonical
Kelvin Li [Wed, 21 Nov 2018 19:10:48 +0000 (19:10 +0000)]
[OPENMP] Support relational-op != (not-equal) as one of the canonical
forms of random access iterator

In OpenMP 4.5, only 4 relational operators are supported: <, <=, >,
and >=.  This work is to enable support for relational operator
!= (not-equal) as one of the canonical forms.

Patch by Anh Tuyen Tran

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

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

5 years agoMark lambda decl as invalid if a captured variable has an invalid type.
Jorge Gorbe Moya [Wed, 21 Nov 2018 17:49:37 +0000 (17:49 +0000)]
Mark lambda decl as invalid if a captured variable has an invalid type.

This causes the compiler to crash when trying to compute a layout for
the lambda closure type (see included test).

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

5 years agoRevert r347364 again, the fix was incomplete.
Nico Weber [Wed, 21 Nov 2018 12:47:43 +0000 (12:47 +0000)]
Revert r347364 again, the fix was incomplete.

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

5 years ago[Driver] Link sanitizer runtime deps on Fuchsia when needed
Petr Hosek [Wed, 21 Nov 2018 04:33:44 +0000 (04:33 +0000)]
[Driver] Link sanitizer runtime deps on Fuchsia when needed

Even though these deps weren't needed, this makes Fuchsia driver
better match other drivers, and it may be necessary when trying to
use different C libraries on Fuchsia.

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

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

5 years agoclang::tooling::Diagnostic: Don't store offset in the scratch space.
Alexander Kornienko [Wed, 21 Nov 2018 01:08:46 +0000 (01:08 +0000)]
clang::tooling::Diagnostic: Don't store offset in the scratch space.

These offsets are useless (and even harmful in certain cases) in exported
diagnostics. The test will be added to clang-tidy, since it's the main user of
the clang::tooling::Diagnostic class.

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

5 years agoImplement YAML serialization of notes in clang::tooling::Diagnostic.
Alexander Kornienko [Wed, 21 Nov 2018 01:06:32 +0000 (01:06 +0000)]
Implement YAML serialization of notes in clang::tooling::Diagnostic.

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

5 years agoReinstate 347294 with a fix for the failures.
Bill Wendling [Tue, 20 Nov 2018 23:24:16 +0000 (23:24 +0000)]
Reinstate 347294 with a fix for the failures.

EvaluateAsInt() is sometimes called in a constant context. When that's the
case, we need to specify it as so.

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

5 years ago[CodeComplete] Penalize inherited ObjC properties for auto-completion
Sam McCall [Tue, 20 Nov 2018 22:06:54 +0000 (22:06 +0000)]
[CodeComplete] Penalize inherited ObjC properties for auto-completion

Summary:
Similar to auto-completion for ObjC methods, inherited properties
should be penalized / direct class and category properties should
be prioritized.

Note that currently, the penalty for using a result from a base class
(CCD_InBaseClass) is equal to the penalty for using a method as a
property (CCD_MethodAsProperty).

Reviewers: jkorous, sammccall, akyrtzi, arphaman, benlangmuir

Reviewed By: sammccall, akyrtzi

Subscribers: arphaman, cfe-commits

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

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

5 years ago[OpenMP] Update CHECK-DAG usage in target_parallel_codegen.cpp
Joel E. Denny [Tue, 20 Nov 2018 22:05:23 +0000 (22:05 +0000)]
[OpenMP] Update CHECK-DAG usage in target_parallel_codegen.cpp

This patch adjusts a test not to depend on deprecated FileCheck
behavior that permits overlapping matches within a block of CHECK-DAG
directives.  Thus, this patch also removes uses of FileCheck's
-allow-deprecated-dag-overlap command-line option.

There were two issues in this test:

1. There were sets of patterns for store instructions in which a
pattern X could match a superset of a pattern Y.  While X appeared
before Y, Y's intended match appeared before X's intended match.  The
result was that X matched Y's intended match.  Under the old
overlapping behavior, Y also matched Y's intended match.  Under the
new non-overlapping behavior, Y had nothing left to match.  This patch
fixes this by gathering these sets in one place and putting the most
specific patterns (Y) before the more general patterns (X).

2. The CHECK-DAG patterns involving the variables CBPADDR3 and
CBPADDR4 were the same, but there was only one match in the text, so
CBPADDR4 patterns had nothing to match under the new non-overlapping
behavior.  Moreover, a preceding related series of directives had
variables (SADDR0, BPADDR0, etc.) numbered only 0 through 4, but this
series had variables numbered 0 through 5.  Assuming CBPADDR4's
directives were not intended, this patch removes them.

Reviewed By: ABataev

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

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

5 years ago[OpenMP] Update CHECK-DAG usage in for_codegen.cpp
Joel E. Denny [Tue, 20 Nov 2018 22:04:45 +0000 (22:04 +0000)]
[OpenMP] Update CHECK-DAG usage in for_codegen.cpp

This patch adjusts a test not to depend on deprecated FileCheck
behavior that permits overlapping matches within a block of CHECK-DAG
directives.  Thus, this patch also removes uses of FileCheck's
-allow-deprecated-dag-overlap command-line option.

Specifically, the FileCheck variables DBG_LOC_START, DBG_LOC_END, and
DBG_LOC_CANCEL were all set to the same value.  As a result, three
TERM_DEBUG-DAG patterns, one for each variable, all matched the same
text under the old overlapping behavior.  Under the new
non-overlapping behavior, that's not permitted.  This patch's solution
is to replace these variables with one variable and replace these
patterns with one pattern.

Reviewed By: ABataev

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

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

5 years ago[clang][Parse] Diagnose useless null statements / empty init-statements
Roman Lebedev [Tue, 20 Nov 2018 18:59:05 +0000 (18:59 +0000)]
[clang][Parse] Diagnose useless null statements / empty init-statements

Summary:
clang has `-Wextra-semi` (D43162), which is not dictated by the currently selected standard.
While that is great, there is at least one more source of need-less semis - 'null statements'.
Sometimes, they are needed:
```
for(int x = 0; continueToDoWork(x); x++)
  ; // Ugly code, but the semi is needed here.
```

But sometimes they are just there for no reason:
```
switch(X) {
case 0:
  return -2345;
case 5:
  return 0;
default:
  return 42;
}; // <- oops

;;;;;;;;;;; <- OOOOPS, still not diagnosed. Clearly this is junk.
```

Additionally:
```
if(; // <- empty init-statement
   true)
  ;

switch (; // empty init-statement
        x) {
  ...
}

for (; // <- empty init-statement
     int y : S())
  ;
}

As usual, things may or may not go sideways in the presence of macros.
While evaluating this diag on my codebase of interest, it was unsurprisingly
discovered that Google Test macros are *very* prone to this.
And it seems many issues are deep within the GTest itself, not
in the snippets passed from the codebase that uses GTest.

So after some thought, i decided not do issue a diagnostic if the semi
is within *any* macro, be it either from the normal header, or system header.

Fixes [[ https://bugs.llvm.org/show_bug.cgi?id=39111 | PR39111 ]]

Reviewers: rsmith, aaron.ballman, efriedma

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

5 years ago[NFC] Remove MS line endings in diagnostics file.
Erich Keane [Tue, 20 Nov 2018 16:32:46 +0000 (16:32 +0000)]
[NFC] Remove MS line endings in diagnostics file.

Change-Id: I74704acf052e2e8fe707f18230bc5655c2bf2a91

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

5 years ago[AST] Store the expressions in ParenListExpr in a trailing array
Bruno Ricci [Tue, 20 Nov 2018 16:20:40 +0000 (16:20 +0000)]
[AST] Store the expressions in ParenListExpr in a trailing array

Use the newly available space in the bit-fields of Stmt
and store the expressions in a trailing array. This saves
2 pointer per ParenListExpr.

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

Reviewed By: rjmccall

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

5 years ago[AST][NFC] Factor out some repeated code in ArraySubscriptExpr.
Bruno Ricci [Tue, 20 Nov 2018 16:09:45 +0000 (16:09 +0000)]
[AST][NFC] Factor out some repeated code in ArraySubscriptExpr.

Factor out the test for whether the LHS is the base of the
array subscript expression into a private method lhsIsBase.

NFC.

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

5 years ago[AST][NFC] Pack ArraySubscriptExpr
Bruno Ricci [Tue, 20 Nov 2018 16:03:33 +0000 (16:03 +0000)]
[AST][NFC] Pack ArraySubscriptExpr

Use the newly available space in the bit-fields of Stmt.
This saves one pointer per ArraySubscriptExpr.

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

5 years agoRevert 347294, it turned many bots on lab.llvm.org:8011/console red.
Nico Weber [Tue, 20 Nov 2018 15:27:43 +0000 (15:27 +0000)]
Revert 347294, it turned many bots on lab.llvm.org:8011/console red.

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

5 years agoUpdate the documentation for attribute feature tests.
Aaron Ballman [Tue, 20 Nov 2018 15:23:07 +0000 (15:23 +0000)]
Update the documentation for attribute feature tests.

This clarifies that __has_cpp_attribute is no longer always an extension since it's now available in C++2a. Also, Both __has_cpp_attribute and __has_c_attribute can accept attribute scope tokens with alternative spelling (clang vs _Clang and gnu vs __gnu__).

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

5 years ago[clang-format] JS: don't treat is: as a type matcher
Krasimir Georgiev [Tue, 20 Nov 2018 14:22:43 +0000 (14:22 +0000)]
[clang-format] JS: don't treat is: as a type matcher

Summary:
Clang-format is treating all occurences of `is` in js as type matchers. In some
cases this is wrong, as it might be a dict key.

Reviewers: mprobst

Reviewed By: mprobst

Subscribers: cfe-commits

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

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

5 years ago[ASTImporter] Set redecl chain of functions before any other import
Gabor Marton [Tue, 20 Nov 2018 14:19:39 +0000 (14:19 +0000)]
[ASTImporter] Set redecl chain of functions before any other import

Summary:
FunctionDecl import starts with a lookup and then we create a new Decl.
Then in case of CXXConstructorDecl we further import other Decls
(base classes, members through CXXConstructorDecl::inits()) before connecting
the redecl chain.  During those in-between imports structural eq fails
because the canonical decl is different.  This commit fixes this.
Synthesizing a test seemed extremely hard, however, Xerces analysis
reproduces the problem.

Reviewers: a_sidorin, a.sidorin

Subscribers: rnkovacs, dkrupp, Szelethus, cfe-commits

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

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

5 years agoAllow force updating the NumCreatedFIDsForFileID.
Vassil Vassilev [Tue, 20 Nov 2018 13:53:20 +0000 (13:53 +0000)]
Allow force updating the NumCreatedFIDsForFileID.

Our internal clients implement parsing cache based on FileID. In order for the
Preprocessor to reenter the cached FileID it needs to reset its
NumCreatedFIDsForFileID.

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

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

5 years agoUse is.constant intrinsic for __builtin_constant_p
Bill Wendling [Tue, 20 Nov 2018 08:53:30 +0000 (08:53 +0000)]
Use is.constant intrinsic for __builtin_constant_p

Summary:
A __builtin_constant_p may end up with a constant after inlining. Use
the is.constant intrinsic if it's a variable that's in a context where
it may resolve to a constant, e.g., an argument to a function after
inlining.

Reviewers: rsmith, shafik

Subscribers: jfb, kristina, cfe-commits, nickdesaulniers, jyknight

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

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

5 years ago[libclang] Unify getCursorDecl and getCursorParentDecl
Fangrui Song [Tue, 20 Nov 2018 08:00:00 +0000 (08:00 +0000)]
[libclang] Unify getCursorDecl and getCursorParentDecl

They do the same thing, thus the latter (which has only 2 call sites) can be deleted.

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

5 years agoEnsure FileManagerTest expects "\\" as path separator on Windows platforms
Matthew Voss [Tue, 20 Nov 2018 03:30:28 +0000 (03:30 +0000)]
Ensure FileManagerTest expects "\\" as path separator on Windows platforms

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

5 years agoDriver: SCS is compatible with every other sanitizer.
Peter Collingbourne [Tue, 20 Nov 2018 01:01:49 +0000 (01:01 +0000)]
Driver: SCS is compatible with every other sanitizer.

Because SCS relies on system-provided runtime support, we can use it
together with any other sanitizer simply by linking the runtime for
the other sanitizer.

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

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

5 years ago[Coverage] Fix PR39258: support coverage regions that start deeper than they end
Vedant Kumar [Mon, 19 Nov 2018 20:10:22 +0000 (20:10 +0000)]
[Coverage] Fix PR39258: support coverage regions that start deeper than they end

popRegions used to assume that the start location of a region can't be
nested deeper than the end location, which is not always true.

Patch by Orivej Desh!

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

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