]> granicus.if.org Git - clang/log
clang
5 years agoRefactor constant evaluation of typeid(T) to track a symbolic type_info
Richard Smith [Fri, 17 May 2019 07:06:46 +0000 (07:06 +0000)]
Refactor constant evaluation of typeid(T) to track a symbolic type_info
object rather than tracking the originating expression.

This is groundwork for supporting polymorphic typeid expressions. (Note
that this somewhat regresses our support for DR1968, but it turns out
that that never actually worked anyway, at least in non-trivial cases.)

This reinstates r360974, reverted in r360988, with a fix for a
static_assert failure on 32-bit builds: force Type base class to have
8-byte alignment like the rest of Clang's AST nodes.

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

5 years ago[Clang][Docs] Document __FILE_NAME__. NFC
Kristina Brooks [Fri, 17 May 2019 06:46:12 +0000 (06:46 +0000)]
[Clang][Docs] Document __FILE_NAME__. NFC

Document the `__FILE_NAME__` preprocessor extension.

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

5 years ago[Analysis] Only run plugins tests if plugins are actually enabled
Petr Hosek [Fri, 17 May 2019 06:07:37 +0000 (06:07 +0000)]
[Analysis] Only run plugins tests if plugins are actually enabled

When plugins aren't enabled, don't try to run plugins tests. Don't
enable plugins unconditionally based on the platform, instead check
if LLVM shared library is actually being built which may not be the
case for every host configuration, even if the host itself supports
plugins.

This addresses test failures introduced by r360891/D59464.

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

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

5 years agoRevert Refactor constant evaluation of typeid(T) to track a symbolic type_info object...
Chris Bieneman [Fri, 17 May 2019 05:46:03 +0000 (05:46 +0000)]
Revert Refactor constant evaluation of typeid(T) to track a symbolic type_info object rather than tracking the originating expression.

This reverts r360974 (git commit 7ee4307bd4450022c3c8777f43a40cc4f0ccc009)

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

5 years agoRevert [c++20] P1327R1: Support for typeid applied to objects of polymorphic class...
Chris Bieneman [Fri, 17 May 2019 05:45:57 +0000 (05:45 +0000)]
Revert [c++20] P1327R1: Support for typeid applied to objects of polymorphic class type in constant evaluation.

This reverts r360977 (git commit f51dc8d2f98f4029247552bc45ef53628ab3b6b9)

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

5 years agoRe-land: Add Clang shared library with C++ exports
Chris Bieneman [Fri, 17 May 2019 04:20:01 +0000 (04:20 +0000)]
Re-land: Add Clang shared library with C++ exports

Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

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

5 years ago[ELF] Implement Dependent Libraries Feature
Ben Dunbobbin [Fri, 17 May 2019 03:44:15 +0000 (03:44 +0000)]
[ELF] Implement Dependent Libraries Feature

This patch implements a limited form of autolinking primarily designed to allow
either the --dependent-library compiler option, or "comment lib" pragmas (
https://docs.microsoft.com/en-us/cpp/preprocessor/comment-c-cpp?view=vs-2017) in
C/C++ e.g. #pragma comment(lib, "foo"), to cause an ELF linker to automatically
add the specified library to the link when processing the input file generated
by the compiler.

Currently this extension is unique to LLVM and LLD. However, care has been taken
to design this feature so that it could be supported by other ELF linkers.

The design goals were to provide:

- A simple linking model for developers to reason about.
- The ability to to override autolinking from the linker command line.
- Source code compatibility, where possible, with "comment lib" pragmas in other
  environments (MSVC in particular).

Dependent library support is implemented differently for ELF platforms than on
the other platforms. Primarily this difference is that on ELF we pass the
dependent library specifiers directly to the linker without manipulating them.
This is in contrast to other platforms where they are mapped to a specific
linker option by the compiler. This difference is a result of the greater
variety of ELF linkers and the fact that ELF linkers tend to handle libraries in
a more complicated fashion than on other platforms. This forces us to defer
handling the specifiers to the linker.

In order to achieve a level of source code compatibility with other platforms
we have restricted this feature to work with libraries that meet the following
"reasonable" requirements:

1. There are no competing defined symbols in a given set of libraries, or
   if they exist, the program owner doesn't care which is linked to their
   program.
2. There may be circular dependencies between libraries.

The binary representation is a mergeable string section (SHF_MERGE,
SHF_STRINGS), called .deplibs, with custom type SHT_LLVM_DEPENDENT_LIBRARIES
(0x6fff4c04). The compiler forms this section by concatenating the arguments of
the "comment lib" pragmas and --dependent-library options in the order they are
encountered. Partial (-r, -Ur) links are handled by concatenating .deplibs
sections with the normal mergeable string section rules. As an example, #pragma
comment(lib, "foo") would result in:

.section ".deplibs","MS",@llvm_dependent_libraries,1
         .asciz "foo"

For LTO, equivalent information to the contents of a the .deplibs section can be
retrieved by the LLD for bitcode input files.

LLD processes the dependent library specifiers in the following way:

1. Dependent libraries which are found from the specifiers in .deplibs sections
   of relocatable object files are added when the linker decides to include that
   file (which could itself be in a library) in the link. Dependent libraries
   behave as if they were appended to the command line after all other options. As
   a consequence the set of dependent libraries are searched last to resolve
   symbols.
2. It is an error if a file cannot be found for a given specifier.
3. Any command line options in effect at the end of the command line parsing apply
   to the dependent libraries, e.g. --whole-archive.
4. The linker tries to add a library or relocatable object file from each of the
   strings in a .deplibs section by; first, handling the string as if it was
   specified on the command line; second, by looking for the string in each of the
   library search paths in turn; third, by looking for a lib<string>.a or
   lib<string>.so (depending on the current mode of the linker) in each of the
   library search paths.
5. A new command line option --no-dependent-libraries tells LLD to ignore the
   dependent libraries.

Rationale for the above points:

1. Adding the dependent libraries last makes the process simple to understand
   from a developers perspective. All linkers are able to implement this scheme.
2. Error-ing for libraries that are not found seems like better behavior than
   failing the link during symbol resolution.
3. It seems useful for the user to be able to apply command line options which
   will affect all of the dependent libraries. There is a potential problem of
   surprise for developers, who might not realize that these options would apply
   to these "invisible" input files; however, despite the potential for surprise,
   this is easy for developers to reason about and gives developers the control
   that they may require.
4. This algorithm takes into account all of the different ways that ELF linkers
   find input files. The different search methods are tried by the linker in most
   obvious to least obvious order.
5. I considered adding finer grained control over which dependent libraries were
   ignored (e.g. MSVC has /nodefaultlib:<library>); however, I concluded that this
   is not necessary: if finer control is required developers can fall back to using
   the command line directly.

RFC thread: http://lists.llvm.org/pipermail/llvm-dev/2019-March/131004.html.

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

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

5 years ago[c++20] P1327R1: Support for typeid applied to objects of polymorphic
Richard Smith [Fri, 17 May 2019 02:16:45 +0000 (02:16 +0000)]
[c++20] P1327R1: Support for typeid applied to objects of polymorphic
class type in constant evaluation.

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

5 years agoRefactor constant evaluation of typeid(T) to track a symbolic type_info
Richard Smith [Fri, 17 May 2019 01:46:05 +0000 (01:46 +0000)]
Refactor constant evaluation of typeid(T) to track a symbolic type_info
object rather than tracking the originating expression.

This is groundwork for supporting polymorphic typeid expressions. (Note
that this somewhat regresses our support for DR1968, but it turns out
that that never actually worked anyway, at least in non-trivial cases.)

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

5 years agoRevert r360946 "Add Clang shared library with C++ exports"
Nico Weber [Fri, 17 May 2019 01:42:37 +0000 (01:42 +0000)]
Revert r360946 "Add Clang shared library with C++ exports"

It breaks LLVM_ENABLE_PIC=OFF builds, and it's not clear
if the object library approach doesn't impact the normal
clang binary.

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

5 years agoRemove unneeded alignment spec from builtin_FUNCTION.cpp test
Eric Fiselier [Thu, 16 May 2019 23:07:45 +0000 (23:07 +0000)]
Remove unneeded alignment spec from builtin_FUNCTION.cpp test

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

5 years agoFix failing source location test on Windows
Eric Fiselier [Thu, 16 May 2019 22:21:42 +0000 (22:21 +0000)]
Fix failing source location test on Windows

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

5 years agoAdd Clang shared library with C++ exports
Chris Bieneman [Thu, 16 May 2019 22:06:07 +0000 (22:06 +0000)]
Add Clang shared library with C++ exports

Summary:
This patch adds a libClang_shared library on *nix systems which exports the entire C++ API. In order to support this on Windows we should really refactor llvm-shlib and share code between the two.

This also uses a slightly different method for generating the shared library, which I should back-port to llvm-shlib. Instead of linking the static archives and passing linker flags to force loading the whole libraries, this patch creates object libraries for every library (which has no cost in the build system), and link the object libraries.

Reviewers: tstellar, winksaville

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years agoFix PCC test failures for source location builtins
Eric Fiselier [Thu, 16 May 2019 21:51:39 +0000 (21:51 +0000)]
Fix PCC test failures for source location builtins

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

5 years ago[clang/test] Add missing dependency on llvm-cxxfilt.
David L. Jones [Thu, 16 May 2019 21:13:59 +0000 (21:13 +0000)]
[clang/test] Add missing dependency on llvm-cxxfilt.

This tool is needed by clang/test/CodeGen/Output/ppc-mmintrin.c.

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

5 years agoReland "[Clang][PP] Add the __FILE_NAME__ builtin macro"
Kristina Brooks [Thu, 16 May 2019 21:13:49 +0000 (21:13 +0000)]
Reland "[Clang][PP] Add the __FILE_NAME__ builtin macro"

This relands commit rL360833 which caused issues on Win32
bots due to path handling/normalization differences. Now
this uses `sys::path::filename` which should handle
additional edge cases on Win32.

Original commit:

"[Clang][PP] Add the __FILE_NAME__ builtin macro"

This patch adds the __FILE_NAME__ macro that expands to the
last component of the path, similar to __FILE__ except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

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

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

5 years agoImplement __builtin_LINE() et. al. to support source location capture.
Eric Fiselier [Thu, 16 May 2019 21:04:15 +0000 (21:04 +0000)]
Implement __builtin_LINE() et. al. to support source location capture.

Summary:
This patch implements the source location builtins `__builtin_LINE(), `__builtin_FUNCTION()`, `__builtin_FILE()` and `__builtin_COLUMN()`. These builtins are needed to implement [`std::experimental::source_location`](https://rawgit.com/cplusplus/fundamentals-ts/v2/main.html#reflection.src_loc.creation).

With the exception of `__builtin_COLUMN`, GCC also implements these builtins, and Clangs behavior is intended to match as closely as possible.

Reviewers: rsmith, joerg, aaron.ballman, bogner, majnemer, shafik, martong

Reviewed By: rsmith

Subscribers: rnkovacs, loskutov, riccibruno, mgorny, kunitoki, alexr, majnemer, hfinkel, cfe-commits

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

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

5 years ago[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.
Craig Topper [Thu, 16 May 2019 18:28:17 +0000 (18:28 +0000)]
[X86] Stop implicitly enabling avx512vl when avx512bf16 is enabled.

Previously we were doing this so that the 256 bit selectw builtin could be used in the implementation of the 512->256 bit conversion intrinsic.

After this commit we now use a masked convert builtin that will emit the intrinsic call and the 256-bit select from custom code in CGBuiltin. Then the header only needs to call that one intrinsic.

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

5 years agoUpdate comments on enums
Stephen Kelly [Thu, 16 May 2019 18:02:36 +0000 (18:02 +0000)]
Update comments on enums

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

5 years agoMove TraversalKind enum to ast_type_traits
Stephen Kelly [Thu, 16 May 2019 17:57:38 +0000 (17:57 +0000)]
Move TraversalKind enum to ast_type_traits

Summary:
Make it usable outside of ASTMatchFinder.  This will make it possible to
use this enum to control whether certain implicit nodes are skipped
while AST dumping for example.

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates...
Craig Topper [Thu, 16 May 2019 17:34:35 +0000 (17:34 +0000)]
[X86] Update doxygen comments for AVX512BF16 to not refer to masks as 'immediates'. Refer to parameter names instead of 'src', 'src1', 'src2'. NFC

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

5 years ago[CodeComplete] Complete enumerators when preferred type is an enum
Ilya Biryukov [Thu, 16 May 2019 16:06:57 +0000 (16:06 +0000)]
[CodeComplete] Complete enumerators when preferred type is an enum

Reviewers: kadircet

Reviewed By: kadircet

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Add a test plugin for checker option handling
Kristof Umann [Thu, 16 May 2019 15:55:07 +0000 (15:55 +0000)]
[analyzer] Add a test plugin for checker option handling

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

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

5 years agoftime-trace as a CoreOption
Alexandre Ganea [Thu, 16 May 2019 15:14:01 +0000 (15:14 +0000)]
ftime-trace as a CoreOption

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

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

5 years agoAdd AIX Version Macros
Xing Xue [Thu, 16 May 2019 14:22:37 +0000 (14:22 +0000)]
Add AIX Version Macros

Summary:
- This patch checks the AIX version and defines the appropriate macros.
- Follow up to a comment on D59048.

Author: andusy

Reviewers: hubert.reinterpretcast, jasonliu, sfertile, xingxue

Reviewed By: sfertile

Subscribers: jsji, cfe-commits

Tags: #clang

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

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

5 years ago[clang] Handle lround/llround builtins
Adhemerval Zanella [Thu, 16 May 2019 13:43:25 +0000 (13:43 +0000)]
[clang] Handle lround/llround builtins

As for other floating-point rounding builtins that can be optimized
when build with -fno-math-errno, this patch adds support for lround
and llround.  It currently only optimize for AArch64 backend.

Reviewed By: efriedma

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

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

5 years agoRecommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>
Fangrui Song [Thu, 16 May 2019 13:24:04 +0000 (13:24 +0000)]
Recommit [Object] Change object::SectionRef::getContents() to return Expected<StringRef>

r360876 didn't fix 2 call sites in clang.

Expected<ArrayRef<uint8_t>> may be better but use Expected<StringRef> for now.

Follow-up of D61781.

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

5 years agoReland "[analyzer] Add an example plugin for checker dependency handling"
Kristof Umann [Thu, 16 May 2019 13:22:04 +0000 (13:22 +0000)]
Reland "[analyzer] Add an example plugin for checker dependency handling"

Buildbots complained that they couldn't find the newly added plugins.

The solution was to move the check-clang cmake target closer to the bottom of
the file, after the new dependencies are added.

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

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

5 years agoFix isInSystemMacro in presence of macro and pasted token
Serge Guelton [Thu, 16 May 2019 12:40:00 +0000 (12:40 +0000)]
Fix isInSystemMacro in presence of macro and pasted token

When a warning is raised from the expansion of a system macro that
involves pasted token, there was still situations were they were not
skipped, as showcased by this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=1472437

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

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

5 years ago[builtin] Fixed definitions of builtins that rely on the int/long long type is 32...
Karl-Johan Karlsson [Thu, 16 May 2019 07:18:02 +0000 (07:18 +0000)]
[builtin] Fixed definitions of builtins that rely on the int/long long type is 32/64 bits

Summary:
The definition of the builtins __builtin_bswap32, __builtin_bitreverse32, __builtin_rotateleft32 and __builtin_rotateright32 rely on that the int type is 32 bits wide on the target.
The defintions of the builtins __builtin_bswap64, __builtin_bitreverse64, __builtin_rotateleft64, and __builtin_rotateright64 rely on that the long long type is 64 bits wide.

On targets where this is not the case (e.g. AVR) clang will generate faulty code (wrong llvm assembler intrinsics).

This patch add support for using 'Z' (the int32_t type) in Bultins.def. The builtins above are changed to be based on the int32_t type instead of the int type, and the int64_t type instead of the long long type.

The AVR backend (experimental) have a native int type that is only 16 bits wide. The supplied testcase will therefore fail if running the testcase on trunk as clang will convert e.g. __builtin_bitreverse32 into llvm.bitreverse.i16 on AVR.

Reviewers: dylanmckay, spatel, rsmith, efriedma

Reviewed By: efriedma

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

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

5 years agoRevert r360833 until I can work out the issue with Win32 bots
Kristina Brooks [Thu, 16 May 2019 03:30:08 +0000 (03:30 +0000)]
Revert r360833 until I can work out the issue with Win32 bots

This reverts "r360833: [Clang][PP] Add the __FILE_NAME__ builtin macro."

The tests are failing on Windows bots, reverting the patchset until I can
work out why.

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

5 years agoFix assumption about Win32 paths in r360833
Kristina Brooks [Thu, 16 May 2019 02:46:12 +0000 (02:46 +0000)]
Fix assumption about Win32 paths in r360833

Attempt to fix Windows buildbots due to differences in
path handling (caused by r360833).

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

5 years agoFix regression in r360311 caused by reversed bool arguments.
Richard Smith [Thu, 16 May 2019 02:06:16 +0000 (02:06 +0000)]
Fix regression in r360311 caused by reversed bool arguments.

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

5 years ago[Clang][PP] Add the __FILE_NAME__ builtin macro.
Kristina Brooks [Thu, 16 May 2019 00:52:41 +0000 (00:52 +0000)]
[Clang][PP] Add the __FILE_NAME__ builtin macro.

This patch adds the `__FILE_NAME__` macro that expands to the
last component of the path, similar to `__FILE__` except with
a guarantee that only the last path component (without the
separator) will be rendered.

I intend to follow through with discussion of this with WG14
as a potential inclusion in the C standard or failing that,
try to discuss this with GCC developers since this extension
is desired by GCC and Clang users/developers alike.

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

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

5 years agoMake tentative parsing to detect template-argument-lists less aggressive
Richard Smith [Wed, 15 May 2019 23:36:14 +0000 (23:36 +0000)]
Make tentative parsing to detect template-argument-lists less aggressive
(and less wrong).

It's not correct to assume that X<something, Type> is always a
template-id; there are a few cases where the comma takes us into a
non-expression syntactic context in which 'Type' might be permissible.
Stop doing that.

This slightly regresses our error recovery on the cases where the
construct is intended to be a template-id. We typically do still manage
to diagnose a missing 'template' keyword, but we realize this too late
to properly recover from the error.

This fixes a regression introduced by r360308.

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

5 years ago[clang-format] Fixed self assignment
David Bolvansky [Wed, 15 May 2019 20:29:33 +0000 (20:29 +0000)]
[clang-format] Fixed self assignment

Reviewers: MyDeveloperDay, RKSimon

Reviewed By: MyDeveloperDay

Subscribers: RKSimon, cfe-commits

Tags: #clang

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

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

5 years ago[OpenMP][Bugfix] Move double and float versions of abs under c++ macro
Gheorghe-Teodor Bercea [Wed, 15 May 2019 20:28:23 +0000 (20:28 +0000)]
[OpenMP][Bugfix] Move double and float versions of abs under c++ macro

Summary:
This is a fix for the reported bug:

[[ https://bugs.llvm.org/show_bug.cgi?id=41861 | 41861 ]]

abs functions need to be moved under the c++ macro to avoid conflicts with included headers.

Reviewers: tra, jdoerfert, hfinkel, ABataev, caomhin

Reviewed By: jdoerfert

Subscribers: guansong, cfe-commits

Tags: #clang

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

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

5 years ago[c++20] For P1327R1: support dynamic_cast in constant expression
Richard Smith [Wed, 15 May 2019 20:22:21 +0000 (20:22 +0000)]
[c++20] For P1327R1: support dynamic_cast in constant expression
evaluation.

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

5 years agoRevert "[analyzer] Add a test for plugins using checker dependencies"
Kristof Umann [Wed, 15 May 2019 20:19:51 +0000 (20:19 +0000)]
Revert "[analyzer] Add a test for plugins using checker dependencies"

Buildbots don't seem to find the new plugin.

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

5 years ago[OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions
Gheorghe-Teodor Bercea [Wed, 15 May 2019 20:18:21 +0000 (20:18 +0000)]
[OpenMP][bugfix] Fix issues with C++ 17 compilation when handling math functions

Summary: In OpenMP device offloading we must ensure that unde C++ 17, the inclusion of cstdlib will works correctly.

Reviewers: ABataev, tra, jdoerfert, hfinkel, caomhin

Reviewed By: jdoerfert

Subscribers: Hahnfeld, guansong, cfe-commits

Tags: #clang

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

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

5 years ago[CodeGenObjC] invoke objc_autorelease, objc_retain when necessary
Erik Pilkington [Wed, 15 May 2019 20:15:01 +0000 (20:15 +0000)]
[CodeGenObjC] invoke objc_autorelease, objc_retain when necessary

Any of these methods can be overridden, so we need to invoke these functions.

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

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

5 years ago[analyzer] Add a test for plugins using checker dependencies
Kristof Umann [Wed, 15 May 2019 19:47:26 +0000 (19:47 +0000)]
[analyzer] Add a test for plugins using checker dependencies

Also, I moved the existing analyzer plugin to test/ as well, in order not to
give the illusion that the analyzer supports plugins -- it's capable of handling
them, but does not _support_ them.

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

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

5 years ago[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.
Artem Dergachev [Wed, 15 May 2019 18:41:32 +0000 (18:41 +0000)]
[analyzer] RetainCount: Fix os_returns_retained_on_zero with weird return types.

The checker was crashing when it was trying to assume a structure
to be null or non-null so that to evaluate the effect of the annotation.

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

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

5 years agoTest commit
Kevin Petit [Wed, 15 May 2019 16:39:28 +0000 (16:39 +0000)]
Test commit

Remove stray space.

Signed-off-by: Kevin Petit <kevin.petit@arm.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@360783 91177308-0d34-0410-b5e6-96231b3b80d8

5 years ago[ASTImporter] Use llvm::Expected and Error in the importer API
Gabor Marton [Wed, 15 May 2019 10:29:48 +0000 (10:29 +0000)]
[ASTImporter] Use llvm::Expected and Error in the importer API

Summary:
This is the final phase of the refactoring towards using llvm::Expected
and llvm::Error in the ASTImporter API.
This involves the following:
- remove old Import functions which returned with a pointer,
- use the Import_New functions (which return with Err or Expected) everywhere
  and handle their return value
- rename Import_New functions to Import
This affects both Clang and LLDB.

Reviewers: shafik, teemperor, aprantl, a_sidorin, balazske, a.sidorin

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

Tags: #clang, #lldb

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

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

5 years ago[analyzer] MIGChecker: Fix redundant semicolon.
Artem Dergachev [Wed, 15 May 2019 01:36:41 +0000 (01:36 +0000)]
[analyzer] MIGChecker: Fix redundant semicolon.

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

5 years ago[analyzer] MIGChecker: Add support for os_ref_retain().
Artem Dergachev [Wed, 15 May 2019 01:19:19 +0000 (01:19 +0000)]
[analyzer] MIGChecker: Add support for os_ref_retain().

Suppress MIG checker false positives that occur when the programmer increments
the reference count before calling a MIG destructor, and the MIG destructor
literally boils down to decrementing the reference count.

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

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

5 years agoFix bots by adding target triple to test.
Leonard Chan [Tue, 14 May 2019 22:37:34 +0000 (22:37 +0000)]
Fix bots by adding target triple to test.

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

5 years ago[NewPM] Port HWASan and Kernel HWASan
Leonard Chan [Tue, 14 May 2019 21:17:21 +0000 (21:17 +0000)]
[NewPM] Port HWASan and Kernel HWASan

Port hardware assisted address sanitizer to new PM following the same guidelines as msan and tsan.

Changes:
- Separate HWAddressSanitizer into a pass class and a sanitizer class.
- Create new PM wrapper pass for the sanitizer class.
- Use the getOrINsert pattern for some module level initialization declarations.
- Also enable kernel-kwasan in new PM
- Update llvm tests and add clang test.

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

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

5 years agoFix ASTMerge/namespace/test.cpp after r360701
Reid Kleckner [Tue, 14 May 2019 20:01:03 +0000 (20:01 +0000)]
Fix ASTMerge/namespace/test.cpp after r360701

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

5 years agoTemporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compress...
Eric Christopher [Tue, 14 May 2019 19:40:42 +0000 (19:40 +0000)]
Temporarily revert "Change -gz and -Wa,--compress-debug-sections to use gABI compression (SHF_COMPRESSED)"

This affects users of older (pre 2.26) binutils in such a way that they can't necessarily
work around it as it doesn't support the compress option on the command line. Reverting
to unblock them and we can revisit whether to make this change now or fix how we want
to express the option.

This reverts commit bdb21337e6e1732c9895966449c33c408336d295/r360403.

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

5 years agoUpdate ASTMerge FileCheck test expectations
Reid Kleckner [Tue, 14 May 2019 19:02:39 +0000 (19:02 +0000)]
Update ASTMerge FileCheck test expectations

I belive many of these diagnostics changed from errors to warnings in
r357394. I've simply mechanically updated the tests, but whoever owns
this code should probably audit for unintented behavior changes. I
wasn't able to find a flag to make these warnings errors again.

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

5 years agoRestore test files accidentally deleted in r354839
Reid Kleckner [Tue, 14 May 2019 18:51:07 +0000 (18:51 +0000)]
Restore test files accidentally deleted in r354839

I think there must be a bug in git-llvm causing parent directories to be
deleted when the diff deletes files in a subdirectory. Perhaps it is
Windows-only.

There has been a behavior change, so some of these tests now fail. I
have marked them XFAIL and will fix them in a follow-up to separate the
changes.

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

5 years ago[Sema] CodeSynthesisContext - add missing variable initialization to constructor...
Simon Pilgrim [Tue, 14 May 2019 14:58:47 +0000 (14:58 +0000)]
[Sema] CodeSynthesisContext - add missing variable initialization to constructor. NFCI.

SavedInNonInstantiationSFINAEContext isn't used outside of specific contexts but this fixes cppcheck and scan-build warnings.

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

5 years ago[Driver][Windows] Add dependent lib argument for profile instr generate
Russell Gallop [Tue, 14 May 2019 14:01:40 +0000 (14:01 +0000)]
[Driver][Windows] Add dependent lib argument for profile instr generate

This is needed so lld-link can find clang_rt.profile when self hosting
on Windows with PGO. Using clang-cl as a linker knows to add the library
but self hosting, using -DCMAKE_LINKER=<...>/lld-link.exe doesn't.

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

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

5 years agoMake getObjCEncodingForTypeImpl() take a bitmask instead of 8 bools
Nico Weber [Tue, 14 May 2019 12:32:37 +0000 (12:32 +0000)]
Make getObjCEncodingForTypeImpl() take a bitmask instead of 8 bools

Slightly easier to read, uses slightly less stack space, and makes it
impossible to mix up the order of all those bools.

No behavior change.

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

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

5 years agoAdd a new language mode for C2x; enable [[attribute]] support by default in C2x.
Aaron Ballman [Tue, 14 May 2019 12:09:55 +0000 (12:09 +0000)]
Add a new language mode for C2x; enable [[attribute]] support by default in C2x.

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

5 years agoRevert r360637 "PR41817: Fix regression in r359260 that caused the MS compatibility"
Hans Wennborg [Tue, 14 May 2019 10:11:33 +0000 (10:11 +0000)]
Revert r360637 "PR41817: Fix regression in r359260 that caused the MS compatibility"

> extension allowing a "static" declaration to follow an "extern"
> declaration to stop working.

It introduced asserts for some "static-following-extern" cases, breaking the
Chromium build. See the cfe-commits thread for reproducer.

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

5 years agoPR41817: Fix regression in r359260 that caused the MS compatibility
Richard Smith [Tue, 14 May 2019 00:27:16 +0000 (00:27 +0000)]
PR41817: Fix regression in r359260 that caused the MS compatibility
extension allowing a "static" declaration to follow an "extern"
declaration to stop working.

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

5 years ago[c++20] P1064R0: Allow virtual function calls in constant expression
Richard Smith [Mon, 13 May 2019 23:35:21 +0000 (23:35 +0000)]
[c++20] P1064R0: Allow virtual function calls in constant expression
evaluation.

This reinstates r360559, reverted in r360580, with a fix to avoid
crashing if evaluation-for-overflow mode encounters a virtual call on an
object of a class with a virtual base class, and to generally not try to
resolve virtual function calls to objects whose (notional) vptrs are not
readable. (The standard rules are unclear here, but this seems like a
reasonable approach.)

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

5 years ago[AMDGPU] gfx1010 clang target
Stanislav Mekhanoshin [Mon, 13 May 2019 23:15:59 +0000 (23:15 +0000)]
[AMDGPU] gfx1010 clang target

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

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

5 years ago[X86] Make `x86intrin.h`, `immintrin.h` includable with `-fno-gnu-inline-asm`.
Volodymyr Sapsai [Mon, 13 May 2019 22:40:11 +0000 (22:40 +0000)]
[X86] Make `x86intrin.h`, `immintrin.h` includable with `-fno-gnu-inline-asm`.

Currently `immintrin.h` includes `pconfigintrin.h` and `sgxintrin.h`
which contain inline assembly. It causes failures when building with the
flag `-fno-gnu-inline-asm`.

Fix by excluding functions with inline assembly when this extension is
disabled. So far there was no need to support `_pconfig_u32`,
`_enclu_u32`, `_encls_u32`, `_enclv_u32` on platforms that require
`-fno-gnu-inline-asm`. But if developers start using these functions,
they'll have compile-time undeclared identifier errors which is
preferrable to runtime errors.

rdar://problem/49540880

Reviewers: craig.topper, GBuella, rnk, echristo

Reviewed By: rnk

Subscribers: jkorous, dexonsmith, cfe-commits

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

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

5 years agoRemoving an unused member variable; NFC.
Aaron Ballman [Mon, 13 May 2019 22:29:16 +0000 (22:29 +0000)]
Removing an unused member variable; NFC.

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

5 years ago[OpenMP][Clang][BugFix] Split declares and math functions inclusion.
Gheorghe-Teodor Bercea [Mon, 13 May 2019 22:11:44 +0000 (22:11 +0000)]
[OpenMP][Clang][BugFix] Split declares and math functions inclusion.

Summary: This patches fixes an issue in which the __clang_cuda_cmath.h header is being included even when cmath or math.h headers are not included.

Reviewers: jdoerfert, ABataev, hfinkel, caomhin, tra

Reviewed By: tra

Subscribers: tra, mgorny, guansong, cfe-commits

Tags: #clang

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

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

5 years agoMake language option `GNUAsm` discoverable with `__has_extension` macro.
Volodymyr Sapsai [Mon, 13 May 2019 22:11:10 +0000 (22:11 +0000)]
Make language option `GNUAsm` discoverable with `__has_extension` macro.

This can be used for better support of `-fno-gnu-inline-asm` builds.

rdar://problem/49540880

Reviewers: aaron.ballman, rsmith

Reviewed By: aaron.ballman

Subscribers: eraman, jkorous, dexonsmith, craig.topper, cfe-commits

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

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

5 years agoIntroduce the ability to dump the AST to JSON.
Aaron Ballman [Mon, 13 May 2019 21:39:55 +0000 (21:39 +0000)]
Introduce the ability to dump the AST to JSON.

This adds the -ast-dump=json cc1 flag (in addition to -ast-dump=default, which is the default if no dump format is specified), as well as some initial AST dumping functionality and tests.

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

5 years agoMake more friendly with unions. Reviewed as https://reviews.llvm.org/D61858
Marshall Clow [Mon, 13 May 2019 19:29:23 +0000 (19:29 +0000)]
Make  more friendly with unions. Reviewed as https://reviews.llvm.org/D61858

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

5 years ago[clang][ASTContext] Call setAttached for comments attached to a declaration
Jan Korous [Mon, 13 May 2019 17:52:09 +0000 (17:52 +0000)]
[clang][ASTContext] Call setAttached for comments attached to a declaration

This is a bug affecting performance when compiling with -Wdocumentation.

In Sema::ActOnDocumentable we're checking whether there are any comments unattached to declaration at the end of comment list whenever we encounter new documentable declaration.
Since this property of RawComment was never set we were trying to find comments every time and that involves at least a couple expensive SourceLocation decompositions.

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

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

5 years agoRevert r360559 "[c++20] P1064R0: Allow virtual function calls in constant expression...
Hans Wennborg [Mon, 13 May 2019 13:19:09 +0000 (13:19 +0000)]
Revert r360559 "[c++20] P1064R0: Allow virtual function calls in constant expression evaluation."

This caused Chromium builds to hit the new "can't handle virtual calls with
virtual bases" assert. Reduced repro coming up.

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

5 years ago[ASTImporter] Separate unittest files
Gabor Marton [Mon, 13 May 2019 10:06:25 +0000 (10:06 +0000)]
[ASTImporter] Separate unittest files

Summary:
Move generic redecl chain tests and visibility tests into their own
separate test files.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years agoPR41845: Detect and reject mismatched inner/outer pack expansion sizes
Richard Smith [Mon, 13 May 2019 08:31:14 +0000 (08:31 +0000)]
PR41845: Detect and reject mismatched inner/outer pack expansion sizes
in fold expressions rather than crashing.

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

5 years agoPR41854: Don't assert when constant-evaluating a member function call on an invalid...
Richard Smith [Mon, 13 May 2019 07:51:29 +0000 (07:51 +0000)]
PR41854: Don't assert when constant-evaluating a member function call on an invalid designator.

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

5 years ago[c++20] P1064R0: Allow virtual function calls in constant expression
Richard Smith [Mon, 13 May 2019 07:42:10 +0000 (07:42 +0000)]
[c++20] P1064R0: Allow virtual function calls in constant expression
evaluation.

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

5 years agoFix test to use -cc1.
Leonard Chan [Sun, 12 May 2019 22:44:46 +0000 (22:44 +0000)]
Fix test to use -cc1.

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

5 years ago[clang] Regenerate AST matcher docs 📖
Stephane Moore [Sun, 12 May 2019 21:52:19 +0000 (21:52 +0000)]
[clang] Regenerate AST matcher docs ðŸ“–

Summary:
The documentation seems to have been manually edited in https://reviews.llvm.org/rGa282bde69e375985edd4c371b79864f617380ad5.

This commit regenerates the documentation and commits the resulting diff.

Reviewers: benhamilton, mwyman

Reviewed By: mwyman

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFix for P41852 where builtin attributes were being caught by FindLocsWithCommonFileID().
Leonard Chan [Sun, 12 May 2019 21:50:01 +0000 (21:50 +0000)]
Fix for P41852 where builtin attributes were being caught by FindLocsWithCommonFileID().

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

5 years agomake -ftime-trace also print template arguments
Lubos Lunak [Sun, 12 May 2019 10:39:21 +0000 (10:39 +0000)]
make -ftime-trace also print template arguments

Without this, I get e.g. 'PerformPendingInstantiations' -> 'std::fill',
now I get 'std::fill<unsigned long *, int>'.

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

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

5 years agoReject attempts to call non-static member functions on objects outside
Richard Smith [Sun, 12 May 2019 09:39:08 +0000 (09:39 +0000)]
Reject attempts to call non-static member functions on objects outside
their lifetime in constant expressions.

This is undefined behavior per [class.cdtor]p2.

We continue to allow this for objects whose values are not visible
within the constant evaluation, because there's no way we can tell
whether the access is defined or not, existing code relies on the
ability to make such calls, and every other compiler allows such
calls.

This reinstates r360499, reverted in r360531.

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

5 years agoFix handling of objects under construction during constant expression
Richard Smith [Sun, 12 May 2019 08:57:59 +0000 (08:57 +0000)]
Fix handling of objects under construction during constant expression
evaluation.

It's not enough to just track the LValueBase that we're evaluating, we
need to also track the path to the objects whose constructors are
running.

This reinstates r360464 (reverted in r360531) with a workaround for an
MSVC bug that previously caused the Windows bots to fail.

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

5 years agoRevert rL360499 and rL360464 from cfe/trunk:
Simon Pilgrim [Sat, 11 May 2019 20:21:59 +0000 (20:21 +0000)]
Revert rL360499 and rL360464 from cfe/trunk:
Reject attempts to call non-static member functions on objects outside
their lifetime in constant expressions.

This is undefined behavior per [class.cdtor]p2.

We continue to allow this for objects whose values are not visible
within the constant evaluation, because there's no way we can tell
whether the access is defined or not, existing code relies on the
ability to make such calls, and every other compiler allows such
calls.
........
Fix handling of objects under construction during constant expression
evaluation.

It's not enough to just track the LValueBase that we're evaluating, we
need to also track the path to the objects whose constructors are
running.
........
Fixes windows buildbots

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

5 years agoConstantLValueEmitter::tryEmitAbsolute - remove unused variable. NFCI.
Simon Pilgrim [Sat, 11 May 2019 11:01:46 +0000 (11:01 +0000)]
ConstantLValueEmitter::tryEmitAbsolute - remove unused variable. NFCI.

Duplicate getOffset() call.

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

5 years agoReject attempts to call non-static member functions on objects outside
Richard Smith [Sat, 11 May 2019 02:00:06 +0000 (02:00 +0000)]
Reject attempts to call non-static member functions on objects outside
their lifetime in constant expressions.

This is undefined behavior per [class.cdtor]p2.

We continue to allow this for objects whose values are not visible
within the constant evaluation, because there's no way we can tell
whether the access is defined or not, existing code relies on the
ability to make such calls, and every other compiler allows such
calls.

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

5 years ago[cc1as] Change -compress-debug-sections= to use --
Fangrui Song [Sat, 11 May 2019 01:14:50 +0000 (01:14 +0000)]
[cc1as] Change -compress-debug-sections= to use --

The double dash form is documented by GNU as, used by gcc, and accepted by llvm-mc.

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

5 years ago[Darwin] Introduce a new flag, -fapple-link-rtlib that forces linking of the builtins...
Amara Emerson [Fri, 10 May 2019 23:24:20 +0000 (23:24 +0000)]
[Darwin] Introduce a new flag, -fapple-link-rtlib that forces linking of the builtins library.

This driver flag is useful when users want to link against the compiler's
builtins, but nothing else, and so use flags like -nostdlib.

Darwin can't use -nolibc & nostdlib++ like other platforms on because we
disable all runtime lib linking with -static, which we still want to have
an option to link with the builtins.

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

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

5 years ago[CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when
Akira Hatanaka [Fri, 10 May 2019 21:54:16 +0000 (21:54 +0000)]
[CodeGen][ObjC] Emit invoke instead of call to call `objc_release` when
necessary.

Prior to r349952, clang used to call objc_msgSend when sending a release
messages, emitting an invoke instruction instead of a call instruction
when it was necessary to catch an exception. That changed in r349952
because runtime function objc_release is called as a nounwind function,
which broke programs that were overriding the dealloc method and
throwing an exception from it. This patch restores the behavior prior to
r349952.

rdar://problem/50253394

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

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

5 years ago[ThinLTO] Clang test changes for new CanAutoHide flag
Teresa Johnson [Fri, 10 May 2019 20:38:31 +0000 (20:38 +0000)]
[ThinLTO] Clang test changes for new CanAutoHide flag

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

5 years agoFixed tests where grep was not matching the linefeed
Alexandre Ganea [Fri, 10 May 2019 20:11:36 +0000 (20:11 +0000)]
Fixed tests where grep was not matching the linefeed

When files are synchronized locally as CRLF on Windows, grep didn't match the newline. Switched to FileCheck instead.

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

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

5 years agoAdd target triple to test.
Leonard Chan [Fri, 10 May 2019 20:07:47 +0000 (20:07 +0000)]
Add target triple to test.

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

5 years agoFix handling of objects under construction during constant expression
Richard Smith [Fri, 10 May 2019 20:05:32 +0000 (20:05 +0000)]
Fix handling of objects under construction during constant expression
evaluation.

It's not enough to just track the LValueBase that we're evaluating, we
need to also track the path to the objects whose constructors are
running.

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

5 years agoImprove interface of APValuePathEntry.
Richard Smith [Fri, 10 May 2019 20:05:31 +0000 (20:05 +0000)]
Improve interface of APValuePathEntry.

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

5 years agoReplace 'REQUIRES: nozlib' with '!zlib' because we don't need two ways
Paul Robinson [Fri, 10 May 2019 18:32:53 +0000 (18:32 +0000)]
Replace 'REQUIRES: nozlib' with '!zlib' because we don't need two ways
to say the same thing.

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

5 years agoFix and test for assertion error in P41835.
Leonard Chan [Fri, 10 May 2019 18:05:15 +0000 (18:05 +0000)]
Fix and test for assertion error in P41835.

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

5 years agoReplace 'REQUIRES: not_?san' with 'UNSUPPORTED: ?san' as that better
Paul Robinson [Fri, 10 May 2019 17:57:22 +0000 (17:57 +0000)]
Replace 'REQUIRES: not_?san' with 'UNSUPPORTED: ?san' as that better
expresses the intent of the exclusion.

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

5 years ago[Sema] Mark array element destructors referenced during initialization
Erik Pilkington [Fri, 10 May 2019 17:52:26 +0000 (17:52 +0000)]
[Sema] Mark array element destructors referenced during initialization

This fixes a crash where we would neglect to mark a destructor referenced for an
__attribute__((no_destory)) array. The destructor is needed though, since if an
exception is thrown we need to cleanup the elements.

rdar://48462498

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

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

5 years ago[libclang] Forward isInline for NamespaceDecl to libclang
Nikolai Kosjar [Fri, 10 May 2019 13:58:34 +0000 (13:58 +0000)]
[libclang] Forward isInline for NamespaceDecl to libclang

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

5 years agoAdd name comments for bools passed to getObjCEncodingForTypeImpl()
Nico Weber [Fri, 10 May 2019 13:56:56 +0000 (13:56 +0000)]
Add name comments for bools passed to getObjCEncodingForTypeImpl()

No behavior change. Medium term, probably want to use a bitmask instead
of 8 distinct bool parameters, but let's make the call sites easier to
read first.

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

5 years agoReplace lit feature keyword 'non-ms-sdk' with 'ms-sdk'; eliminate
Paul Robinson [Fri, 10 May 2019 13:40:17 +0000 (13:40 +0000)]
Replace lit feature keyword 'non-ms-sdk' with 'ms-sdk'; eliminate
'non-ps4-sdk' and use just 'ps4'.

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

5 years agoFix Wdocumentation warning. NFCI.
Simon Pilgrim [Fri, 10 May 2019 10:36:37 +0000 (10:36 +0000)]
Fix Wdocumentation warning. NFCI.

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

5 years ago[Preamble] Stop circular inclusion of main file when building preamble
Nikolai Kosjar [Fri, 10 May 2019 10:25:35 +0000 (10:25 +0000)]
[Preamble] Stop circular inclusion of main file when building preamble

If a header file was processed for the second time, we could end up with a
wrong conditional stack and skipped ranges:

In the particular example, if the header guard is evaluated the second time and
it is decided to skip the conditional block, the corresponding "#endif" is
never seen since the preamble does not include it and we end up in the
Tok.is(tok::eof) case with a wrong conditional stack.

Detect the circular inclusion, emit a diagnostic and stop processing the
inclusion.

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

5 years agoRevert "Revert "[clang-format] Keep protobuf "package" statement on one line""
Krasimir Georgiev [Fri, 10 May 2019 09:15:11 +0000 (09:15 +0000)]
Revert "Revert "[clang-format] Keep protobuf "package" statement on one line""

Summary:
Top-level "package" and "import" statements should generally be kept on
one line, for all languages.

----

This reverts commit rL356912.
The regression from rL356835 was fixed via rC358275.

Reviewers: krasimir, sammccall, MyDeveloperDay, xinz, dchai, klimek

Reviewed By: krasimir, xinz, dchai

Subscribers: cfe-commits

Tags: #clang

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

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