]> granicus.if.org Git - clang/log
clang
6 years agoRevert rC330794 and some dependent tiny bug fixes
Faisal Vali [Thu, 26 Apr 2018 00:42:40 +0000 (00:42 +0000)]
Revert rC330794 and some dependent tiny bug fixes

See Richard's humbling feedback here:
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226482.html
http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180423/226486.html

Wish I'd had the patience to solicit the feedback prior to committing :)

Sorry for the noise guys.

Thank you Richard for being the steward that clang deserves!

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

6 years agoSwitch to Clang's isDigit function.
Richard Trieu [Wed, 25 Apr 2018 23:50:55 +0000 (23:50 +0000)]
Switch to Clang's isDigit function.

std::isdigit can be overloaded, causing the template deduction to fail.  Use
Clang's isDigit function which to avoid this.  Switch the other calls for
consistency.

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

6 years agoInclude <cctype> to get std::isdigit, fixes MSVC STL build
Reid Kleckner [Wed, 25 Apr 2018 23:38:54 +0000 (23:38 +0000)]
Include <cctype> to get std::isdigit, fixes MSVC STL build

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

6 years ago[analyzer] Fix a crash on lifetime extension through aggregate initialization.
Artem Dergachev [Wed, 25 Apr 2018 23:02:06 +0000 (23:02 +0000)]
[analyzer] Fix a crash on lifetime extension through aggregate initialization.

If 'A' is a C++ aggregate with a reference field of type 'C', in code like
  A a = { C() };
C() is lifetime-extended by 'a'. The analyzer wasn't expecting this pattern and
crashing. Additionally, destructors aren't added in the CFG for this case,
so for now we shouldn't be inlining the constructor for C().

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

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

6 years agoFix crash on qualified template name instantiation if the template name has no
Richard Smith [Wed, 25 Apr 2018 22:58:55 +0000 (22:58 +0000)]
Fix crash on qualified template name instantiation if the template name has no
template argument list.

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

6 years ago[RISCV] More validations on the input value of -march=
Ana Pazos [Wed, 25 Apr 2018 22:42:38 +0000 (22:42 +0000)]
[RISCV] More validations on the input value of -march=

Supporting additional rules for parsing ISA string.

- RISC-V ISA strings must be lowercase.
E.g.: rv32IMC is not supported, rv32imc is correct.

- Multi-letter extensions are to be separated by a single
underscore '_'. The extension prefix counts as a letter.
This means extensions that start with 's', 'sx' and 'sx'
are all multi-letter.
E.g.:
xasb is a single non-standard extension named 'xasb'
xa_sb are two extensions, the non-standard user level extension
'xa', and the supervisor level extension 'sb'.

- Standard user-level extensions are specified following
a canonical order, according to Table 22.1 in
RISC-V User-Level ISA V2.2.

- Non-standard user-level 'x' extensions,
standard supervisor-level 's' extensions and
non-standard supervisor-level 'sx' extensions
are also specified following a canonical order according
to Table 22.1 in RISC-V User-Level ISA V2.2:
'x' extensions, follwed by 's' extensions and then 'sx' extensions.

- Extensions might have a version number.
Underscores may be used to separate ISA subset components to
improve readability and to provide disambiguation.
E.g.: rv32i2_m3_a1_f2_d2

- Version numbers are divided into major and minor numbers,
separated by a 'p'. If the minor version is 0, then 'p0' can
be omitted.

- Additional checks for dependent extensions and invalid
extensions combinations.
E.g.:
'e' requires rv32
'e' can't be combined with 'f' nor 'd'
'q' requires rv64

- TODO items have also been marked with comments in the code.

Reviewers: asb, kito-cheng

Reviewed By: asb

Subscribers: edward-jones, mgrang, zzheng, rbar, johnrusso, simoncook, jordy.potman.lists, sabuasal, niosHD, shiva0217, cfe-commits

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

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

6 years ago[driver][darwin] Do not infer -simulator environment for OS version env vars
Alex Lorenz [Wed, 25 Apr 2018 22:23:26 +0000 (22:23 +0000)]
[driver][darwin] Do not infer -simulator environment for OS version env vars
with non-simulator SDKs

rdar://37955008

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

6 years ago[analyzer] Enable analysis of WebKit "unified sources".
Artem Dergachev [Wed, 25 Apr 2018 21:51:26 +0000 (21:51 +0000)]
[analyzer] Enable analysis of WebKit "unified sources".

Normally the analyzer begins path-sensitive analysis from functions within
the main file, even though the path is allowed to go through any functions
within the translation unit.

When a recent version of WebKit is compiled, the "unified sources" technique
is used, that assumes #including multiple code files into a single main file.
Such file would have no functions defined in it, so the analyzer wouldn't be
able to find any entry points for path-sensitive analysis.

This patch pattern-matches unified file names that are similar to those
used by WebKit and allows the analyzer to find entry points in the included
code files. A more aggressive/generic approach is being planned as well.

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

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

6 years ago[Driver] Reland "Android triples are not aliases for other triples."
Dan Albert [Wed, 25 Apr 2018 21:26:06 +0000 (21:26 +0000)]
[Driver] Reland "Android triples are not aliases for other triples."

Fixed directory separators in tests to be compatible with both
Windows and !Windows.

This reverts commit aa423850afa4c16a53c4c492fe254dcad3d5a53e.

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

6 years ago[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.
Martin Storsjo [Wed, 25 Apr 2018 21:24:04 +0000 (21:24 +0000)]
[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.

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

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

6 years ago[Driver] Fix implicit config files from prefixed symlinks
Martin Storsjo [Wed, 25 Apr 2018 21:23:59 +0000 (21:23 +0000)]
[Driver] Fix implicit config files from prefixed symlinks

If -no-canonical-prefixes isn't used, the clang executable name used
is the one of the actual executable, not the name of the symlink that
the user invoked.

In these cases, the target prefix was overridden based on the clang
executable name. (On the other hand the implicit -target option
that such a symlink adds, is added as an actual command line parameter
in tools/driver/driver.cop, before resolving the symlink and finding
the actual clang executable.

Use the original ClangNameParts (set from argv[0] in
tools/driver/driver.cpp) if it seems to be initialized propery.

All existing tests of this feature used -no-canonical-prefixes
(possibly because it also makes the driver look in the directory
of the symlink instead of the directory of the executable); add
another one that uses --config-user-dir= to specify the directory
instead. (For actual users of such symlinks, outisde of the test
suite, the directory is probably the same for both.)

This makes this feature work more like what the documentation
describes.

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

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

6 years ago[TargetInfo] Sort target features before passing them to the backend
Eli Friedman [Wed, 25 Apr 2018 19:14:05 +0000 (19:14 +0000)]
[TargetInfo] Sort target features before passing them to the backend

Passing the features in random order will lead to unpredictable results
when some of the features are related (like the architecture-version
features on ARM).

It might be possible to fix this particular case in the ARM target code,
to avoid adding overlapping target features. But we should probably be
sorting in any case: the behavior shouldn't depend on StringMap's
hashing algorithm.

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

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

6 years ago[CMake] Enable libc++ for Fuchsia toolchain on Darwin
Petr Hosek [Wed, 25 Apr 2018 18:30:55 +0000 (18:30 +0000)]
[CMake] Enable libc++ for Fuchsia toolchain on Darwin

This is necessary in order to get a working C++ compiler on Darwin
since Clang expects libc++ headers to be part of the toolchain.

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

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

6 years ago[ASTImporter] FriendDecl importing improvements
Peter Szecsi [Wed, 25 Apr 2018 17:28:03 +0000 (17:28 +0000)]
[ASTImporter] FriendDecl importing improvements

There are only a few cases of importing a frienddecl which is currently supported.
This patch aims to improve the friend import process.
Set FriendObjectKind in case of decls, insert friend into the friend chain
correctly, checks structurally equivalent in a more advanced manner.
Test cases added as well.

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

6 years ago[Builtins] Fix typos in a comment. NFC
Craig Topper [Wed, 25 Apr 2018 16:57:46 +0000 (16:57 +0000)]
[Builtins] Fix typos in a comment. NFC

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

6 years agoMake add_clang_unittest formatting a bit more consistent.
Nico Weber [Wed, 25 Apr 2018 16:20:43 +0000 (16:20 +0000)]
Make add_clang_unittest formatting a bit more consistent.

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

6 years ago[CodeComplete] Fix completion in the middle of ident in ctor lists.
Ilya Biryukov [Wed, 25 Apr 2018 15:13:34 +0000 (15:13 +0000)]
[CodeComplete] Fix completion in the middle of ident in ctor lists.

Summary:
The example that was broken before (^ designates completion points):

    class Foo {
      Foo() : fie^ld^() {} // no completions were provided here.
      int field;
    };

To fix it we don't cut off lexing after an identifier followed by code
completion token is lexed. Instead we skip the rest of identifier and
continue lexing.
This is consistent with behavior of completion when completion token is
right before the identifier.

Reviewers: sammccall, aaron.ballman, bkramer, sepavloff, arphaman, rsmith

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Start formatting cpp code in raw strings in google style
Krasimir Georgiev [Wed, 25 Apr 2018 14:56:19 +0000 (14:56 +0000)]
[clang-format] Start formatting cpp code in raw strings in google style

Summary: This adds some delimiters to detect cpp code in raw strings.

Reviewers: klimek

Reviewed By: klimek

Subscribers: cfe-commits

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

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

6 years ago[HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__
Yaxun Liu [Wed, 25 Apr 2018 13:33:19 +0000 (13:33 +0000)]
[HIP] Add predefined macros __HIPCC__ and __HIP_DEVICE_COMPILE__

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

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

6 years agoFix failure in lit test kernel-call.cu due to name mangling
Yaxun Liu [Wed, 25 Apr 2018 13:07:58 +0000 (13:07 +0000)]
Fix failure in lit test kernel-call.cu due to name mangling

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

6 years agoadd check for long double for __builtin_dump_struct
Paul Semel [Wed, 25 Apr 2018 10:09:20 +0000 (10:09 +0000)]
add check for long double for __builtin_dump_struct

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

6 years agoFix buildbot problems after rC330794
Bjorn Pettersson [Wed, 25 Apr 2018 09:04:12 +0000 (09:04 +0000)]
Fix buildbot problems after rC330794

Avoiding
  error: no matching function for call to 'makeArrayRef'
at
  ../tools/clang/lib/Parse/ParseTemplate.cpp:373:17

By using a local C array as input to makeArrayRef.

Not sure if this is the best solution, but it makes the code
compile again.

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

6 years ago[NFC] Make dependent parameter non-deducible, so that we are forced to use the defaul...
Faisal Vali [Wed, 25 Apr 2018 03:54:20 +0000 (03:54 +0000)]
[NFC] Make dependent parameter non-deducible, so that we are forced to use the default template parameter.

This might provide users with more graceful diagnostics if they should ever try and call this function with non-ConceptDecls.

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

6 years agoFix rC330794 - a parameter that should have been dependent was inadvertently not -
Faisal Vali [Wed, 25 Apr 2018 03:28:23 +0000 (03:28 +0000)]
Fix rC330794 - a parameter that should have been dependent was inadvertently not -
 and compiled in MSVC - but not so for the other bots.

The fix was to make it dependent as intended.

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

6 years agoFix lit test kernel-call.cu failure on ps4 due to dso_local
Yaxun Liu [Wed, 25 Apr 2018 03:16:07 +0000 (03:16 +0000)]
Fix lit test kernel-call.cu failure on ps4 due to dso_local

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

6 years ago[c++2a] [concepts] Add rudimentary parsing support for template concept declarations
Faisal Vali [Wed, 25 Apr 2018 02:42:26 +0000 (02:42 +0000)]
[c++2a] [concepts] Add rudimentary parsing support for template concept declarations

This patch is a tweak of changyu's patch: https://reviews.llvm.org/D40381. It differs in that the recognition of the 'concept' token is moved into the machinery that recognizes declaration-specifiers - this allows us to leverage the attribute handling machinery more seamlessly.

See the test file to get a sense of the basic parsing that this patch supports.

There is much more work to be done before concepts are usable...

Thanks Changyu!

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

6 years agoFix failure in lit test kernel-call.cu
Yaxun Liu [Wed, 25 Apr 2018 02:34:04 +0000 (02:34 +0000)]
Fix failure in lit test kernel-call.cu

There is signext on ppc64. Just remove check for function argument.

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

6 years ago[HIP] Add hip input kind and codegen for kernel launching
Yaxun Liu [Wed, 25 Apr 2018 01:10:37 +0000 (01:10 +0000)]
[HIP] Add hip input kind and codegen for kernel launching

HIP is a language similar to CUDA (https://github.com/ROCm-Developer-Tools/HIP/blob/master/docs/markdown/hip_kernel_language.md ).
The language syntax is very similar, which allows a hip program to be compiled as a CUDA program by Clang. The main difference
is the host API. HIP has a set of vendor neutral host API which can be implemented on different platforms. Currently there is open source
implementation of HIP runtime on amdgpu target (https://github.com/ROCm-Developer-Tools/HIP).

This patch adds support of input kind and language standard hip.

When hip file is compiled, both LangOpts.CUDA and LangOpts.HIP is turned on. This allows compilation of hip program as CUDA
in most cases and only special handling of hip program is needed LangOpts.HIP is checked.

This patch also adds support of kernel launching of HIP program using HIP host API.

When -x hip is not specified, there is no behaviour change for CUDA.

Patch by Greg Rodgers.
Revised and lit test added by Yaxun Liu.

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

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

6 years ago[ODRHash] Hash template arguments of methods.
Richard Trieu [Wed, 25 Apr 2018 00:31:15 +0000 (00:31 +0000)]
[ODRHash] Hash template arguments of methods.

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

6 years agoRevert "[Driver] Android triples are not aliases for other triples."
Dan Albert [Tue, 24 Apr 2018 22:06:40 +0000 (22:06 +0000)]
Revert "[Driver] Android triples are not aliases for other triples."

Revering while I diagnose the failures.

This reverts commit 82dc3bf2157da280420f80e654292cb05e0dc5f7.

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

6 years ago[Driver] Android triples are not aliases for other triples.
Dan Albert [Tue, 24 Apr 2018 21:18:37 +0000 (21:18 +0000)]
[Driver] Android triples are not aliases for other triples.

Summary:
Android targets should never use tools/libraries for non-Android
targets or vice versa.

Reviewers: srhines, george.burgess.iv, eugenis

Reviewed By: eugenis

Subscribers: cfe-commits

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

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

6 years ago[analyzer] Add support for the note diagnostic pieces to plist output format.
Artem Dergachev [Tue, 24 Apr 2018 20:45:48 +0000 (20:45 +0000)]
[analyzer] Add support for the note diagnostic pieces to plist output format.

Note diagnostic pieces are an additional way of highlighting code sections to
the user. They aren't part of the normal path diagnostic sequence. They can
also be attached to path-insensitive reports.

Notes are already supported by the text output and scan-build.

Expanding our machine-readable plist output format to be able to represent notes
opens up the possibility for various analyzer GUIs to pick them up.

Patch by Umann Kristóf!

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

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

6 years agoImprove -Warray-bounds to handle multiple array extents rather than only handling...
Aaron Ballman [Tue, 24 Apr 2018 19:21:04 +0000 (19:21 +0000)]
Improve -Warray-bounds to handle multiple array extents rather than only handling the top-most array extent.

Patch by Bevin Hansson.

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

6 years ago[CUDA] Enable CUDA compilation with CUDA-9.2
Artem Belevich [Tue, 24 Apr 2018 18:23:19 +0000 (18:23 +0000)]
[CUDA] Enable CUDA compilation with CUDA-9.2

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

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

6 years ago[HWASan] Update HWASan assembly snippet in the docs
Alex Shlyapnikov [Tue, 24 Apr 2018 17:41:48 +0000 (17:41 +0000)]
[HWASan] Update HWASan assembly snippet in the docs

Summary: To complement https://reviews.llvm.org/D45840

Reviewers: eugenis

Subscribers: cfe-commits

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

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

6 years ago[X86] Add recently added intrinsic headers to the module map.
Craig Topper [Tue, 24 Apr 2018 17:40:49 +0000 (17:40 +0000)]
[X86] Add recently added intrinsic headers to the module map.

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

6 years ago[X86] Consistently use double underscore at the beginning of the include guards in...
Craig Topper [Tue, 24 Apr 2018 17:40:47 +0000 (17:40 +0000)]
[X86] Consistently use double underscore at the beginning of the include guards in our intrinsic headers.

Most files used double underscore, but a few used single. This converges them all to double.

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

6 years ago[Attr] Print enum attributes at correct position
Joel E. Denny [Tue, 24 Apr 2018 14:50:23 +0000 (14:50 +0000)]
[Attr] Print enum attributes at correct position

For example, given:

  void fn() {
    enum __attribute__((deprecated)) T *p;
  }

-ast-print produced:

  void fn() {
    enum T __attribute__((deprecated(""))) *p;
  }

-ast-print on that produced:

  void fn() {
    enum T *p __attribute__((deprecated("")));
  }

The attribute is on enum T in the first case, but it's on p in the
other cases.

Details:

Within enum declarations, enum attributes were always printed after
the tag and any member list.  When no member list was present but the
enum was a type specifier in a variable declaration, the attribute
then applied to the variable not the enum, changing the semantics.

This patch fixes that by always printing attributes between the enum's
keyword and tag, as clang already does for structs, unions, and
classes.

Reviewed By: rsmith

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

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

6 years ago[OpenCL] Fix diagnostic of thread_local
Sven van Haastregt [Tue, 24 Apr 2018 14:47:29 +0000 (14:47 +0000)]
[OpenCL] Fix diagnostic of thread_local

Commit 08c258670c ("[OpenCL] Generic address space has been added in
OpenCL v2.0.", 2014-11-26) did not mark the thread_local keyword as a
storage class specifier, whereas it did mark _Thread_local as such.
According to the C++14 spec s7.1.1, thread_local is a storage class
specifier, so mark it as such.

I will add a test for this in a follow-up commit that adds keyword
restrictions to the OpenCL C++ language mode.

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

6 years ago[CodeComplete] Fix completion at the end of keywords
Ilya Biryukov [Tue, 24 Apr 2018 13:48:53 +0000 (13:48 +0000)]
[CodeComplete] Fix completion at the end of keywords

Summary:
Make completion behave consistently no matter if it is run at the
start, in the middle or at the end of an identifier that happens to
be a keyword or a macro name. Since completion is often ran on
incomplete identifiers, they may turn into keywords by accident.

For example, we should produce same results for all of these
completion points:

    // ^ is completion point.
    ^class
    cla^ss
    class^

Previously clang produced different results for the last case (as if
the completion point was after a space: `class ^`).

This change also updates some offsets in tests that (unintentionally?)
relied on the old behavior.

Reviewers: sammccall, bkramer, arphaman, aaron.ballman

Reviewed By: sammccall

Subscribers: cfe-commits

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

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

6 years ago[GCC] Don't keep a StringRef to a temporary std::string
Martin Storsjo [Tue, 24 Apr 2018 11:57:02 +0000 (11:57 +0000)]
[GCC] Don't keep a StringRef to a temporary std::string

This fixes failures in asan builds and possibly other buildbots
as well, after SVN r330696.

Prior to that revision, the std::string was stored in another
variable, before assigning to a StringRef.

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

6 years ago[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous...
Aleksei Sidorin [Tue, 24 Apr 2018 10:11:53 +0000 (10:11 +0000)]
[ASTImporter] Allow testing of import sequences; fix import of typedefs for anonymous decls

This patch introduces the ability to test an arbitrary sequence of imports
between a given set of virtual source files. This should finally allow
us to write simple tests and fix annoying issues inside ASTImporter
that cause failures in CSA CTU. This is done by refactoring
ASTImporterTest functions and introducing `testImportSequence` facility.
As a side effect, `testImport` facility was generalized a bit more. It
should now allow import of non-decl AST nodes; however, there is still no
test using this ability.

As a "test for test", there is also a fix for import anonymous TagDecls
referred by typedef. Before this patch, the setting of typedef for anonymous
structure was delayed; however, this approach misses the corner case if
an enum constant is imported directly. In this patch, typedefs for
anonymous declarations are imported right after the anonymous declaration
is imported, without any delay.

Thanks to Adam Balogh for suggestions included into this patch.

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

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

6 years ago[GCC] Match a GCC version with a patch suffix without a third version component
Martin Storsjo [Tue, 24 Apr 2018 08:50:11 +0000 (08:50 +0000)]
[GCC] Match a GCC version with a patch suffix without a third version component

Previously it would only accept a string as a GCC version if it had
either two components and no suffix, or three components with an
optional suffix.

Debian and ubuntu provided mingw compilers have lib/gcc/target entries
like "5.3-posix" and "5.3-win32". This doesn't try to make any specific
preference between them (other than lexical sorting of the suffix).

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

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

6 years ago[test] Fix a typo in a test directory name. NFC.
Martin Storsjo [Tue, 24 Apr 2018 08:49:57 +0000 (08:49 +0000)]
[test] Fix a typo in a test directory name. NFC.

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

6 years agoLink to AggressiveInstCombine in a few places. Unbreaks build for me.
Roman Lebedev [Tue, 24 Apr 2018 08:40:44 +0000 (08:40 +0000)]
Link to AggressiveInstCombine in a few places. Unbreaks build for me.

/usr/local/bin/ld.lld: error: undefined symbol: llvm::createAggressiveInstCombinerPass()
>>> referenced by cc1_main.cpp
>>>               tools/clang/tools/driver/CMakeFiles/clang.dir/cc1_main.cpp.o:(_GLOBAL__sub_I_cc1_main.cpp)

And so on

The bot coverage is clearly missing.

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

6 years ago[libclang] Only mark CXCursors for explicit attributes with a type
Erik Verbruggen [Tue, 24 Apr 2018 08:39:46 +0000 (08:39 +0000)]
[libclang] Only mark CXCursors for explicit attributes with a type

All attributes have a source range associated with it. However, implicit
attributes are added by the compiler, and not added because the user
wrote something in the input. So no token type should be set to
CXCursor_*Attr.

The problem was visible when a class gets marked by e.g.
MSInheritanceAttr, which has the full CXXRecordDecl's range as its
own range. The effect of marking that range as CXCursor_UnexposedAttr
was that all cursors for the record decl, including all child decls,
would become CXCursor_UnexposedAttr.

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

6 years ago[AST] Another attempt at fixing the ARM bots.
Benjamin Kramer [Tue, 24 Apr 2018 08:18:32 +0000 (08:18 +0000)]
[AST] Another attempt at fixing the ARM bots.

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

6 years ago[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.
Benjamin Kramer [Tue, 24 Apr 2018 07:53:10 +0000 (07:53 +0000)]
[AST] Use a bit of trickery to make test pass on platforms where wchar_t is unsigned.

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

6 years ago[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.
Craig Topper [Tue, 24 Apr 2018 03:36:08 +0000 (03:36 +0000)]
[X86] Remove '#ifdef __x86_64__' around mask_set1_epi64 intrinsics.

The unmasked versions already didn't have this restrction. I don't think gcc or icc limit these to 64-bit mode so we shouldn't either.

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

6 years agoMake add_clang_tool() formatting a bit more consistent.
Nico Weber [Tue, 24 Apr 2018 01:30:44 +0000 (01:30 +0000)]
Make add_clang_tool() formatting a bit more consistent.

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

6 years agoFix build break due to content moving from Scalar.h to InstCombine.h in LLVM
David Blaikie [Tue, 24 Apr 2018 00:59:22 +0000 (00:59 +0000)]
Fix build break due to content moving from Scalar.h to InstCombine.h in LLVM

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

6 years ago[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_...
Craig Topper [Mon, 23 Apr 2018 22:18:36 +0000 (22:18 +0000)]
[X86] Move the 32-bit versions of rdfsbase/rdgsbase/wrfsbase/wrgsbase to BuiltinsX86_64.def.

The 32-bit refers to their input/output type, but the instructions are only available in 64-bit mode.

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

6 years ago[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_6...
Craig Topper [Mon, 23 Apr 2018 22:18:34 +0000 (22:18 +0000)]
[X86] Move __builtin_ia32_movnti64 andd __builtin_ia32_rdrand64_step to BuiltinsX86_64.def to make them unavailable in 32-bit mode.

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

6 years ago[AST] strcmp/memcmp always compares unsigned chars.
Benjamin Kramer [Mon, 23 Apr 2018 22:04:34 +0000 (22:04 +0000)]
[AST] strcmp/memcmp always compares unsigned chars.

This makes it return the right result in a couple of edge cases. The
wide versions always do the comparison on the underlying wchar_t type.

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

6 years ago[Docs] Regenerate command line documentation.
Craig Topper [Mon, 23 Apr 2018 21:41:06 +0000 (21:41 +0000)]
[Docs] Regenerate command line documentation.

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

6 years ago[Sema] Add -Wno-self-assign-overloaded
Roman Lebedev [Mon, 23 Apr 2018 21:35:21 +0000 (21:35 +0000)]
[Sema] Add -Wno-self-assign-overloaded

Summary:
It seems there isn't much enthusiasm for `-wtest` D45685.

This is more conservative version, which i had in the very first
revision of D44883, but that 'erroneously' got removed because of the review.

**Based on some [irc] discussions, it must really be documented that
we want all the new diagnostics to have their own flags, to ease
rollouts, transitions, etc.**

Please do note that i'm only adding `-Wno-self-assign-overloaded`,
but not `-Wno-self-assign-field-overloaded`, because i'm honestly
not aware of any false-positives from the `-field` variant,
but i can just as easily add it if wanted.
https://reviews.llvm.org/D44883#1068561

Reviewers: dblaikie, aaron.ballman, thakis, rjmccall, rsmith

Reviewed By: dblaikie

Subscribers: Quuxplusone, chandlerc, cfe-commits

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

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

6 years ago[OPENMP] Formatting and code improvement, NFC.
Alexey Bataev [Mon, 23 Apr 2018 19:53:05 +0000 (19:53 +0000)]
[OPENMP] Formatting and code improvement, NFC.

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

6 years agoFix typo in comment.
Nico Weber [Mon, 23 Apr 2018 19:22:52 +0000 (19:22 +0000)]
Fix typo in comment.

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

6 years agoDR727: remove wrong assertion for use of class-scope explicit
Richard Smith [Mon, 23 Apr 2018 18:38:30 +0000 (18:38 +0000)]
DR727: remove wrong assertion for use of class-scope explicit
specialization without -fms-extensions.

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

6 years agoImprove checks in test/Frontend/ftime-report-template-decl.cpp
Bjorn Pettersson [Mon, 23 Apr 2018 18:05:35 +0000 (18:05 +0000)]
Improve checks in test/Frontend/ftime-report-template-decl.cpp

Some buildbots seems to have problems with the CHECKs in
test/Frontend/ftime-report-template-decl.cpp.

I this the problem is that the order in which timers are printed
is based on consumed wall time. So there is no guarantee in which
order the timers are printed.

This patch uses CHECK-DAG instead of CHECK to make the test
case less sensitive to the actual time used by the different
passes.

The (sometimes) failing test cases where introduced in trunk@330571.

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

6 years ago[OPENMP] Do not cast captured by value variables with pointer types in
Alexey Bataev [Mon, 23 Apr 2018 17:33:41 +0000 (17:33 +0000)]
[OPENMP] Do not cast captured by value variables with pointer types in
NVPTX target.

When generating the wrapper function for the offloading region, we need
to call the outlined function and cast the arguments correctly to follow
the ABI. Usually, variables captured by value are casted to `uintptr_t`
type. But this should not performed for the variables with pointer type.

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

6 years agoQuick fix for rC330605: specify a target arch for test
Aleksei Sidorin [Mon, 23 Apr 2018 16:38:29 +0000 (16:38 +0000)]
Quick fix for rC330605: specify a target arch for test

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

6 years ago[analyzer] Don't crash on printing ConcreteInt of size >64 bits
Aleksei Sidorin [Mon, 23 Apr 2018 15:41:44 +0000 (15:41 +0000)]
[analyzer] Don't crash on printing ConcreteInt of size >64 bits

Printing of ConcreteInts with size >64 bits resulted in assertion failure
in get[Z|S]ExtValue() because these methods are only allowed to be used
with integers of 64 max bit width. This patch fixes the issue.

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

6 years agoFix case of LLVM library names.
Nico Weber [Mon, 23 Apr 2018 15:41:08 +0000 (15:41 +0000)]
Fix case of LLVM library names.

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

6 years agoRemove unused code (made unused by r161073, and later more so by r248043).
Nico Weber [Mon, 23 Apr 2018 15:26:15 +0000 (15:26 +0000)]
Remove unused code (made unused by r161073, and later more so by r248043).

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

6 years ago[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisit...
Henry Wong [Mon, 23 Apr 2018 14:41:17 +0000 (14:41 +0000)]
[analyzer] Move `TaintBugVisitor` from `GenericTaintChecker.cpp` to `BugReporterVisitors.h`.

Summary: `TaintBugVisitor` is a universal visitor, and many checkers rely on it, such as `ArrayBoundCheckerV2.cpp`, `DivZeroChecker.cpp` and `VLASizeChecker.cpp`. Moving `TaintBugVisitor` to `BugReporterVisitors.h` enables other checker can also track where `tainted` value came from.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

Subscribers: szepet, rnkovacs, a.sidorin, cfe-commits, MTC

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

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

6 years ago[index] Fix methods that take a shared_ptr to just take a reference.
Benjamin Kramer [Mon, 23 Apr 2018 14:30:21 +0000 (14:30 +0000)]
[index] Fix methods that take a shared_ptr to just take a reference.

There is no ownership here, passing a shared_ptr just adds confusion. No
functionality change intended.

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

6 years ago[analyzer] CStringChecker.cpp - Code refactoring on bug report.
Henry Wong [Mon, 23 Apr 2018 13:36:51 +0000 (13:36 +0000)]
[analyzer] CStringChecker.cpp - Code refactoring on bug report.

Reviewers: NoQ, george.karpenkov, xazax.hun

Reviewed By: george.karpenkov

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

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

6 years ago[OpenCL] Reject virtual functions for OpenCL C++
Sven van Haastregt [Mon, 23 Apr 2018 11:23:47 +0000 (11:23 +0000)]
[OpenCL] Reject virtual functions for OpenCL C++

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

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

6 years ago[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident
Mikhail Maltsev [Mon, 23 Apr 2018 10:08:46 +0000 (10:08 +0000)]
[CodeGen] Reland r330442: Add an option to suppress output of llvm.ident

The test case in the original patch was overly contrained and
failed on PPC targets.

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

6 years ago[clang-format] Fix clang-tidy readability problems, NFCI
Krasimir Georgiev [Mon, 23 Apr 2018 10:02:59 +0000 (10:02 +0000)]
[clang-format] Fix clang-tidy readability problems, NFCI

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

6 years agoFormat closing braces when reformatting the line containing the opening brace.
Manuel Klimek [Mon, 23 Apr 2018 09:34:26 +0000 (09:34 +0000)]
Format closing braces when reformatting the line containing the opening brace.

This required a couple of yaks to be shaved:
1. MatchingOpeningBlockLineIndex was misused to also store the
   closing index; instead, use a second variable, as this doesn't
   work correctly for "} else {".
2. We needed to change the API of AffectedRangeManager to not
   use iterators; we always passed in begin / end for the whole
   container before, so there was no mismatch in generality.
3. We need an extra check to discontinue formatting at the top
   level, as we now sometimes change the indent of the closing
   brace, but want to bail out immediately afterwards, for
   example:
     void f() {
       if (a) {
     }
     void g();
   Previously:
     void f() {
       if (a) {
     }
     void g();
   Now:
     void f() {
       if (a) {
       }
     void g();

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

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

6 years ago[Solaris] __float128 is supported on Solaris/x86
Rainer Orth [Mon, 23 Apr 2018 09:28:08 +0000 (09:28 +0000)]
[Solaris] __float128 is supported on Solaris/x86

When rebasing https://reviews.llvm.org/D40898 with GCC 5.4 on Solaris 11.4, I ran
into a few instances of

In file included from /vol/llvm/src/compiler-rt/local/test/asan/TestCases/Posix/asan-symbolize-sanity-test.cc:19:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/string:40:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/char_traits.h:39:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_algobase.h:64:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/stl_pair.h:59:
In file included from /usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/bits/move.h:57:
/usr/gcc/5/lib/gcc/x86_64-pc-solaris2.11/5.4.0/../../../../include/c++/5.4.0/type_traits:311:39: error: __float128 is not supported on this target

  struct __is_floating_point_helper<__float128>
                                    ^

during make check-all.  The line above is inside

#if !defined(__STRICT_ANSI__) && defined(_GLIBCXX_USE_FLOAT128)

  template<>
    struct __is_floating_point_helper<__float128>
    : public true_type { };

#endif

While the libstdc++ header indicates support for __float128, clang does not, but
should.  The following patch implements this and fixed those errors.

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

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

6 years agoUse special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEna...
Andrew V. Tischenko [Mon, 23 Apr 2018 09:22:30 +0000 (09:22 +0000)]
Use special new Clang flag 'FrontendTimesIsEnabled' instead of 'llvm::TimePassesIsEnabled' inside -ftime-report feature.
Differential Revision: https://reviews.llvm.org/D45619

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

6 years agoRevert "[clang-format] Improve Incomplete detection for (text) protos"
Krasimir Georgiev [Mon, 23 Apr 2018 08:50:36 +0000 (08:50 +0000)]
Revert "[clang-format] Improve Incomplete detection for (text) protos"

This reverts commit r330016.
The incomplete detection has too many false positives, picking up typos
for hard failures and refusing to format anything in that case.

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

6 years ago[Atomics] warn about atomic accesses using libcalls
Tim Northover [Mon, 23 Apr 2018 08:16:24 +0000 (08:16 +0000)]
[Atomics] warn about atomic accesses using libcalls

If an atomic variable is misaligned (and that suspicion is why Clang emits
libcalls at all) the runtime support library will have to use a lock to safely
access it, with potentially very bad performance consequences. There's a very
good chance this is unintentional so it makes sense to issue a warning.

Also give it a named group so people can promote it to an error, or disable it
if they really don't care.

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

6 years ago[XRay] Change std::sort to llvm::sort in response to r327219
Mandeep Singh Grang [Mon, 23 Apr 2018 00:49:25 +0000 (00:49 +0000)]
[XRay] Change std::sort to llvm::sort in response to r327219

r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

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

6 years ago[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677
Jonathan Coe [Sun, 22 Apr 2018 20:51:05 +0000 (20:51 +0000)]
[python bindings] Fix Cursor.result_type for ObjC method declarations - Bug 36677

Summary:
In cindex.py, Cursor.result_type called into the wrong libclang
function, causing cursors for ObjC method declarations to return invalid
result types. Fixes Bug 36677.

Reviewers: jbcoe, rsmith

Reviewed By: jbcoe

Subscribers: cfe-commits, llvm-commits

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

Patch by kjteske (Kyle Teske).

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

6 years agoAdd tests for llvm-bcanalyzer stream types
Brian Gesiak [Sun, 22 Apr 2018 00:04:35 +0000 (00:04 +0000)]
Add tests for llvm-bcanalyzer stream types

Summary:
Add tests for the improved stream type detection added to
`llvm-bcanalyzer` in https://reviews.llvm.org/D41979.

Test Plan: `check-clang`

Reviewers: pcc, aprantl, mehdi_amini, george.karpenkov

Reviewed By: aprantl

Subscribers: cfe-commits, a.sidorin

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

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

6 years ago[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink
Petr Pavlu [Sat, 21 Apr 2018 14:35:18 +0000 (14:35 +0000)]
[libclang] Fix LibclangReparseTest.FileName when TMPDIR is set to a symlink

Fix testing of clang_File_tryGetRealPathName() in
LibclangReparseTest.FileName when executing in an environment which has
TMPDIR set to a symbolic link that points to an actual directory. The
test would fail because the name returned by
clang_File_tryGetRealPathName() has the symlink resolved but the test
compared it to the original filename of a temporary file.

The patch addresses the problem by checking only that the value returned
by clang_File_tryGetRealPathName() ends with "main.cpp".

Additionally, the patch makes the previous assertion in the test that
checks result of clang_getFileName() stricter. It newly verifies that
the name returned by the function is exactly same as what was given to
clang_parseTranslationUnit()/clang_getFile().

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

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

6 years ago[X86] WaitPKG intrinsics
Gabor Buella [Fri, 20 Apr 2018 18:44:33 +0000 (18:44 +0000)]
[X86] WaitPKG intrinsics

Reviewers: craig.topper, zvi

Reviewed By: craig.topper

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

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

6 years agoRecord whether a module came from a private module map
Jordan Rose [Fri, 20 Apr 2018 17:16:04 +0000 (17:16 +0000)]
Record whether a module came from a private module map

Right now we only use this information in one place, immediately after
we calculate it, but it's still nice information to have. The Swift
project is going to use this to tidy up its "API notes" feature (see
past discussion on cfe-dev that never quite converged).

Reviewed by Bruno Cardoso Lopes.

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

6 years agoRevert r330442, CodeGen/no-ident-version.c is failing on PPC
Mikhail Maltsev [Fri, 20 Apr 2018 17:14:39 +0000 (17:14 +0000)]
Revert r330442, CodeGen/no-ident-version.c is failing on PPC

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

6 years ago[CUDA] Set LLVM calling convention for CUDA kernel
Yaxun Liu [Fri, 20 Apr 2018 17:01:03 +0000 (17:01 +0000)]
[CUDA] Set LLVM calling convention for CUDA kernel

Some targets need special LLVM calling convention for CUDA kernel.
This patch does that through a TargetCodeGenInfo hook.

It only affects amdgcn target.

Patch by Greg Rodgers.
Revised and lit tests added by Yaxun Liu.

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

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

6 years ago[CodeGen] Add an option to suppress output of llvm.ident
Mikhail Maltsev [Fri, 20 Apr 2018 16:29:03 +0000 (16:29 +0000)]
[CodeGen] Add an option to suppress output of llvm.ident

Summary:
By default Clang outputs its version (including git commit hash, in
case of trunk builds) into object and assembly files. It might be
useful to have an option to disable this, especially for debugging
purposes.
This patch implements new command line flags -Qn and -Qy (the names
are chosen for compatibility with GCC). -Qn disables output of
the 'llvm.ident' metadata string and the 'producer' debug info. -Qy
(enabled by default) does the opposite.

Reviewers: faisalv, echristo, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits, JDevlieghere, rogfer01

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

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

6 years agoFix some tests that were failing on Windows
Hans Wennborg [Fri, 20 Apr 2018 15:33:44 +0000 (15:33 +0000)]
Fix some tests that were failing on Windows

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

6 years ago[docs] Regenerate command line reference
Jonas Hahnfeld [Fri, 20 Apr 2018 13:26:03 +0000 (13:26 +0000)]
[docs] Regenerate command line reference

This will correctly sort some manually added entries which should
generally be avoided!

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

6 years ago[OpenMP] Hide -fopenmp-cuda-mode
Jonas Hahnfeld [Fri, 20 Apr 2018 13:25:59 +0000 (13:25 +0000)]
[OpenMP] Hide -fopenmp-cuda-mode

This is an advanced flag that should show up neither in clang --help
nor in the ClangCommandLineReference.

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

6 years agoclang-cl: Accept (and ignore) /Zc:__cplusplus.
Nico Weber [Fri, 20 Apr 2018 13:10:44 +0000 (13:10 +0000)]
clang-cl: Accept (and ignore) /Zc:__cplusplus.

See https://blogs.msdn.microsoft.com/vcblog/2018/04/09/msvc-now-correctly-reports-__cplusplus/
clang-cl already sets __cplusplus to the correct value, so we can just ignore this flag.

Also add test coverage for a few more accepted-but-ignored flags.

https://reviews.llvm.org/D45877

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

6 years ago[CUDA] Document recent changes
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:54 +0000 (13:04 +0000)]
[CUDA] Document recent changes

 * Finding installations via ptxas binary
 * Relocatable device code

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

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

6 years ago[CUDA] Register relocatable GPU binaries
Jonas Hahnfeld [Fri, 20 Apr 2018 13:04:45 +0000 (13:04 +0000)]
[CUDA] Register relocatable GPU binaries

nvcc generates a unique registration function for each object file
that contains relocatable device code. Unique names are achieved
with a module id that is also reflected in the function's name.

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

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

6 years ago[Driver] Support for -save-stats in AddGoldPlugin.
Florian Hahn [Fri, 20 Apr 2018 12:50:10 +0000 (12:50 +0000)]
[Driver] Support for -save-stats in AddGoldPlugin.

This patch updates AddGoldPlugin to pass stats-file to the Gold plugin,
if -save-stats is passed. It also moves the save-stats option handling
to a helper function tools::getStatsFileName.

Reviewers: tejohnson, mehdi_amini, compnerd

Reviewed By: tejohnson, compnerd

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

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

6 years ago[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16...
Ivan A. Kosarev [Fri, 20 Apr 2018 12:09:25 +0000 (12:09 +0000)]
[NEON] Add a comment explaining the situation with vget_high_f16() and vget_low_f16() intrinsics

Related differential revision: https://reviews.llvm.org/D45668

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

6 years agoFix -Wunused-variable warnings after r330377.
Andrea Di Biagio [Fri, 20 Apr 2018 09:47:03 +0000 (09:47 +0000)]
Fix -Wunused-variable warnings after r330377.

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

6 years ago[OpenCL] Add 'denorms-are-zero' function attribute
Alexey Sotkin [Fri, 20 Apr 2018 08:08:04 +0000 (08:08 +0000)]
[OpenCL] Add 'denorms-are-zero' function attribute

Summary:
Generate attribute 'denorms-are-zero'='true' if '-cl-denorms-are-zero'
compile option was specified and 'denorms-are-zero'='false' otherwise.

Patch by krisb

Reviewers: Anastasia, yaxunl

Reviewed By:  yaxunl

Subscribers: cfe-commits

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

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

6 years ago[CFG] [analyzer] Add construction contexts for loop condition variables.
Artem Dergachev [Thu, 19 Apr 2018 23:30:15 +0000 (23:30 +0000)]
[CFG] [analyzer] Add construction contexts for loop condition variables.

Loop condition variables, eg.

  while (shared_ptr<int> P = getIntPtr()) { ... })

weren't handled in r324794 because they don't go through the common
CFGBuilder::VisitDeclStmt method. Which means that they regressed
after r324800.

Fix the regression by duplicating the necessary construction context scan in
the loop visiting code.

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

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

6 years ago[analyzer] When we fail to evaluate a pointer cast, escape the pointer.
Artem Dergachev [Thu, 19 Apr 2018 23:24:32 +0000 (23:24 +0000)]
[analyzer] When we fail to evaluate a pointer cast, escape the pointer.

If a pointer cast fails (evaluates to an UnknownVal, i.e. not implemented in the
analyzer) and such cast is in fact the last use of the pointer, the pointer
symbol is no longer referenced by the program state and a leak is
(mis-)diagnosed.

"Escape" the pointer upon a failed cast, i.e. inform the checker that we can no
longer reliably track it.

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

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

6 years agoImplement proper support for `-falign-functions`
Saleem Abdulrasool [Thu, 19 Apr 2018 23:14:57 +0000 (23:14 +0000)]
Implement proper support for `-falign-functions`

This implements support for the previously ignored flag
`-falign-functions`.  This allows the frontend to request alignment on
function definitions in the translation unit where they are not
explicitly requested in code.  This is compatible with the GCC behaviour
and the ICC behaviour.

The scalar value passed to `-falign-functions` aligns functions to a
power-of-two boundary.  If flag is used, the functions are aligned to
16-byte boundaries.  If the scalar is specified, it must be an integer
less than or equal to 4096.  If the value is not a power-of-two, the
driver will round it up to the nearest power of two.

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

6 years ago[CFG] [analyzer] Don't treat argument constructors as temporary constructors.
Artem Dergachev [Thu, 19 Apr 2018 23:09:22 +0000 (23:09 +0000)]
[CFG] [analyzer] Don't treat argument constructors as temporary constructors.

Function argument constructors (that are used for passing objects into functions
by value) are completely unlike temporary object constructors, but we were
treating them as such because they are also wrapped into a CXXBindTemporaryExpr.

This patch adds a partial construction context layer for call argument values,
but doesn't proceed to transform it into an actual construction context yet.
This is tells the clients that we aren't supporting these constructors yet.

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

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

6 years ago[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.
Artem Dergachev [Thu, 19 Apr 2018 23:00:22 +0000 (23:00 +0000)]
[analyzer] RetainCount: Accept more "safe" CFRetain wrappers.

r315736 added support for the misplaced CF_RETURNS_RETAINED annotation on
CFRetain() wrappers. It works by trusting the function's name (seeing if it
confirms to the CoreFoundation naming convention) rather than the annotation.

There are more false positives caused by users using a different naming
convention, namely starting the function name with "retain" or "release"
rather than suffixing it with "retain" or "release" respectively.

Because this isn't according to the naming convention, these functions
are usually inlined and the annotation is therefore ignored, which is correct.
But sometimes we run out of inlining stack depth and the function is
evaluated conservatively and then the annotation is trusted.

Add support for the "alternative" naming convention and test the situation when
we're running out of inlining stack depth.

rdar://problem/18270122

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

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