]> granicus.if.org Git - clang/log
clang
6 years agoSet dso_local on vtables.
Rafael Espindola [Thu, 22 Mar 2018 20:33:01 +0000 (20:33 +0000)]
Set dso_local on vtables.

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

6 years agoSet dso_local on builtin functions.
Rafael Espindola [Thu, 22 Mar 2018 18:03:13 +0000 (18:03 +0000)]
Set dso_local on builtin functions.

The difference between CreateRuntimeFunction and CreateBuiltinFunction
is that CreateBuiltinFunction would not set dllimport or dso_local.

To keep the current semantics, just forward to CreateRuntimeFunction
with Local=true so it doesn't add dllimport.

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

6 years ago[clang-format] Fix ObjC style guesser to also iterate over child lines
Ben Hamilton [Thu, 22 Mar 2018 17:37:19 +0000 (17:37 +0000)]
[clang-format] Fix ObjC style guesser to also iterate over child lines

Summary:
When I wrote `ObjCHeaderStyleGuesser`, I incorrectly assumed the
correct way to iterate over all tokens in `AnnotatedLine` was to
iterate over the linked list tokens starting with
`AnnotatedLine::First`.

However, `AnnotatedLine` also contains a vector
`AnnotedLine::Children` with child `AnnotedLine`s which have their own
tokens which we need to iterate over.

Because I didn't iterate over the tokens in the children lines, the
ObjC style guesser would fail on syntax like:

  #define FOO ({ NSString *s = ... })

as the statement(s) inside { ... } are child lines.

This fixes the bug and adds a test. I confirmed the test
failed before the fix, and passed after the fix.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, Wizard

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

6 years ago[OpenMP][Clang] Add call to global data sharing stack initialization on the workers...
Gheorghe-Teodor Bercea [Thu, 22 Mar 2018 17:33:27 +0000 (17:33 +0000)]
[OpenMP][Clang] Add call to global data sharing stack initialization on the workers side

Summary: The workers also need to initialize the global stack. The call to the initialization function needs to happen after the kernel_init() function is called by the master. This ensures that the per-team data structures of the runtime have been initialized.

Reviewers: ABataev, grokos, carlo.bertolli, caomhin

Reviewed By: ABataev

Subscribers: jholewinski, guansong, cfe-commits

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

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

6 years ago[CUDA] add REQUIRES fields for CUDA variants of LTO tests.
Artem Belevich [Thu, 22 Mar 2018 16:47:41 +0000 (16:47 +0000)]
[CUDA] add REQUIRES fields for CUDA variants of LTO tests.

Also relax checking for nvptx triple. This should avoid test failure if
the test is executed on 32-bit platform.

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

6 years agoclang-format: Narrow down raw string literal line break exception.
Daniel Jasper [Thu, 22 Mar 2018 14:43:54 +0000 (14:43 +0000)]
clang-format: Narrow down raw string literal line break exception.

For multiline raw string literals, we generally want to respect the
author's choice of linebreak before the 'R"(' as the rest of the raw
string might be aligned to it and we cannot (commonly) modify the
content.

For single-line raw string literals, this doesn't make any sense and so
we should just treat them as regular string literals in this regard.

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

6 years agoclang-format: Fix SpacesInParentheses with fully qualified names.
Daniel Jasper [Thu, 22 Mar 2018 14:30:28 +0000 (14:30 +0000)]
clang-format: Fix SpacesInParentheses with fully qualified names.

When SpacesInParentheses is set to true clang-format does not add a
space before fully qualified names. For example:

  do_something(::globalVar );

Fix by Darby Payne. Thank you!

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

6 years ago[CodeGen] Emit DWARF "constructor" calling convention
Jonas Devlieghere [Thu, 22 Mar 2018 13:53:30 +0000 (13:53 +0000)]
[CodeGen] Emit DWARF "constructor" calling convention

Now that LLVM has support for emitting calling conventions in DWARF (see
r328191) have clang emit them.

Patch by: Adrien Guinet

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

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

6 years ago[clang-format] Add a few more Core Graphics identifiers to ObjC heuristic
Ben Hamilton [Thu, 22 Mar 2018 03:25:22 +0000 (03:25 +0000)]
[clang-format] Add a few more Core Graphics identifiers to ObjC heuristic

Summary:
We received reports of the Objective-C style guesser getting a false
negative on header files like:

CGSize SizeOfThing(MyThing thing);

This adds more Core Graphics identifiers to the Objective-C style
guesser.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, djasper

Reviewed By: jolesiak, djasper

Subscribers: krasimir, klimek, cfe-commits

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

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

6 years ago[clang-format] Don't insert space between r_paren and 'new' in ObjC decl
Ben Hamilton [Thu, 22 Mar 2018 03:23:53 +0000 (03:23 +0000)]
[clang-format] Don't insert space between r_paren and 'new' in ObjC decl

Summary:
Previously, clang-format would insert a space between
the closing parenthesis and 'new' in the following valid Objective-C
declaration:

  + (instancetype)new;

This was because 'new' is treated as a keyword, not an identifier.

TokenAnnotator::spaceRequiredBefore() already handled the case where
r_paren came before an identifier, so this diff extends it to
handle r_paren before 'new'.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: djasper, jolesiak, stephanemoore

Reviewed By: djasper, jolesiak, stephanemoore

Subscribers: stephanemoore, klimek, cfe-commits

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

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

6 years agoImprove -Winfinite-recursion
Robert Widmann [Thu, 22 Mar 2018 03:16:23 +0000 (03:16 +0000)]
Improve -Winfinite-recursion

Summary: Rewrites -Winfinite-recursion to remove the state dictionary and explore paths in loops - especially infinite loops.  The new check now detects recursion in loop bodies dominated by a recursive call.

Reviewers: rsmith, rtrieu

Reviewed By: rtrieu

Subscribers: lebedev.ri, cfe-commits

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

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

6 years ago[Frontend] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Thu, 22 Mar 2018 00:53:26 +0000 (00:53 +0000)]
[Frontend] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoFix for LLVM change (Transforms/Utils/Local.h -> Analysis/Utils/Local.h)
David Blaikie [Wed, 21 Mar 2018 22:34:27 +0000 (22:34 +0000)]
Fix for LLVM change (Transforms/Utils/Local.h -> Analysis/Utils/Local.h)

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

6 years ago[CUDA] Disable LTO for device-side compilations.
Artem Belevich [Wed, 21 Mar 2018 22:22:59 +0000 (22:22 +0000)]
[CUDA] Disable LTO for device-side compilations.

This fixes host-side LTO during CUDA compilation. Before, LTO
pipeline construction was clashing with CUDA pipeline construction.

At the moment there's no point doing LTO on device side as each
device-side TU is a complete program.  We will need to figure out
compilation pipeline construction for the device-side LTO when we
have working support for multi-TU device-side CUDA compilation.

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

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

6 years ago[NVPTX] Make tensor shape part of WMMA intrinsic's name.
Artem Belevich [Wed, 21 Mar 2018 21:55:02 +0000 (21:55 +0000)]
[NVPTX] Make tensor shape part of WMMA intrinsic's name.

This is needed for the upcoming implementation of the
new 8x32x16 and 32x8x16 variants of WMMA instructions
introduced in CUDA 9.1.

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

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

6 years ago[Modules] Fix creating fake definition data for lambdas.
Volodymyr Sapsai [Wed, 21 Mar 2018 21:28:54 +0000 (21:28 +0000)]
[Modules] Fix creating fake definition data for lambdas.

During reading C++ definition data for lambda we can access
CXXRecordDecl representing lambda before we finished reading the
definition data. This can happen by reading a captured variable which is
VarDecl, then reading its decl context which is CXXMethodDecl `operator()`,
then trying to merge redeclarable methods and accessing
enclosing CXXRecordDecl. The call stack looks roughly like

    VisitCXXRecordDecl
      ReadCXXRecordDefinition
        VisitVarDecl
          VisitCXXMethodDecl
            mergeRedeclarable
              getPrimaryContextForMerging

If we add fake definition data at this point, later we'll hit the assertion

    Assertion failed: (!DD.IsLambda && !MergeDD.IsLambda && "faked up lambda definition?"), function MergeDefinitionData, file clang/lib/Serialization/ASTReaderDecl.cpp, line 1675.

The fix is to assign definition data before reading it. Fixes PR32556.

rdar://problem/37461072

Reviewers: rsmith, bruno

Reviewed By: rsmith

Subscribers: cfe-commits, jkorous-apple, aprantl

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

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

6 years ago[Builtins] Overload __builtin_operator_new/delete to allow forwarding to usual alloca...
Eric Fiselier [Wed, 21 Mar 2018 19:19:48 +0000 (19:19 +0000)]
[Builtins] Overload __builtin_operator_new/delete to allow forwarding to usual allocation/deallocation functions.

Summary:
Libc++'s default allocator uses `__builtin_operator_new` and `__builtin_operator_delete` in order to allow the calls to new/delete to be ellided. However, libc++ now needs to support over-aligned types in the default allocator. In order to support this without disabling the existing optimization Clang needs to support calling the aligned new overloads from the builtins.

See llvm.org/PR22634 for more information about the libc++ bug.

This patch changes `__builtin_operator_new`/`__builtin_operator_delete` to call any usual `operator new`/`operator delete` function. It does this by performing overload resolution with the arguments passed to the builtin to determine which allocation function to call. If the selected function is not a usual allocation function a diagnostic is issued.

One open issue is if the `align_val_t` overloads should be considered "usual" when `LangOpts::AlignedAllocation` is disabled.

In order to allow libc++ to detect this new behavior the value for `__has_builtin(__builtin_operator_new)` has been updated to `201802`.

Reviewers: rsmith, majnemer, aaron.ballman, erik.pilkington, bogner, ahatanak

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years ago[Fuchsia] Don't install libc++, libc++abi or libunwind on Darwin
Petr Hosek [Wed, 21 Mar 2018 16:48:26 +0000 (16:48 +0000)]
[Fuchsia] Don't install libc++, libc++abi or libunwind on Darwin

The Clang driver doesn't currently know how to use the libraries
that are shipped as part of the toolchain so there's no reason to
ship them at all.

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

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

6 years agoclang-interpreter example cmake fix
Luke Cheeseman [Wed, 21 Mar 2018 12:05:19 +0000 (12:05 +0000)]
clang-interpreter example cmake fix

Add in a space when appending the export to the linker options. Without
the space the export is appended onto whatever the last link option
was, which might be a file.

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

6 years ago[ASTMatchers] Remove extra qualifier for consistency (LibASTMatchersReference.html)
Clement Courbet [Wed, 21 Mar 2018 10:54:29 +0000 (10:54 +0000)]
[ASTMatchers] Remove extra qualifier for consistency (LibASTMatchersReference.html)

+ Regenerate doc.

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

6 years ago[ASTMatchers] Regenerate doc.
Clement Courbet [Wed, 21 Mar 2018 10:48:00 +0000 (10:48 +0000)]
[ASTMatchers] Regenerate doc.

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

6 years agoSet dso_local on runtime variables.
Rafael Espindola [Wed, 21 Mar 2018 01:30:16 +0000 (01:30 +0000)]
Set dso_local on runtime variables.

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

6 years agoRevert r326782 "[analyzer] CStringChecker.cpp: Remove the duplicated check...".
Artem Dergachev [Wed, 21 Mar 2018 00:57:37 +0000 (00:57 +0000)]
Revert r326782 "[analyzer] CStringChecker.cpp: Remove the duplicated check...".

It seems that the refactoring was causing a functional change and some warnings
have disappeared.

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

6 years ago[analyzer] Suppress more MallocChecker positives in smart pointer destructors.
Artem Dergachev [Wed, 21 Mar 2018 00:49:47 +0000 (00:49 +0000)]
[analyzer] Suppress more MallocChecker positives in smart pointer destructors.

r326249 wasn't quite enough because we often run out of inlining stack depth
limit and for that reason fail to see the atomics we're looking for.

Add a more straightforward false positive suppression that is based on the name
of the class. I.e. if we're releasing a pointer in a destructor of a "something
shared/intrusive/reference/counting something ptr/pointer something", then any
use-after-free or double-free that occurs later would likely be a false
positive.

rdar://problem/38013606

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

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 21 Mar 2018 00:14:43 +0000 (00:14 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[Modules] Honor -fmodule-name when handling private framework modules
Bruno Cardoso Lopes [Tue, 20 Mar 2018 22:36:39 +0000 (22:36 +0000)]
[Modules] Honor -fmodule-name when handling private framework modules

When skipping building the module for a private framework module,
LangOpts.CurrentModule isn't enough for implict modules builds; for
instance, in case a private module is built while building a public one,
LangOpts.CurrentModule doesn't reflect the -fmodule-name being passed
down, but instead the module name which triggered the build.

Store the actual -fmodule-name in LangOpts.ModuleName and actually
check a name was provided during compiler invocation in order to
skip building the private module.

rdar://problem/38434694

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

6 years agoChange ImplicitConverionKind comments to refer to C++ stable names[NFC]
Erich Keane [Tue, 20 Mar 2018 22:05:01 +0000 (22:05 +0000)]
Change ImplicitConverionKind comments to refer to C++ stable names[NFC]

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

6 years agoDelete BuiltinCC. NFC.
Rafael Espindola [Tue, 20 Mar 2018 22:02:57 +0000 (22:02 +0000)]
Delete BuiltinCC. NFC.

It is always identical to RuntimeCC.

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

6 years agoAdd CHECKs for a few declarations. NFC.
Rafael Espindola [Tue, 20 Mar 2018 21:54:14 +0000 (21:54 +0000)]
Add CHECKs for a few declarations. NFC.

We were just missing test coverage for this.

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

6 years ago[format] Eliminate global destructors.
Benjamin Kramer [Tue, 20 Mar 2018 21:52:19 +0000 (21:52 +0000)]
[format] Eliminate global destructors.

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

6 years ago[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor...
Eugene Zelenko [Tue, 20 Mar 2018 21:08:59 +0000 (21:08 +0000)]
[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[format] Initialize regex lazily
Benjamin Kramer [Tue, 20 Mar 2018 20:43:12 +0000 (20:43 +0000)]
[format] Initialize regex lazily

No need to pay for this on program startup, and also no need to destroy
it on process end.

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

6 years agoSet dso_local on string literals.
Rafael Espindola [Tue, 20 Mar 2018 20:42:55 +0000 (20:42 +0000)]
Set dso_local on string literals.

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

6 years ago[AArch64] Add vmulxh_lane fp16 vector intrinsic
Abderrazek Zaafrani [Tue, 20 Mar 2018 20:37:31 +0000 (20:37 +0000)]
[AArch64] Add vmulxh_lane fp16 vector intrinsic

https://reviews.llvm.org/D44591

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

6 years agoSet dso_local for runtime function.
Rafael Espindola [Tue, 20 Mar 2018 20:27:30 +0000 (20:27 +0000)]
Set dso_local for runtime function.

This is another case where there is special logic for adding dllimport
and so we cannot use setGVProperties.

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

6 years agoBasic: support PreserveMost and PreserveAll on Windows ARM
Saleem Abdulrasool [Tue, 20 Mar 2018 17:33:26 +0000 (17:33 +0000)]
Basic: support PreserveMost and PreserveAll on Windows ARM

Do not ignore these calling conventions on Windows ARM.  They are used
by the swift runtime for certain calls.

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

6 years ago[NVPTX] Make tensor load/store intrinsics overloaded.
Artem Belevich [Tue, 20 Mar 2018 17:18:59 +0000 (17:18 +0000)]
[NVPTX] Make tensor load/store intrinsics overloaded.

This way we can support address-space specific variants without explicitly
encoding the space in the name of the intrinsic. Less intrinsics to deal with ->
less boilerplate.

Added a bit of tablegen magic to match/replace an intrinsics with a pointer
argument in particular address space with the space-specific instruction
variant.

Updated tests to use non-default address spaces.

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

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

6 years agoSet dso_local for CFConstantStringClassReference.
Rafael Espindola [Tue, 20 Mar 2018 15:48:00 +0000 (15:48 +0000)]
Set dso_local for CFConstantStringClassReference.

This one cannot use setGVProperties since it has special logic for
when it is dllimport or not.

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

6 years agoSet dso_local for guid decls.
Rafael Espindola [Tue, 20 Mar 2018 15:42:58 +0000 (15:42 +0000)]
Set dso_local for guid decls.

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

6 years ago[OPENMP, NVPTX] Codegen for target distribute parallel combined
Alexey Bataev [Tue, 20 Mar 2018 15:41:05 +0000 (15:41 +0000)]
[OPENMP, NVPTX] Codegen for target distribute parallel combined
constructs in generic mode.

Fixed codegen for distribute parallel combined constructs. We have to
pass and read the shared lower and upper bound from the distribute
region in the inner parallel region. Patch is for generic mode.

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

6 years ago[clang-format] Fix ObjC selectors with multiple params passed to macro
Ben Hamilton [Tue, 20 Mar 2018 14:53:25 +0000 (14:53 +0000)]
[clang-format] Fix ObjC selectors with multiple params passed to macro

Summary:
Objective-C selectors with arguments take the form of:

foo:
foo:bar:
foo:bar:baz:

These can be passed to a macro, like NS_SWIFT_NAME():

https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html

and must never have spaces inserted around the colons.

Previously, there was logic in TokenAnnotator's tok::colon parser to
handle the single-argument case, but it failed for the
multiple-argument cases.

This diff fixes the bug and adds more tests.

Test Plan: New tests added. Ran tests with:
  % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, djasper, Wizard

Reviewed By: jolesiak, Wizard

Subscribers: klimek, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Globalization of the private redeclarations.
Alexey Bataev [Tue, 20 Mar 2018 14:45:59 +0000 (14:45 +0000)]
[OPENMP, NVPTX] Globalization of the private redeclarations.

If the generic codegen is enabled and private copy of the original
variable escapes the declaration context, this private copy should be
globalized just like it was the original variable.

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

6 years agoBackport changes from llvm/.clang_tidy to clang/.clang_tidy configs
Ilya Biryukov [Tue, 20 Mar 2018 14:39:12 +0000 (14:39 +0000)]
Backport changes from llvm/.clang_tidy to clang/.clang_tidy configs

Summary: LLVM .clang_tidy seems to be more up-to-date.

Reviewers: alexfh, simark

Reviewed By: alexfh

Subscribers: simark, cfe-commits

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

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

6 years ago[analyzer] Fix the crash in IteratorChecker.cpp when 'SymbolConjured' has a null...
Henry Wong [Tue, 20 Mar 2018 09:27:02 +0000 (09:27 +0000)]
[analyzer] Fix the crash in IteratorChecker.cpp when 'SymbolConjured' has a null Stmt.

When the loop has a null terminator statement and sets 'widen-loops=true', 'invalidateRegions' will constructs the 'SymbolConjured' with null 'Stmt'. And this will lead to a crash in 'IteratorChecker.cpp'. This patch use 'dyn_cast_or_null<>' instead of 'dyn_cast<>' in IteratorChecker.cpp.

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

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

6 years ago[ms] Parse #pragma optimize and ignore it behind its own flag
Hans Wennborg [Tue, 20 Mar 2018 08:53:11 +0000 (08:53 +0000)]
[ms] Parse #pragma optimize and ignore it behind its own flag

This allows users to turn off warnings about this pragma specifically,
while still receiving warnings about other ignored pragmas.

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

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

6 years agoProperly construct `inline` members without initializers
George Burgess IV [Tue, 20 Mar 2018 03:27:44 +0000 (03:27 +0000)]
Properly construct `inline` members without initializers

Digging through commit logs, it appears the checks in this block predate
`inline` class variables. With them, we fail to emit dynamic
initializers for members that don't have an explicit initializer, and we
won't go out of our way to instantiate the class denoted by
`Var->getType()`.

Fixes PR35599.

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

6 years ago[CodeGen] Ignore OpaqueValueExprs that are unique references to their
Akira Hatanaka [Tue, 20 Mar 2018 01:47:58 +0000 (01:47 +0000)]
[CodeGen] Ignore OpaqueValueExprs that are unique references to their
source expressions when iterating over a PseudoObjectExpr's semantic
subexpression list.

Previously the loop in emitPseudoObjectExpr would emit the IR for each
OpaqueValueExpr that was in a PseudoObjectExpr's semantic-form
expression list and use the result when the OpaqueValueExpr later
appeared in other expressions. This caused an assertion failure when
AggExprEmitter tried to copy the result of an OpaqueValueExpr and the
copied type didn't have trivial copy/move constructors or assignment
operators.

This patch adds flag IsUnique to OpaqueValueExpr which indicates it is a
unique reference to its source expression (it is not used in multiple
places). The loop in emitPseudoObjectExpr ignores OpaqueValueExprs that
are unique and CodeGen visitors simply traverse the source expressions
of such OpaqueValueExprs.

rdar://problem/34363596

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

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

6 years ago[analyzer] Improve performance of NoStoreFuncVisitor
George Karpenkov [Tue, 20 Mar 2018 01:16:46 +0000 (01:16 +0000)]
[analyzer] Improve performance of NoStoreFuncVisitor

Compute modifying frames lazily on demand.

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

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

6 years agoAllow builtins for Cross-DSO CFI on Android
Petr Hosek [Tue, 20 Mar 2018 00:56:08 +0000 (00:56 +0000)]
Allow builtins for Cross-DSO CFI on Android

This is needed to avoid the test failure in case when compiler-rt
is set as the default runtime library for Clang.

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

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

6 years ago[analyzer] Fix the assertion failure when static globals are used in lambda by reference
George Karpenkov [Tue, 20 Mar 2018 00:20:58 +0000 (00:20 +0000)]
[analyzer] Fix the assertion failure when static globals are used in lambda by reference

Also use the opportunity to clean up the code and remove unnecessary duplication.

rdar://37625895

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

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

6 years ago[CodeGen] Add funclet token to ARC marker
Shoaib Meenai [Mon, 19 Mar 2018 19:34:39 +0000 (19:34 +0000)]
[CodeGen] Add funclet token to ARC marker

The inline assembly generated for the ARC autorelease elision marker
must have a funclet token if it's emitted inside a funclet, otherwise
the inline assembly (and all subsequent code in the funclet) will be
marked unreachable. r324689 fixed this issue for regular inline assembly
blocks.

Note that clang only emits the marker at -O0, so this only fixes that
case. The optimizations case (where the marker is emitted by the
backend) will be fixed in a separate change.

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

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

6 years ago[OPENMP, NVPTX] Reworked castToType() function, NFC.
Alexey Bataev [Mon, 19 Mar 2018 17:53:56 +0000 (17:53 +0000)]
[OPENMP, NVPTX] Reworked castToType() function, NFC.

Reworked function castToType to use more frontend functionality rather
than the backend.

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

6 years ago[ObjC] Allow declaring __weak pointer fields in C structs in ARC.
Akira Hatanaka [Mon, 19 Mar 2018 17:38:40 +0000 (17:38 +0000)]
[ObjC] Allow declaring __weak pointer fields in C structs in ARC.

This patch uses the infrastructure added in r326307 for enabling
non-trivial fields to be declared in C structs to allow __weak fields in
C structs in ARC.

This recommits r327206, which was reverted because it caused
module-enabled builders to fail. I discovered that the
CXXRecordDecl::CanPassInRegisters flag wasn't being set correctly in
some cases after I moved it to RecordDecl.

Thanks to Eric Liu for helping me investigate the bug.

rdar://problem/33599681

https://reviews.llvm.org/D44095

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

6 years ago[OPENMP] Fix build with MSVC, NFC.
Alexey Bataev [Mon, 19 Mar 2018 17:18:13 +0000 (17:18 +0000)]
[OPENMP] Fix build with MSVC, NFC.

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

6 years ago[OPENMP, NVPTX] Emit correct thread id.
Alexey Bataev [Mon, 19 Mar 2018 17:04:07 +0000 (17:04 +0000)]
[OPENMP, NVPTX] Emit correct thread id.

We emitted fake thread id for the outined function in NVPTX codegen.
Patch adds emission of the real thread id.

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

6 years ago[Driver] Avoid invalidated iterator in insertTargetAndModeArgs
Serge Pavlov [Mon, 19 Mar 2018 16:13:43 +0000 (16:13 +0000)]
[Driver] Avoid invalidated iterator in insertTargetAndModeArgs

Doing an .insert() can potentially invalidate iterators by reallocating the
vector's storage. When all the stars align just right, this causes segfaults
or glibc aborts.

Gentoo Linux bug (crashes while building Chromium): https://bugs.gentoo.org/650082.

Patch by Hector Martin!

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

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

6 years ago[clang-format] Remove empty lines before }[;] // comment
Krasimir Georgiev [Mon, 19 Mar 2018 15:33:40 +0000 (15:33 +0000)]
[clang-format] Remove empty lines before }[;] // comment

Summary:
This addresses bug 36766 and a FIXME in tests about empty lines before
`}[;] // comment` lines.

Subscribers: klimek, cfe-commits

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

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

6 years ago[CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain
Petr Hosek [Mon, 19 Mar 2018 15:19:19 +0000 (15:19 +0000)]
[CMake] Use libc++ and compiler-rt as default libraries in Fuchsia toolchain

Fuchsia already defaults to libc++ and compiler-rt, but we want to use
these as default runtimes even on the host platform.

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

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

6 years agoUpdated a usage of createTemporaryFile that does not expect file to be created.
Ilya Biryukov [Mon, 19 Mar 2018 14:20:25 +0000 (14:20 +0000)]
Updated a usage of createTemporaryFile that does not expect file to be created.

Summary:
This fixes a usage of createTemporaryFile in clang repo after
a change in llvm repo.

Reviewers: klimek, bkramer, krasimir, espindola, ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[ARM] Pass half or i16 types for NEON intrinsics
Sjoerd Meijer [Mon, 19 Mar 2018 13:22:49 +0000 (13:22 +0000)]
[ARM] Pass half or i16 types for NEON intrinsics

For generating NEON intrinsics, this determines the NEON data type, and whether
it should be a half type or an i16 type. I.e., we always pass a half type for
AArch64, this hasn't changed, but now also for ARM but only when FullFP16 is
enabled, and i16 otherwise.

This is intended to be non-functional change, but together with the backend
work in D44538 which adds support for f16 vectors, this enables adding the
AArch32 FP16 (vector) intrinsics.

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

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

6 years agoResolve unused variable 'VR' warning in RetainCountChecker.cpp
Bjorn Pettersson [Sun, 18 Mar 2018 16:07:20 +0000 (16:07 +0000)]
Resolve unused variable 'VR' warning in RetainCountChecker.cpp

Getting rid of
  error: unused variable 'VR' [-Werror,-Wunused-variable]
warning/error at
  lib/StaticAnalyzer/Checkers/RetainCountChecker.cpp:1933

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

6 years ago[dsymutil] Rename llvm-dsymutil -> dsymutil
Jonas Devlieghere [Sun, 18 Mar 2018 11:38:41 +0000 (11:38 +0000)]
[dsymutil] Rename llvm-dsymutil -> dsymutil

Now that almost all functionality of Apple's dsymutil has been
upstreamed, the open source variant can be used as a drop in
replacement. Hence we feel it's no longer necessary to have the llvm
prefix.

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

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

6 years ago[C++17] Allow an empty expression in an if init statement
Zhihao Yuan [Sat, 17 Mar 2018 21:42:10 +0000 (21:42 +0000)]
[C++17] Allow an empty expression in an if init statement

Summary:
This fixes [PR35381](https://llvm.org/pr35381) and an additional bug where clang didn't warn about the C++17 extension when having an expression in the init statement.

Thanks Nicolas Lesser for contributing the patch.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: erik.pilkington, cfe-commits

Tags: #clang

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

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

6 years agoImplement DR2229, which prohibits unnamed bit-fields from having qualifiers in C++.
Aaron Ballman [Sat, 17 Mar 2018 21:08:40 +0000 (21:08 +0000)]
Implement DR2229, which prohibits unnamed bit-fields from having qualifiers in C++.

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

6 years agoFix codegen for structured binding binding in conditions
Zhihao Yuan [Sat, 17 Mar 2018 21:01:27 +0000 (21:01 +0000)]
Fix codegen for structured binding binding in conditions

Summary:
The codegen for conditions assumes that a normal variable declaration is used in a condition, but this is not the case when a structured binding is used.

This fixes [PR36747](http://llvm.org/pr36747).

Thanks Nicolas Lesser for contributing the patch.

Reviewers: lichray, rsmith

Reviewed By: lichray

Subscribers: cfe-commits

Tags: #clang

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

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

6 years ago[Driver] Fix the descriptions for -Tdata and -Ttext options
Aaron Smith [Sat, 17 Mar 2018 15:24:35 +0000 (15:24 +0000)]
[Driver] Fix the descriptions for -Tdata and -Ttext options

Reviewers: llvm-commits

Subscribers: cfe-commits

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

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

6 years ago[cxx_status] Add entry for the Reflection TS.
Richard Smith [Sat, 17 Mar 2018 14:34:21 +0000 (14:34 +0000)]
[cxx_status] Add entry for the Reflection TS.

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

6 years ago[cxx_status] Update to match Jacksonville 2018 motions.
Richard Smith [Sat, 17 Mar 2018 14:28:47 +0000 (14:28 +0000)]
[cxx_status] Update to match Jacksonville 2018 motions.

Also rearrange how we list DR motions: rather than listing them as part of some
later standard, list them against the feature they are a DR against. Explicitly
add a description of how we handle DRs.

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

6 years agoAdding nocf_check attribute for cf-protection fine tuning
Oren Ben Simhon [Sat, 17 Mar 2018 13:31:35 +0000 (13:31 +0000)]
Adding nocf_check attribute for cf-protection fine tuning

The patch adds nocf_check target independent attribute for disabling checks that were enabled by cf-protection flag.
The attribute can be appertained to functions and function pointers.
Attribute name follows GCC's similar attribute name.

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

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

6 years ago[MS] Fix bug in r327732 with devirtualized complete destructor calls
Reid Kleckner [Fri, 16 Mar 2018 22:20:57 +0000 (22:20 +0000)]
[MS] Fix bug in r327732 with devirtualized complete destructor calls

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 21:22:42 +0000 (21:22 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[MS] Fix tests after r327738 that only fail with a default Windows target
Reid Kleckner [Fri, 16 Mar 2018 20:53:13 +0000 (20:53 +0000)]
[MS] Fix tests after r327738 that only fail with a default Windows target

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

6 years ago[MS] Commit some changes that were intended to be part of r327738
Reid Kleckner [Fri, 16 Mar 2018 20:37:59 +0000 (20:37 +0000)]
[MS] Commit some changes that were intended to be part of r327738

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

6 years ago[MS] Don't escape MS C++ names with \01
Reid Kleckner [Fri, 16 Mar 2018 20:36:49 +0000 (20:36 +0000)]
[MS] Don't escape MS C++ names with \01

It is not needed after LLVM r327734. Now it will be easier to copy-paste
IR symbol names from Clang.

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

6 years ago[Parser] Remove hard-coded bracket depth limit
Jan Korous [Fri, 16 Mar 2018 20:17:28 +0000 (20:17 +0000)]
[Parser] Remove hard-coded bracket depth limit

The diagnostics produced if assert fails are using proper limit from language definition already.

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

6 years ago[MS] Always use base dtors in place of complete/vbase dtors when possible
Reid Kleckner [Fri, 16 Mar 2018 19:40:50 +0000 (19:40 +0000)]
[MS] Always use base dtors in place of complete/vbase dtors when possible

Summary:
Previously we tried too hard to uphold the fiction that destructor
variants work like they do on Itanium throughout the ABI-neutral parts
of clang. This lead to MS C++ ABI incompatiblities and other bugs. Now,
-mconstructor-aliases will no longer control this ABI detail, and clang
-cc1's LLVM IR output will be this much closer to the clang driver's.

Based on a patch by Zahira Ammarguellat:
  https://reviews.llvm.org/D39063

I've tried to move the logic that Zahira added into MicrosoftCXXABI.cpp.
There is only one ABI-specific detail sticking out, and that is in
CodeGenModule::getAddrOfCXXStructor, where we collapse complete dtors to
base dtors in the MS ABI.

This fixes PR32990.

Reviewers: erichkeane, zahiraam, majnemer, rjmccall

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var
George Karpenkov [Fri, 16 Mar 2018 18:16:47 +0000 (18:16 +0000)]
[analyzer] Fix crashes in RetainCountChecker when underlying region is not a var

For other regions, the error message contains a good indication of the
problem, and there, in general, nothing helpful we can print.
Error pointer to the problematic expression seems enough.

rdar://37323555

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

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

6 years ago[docs] ReleaseNotes: document -Wextra-semi changes.
Roman Lebedev [Fri, 16 Mar 2018 18:01:07 +0000 (18:01 +0000)]
[docs] ReleaseNotes: document -Wextra-semi changes.

I should have done it in rL327558 / D43162, but forgot..

I'm not 100% sure about the text, but i don't think
it warrants a whole new differential revision.

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

6 years ago[clang-format] Disallow breaks before ']' in text proto extensions
Krasimir Georgiev [Fri, 16 Mar 2018 15:23:22 +0000 (15:23 +0000)]
[clang-format] Disallow breaks before ']' in text proto extensions

Summary: This disallows patterns like `[ext.name\n]` in text protos.

Subscribers: klimek, cfe-commits

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

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

6 years ago[clang-format] Fix raw string prefix penalty
Krasimir Georgiev [Fri, 16 Mar 2018 14:01:25 +0000 (14:01 +0000)]
[clang-format] Fix raw string prefix penalty

Summary: We weren't penalizing cases where the raw string prefix goes over the column limit.

Subscribers: klimek, cfe-commits

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

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

6 years agoImplement C++ DR727, which permits explicit specializations at class scope.
Richard Smith [Fri, 16 Mar 2018 13:36:56 +0000 (13:36 +0000)]
Implement C++ DR727, which permits explicit specializations at class scope.

More generally, this permits a template to be specialized in any scope in which
it could be defined, so this also supersedes DR44 and DR374 (the latter of
which we previously only implemented in C++11 mode onwards due to unclarity as
to whether it was a DR).

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

6 years agoFix compilation warning introduced in r327654
Mikael Holmen [Fri, 16 Mar 2018 07:27:57 +0000 (07:27 +0000)]
Fix compilation warning introduced in r327654

The compiler complained about

../tools/clang/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp:184:15: error: unused variable 'CSI' [-Werror,-Wunused-variable]
    if (auto *CSI = CGF.CapturedStmtInfo) {
              ^
1 error generated.

I don't know this code but it seems like an easy fix so I push it anyway
to get rid of the warning.

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

6 years ago[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Fri, 16 Mar 2018 00:37:51 +0000 (00:37 +0000)]
[Analysis] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years ago[OPENMP, NVPTX] Improve globalization of the variables captured by value.
Alexey Bataev [Thu, 15 Mar 2018 18:10:54 +0000 (18:10 +0000)]
[OPENMP, NVPTX] Improve globalization of the variables captured by value.

If the variable is captured by value and the corresponding parameter in
the outlined function escapes its declaration context, this parameter
must be globalized. To globalize it we need to get the address of the
original parameter, load the value, store it to the global address and
use this global address instead of the original.

Patch improves globalization for parallel|teams regions + functions in
declare target regions.

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

6 years ago[OPENMP] Codegen for `omp declare target` construct.
Alexey Bataev [Thu, 15 Mar 2018 15:47:20 +0000 (15:47 +0000)]
[OPENMP] Codegen for `omp declare target` construct.

Added initial codegen for device side of declarations inside `omp
declare target` construct + codegen for implicit `declare target`
functions, which are used in the target regions.

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

6 years agoRecommit r326946 after reducing CallArgList memory footprint
Yaxun Liu [Thu, 15 Mar 2018 15:25:19 +0000 (15:25 +0000)]
Recommit r326946 after reducing CallArgList memory footprint

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

6 years ago[AAch64] Tests for ACLE FP16 macros
Sjoerd Meijer [Thu, 15 Mar 2018 13:36:30 +0000 (13:36 +0000)]
[AAch64] Tests for ACLE FP16 macros

This adds some missing tests for the AArch64 FP16 macros.

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

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

6 years agoMore warnings when double truncation to float: compound assignment is supported now.
Andrew V. Tischenko [Thu, 15 Mar 2018 10:03:35 +0000 (10:03 +0000)]
More warnings when double truncation to float: compound assignment is supported now.

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

6 years agoRefactoring code around move/copy initialization. NFC.
Richard Trieu [Thu, 15 Mar 2018 03:00:55 +0000 (03:00 +0000)]
Refactoring code around move/copy initialization.  NFC.

Use an enum parameter instead of a bool for more control on how the copy elision
functions work.  Extract the move initialization code from the move or copy
initialization block.

Patch by: Arthur O'Dwyer

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

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

6 years ago[CFG] Allow CallExpr's to be looked up in CFG's
Richard Trieu [Thu, 15 Mar 2018 00:09:26 +0000 (00:09 +0000)]
[CFG] Allow CallExpr's to be looked up in CFG's

r327343 changed the handling for CallExpr in a CFG, which prevented lookups for
CallExpr while other Stmt kinds still worked.  This change carries over the
necessary bits from Stmt function to CallExpr function.

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

6 years ago[analyzer] Explicitly set an -std level for the analyzer test.
George Karpenkov [Wed, 14 Mar 2018 23:50:18 +0000 (23:50 +0000)]
[analyzer] Explicitly set an -std level for the analyzer test.

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

6 years agoRemove test deep-ast-tree.cpp
Yaxun Liu [Wed, 14 Mar 2018 21:40:55 +0000 (21:40 +0000)]
Remove test deep-ast-tree.cpp

Since there is no reliable way to change the AST depth of this test by supported stack size
of the test environment, remove this test for now.

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

6 years ago[Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; other...
Eugene Zelenko [Wed, 14 Mar 2018 21:05:51 +0000 (21:05 +0000)]
[Tooling] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).

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

6 years agoReduce AST depth for test deep-ast-tree.cpp for atom
Yaxun Liu [Wed, 14 Mar 2018 20:41:05 +0000 (20:41 +0000)]
Reduce AST depth for test deep-ast-tree.cpp for atom

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

6 years ago[Parser] (C++) Make -Wextra-semi slightly more useful
Roman Lebedev [Wed, 14 Mar 2018 19:31:34 +0000 (19:31 +0000)]
[Parser] (C++) Make -Wextra-semi slightly more useful

Summary:
Let's suppose the `-Weverything` is passed.

Given code like
```
void F() {}
;
```
If the code is compiled with `-std=c++03`, it would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is a C++11 extension [-Wc++11-extra-semi]
;
^~
```
If the code is compiled with `-std=c++11`, it also would diagnose that extra sema:
```
<source>:2:1: warning: extra ';' outside of a function is incompatible with C++98 [-Wc++98-compat-pedantic]
;
^~
```

But, let's suppose the C++11 or higher is used, and the used does not care
about `-Wc++98-compat-pedantic`, so he disables that diagnostic.
And that silences the complaint about extra `;` too.
And there is no way to re-enable that particular diagnostic, passing `-Wextra-semi` does nothing...

Now, there is also a related `no newline at end of file` diagnostic, which is also emitted by `-Wc++98-compat-pedantic`
```
<source>:2:2: warning: C++98 requires newline at end of file [-Wc++98-compat-pedantic]
;
 ^
```
But unlike the previous case, if `-Wno-c++98-compat-pedantic` is passed, that diagnostic stays displayed:
```
<source>:2:2: warning: no newline at end of file [-Wnewline-eof]
;
 ^
```

This diff refactors the code so `-Wc++98-compat-extra-semi` can be re-enabled, after the `-Wc++98-compat-pedantic` was disabled.
This seems ugly, but there does not seem to be any saner way.

Testing: `$ ninja check-clang`

Reviewers: rsmith, rtrieu, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jordan_rose, cfe-commits

Tags: #clang

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

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

6 years agoAttempt to fix failure of deep-ast-tree.cpp on atom and s390
Yaxun Liu [Wed, 14 Mar 2018 18:24:38 +0000 (18:24 +0000)]
Attempt to fix failure of deep-ast-tree.cpp on atom and s390

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

6 years agoUpdate DR script to mark Clang 6 as 'done' not 'svn'.
Richard Smith [Wed, 14 Mar 2018 18:20:45 +0000 (18:20 +0000)]
Update DR script to mark Clang 6 as 'done' not 'svn'.

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

6 years ago[www] Update C++ DR status to match latest issues list.
Richard Smith [Wed, 14 Mar 2018 18:19:41 +0000 (18:19 +0000)]
[www] Update C++ DR status to match latest issues list.

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

6 years agoSet dso_local for NSConcreteStackBlock.
Rafael Espindola [Wed, 14 Mar 2018 18:19:26 +0000 (18:19 +0000)]
Set dso_local for NSConcreteStackBlock.

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

6 years agoSet dso_local on external rtti GVs.
Rafael Espindola [Wed, 14 Mar 2018 18:14:46 +0000 (18:14 +0000)]
Set dso_local on external rtti GVs.

In this particular case it would be possible to just add an else with
CGM.setDSOLocal(GV), but it seems better to have as many callers as
possible just call setGVProperties so that we can centralize the logic
there.

This patch then makes setGVProperties able to handle null Decls.

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