]> granicus.if.org Git - clang/log
clang
5 years ago[Sema] Correct typos in return statements so the return types of 'auto' functions...
Sam McCall [Wed, 8 May 2019 05:49:42 +0000 (05:49 +0000)]
[Sema] Correct typos in return statements so the return types of 'auto' functions are always deduced.

Summary:
e.g.
  auto foo() {
    return no_such_thing; // Return value is a TypoExpr
  }
  using T = decltype(foo()); // Uh-oh, undeduced auto.

Reviewers: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFix buildbot break after r360195
Nemanja Ivanovic [Wed, 8 May 2019 02:03:32 +0000 (02:03 +0000)]
Fix buildbot break after r360195

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

5 years agoSplit ActOnCallExpr into an ActOnCallExpr to be called by the parser,
Richard Smith [Wed, 8 May 2019 01:36:36 +0000 (01:36 +0000)]
Split ActOnCallExpr into an ActOnCallExpr to be called by the parser,
and a BuildCallExpr to be called internally within Sema to build /
rebuild calls.

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

5 years ago[hip] Fix ambiguity from `>>>` of CUDA.
Michael Liao [Wed, 8 May 2019 00:52:33 +0000 (00:52 +0000)]
[hip] Fix ambiguity from `>>>` of CUDA.

Summary:
- For template arguments ending with `>>>`, we should cease lookahead
  and treat it as type-id firstly, so that deduction could work
  properly.

Reviewers: tra, yaxunl

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[COFF] Use COFF stubs for extern_weak functions
Reid Kleckner [Tue, 7 May 2019 23:06:21 +0000 (23:06 +0000)]
[COFF] Use COFF stubs for extern_weak functions

Summary:
A COFF stub indirects the reference to a symbol through memory. A
.refptr.$sym global variable pointer is created to refer to $sym.
Typically mingw uses these for external global variable declarations,
but we can use them for weak function declarations as well.

Updates the dso_local classification to add a special case for
extern_weak symbols on COFF in both clang and LLVM.

Fixes PR37598

Reviewers: smeenai, mstorsjo

Subscribers: hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[analyzer] Fix a crash when doing RVO from within blocks.
Artem Dergachev [Tue, 7 May 2019 22:33:13 +0000 (22:33 +0000)]
[analyzer] Fix a crash when doing RVO from within blocks.

When looking for the location context of the call site, unwrap block invocation
contexts because they are attached to the current AnalysisDeclContext
while what we need is the previous AnalysisDeclContext.

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

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

5 years ago-frewrite-imports: Add support for wildcard rules in umbrella modules with
David Blaikie [Tue, 7 May 2019 21:38:51 +0000 (21:38 +0000)]
-frewrite-imports: Add support for wildcard rules in umbrella modules with

This trips over a few other limitations, but in the interests of incremental development I'm starting here & I'll look at the issues with -verify and filesystem checks (the fact that the behavior depends on the existence of a 'foo' directory even though it shouldn't need it), etc.

Reviewers: rsmith

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

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

5 years agoRevert "[OpenMP][Clang] Support for target math functions"
Jonas Devlieghere [Tue, 7 May 2019 21:08:15 +0000 (21:08 +0000)]
Revert "[OpenMP][Clang] Support for target math functions"

This commit appears to be breaking stage-2 builds on GreenDragon. The
OpenMP wrappers for cmath and math.h are copied into the root of the
resource directory and cause a cyclic dependency in module 'Darwin':
Darwin -> std -> Darwin. This blows up when CMake is testing for modules
support and breaks all stage 2 module builds, including the ThinLTO bot
and all LLDB bots.

CMake Error at cmake/modules/HandleLLVMOptions.cmake:497 (message):
  LLVM_ENABLE_MODULES is not supported by this compiler

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

5 years ago[ASTImporter] Corrected type of integer constant in a test.
Balazs Keri [Tue, 7 May 2019 14:53:04 +0000 (14:53 +0000)]
[ASTImporter] Corrected type of integer constant in a test.

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

5 years agoAdd an explicit triple to this test to hopefully appease the build bots.
Aaron Ballman [Tue, 7 May 2019 14:40:37 +0000 (14:40 +0000)]
Add an explicit triple to this test to hopefully appease the build bots.

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

5 years ago[Tooling] Add -x flags when inferring compile commands for files with no/invalid...
Sam McCall [Tue, 7 May 2019 14:34:06 +0000 (14:34 +0000)]
[Tooling] Add -x flags when inferring compile commands for files with no/invalid extension.

Summary: We treat them as headers, as the motivating case is C++ standard library.

Reviewers: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Prevent mangling kernel functions.
Anastasia Stulova [Tue, 7 May 2019 14:22:34 +0000 (14:22 +0000)]
[OpenCL] Prevent mangling kernel functions.

Kernel function names have to be preserved as in the original
source to be able to access them from the host API side.

This commit also adds restriction to kernels that prevents them
from being used in overloading, templates, etc.

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

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

5 years agoAllow field offset lookups in types with incomplete arrays within libclang.
Aaron Ballman [Tue, 7 May 2019 14:00:49 +0000 (14:00 +0000)]
Allow field offset lookups in types with incomplete arrays within libclang.

Patch thanks to Jorn Vernee

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

5 years ago[ASTImporter] Import TemplateParameterLists in function templates.
Balazs Keri [Tue, 7 May 2019 10:55:11 +0000 (10:55 +0000)]
[ASTImporter] Import TemplateParameterLists in function templates.

Summary: Correct missing import of TemplateParameterList in function decl.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong

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

Tags: #clang

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

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

5 years ago[Tooling] Don't mmap the JSONCompilationDatabase, it's not correct for long-lived...
Sam McCall [Tue, 7 May 2019 09:05:15 +0000 (09:05 +0000)]
[Tooling] Don't mmap the JSONCompilationDatabase, it's not correct for long-lived processes.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Sema] Add missing VisitMacroQualifiedTypeLoc to TypeSpecLocFiller
Leonard Chan [Tue, 7 May 2019 08:12:28 +0000 (08:12 +0000)]
[Sema] Add missing VisitMacroQualifiedTypeLoc to TypeSpecLocFiller

To hopefully fix greenbot failures

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

5 years agoImprove function / variable disambiguation.
Richard Smith [Tue, 7 May 2019 07:36:07 +0000 (07:36 +0000)]
Improve function / variable disambiguation.

Keep looking for decl-specifiers after an unknown identifier. Don't
issue diagnostics about an error type specifier conflicting with later
type specifiers.

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

5 years agoRecommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute...
Leonard Chan [Tue, 7 May 2019 03:20:17 +0000 (03:20 +0000)]
Recommit r359859 "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"

Updated with fix for read of uninitialized memory.

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

5 years agoFix typo in risc-v register aliases.
Eric Christopher [Tue, 7 May 2019 00:45:47 +0000 (00:45 +0000)]
Fix typo in risc-v register aliases.

Patch by John.

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

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

5 years ago[Clang][NewPM] Don't bail out if the target machine is empty
Petr Hosek [Mon, 6 May 2019 23:24:17 +0000 (23:24 +0000)]
[Clang][NewPM] Don't bail out if the target machine is empty

This matches the behavior of the old pass manager. There are some
targets that don't have target machine at all (e.g. le32, spir) which
whose tests would never run with new pass manager. Similarly, we would
need to disable tests for targets that are disabled.

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

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

5 years ago[Sema] Fix for P41774 where `ExpectNoDerefChunk` is assigned twice
Leonard Chan [Mon, 6 May 2019 22:09:12 +0000 (22:09 +0000)]
[Sema] Fix for P41774 where `ExpectNoDerefChunk` is assigned twice

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

5 years agoRevert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink...
Jordan Rupprecht [Mon, 6 May 2019 21:55:05 +0000 (21:55 +0000)]
Revert "Re-commit r357452: SimplifyCFG SinkCommonCodeFromPredecessors: Also sink function calls without used results (PR41259)"

This reverts r357452 (git commit 21eb771dcb5c11d7500fa6ad551c97a921997f05).

This was causing strange optimization-related test failures on an internal test. Will followup with more details offline.

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

5 years agoPR41183: Don't emit strict-prototypes warning for an implicit function
James Y Knight [Mon, 6 May 2019 21:37:59 +0000 (21:37 +0000)]
PR41183: Don't emit strict-prototypes warning for an implicit function
declaration.

It should emit _only_ an implicit-function-declaration warning, not
both of them.

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

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

5 years ago[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW
Martin Storsjo [Mon, 6 May 2019 21:19:07 +0000 (21:19 +0000)]
[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW

In MinGW, setjmp isn't expanded as a builtin in the compiler (like it
is for MSVC), but manually hooked up as calls to the right underlying
functions in headers. Using the actual CRT's real setjmp/longjmp
functions requires this intrinsic. (Currently this is worked around by
using MinGW specific reimplementations of setjmp/longjmp on aarch64.)

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

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

5 years ago[MinGW] Use SEH by default on AArch64
Martin Storsjo [Mon, 6 May 2019 21:19:01 +0000 (21:19 +0000)]
[MinGW] Use SEH by default on AArch64

The implementation of SEH is pretty mature at this point.

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

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

5 years ago[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
Alexey Bataev [Mon, 6 May 2019 20:07:20 +0000 (20:07 +0000)]
[OPENMP]Fix PR41767: diagnose DSA for variables in clauses with
default(none).

If the combined directive has default(none) clause and has clauses for
inner directive that reference some variables, for which data-sharing
attributes are not specified, the error messages should be emitted for
such variables.

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

5 years ago[OpenMP][Clang] Support for target math functions
Gheorghe-Teodor Bercea [Mon, 6 May 2019 18:19:15 +0000 (18:19 +0000)]
[OpenMP][Clang] Support for target math functions

Summary:
In this patch we propose a temporary solution to resolving math functions for the NVPTX toolchain, temporary until OpenMP variant is supported by Clang.

We intercept the inclusion of math.h and cmath headers and if we are in the OpenMP-NVPTX case, we re-use CUDA's math function resolution mechanism.

Authors:
@gtbercea
@jdoerfert

Reviewers: hfinkel, caomhin, ABataev, tra

Reviewed By: hfinkel, ABataev, tra

Subscribers: mgorny, guansong, cfe-commits, jdoerfert

Tags: #clang

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

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

5 years ago[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.
Alexey Bataev [Mon, 6 May 2019 17:49:22 +0000 (17:49 +0000)]
[OPENMP]Fix PR41768: check DSA for globals with `default(none)` clauses.

If the `default(none)` was specified for the construct, we might miss
diagnostic for the globals without explicitly specified data-sharing
attributes. Patch fixes this problem.

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

5 years ago[CodeComplete] Update python tests after r360042
Ilya Biryukov [Mon, 6 May 2019 14:56:24 +0000 (14:56 +0000)]
[CodeComplete] Update python tests after r360042

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

5 years ago[CodeComplete] Add a trailing semicolons to some pattern completions
Ilya Biryukov [Mon, 6 May 2019 13:18:00 +0000 (13:18 +0000)]
[CodeComplete] Add a trailing semicolons to some pattern completions

Summary:
Where semicolon is required in any case. Here's a list of completions
that now have a semicolon:
  - namespace <name> = <target>;
  - using namespace <name>;
  - using <qualifier>::<name>;
  - continue;
  - break;
  - goto <label>;
  - return;
  - return <expression>;

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoRevert r359949 "[clang] adding explicit(bool) from c++2a"
Hans Wennborg [Mon, 6 May 2019 09:51:10 +0000 (09:51 +0000)]
Revert r359949 "[clang] adding explicit(bool) from c++2a"

This caused Clang to start erroring on the following:

  struct S {
    template <typename = int> explicit S();
  };

  struct T : S {};

  struct U : T {
    U();
  };
  U::U() {}

  $ clang -c /tmp/x.cc
  /tmp/x.cc:10:4: error: call to implicitly-deleted default constructor of 'T'
  U::U() {}
     ^
  /tmp/x.cc:5:12: note: default constructor of 'T' is implicitly deleted
    because base class 'S' has no default constructor
  struct T : S {};
             ^
  1 error generated.

See discussion on the cfe-commits email thread.

This also reverts the follow-ups r359966 and r359968.

> this patch adds support for the explicit bool specifier.
>
> Changes:
> - The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
> - The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
> - Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
> - Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
> - The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
> - Test for Semantic and Serialization were added.
>
> This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
> Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.
>
> Patch by Tyker
>
> Differential Revision: https://reviews.llvm.org/D60934

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

5 years ago[X86] Move files to correct directories after D60552
Fangrui Song [Mon, 6 May 2019 09:24:36 +0000 (09:24 +0000)]
[X86] Move files to correct directories after D60552

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

5 years agoEnable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake
Luo, Yuanke [Mon, 6 May 2019 08:25:11 +0000 (08:25 +0000)]
Enable intrinsics of AVX512_BF16, which are supported for BFLOAT16 in Cooper Lake

Summary:
1. Enable infrastructure of AVX512_BF16, which is supported for BFLOAT16 in Cooper Lake;
2. Enable intrinsics for VCVTNE2PS2BF16, VCVTNEPS2BF16 and DPBF16PS instructions, which are Vector Neural Network Instructions supporting BFLOAT16 inputs and conversion instructions from IEEE single precision.
For more details about BF16 intrinsic, please refer to the latest ISE document: https://software.intel.com/en-us/download/intel-architecture-instruction-set-extensions-programming-reference

Patch by LiuTianle

Reviewers: craig.topper, smaslov, LuoYuanke, wxiao3, annita.zhang, spatel, RKSimon

Reviewed By: craig.topper

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years agoP1286R2: Remove restriction that the exception specification of a
Richard Smith [Mon, 6 May 2019 05:04:56 +0000 (05:04 +0000)]
P1286R2: Remove restriction that the exception specification of a
defaulted special member matches the implicit exception specification.

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

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Mon, 6 May 2019 04:14:01 +0000 (04:14 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

This reverts r359984 (which reverted r359962). The bug in clang-tidy's
test suite exposed by the original commit was fixed in r360009.

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

5 years ago[c++20] Implement P1009R2: allow omitting the array bound in an array
Richard Smith [Mon, 6 May 2019 03:47:15 +0000 (03:47 +0000)]
[c++20] Implement P1009R2: allow omitting the array bound in an array
new expression.

This was voted into C++20 as a defect report resolution, so we
retroactively apply it to all prior language modes (though it can never
actually be used before C++11 mode).

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

5 years agoThe 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets...
Galina Kistanova [Mon, 6 May 2019 03:30:09 +0000 (03:30 +0000)]
The 'CodeGenObjC/illegal-UTF8.m' get failed with Clang built with 32-bit targets only (as example ARM-only) with the following error:

error: unable to create target: 'No available targets are compatible with triple "< ... any 64-bit target triple ... >"'

I didn't find any 64-bit dependencies for the test and I think removing '-m64' option should fix the problem and allow this test for any target specified by LLVM_DEFAULT_TARGET_TRIPLE.

Patch by Vlad Vereschaka.

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

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

5 years ago[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.
Kristof Umann [Sun, 5 May 2019 19:42:33 +0000 (19:42 +0000)]
[analyzer][UninitializedObjectChecker] PR41741: Regard all scalar types as primitive.

https://bugs.llvm.org/show_bug.cgi?id=41741

Pretty much the same as D61246 and D61106, this time for __complex__ types. Upon
further investigation, I realized that we should regard all types
Type::isScalarType returns true for as primitive, so I merged
isMemberPointerType(), isBlockPointerType() and isAnyComplexType()` into that
instead.

I also stumbled across yet another bug,
https://bugs.llvm.org/show_bug.cgi?id=41753, but it seems to be unrelated to
this checker.

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

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

5 years agoRevert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Simon Pilgrim [Sun, 5 May 2019 17:10:05 +0000 (17:10 +0000)]
Revert rL359962 : Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.
........
Try to fix buildbots

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

5 years ago[clang] fixing -ast-print for variadic parameter pack in lambda capture
Nicolas Lesser [Sun, 5 May 2019 12:35:12 +0000 (12:35 +0000)]
[clang] fixing -ast-print for variadic parameter pack in lambda capture

Summary:
currently for:
```
 template<typename ... T>
void f(T... t) {
  auto l = [t...]{};
}
```
`clang -ast-print file.cpp`
outputs:

```
template <typename ...T> void f(T ...t) {
    auto l = [t]         {
        }
;
}
```
notice that there is not `...` in the capture list of the lambda. this patch fixes this issue. and add test for it.

Patch by Tyker

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[C++] Interpret unknown identifier in parameter clause as unknown type
Nicolas Lesser [Sun, 5 May 2019 12:15:17 +0000 (12:15 +0000)]
[C++] Interpret unknown identifier in parameter clause as unknown type

instead of as parameter name without a type.

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

5 years ago[NFC] Add parentheses to avoid -Wparentheses.
Nicolas Lesser [Sat, 4 May 2019 11:28:11 +0000 (11:28 +0000)]
[NFC] Add parentheses to avoid -Wparentheses.

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

5 years ago[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas
Hamza Sood [Sat, 4 May 2019 10:49:46 +0000 (10:49 +0000)]
[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas

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

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

5 years ago[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:
Richard Smith [Sat, 4 May 2019 06:46:18 +0000 (06:46 +0000)]
[c++20] Implement tweaked __VA_OPT__ rules from P1042R1:

 * __VA_OPT__ is expanded if the *expanded* __VA_ARGS__ is non-empty,
   not if the original argument contained no tokens.
 * Placemarkers at the start and end of __VA_OPT__ are retained just
   long enough to paste them with adjacent ## operators. We never paste
   "across" a discarded placemarker.

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

5 years agoUse DiagRuntimeBehavior for -Wunsequenced to weed out false positives
Richard Smith [Sat, 4 May 2019 05:20:14 +0000 (05:20 +0000)]
Use DiagRuntimeBehavior for -Wunsequenced to weed out false positives
where either the modification or the other access is unreachable.

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

5 years agoReduce amount of work ODR hashing does.
Richard Trieu [Sat, 4 May 2019 04:22:33 +0000 (04:22 +0000)]
Reduce amount of work ODR hashing does.

When a FunctionProtoType is in the original type in a DecayedType, the decayed
type is a PointerType which points back the original FunctionProtoType.  The
visitor for ODRHashing will attempt to process both Type's, doing double work.
By chaining together multiple DecayedType's and FunctionProtoType's, this would
result in 2^N Type's visited only N DecayedType's and N FunctionProtoType's
exsit.  Another bug where VisitDecayedType and VisitAdjustedType did
redundant work doubled the work at each level, giving 4^N Type's visited.  This
patch removed the double work and detects when a FunctionProtoType decays to
itself to only check the Type once.  This lowers the exponential runtime to
linear runtime.  Fixes https://bugs.llvm.org/show_bug.cgi?id=41625

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

5 years agoDisallow the operand of __builtin_constant_p from modifying enclosing
Richard Smith [Sat, 4 May 2019 04:00:45 +0000 (04:00 +0000)]
Disallow the operand of __builtin_constant_p from modifying enclosing
state when it's encountered while evaluating a constexpr function.

We attempt to follow GCC trunk's behavior here, but it is somewhat
inscrutible, so our behavior is only approximately the same for now.
Specifically, we only permit modification of objects whose lifetime
began within the operand of the __builtin_constant_p. GCC appears to
have effectively the same restriction, but also some unknown restriction
based on where and how the local state of the constexpr function is
mentioned within the operand (see added testcases).

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

5 years ago[Driver] Create non-existent directory for -fcrash-diagnostics-dir
Petr Hosek [Sat, 4 May 2019 00:55:14 +0000 (00:55 +0000)]
[Driver] Create non-existent directory for -fcrash-diagnostics-dir

When user specifies non-existent directory to -fcrash-diagnostics-dir,
create it rather than failing with an error as would be the case before.

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

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

5 years ago[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
Richard Smith [Sat, 4 May 2019 00:27:21 +0000 (00:27 +0000)]
[cxx_status] Don't list -fmodules / -fmodules-ts against C++ modules
support; those turn on different modules modes. The real C++ modules
support is behind -std=c++2a like the rest of C++20.

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

5 years ago[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.
Richard Smith [Sat, 4 May 2019 00:23:18 +0000 (00:23 +0000)]
[cxx_status] Replace "SVN" entries with Clang 8 as appropriate.

Also: use the "svn" color for "explicit(bool)" rather than the "full" color.

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

5 years ago[clang] adding explicit(bool) from c++2a
Nicolas Lesser [Sat, 4 May 2019 00:09:00 +0000 (00:09 +0000)]
[clang] adding explicit(bool) from c++2a

this patch adds support for the explicit bool specifier.

Changes:
- The parsing for the explicit(bool) specifier was added in ParseDecl.cpp.
- The storage of the explicit specifier was changed. the explicit specifier was stored as a boolean value in the FunctionDeclBitfields and in the DeclSpec class. now it is stored as a PointerIntPair<Expr*, 2> with a flag and a potential expression in CXXConstructorDecl, CXXDeductionGuideDecl, CXXConversionDecl and in the DeclSpec class.
- Following the AST change, Serialization, ASTMatchers, ASTComparator and ASTPrinter were adapted.
- Template instantiation was adapted to instantiate the potential expressions of the explicit(bool) specifier When instantiating their associated declaration.
- The Add*Candidate functions were adapted, they now take a Boolean indicating if the context allowing explicit constructor or conversion function and this boolean is used to remove invalid overloads that required template instantiation to be detected.
- Test for Semantic and Serialization were added.

This patch is not yet complete. I still need to check that interaction with CTAD and deduction guides is correct. and add more tests for AST operations. But I wanted first feedback.
Perhaps this patch should be spited in smaller patches, but making each patch testable as a standalone may be tricky.

Patch by Tyker

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

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

5 years agoCWG issue 727: Fix numerous bugs in support for class-scope explicit
Richard Smith [Fri, 3 May 2019 23:51:38 +0000 (23:51 +0000)]
CWG issue 727: Fix numerous bugs in support for class-scope explicit
specializations for variable templates.

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

5 years ago[clang-format] Fix bug in block comment reflow that joins * and /
Owen Pan [Fri, 3 May 2019 23:15:40 +0000 (23:15 +0000)]
[clang-format] Fix bug in block comment reflow that joins * and /

Fixes PR41213

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

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

5 years ago[COFF, ARM64] Fix ABI implementation of struct returns
Mandeep Singh Grang [Fri, 3 May 2019 21:12:24 +0000 (21:12 +0000)]
[COFF, ARM64] Fix ABI implementation of struct returns

Summary:
Related llvm patch: D60348.
Patch co-authored by Sanjin Sijaric.

Reviewers: rnk, efriedma, TomTan, ssijaric, ostannard

Reviewed By: efriedma

Subscribers: dmajor, richard.townsend.arm, ostannard, javed.absar, kristof.beyls, cfe-commits

Tags: #clang

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

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

5 years agoEnsure there is stack usage in stack size warning test
Matt Arsenault [Fri, 3 May 2019 19:04:14 +0000 (19:04 +0000)]
Ensure there is stack usage in stack size warning test

r359906 broke this because the only stack usage was from a spill which
can be avoided since the only block is a return.

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

5 years agoAttempt to fix the clang-sphinx-docs bot after r358797
Nico Weber [Fri, 3 May 2019 18:54:18 +0000 (18:54 +0000)]
Attempt to fix the clang-sphinx-docs bot after r358797

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

5 years agoRemove else-after-return
David Blaikie [Fri, 3 May 2019 18:11:31 +0000 (18:11 +0000)]
Remove else-after-return

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

5 years ago[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case
Gheorghe-Teodor Bercea [Fri, 3 May 2019 17:59:18 +0000 (17:59 +0000)]
[CUDA][Clang][Bugfix] Add missing CUDA 9.2 case

Summary:
The bug was reported on the OpenMP-dev list:

.../obj-release/lib/clang/9.0.0/include/__clang_cuda_intrinsics.h:173:35: error: '__nvvm_shfl_sync_idx_i32' needs target feature ptx60|ptx61|ptx63|ptx64
__MAKE_SYNC_SHUFFLES(__shfl_sync, __nvvm_shfl_sync_idx_i32,

This problem occurs when trying to compile a .cu file that requires a newer ptx version (>ptx60 in this case) than ptx42.

Reviewers: tra, ABataev, caomhin

Reviewed By: tra

Subscribers: jdoerfert, cfe-commits

Tags: #clang

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

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

5 years ago[CommandLine] Change help output to prefix long options with `--` instead of `-`...
Don Hinton [Fri, 3 May 2019 17:47:29 +0000 (17:47 +0000)]
[CommandLine] Change help output to prefix long options with `--` instead of `-`. NFC . Part 3 of 5

Summary:
By default, `parseCommandLineOptions()` will accept either a
`-` or `--` prefix for long options -- options with names longer than
a single character.

While this change does not affect behavior, it will be helpful with a
subsequent change that requires long options use the `--` prefix.

Reviewers: rnk, thopre

Reviewed By: thopre

Subscribers: thopre, cfe-commits, hiraditya, llvm-commits

Tags: #llvm, #clang

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

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

5 years agoAdded an AST matcher for declarations that are in the `std` namespace
Dmitri Gribenko [Fri, 3 May 2019 12:50:00 +0000 (12:50 +0000)]
Added an AST matcher for declarations that are in the `std` namespace

Reviewers: alexfh

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Sema][ObjC] Disable -Wunused-parameter for ObjC methods
Akira Hatanaka [Fri, 3 May 2019 07:19:46 +0000 (07:19 +0000)]
[Sema][ObjC] Disable -Wunused-parameter for ObjC methods

The warning isn't very useful when the function is an ObjC method.

rdar://problem/41561853

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

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

5 years agoRevert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"
Leonard Chan [Fri, 3 May 2019 03:28:06 +0000 (03:28 +0000)]
Revert "[Attribute/Diagnostics] Print macro if definition is an attribute declaration"

This reverts commit fc40cbd9d8c63e65eed3590ba925321afe782e1d.

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

5 years agoRevert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage...
Nico Weber [Fri, 3 May 2019 03:16:07 +0000 (03:16 +0000)]
Revert r359814 "[Sema] Emit warning for visibility attribute on internal-linkage declaration"

See cfe-commits thread for r359814.

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

5 years agoSemaOverload: Complete candidates before emitting the error, to ensure diagnostics...
David Blaikie [Fri, 3 May 2019 00:44:50 +0000 (00:44 +0000)]
SemaOverload: Complete candidates before emitting the error, to ensure diagnostics emitted (or suppressed) during completion don't interfere with the overload notes

Because diagnostics and their notes are not connected at the API level,
if the error message for an overload is emitted, then the overload
candidates are completed - if a diagnostic is emitted during that work,
the notes related to overload candidates would be attached to the latter
diagnostic, not the original error. Sort of worse, if the latter
diagnostic was disabled, the notes are disabled.

Reviewers: rsmith

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

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

5 years agoFix -Wunsequenced false-positives in code controlled by a branch on
Richard Smith [Thu, 2 May 2019 23:21:28 +0000 (23:21 +0000)]
Fix -Wunsequenced false-positives in code controlled by a branch on
__builtin_constant_p.

If the operand of __builtin_constant_p is not constant and has
side-effects, then code controlled by a branch on it is unreachable and
we should not emit runtime behavior warnings in such code.

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

5 years ago[CUDA] Do not pass deprecated option fo fatbinary
Artem Belevich [Thu, 2 May 2019 22:37:19 +0000 (22:37 +0000)]
[CUDA] Do not pass deprecated option fo fatbinary

CUDA 10.1 tools deprecated some command line options.
fatbinary no longer needs --cuda.

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

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

5 years ago[Attribute/Diagnostics] Print macro if definition is an attribute declaration
Leonard Chan [Thu, 2 May 2019 20:38:14 +0000 (20:38 +0000)]
[Attribute/Diagnostics] Print macro if definition is an attribute declaration

If an address_space attribute is defined in a macro, print the macro instead
when diagnosing a warning or error for incompatible pointers with different
address_spaces.

We allow this for all attributes (not just address_space), and for multiple
attributes declared in the same macro.

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

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

5 years agoChange the metadata for heapallocsite calls when the type is cast.
Amy Huang [Thu, 2 May 2019 20:07:35 +0000 (20:07 +0000)]
Change the metadata for heapallocsite calls when the type is cast.

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

5 years agoAnother attempt to fix "could not find clang-check" lit warning in analyzer-less...
Nico Weber [Thu, 2 May 2019 19:47:05 +0000 (19:47 +0000)]
Another attempt to fix "could not find clang-check" lit warning in analyzer-less builds

r359717 added clang-check as a dep of check-clang unconditionally
because I had missed lit.local.cfg in test/Tooling.

Instead, only add clang-check to the tools if the analyzer is enabled,
since the build target only exists then, and since all tests using
clang-check are skipped when the analyzer is disabled.

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

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

5 years ago[Sema] Emit warning for visibility attribute on internal-linkage declaration
Scott Linder [Thu, 2 May 2019 19:03:57 +0000 (19:03 +0000)]
[Sema] Emit warning for visibility attribute on internal-linkage declaration

GCC warns on these cases, but we currently just silently ignore the attribute.

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

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

5 years agoUse primary template parameter names for variable template debug info
Reid Kleckner [Thu, 2 May 2019 17:45:54 +0000 (17:45 +0000)]
Use primary template parameter names for variable template debug info

Summary:
Fixes PR41677

Consider:
  template <typename LHS, typename RHS> constexpr bool is_same_v = false;
  template <typename T> constexpr bool is_same_v<T, T> = true;
  template constexpr bool is_same_v<int, int>;

Before this change, when emitting debug info for the
`is_same_v<int, int>` global variable, clang would crash because it
would try to use the template parameter list from the partial
specialization to give parameter names to template arguments. This
doesn't work in general, since a partial specialization can have fewer
arguments than the primary template. Therefore, always use the primary
template. Hypothetically we could try to use the parameter names from
the partial specialization when possible, but it's not clear this really
helps debugging in practice.

Reviewers: JDevlieghere, aprantl, ormris, dblaikie

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoDo not warn on switches over enums that do not use [[maybe_unused]] enumerators
David Blaikie [Thu, 2 May 2019 16:30:49 +0000 (16:30 +0000)]
Do not warn on switches over enums that do not use [[maybe_unused]] enumerators

PR36231, [dcl.attr.unused]p3

Reviewers: aaron.ballman

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

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

5 years ago[OpenCL] Fix initialisation of this via pointer.
Anastasia Stulova [Thu, 2 May 2019 16:10:50 +0000 (16:10 +0000)]
[OpenCL] Fix initialisation of this via pointer.

When the expression used to initialise 'this' has a pointer type,
check the address space of the pointee type instead of the pointer
type to decide whether an address space cast is required.
It is the pointee type that carries the address space qualifier.

Fixing PR41674.

Patch by kpet (Kevin Petit)!

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

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

5 years ago[OpenCL] Deduce static data members to __global addr space.
Anastasia Stulova [Thu, 2 May 2019 14:40:40 +0000 (14:40 +0000)]
[OpenCL] Deduce static data members to __global addr space.

Similarly to static variables in OpenCL, static class data
members should be deduced to __global addr space.

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

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

5 years agoFix typo in test case.
Akira Hatanaka [Thu, 2 May 2019 07:38:07 +0000 (07:38 +0000)]
Fix typo in test case.

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

5 years agoAdapt -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO
Stephan Bergmann [Thu, 2 May 2019 06:40:33 +0000 (06:40 +0000)]
Adapt -fsanitize=function to SANITIZER_NON_UNIQUE_TYPEINFO

This follows up after b7692bc3e9ad2691fc07261904b88fb15f30696b "[UBSan] Fix
isDerivedFromAtOffset on iOS ARM64" fixed the RTTI comparison in
isDerivedFromAtOffset on just one platform and then
a25a2c7c9a7e1e328a5bd8274d2d86b1fadc4692 "Always compare C++ typeinfo (based on
libstdc++ implementation)" extended that fix to more platforms.

But there is another RTTI comparison for -fsanitize=function generated in
clang's CodeGenFunction::EmitCall as just a pointer comparison.  For
SANITIZER_NON_UNIQUE_TYPEINFO platforms this needs to be extended to also do
string comparison.  For that, __ubsan_handle_function_type_mismatch[_abort]
takes the two std::type_info pointers as additional parameters now, checks them
internally for potential equivalence, and returns without reporting failure if
they turn out to be equivalent after all.  (NORETURN needed to be dropped from
the _abort variant for that.)  Also these functions depend on ABI-specific RTTI
now, so needed to be moved from plain UBSAN_SOURCES (ubsan_handlers.h/cc) to
UBSAN_CXXABI_SOURCES (ubsan_handlers_cxx.h/cc), but as -fsanitize=function is
only supported in C++ mode that's not a problem.

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

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

5 years agoReplace ad-hoc tracking of pattern for an instantiated class-scope
Richard Smith [Thu, 2 May 2019 00:49:14 +0000 (00:49 +0000)]
Replace ad-hoc tracking of pattern for an instantiated class-scope
explicit function specialization with the MemberSpecializationInfo used
everywhere else.

Not NFC: the ad-hoc pattern tracking was not being serialized /
deserialized properly. That's fixed here.

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

5 years agoDiagnose non-dependent qualified friend function template declarations
Richard Smith [Thu, 2 May 2019 00:49:05 +0000 (00:49 +0000)]
Diagnose non-dependent qualified friend function template declarations
that don't match any existing declaration. Don't get confused and treat
such declarations as template *specializations*.

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

5 years ago[COFF, ARM64] Align global symbol by size for ARM64 MSVC ABI
Tom Tan [Thu, 2 May 2019 00:38:14 +0000 (00:38 +0000)]
[COFF, ARM64] Align global symbol by size for ARM64 MSVC ABI

According to alignment section in below ARM64 ABI document, MSVC could increase
alignment of global data based on its total size. Clang doesn't do this. Compile
the same symbol into different alignments by Clang and MSVC could cause link
error because some instruction encodings, like 64-bit LDR/STR with immediate,
require the target to be 8 bytes aligned, and linker could choose code stream
with such LDR/STR instruction from MSVC and 4 bytes aligned data from Clang into
final image, which actually cannot be linked together
(see https://bugs.llvm.org/show_bug.cgi?id=41506 for more details).

https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019#alignment

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

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

5 years agoConsume unexpected "template" keywords after "using"
Richard Trieu [Wed, 1 May 2019 23:33:49 +0000 (23:33 +0000)]
Consume unexpected "template" keywords after "using"

The parser was dealing with unexpected "template" keywords after "using"
keywords too late and putting the parser into the wrong state, which could
lead to a crash down the line.  This change allows the parser to consume the
bad "template" keywords earlier, and continue parsing as if "template" was
never there to begin with for better error recovery.

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

5 years agoRevert r359717, "Make check-clang depend on the clang-check binary always"
Nico Weber [Wed, 1 May 2019 23:32:38 +0000 (23:32 +0000)]
Revert r359717, "Make check-clang depend on the clang-check binary always"

The Tooling tests do have a lit.local.cfg with

    if not config.root.clang_staticanalyzer:
        config.unsupported = True

so what's wrong isn't the missing dep, but that lit prints a warning for
the binary missing. This will need a different kind of fix.

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

5 years ago[analyzer] Fix buildbot failures caused by a forgotten initialization
Kristof Umann [Wed, 1 May 2019 21:09:32 +0000 (21:09 +0000)]
[analyzer] Fix buildbot failures caused by a forgotten initialization

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

5 years agoMake clang/utils/creduce-clang-crash.py executable
Reid Kleckner [Wed, 1 May 2019 20:15:39 +0000 (20:15 +0000)]
Make clang/utils/creduce-clang-crash.py executable

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

5 years ago[analyzer] Don't display implementation checkers under -analyzer-checker-help, but...
Kristof Umann [Wed, 1 May 2019 19:56:47 +0000 (19:56 +0000)]
[analyzer] Don't display implementation checkers under -analyzer-checker-help, but do under the new flag -analyzer-checker-help-hidden

During my work on analyzer dependencies, I created a great amount of new
checkers that emitted no diagnostics at all, and were purely modeling some
function or another.

However, the user shouldn't really disable/enable these by hand, hence this
patch, which hides these by default. I intentionally chose not to hide alpha
checkers, because they have a scary enough name, in my opinion, to cause no
surprise when they emit false positives or cause crashes.

The patch introduces the Hidden bit into the TableGen files (you may remember
it before I removed it in D53995), and checkers that are either marked as
hidden, or are in a package that is marked hidden won't be displayed under
-analyzer-checker-help. -analyzer-checker-help-hidden, a new flag meant for
developers only, displays the full list.

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

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

5 years agoMake check-clang depend on the clang-check binary always
Nico Weber [Wed, 1 May 2019 19:34:00 +0000 (19:34 +0000)]
Make check-clang depend on the clang-check binary always

check-clang (the target that runs all clang tests) used to
only depend on clang-check (a binary like clang-tidy,
clang-refactor, etc) if the static analyzer is enabled.
However, several lit tests call clang-check unconditionally,
so always depend on it.

Fixes a "could not find clang-check" lit warning in clean builds with
the static analyzer disabled.

Also sort the deps in the CMake file and put just one dep on each line.

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

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

5 years ago[Parser] Avoid correcting delayed typos in array subscript multiple times.
Volodymyr Sapsai [Wed, 1 May 2019 19:24:50 +0000 (19:24 +0000)]
[Parser] Avoid correcting delayed typos in array subscript multiple times.

We correct some typos in `ActOnArraySubscriptExpr` and
`ActOnOMPArraySectionExpr`, so when their result is `ExprError`, we can
end up correcting delayed typos in the same expressions again. In
general it is OK but when `NumTypos` is incorrect, we can hit the
assertion

> Assertion failed: (Entry != DelayedTypos.end() && "Failed to get the state for a TypoExpr!"), function getTypoExprState, file clang/lib/Sema/SemaLookup.cpp, line 5219.

Fix by replacing some subscript `ExprResult` with typo-corrected expressions
instead of keeping the original expressions. Thus if original expressions
contained `TypoExpr`, we'll use corrected expressions instead of trying to
correct them again.

rdar://problem/47403222

Reviewers: rsmith, erik.pilkington, majnemer

Reviewed By: erik.pilkington

Subscribers: jkorous, dexonsmith, cfe-commits

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

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

5 years ago[clang-format] Fix a bug in AlignConsecutiveDeclarations.
Owen Pan [Wed, 1 May 2019 18:23:44 +0000 (18:23 +0000)]
[clang-format] Fix a bug in AlignConsecutiveDeclarations.

Fixes PR37175

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

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

5 years ago[Driver] Explicitly request platform rtlib in the Driver pic test
Petr Hosek [Wed, 1 May 2019 16:52:45 +0000 (16:52 +0000)]
[Driver] Explicitly request platform rtlib in the Driver pic test

This test checks whether crtbegin.o and crtend.o appear on the link
line, but names of these files may be affected by the choice of the
rtlib, specifically when compiler-rt is used as the default rtlib
the names will be clang_rt.crtbegin.o and clang_rt.crtend.o instead
of crtbeginS.o and crtendS.o. To avoid the test failure, explicitly
request to use the platform rtlib.

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

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

5 years agoBump DIAG_SIZE_SEMA, as we've hit it.
Scott Linder [Wed, 1 May 2019 16:45:49 +0000 (16:45 +0000)]
Bump DIAG_SIZE_SEMA, as we've hit it.

$ grep 'DIAG_SIZE_SEMA          =' include/clang/Basic/DiagnosticIDs.h
      DIAG_SIZE_SEMA          = 4000,
$ grep DIAG $(build)/tools/clang/include/clang/Basic/DiagnosticSemaKinds.inc | wc -l
3499

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

5 years ago[analyzer][tests][NFC] Add EOF newlines, normalize reference expected files
Hubert Tong [Wed, 1 May 2019 15:57:00 +0000 (15:57 +0000)]
[analyzer][tests][NFC] Add EOF newlines, normalize reference expected files

Reference expected files not ending with a newline are normalized to
have said newlines. Additionally `plist-macros-with-expansion.cpp.plist`
is modified to add a line that is ignored by `%diff_plist`, but not by
the more sensitive pattern proposed by
http://lists.llvm.org/pipermail/cfe-dev/2019-April/061904.html for
`%normalize_plist`.

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

5 years ago[analyzer][tests] Use diff_plist, correct order of arguments for missed cases; NFC
Hubert Tong [Wed, 1 May 2019 15:53:56 +0000 (15:53 +0000)]
[analyzer][tests] Use diff_plist, correct order of arguments for missed cases; NFC

For various files under `clang/test/Analysis`, D52036 applied
`%diff_plist` to replace `diff` invocations with certain options and
D56340 swapped the order of the arguments so that the reference file
comes first. The tests that used `tail` to filter the test output were
not modified accordingly. This patch applies the corresponding update
to those tests.

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

5 years ago[clang-format] Fix bug that misses some function-like macro usages
Owen Pan [Wed, 1 May 2019 15:03:41 +0000 (15:03 +0000)]
[clang-format] Fix bug that misses some function-like macro usages

Fixes PR41483

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

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

5 years agoChange llvm-{objdump,readobj} -long-option to --long-option or well-known short optio...
Fangrui Song [Wed, 1 May 2019 09:30:45 +0000 (09:30 +0000)]
Change llvm-{objdump,readobj} -long-option to --long-option or well-known short options in tests. NFC

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

5 years agolib/Header: Fix Visual Studio builds try #2
Tom Stellard [Wed, 1 May 2019 06:18:03 +0000 (06:18 +0000)]
lib/Header: Fix Visual Studio builds try #2

Summary:
This is a follow up to r355253 and a better fix than the first attempt
which was r359257.

We can't install anything from ${CMAKE_CFG_INTDIR}, because this value
is only defined at build time, but we still must make sure to copy the
headers into ${CMAKE_CFG_INTDIR}/lib/clang/$VERSION/include, because the lit
tests look for headers there.  So for this fix we revert to the
old behavior of copying the headers to ${CMAKE_CFG_INTDIR}/lib/clang/$VERSION/include
during the build and then installing them from the source tree.

Reviewers: smeenai, vzakhari, phosek

Reviewed By: smeenai, vzakhari

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years agoFix auto-init test
JF Bastien [Tue, 30 Apr 2019 23:27:28 +0000 (23:27 +0000)]
Fix auto-init test

r359628 changed the initialization of padding to follow C, but I didn't update the C++ tests.

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

5 years ago[WebAssembly] Use the "wasm32-wasi" triple in tests
Dan Gohman [Tue, 30 Apr 2019 23:06:07 +0000 (23:06 +0000)]
[WebAssembly] Use the "wasm32-wasi" triple in tests

Similar to https://reviews.llvm.org/D61334, update clang tests to use the
"wasm32-wasi" triple, removing the "-musl" environment and omitting the
"-unknown" vendor.

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

Reviewer: sbc100

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

5 years agoVariable auto-init: don't initialize aggregate padding of all aggregates
JF Bastien [Tue, 30 Apr 2019 22:56:53 +0000 (22:56 +0000)]
Variable auto-init: don't initialize aggregate padding of all aggregates

Summary:
C guarantees that brace-init with fewer initializers than members in the
aggregate will initialize the rest of the aggregate as-if it were static
initialization. In turn static initialization guarantees that padding is
initialized to zero bits.

Quoth the Standard:

C17 6.7.9 Initialization ❡21

If there are fewer initializers in a brace-enclosed list than there are elements
or members of an aggregate, or fewer characters in a string literal used to
initialize an array of known size than there are elements in the array, the
remainder of the aggregate shall be initialized implicitly the same as objects
that have static storage duration.

C17 6.7.9 Initialization ❡10

If an object that has automatic storage duration is not initialized explicitly,
its value is indeterminate. If an object that has static or thread storage
duration is not initialized explicitly, then:

 * if it has pointer type, it is initialized to a null pointer;
 * if it has arithmetic type, it is initialized to (positive or unsigned) zero;
 * if it is an aggregate, every member is initialized (recursively) according to
   these rules, and any padding is initialized to zero bits;
 * if it is a union, the first named member is initialized (recursively)
   according to these rules, and any padding is initialized to zero bits;

<rdar://problem/50188861>

Reviewers: glider, pcc, kcc, rjmccall, erik.pilkington

Subscribers: jkorous, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years agoRemove two unnecessary wrappers of canPassInRegisters
Reid Kleckner [Tue, 30 Apr 2019 22:23:20 +0000 (22:23 +0000)]
Remove two unnecessary wrappers of canPassInRegisters

These extra layers aren't necessary.

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

5 years agoSet LoopInterleaved in the PassManagerBuilder.
Alina Sbirlea [Tue, 30 Apr 2019 21:29:23 +0000 (21:29 +0000)]
Set LoopInterleaved in the PassManagerBuilder.

Summary: Corresponds to D61030.

Subscribers: jlebar, cfe-commits, llvm-commits

Tags: #clang

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

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

5 years ago[Driver] Support compiler-rt crtbegin.o/crtend.o for Linux
Petr Hosek [Tue, 30 Apr 2019 19:35:14 +0000 (19:35 +0000)]
[Driver] Support compiler-rt crtbegin.o/crtend.o for Linux

When compiler-rt is selected as the runtime library for Linux targets
use its crtbegin.o/crtend.o implemenetation rather than platform one
if available.

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

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