]> granicus.if.org Git - clang/log
clang
5 years agoDiagnose _Bool as a C99 extension.
Aaron Ballman [Tue, 27 Aug 2019 20:33:05 +0000 (20:33 +0000)]
Diagnose _Bool as a C99 extension.

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

5 years agoDebug Info: Support for DW_AT_export_symbols for anonymous structs
Shafik Yaghmour [Tue, 27 Aug 2019 20:17:35 +0000 (20:17 +0000)]
Debug Info: Support for DW_AT_export_symbols for anonymous structs

This implements the DWARF 5 feature described in:

http://dwarfstd.org/ShowIssue.php?issue=141212.1

To support recognizing anonymous structs:

  struct A {
    struct { // Anonymous struct
        int y;
    };
  } a;

This patch adds support in CGDebugInfo::CreateLimitedType(...) for this new flag and an accompanying test to verify this feature.

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

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

5 years agoAMDGPU: Always emit amdgpu-flat-work-group-size
Matt Arsenault [Tue, 27 Aug 2019 19:25:40 +0000 (19:25 +0000)]
AMDGPU: Always emit amdgpu-flat-work-group-size

The backend default maximum should be the hardware maximum, so the
frontend should set the implementation defined default maximum.

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

5 years agoDiagnose both _Complex and _Imaginary as C99 extensions.
Aaron Ballman [Tue, 27 Aug 2019 19:15:24 +0000 (19:15 +0000)]
Diagnose both _Complex and _Imaginary as C99 extensions.

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

5 years ago[driver][xray] fix the macOS support checker by supporting -macos
Alex Lorenz [Tue, 27 Aug 2019 18:26:36 +0000 (18:26 +0000)]
[driver][xray] fix the macOS support checker by supporting -macos
triple in addition to -darwin

The previous check incorrectly checked for macOS support by
allowing -darwin triples only, and -macos triple was not supported.

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

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

5 years agoMove EH spec mismatches under -fms-compatibility
Reid Kleckner [Tue, 27 Aug 2019 17:52:03 +0000 (17:52 +0000)]
Move EH spec mismatches under -fms-compatibility

-fms-extensions is intended to enable conforming language extensions and
-fms-compatibility is intended to language rule relaxations, so a user
could plausibly compile with -fno-ms-compatibility on Windows while
still using dllexport, for example.  This exception specification
validation behavior has been handled as a warning since before
-fms-compatibility was added in 2011. I think it's just an oversight
that it hasn't been moved yet.

This will help users find conformance issues in their code such as those
found in _com_ptr_t as described in https://llvm.org/PR42842.

Reviewers: hans

Subscribers: STL_MSFT, cfe-commits

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

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

5 years agoChange the X86 datalayout to add three address spaces for 32 bit signed,
Amy Huang [Tue, 27 Aug 2019 17:46:53 +0000 (17:46 +0000)]
Change the X86 datalayout to add three address spaces for 32 bit signed,
32 bit unsigned, and 64 bit pointers.

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

5 years agoUse FileEntryRef for PPCallbacks::HasInclude
Alex Lorenz [Tue, 27 Aug 2019 17:32:42 +0000 (17:32 +0000)]
Use FileEntryRef for PPCallbacks::HasInclude

This fixes the issue where a filename dependendency was missing if the file that
was referenced with __has_include() was accessed through a symlink in an earlier run,
if the file manager was reused between runs.

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

5 years ago[RISCV] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for RV32/RV64 targets...
Sam Elliott [Tue, 27 Aug 2019 15:41:16 +0000 (15:41 +0000)]
[RISCV] Set MaxAtomicInlineWidth and MaxAtomicPromoteWidth for RV32/RV64 targets with atomics

Summary: This ensures that libcalls aren't generated when the target supports atomics. Atomics aren't in the base RV32I/RV64I instruction sets, so MaxAtomicInlineWidth and MaxAtomicPromoteWidth are set only when the atomics extension is being targeted. This must be done in setMaxAtomicWidth, as this should be done after handleTargetFeatures has been called.

Reviewers: jfb, jyknight, wmi, asb

Reviewed By: asb

Subscribers: pzheng, MaskRay, s.egerton, lenary, dexonsmith, psnobl, benna, Jim, JohnLLVM, rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, lewis-revill, cfe-commits

Tags: #clang

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

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

5 years agoUpdate the SARIF exporter to SARIF 2.1
Joe Ranieri [Tue, 27 Aug 2019 14:43:54 +0000 (14:43 +0000)]
Update the SARIF exporter to SARIF 2.1

This updates the SARIF exporter to produce SARIF 2.1 output. The bulk of the diffs come from two changes to SARIF:
* https://github.com/oasis-tcs/sarif-spec/issues/309
* https://github.com/oasis-tcs/sarif-spec/issues/179

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

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

5 years agoReplace some custom C11 extension warnings with the generic warning.
Aaron Ballman [Tue, 27 Aug 2019 14:41:39 +0000 (14:41 +0000)]
Replace some custom C11 extension warnings with the generic warning.

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

5 years agoFix a SARIF exporter crash with macro expansions
Joe Ranieri [Tue, 27 Aug 2019 14:20:27 +0000 (14:20 +0000)]
Fix a SARIF exporter crash with macro expansions

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

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

5 years agoFix text range end columns in SARIF to be exclusive
Joe Ranieri [Tue, 27 Aug 2019 13:49:45 +0000 (13:49 +0000)]
Fix text range end columns in SARIF to be exclusive

According to the SARIF specification, "a text region does not include the character specified by endColumn".

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

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

5 years agoQuote the token being diagnosed for C11 extensions.
Aaron Ballman [Tue, 27 Aug 2019 13:47:51 +0000 (13:47 +0000)]
Quote the token being diagnosed for C11 extensions.

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

5 years agoSpeculatively fix the build bots after r370052.
Aaron Ballman [Tue, 27 Aug 2019 13:45:42 +0000 (13:45 +0000)]
Speculatively fix the build bots after r370052.

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

5 years agoImplement codegen for MSVC unions with reference members.
Aaron Ballman [Tue, 27 Aug 2019 12:42:45 +0000 (12:42 +0000)]
Implement codegen for MSVC unions with reference members.

Currently, clang accepts a union with a reference member when given the -fms-extensions flag. This change fixes the codegen for this case.

Patch by Dominic Ferreira.

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

5 years agoTesting commit access; NFC
Joe Ranieri [Tue, 27 Aug 2019 12:36:25 +0000 (12:36 +0000)]
Testing commit access; NFC

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

5 years ago[ASTImporter] Fix name conflict handling with different strategies
Gabor Marton [Tue, 27 Aug 2019 11:36:10 +0000 (11:36 +0000)]
[ASTImporter] Fix name conflict handling with different strategies

There are numorous flaws about the name conflict handling, this patch
attempts fixes them. Changes in details:

* HandleNameConflict return with a false DeclarationName

Hitherto we effectively never returned with a NameConflict error, even
if the preceding StructuralMatch indicated a conflict.
Because we just simply returned with the parameter `Name` in
HandleNameConflict and that name is almost always `true` when converted to
`bool`.

* Add tests which indicate wrong NameConflict handling

* Add to ConflictingDecls only if decl kind is different

Note, we might not indicate an ODR error when there is an existing record decl
and a enum is imported with same name.  But there are other cases. E.g. think
about the case when we import a FunctionTemplateDecl with name f and we found a
simple FunctionDecl with name f. They overload.  Or in case of a
ClassTemplateDecl and CXXRecordDecl, the CXXRecordDecl could be the 'templated'
class, so it would be false to report error.  So I think we should report a
name conflict error only when we are 100% sure of that.  That is why I think it
should be a general pattern to report the error only if the kind is the same.

* Fix failing ctu test with EnumConstandDecl

In ctu-main.c we have the enum class 'A' which brings in the enum
constant 'x' with value 0 into the global namespace.
In ctu-other.c we had the enum class 'B' which brought in the same name
('x') as an enum constant but with a different enum value (42). This is clearly
an ODR violation in the global namespace. The solution was to rename the
second enum constant.

 * Introduce ODR handling strategies

Reviewers: a_sidorin, shafik

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

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

5 years ago[clang] Ensure that statements, expressions and types are trivially destructible
Bruno Ricci [Tue, 27 Aug 2019 11:35:49 +0000 (11:35 +0000)]
[clang] Ensure that statements, expressions and types are trivially destructible

Since statements, expressions and types are allocated with the BumpPtrAllocator
from ASTContext their destructor is not executed. Two classes are currently
exempted from the check : InitListExpr due to its ASTVector and
ConstantArrayType due to its APInt.

No functional changes.

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

Reviewed By: lebedev.ri, gribozavr

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

5 years ago[clang] Ensure that comment classes are trivially destructible
Bruno Ricci [Tue, 27 Aug 2019 11:21:00 +0000 (11:21 +0000)]
[clang] Ensure that comment classes are trivially destructible

As in D66646, these classes are also allocated with a BumpPtrAllocator,
and therefore should be trivially destructible.

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

Reviewed By: Mordante, gribozavr

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

5 years ago[ReleaseNotes] MemorySanitizer support of ASLR on FreeBSD
David Carlier [Tue, 27 Aug 2019 10:04:03 +0000 (10:04 +0000)]
[ReleaseNotes] MemorySanitizer support of ASLR on FreeBSD

Reviewers: sylvestre.ledru, kcc

Reviewed By: sylvestre.ledru

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

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

5 years ago[Driver] Add an option for createInvocationFromCommandLine to recover on errors
Ilya Biryukov [Tue, 27 Aug 2019 10:02:18 +0000 (10:02 +0000)]
[Driver] Add an option for createInvocationFromCommandLine to recover on errors

Summary:
Previously, it would always return nullptr on any error.
This change adds a parameter, controlling whether the function should
attempt to return a non-null result even if unknown arguments (or other
errors were encountered).

The new behavior is only used in clangd.

Considered an alternative of changing the return value instead of adding
a new parameter, but that would require updating all callsites. Settled
with the parameter to minimize the code changes.

Reviewers: gribozavr

Reviewed By: gribozavr

Subscribers: nridge, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoRevert "[clang-scan-deps] Minimizer: Correctly handle multi-line content with CR...
Richard Smith [Tue, 27 Aug 2019 01:06:23 +0000 (01:06 +0000)]
Revert "[clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings"

This reverts commit r369986.

This change added a dependency on the 'dos2unix' tool, which is not one
of our accepted test dependencies and may not exist on all machines that
build Clang.

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

5 years agoDon't lose the FoundDecl and template arguments for a DeclRefExpr in
Richard Smith [Tue, 27 Aug 2019 01:06:21 +0000 (01:06 +0000)]
Don't lose the FoundDecl and template arguments for a DeclRefExpr in
TreeTransform.

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

5 years agoUse FileEntryRef for PPCallbacks::FileSkipped
Alex Lorenz [Tue, 27 Aug 2019 01:03:25 +0000 (01:03 +0000)]
Use FileEntryRef for PPCallbacks::FileSkipped

This fixes the issue where a filename dependendency was missing if the file that
was skipped was included through a symlink in an earlier run, if the file
manager was reused between runs.

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

5 years ago[clang-scan-deps] Skip UTF-8 BOM in source minimizer
Alexandre Ganea [Tue, 27 Aug 2019 00:13:52 +0000 (00:13 +0000)]
[clang-scan-deps] Skip UTF-8 BOM in source minimizer

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

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

5 years agoNFC: Make test work with or without assertions
Vitaly Buka [Tue, 27 Aug 2019 00:11:33 +0000 (00:11 +0000)]
NFC: Make test work with or without assertions

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

5 years ago[clang-scan-deps] Minimizer: Correctly skip over double slashes in angle bracket...
Alexandre Ganea [Mon, 26 Aug 2019 23:28:05 +0000 (23:28 +0000)]
[clang-scan-deps] Minimizer: Correctly skip over double slashes in angle bracket #include

Previously, double slashes (//) occurring in angle brackets #include were incorrectly interpreted as comments. eg. #include <dir//file.h>

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

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

5 years ago[clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line...
Alexandre Ganea [Mon, 26 Aug 2019 23:19:21 +0000 (23:19 +0000)]
[clang-scan-deps] Minimizer: Correctly handle multi-line content with CR+LF line endings

Previously, an #error directive with quoted, multi-line content, along with CR+LF line endings wasn't handled correctly.

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

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

5 years agoPR42587: diagnose unexpanded uses of a pack parameter of a generic
Richard Smith [Mon, 26 Aug 2019 22:51:28 +0000 (22:51 +0000)]
PR42587: diagnose unexpanded uses of a pack parameter of a generic
lambda from within the lambda-declarator.

Instead of trying to reconstruct whether a parameter pack was declared
inside a lambda (which we can't do correctly in general because we might
not have attached parameters to their declaration contexts yet), track
the set of parameter packs introduced in each live lambda scope, and
require only those parameters to be immediately expanded when they
appear inside that lambda.

In passing, fix incorrect disambiguation of a lambda-expression starting
with an init-capture pack in a braced-init-list. We previously
incorrectly parsed that as a designated initializer.

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

5 years agohwasan, codegen: Keep more lifetime markers used for hwasan
Vitaly Buka [Mon, 26 Aug 2019 22:16:05 +0000 (22:16 +0000)]
hwasan, codegen: Keep more lifetime markers used for hwasan

Reviewers: eugenis

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agomsan, codegen, instcombine: Keep more lifetime markers used for msan
Vitaly Buka [Mon, 26 Aug 2019 22:15:50 +0000 (22:15 +0000)]
msan, codegen, instcombine: Keep more lifetime markers used for msan

Reviewers: eugenis

Subscribers: hiraditya, cfe-commits, #sanitizers, llvm-commits

Tags: #clang, #sanitizers, #llvm

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

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

5 years agoRevert r369843 "[Testing] Unbreak r369830"
Vitaly Buka [Mon, 26 Aug 2019 21:29:06 +0000 (21:29 +0000)]
Revert r369843 "[Testing] Unbreak r369830"

That was not the fix.

This reverts commit 8bcf690ae03db85608b2ea22eac7a91c84df4dc.

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

5 years agoUpdating a test case that was missed in r369957.
Aaron Ballman [Mon, 26 Aug 2019 20:55:43 +0000 (20:55 +0000)]
Updating a test case that was missed in r369957.

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

5 years agoRemove unused variables.
Benjamin Kramer [Mon, 26 Aug 2019 20:51:23 +0000 (20:51 +0000)]
Remove unused variables.

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

5 years ago[DebugInfo] Add debug-entry-values test coverage, NFC
Vedant Kumar [Mon, 26 Aug 2019 20:50:54 +0000 (20:50 +0000)]
[DebugInfo] Add debug-entry-values test coverage, NFC

Check that call site descriptions are emitted in dwarf4 + lldb +
debug-entry-values mode.

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

5 years agoFixing a weird copy-pasta to get bots back to green.
Aaron Ballman [Mon, 26 Aug 2019 20:46:20 +0000 (20:46 +0000)]
Fixing a weird copy-pasta to get bots back to green.

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

5 years agoContentCache: Drop getBuffer's dependency on SourceManager
Duncan P. N. Exon Smith [Mon, 26 Aug 2019 20:32:05 +0000 (20:32 +0000)]
ContentCache: Drop getBuffer's dependency on SourceManager

Refactor ContentCache::IsSystemFile to IsFileVolatile, checking
SourceManager::userFilesAreVolatile at construction time.  This is a
step toward lowering ContentCache down from SourceManager to
FileManager.

No functionality change intended.

https://reviews.llvm.org/D66713

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

5 years agoReword the C11 extension diagnostic.
Aaron Ballman [Mon, 26 Aug 2019 20:29:08 +0000 (20:29 +0000)]
Reword the C11 extension diagnostic.

This makes it more consistent with other language extension diagnostics.

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

5 years agoFix gen-cdb-fragment test for Windows
Alex Lorenz [Mon, 26 Aug 2019 20:02:40 +0000 (20:02 +0000)]
Fix gen-cdb-fragment test for Windows

Windows bots didn't seem to like the empty argument, so I rewrote the test.

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

5 years ago[Clang][Bundler] Use llvm-objcopy for creating fat object files
Sergey Dmitriev [Mon, 26 Aug 2019 19:48:43 +0000 (19:48 +0000)]
[Clang][Bundler] Use llvm-objcopy for creating fat object files

clang-offload-bundler currently uses partial linking for creating fat object files, but such technique cannot be used on Windows due to the absence of partial linking support in the linker. This patch changes implementation to use llvm-objcopy for merging device and host objects instead of doing partial linking. This is one step forward towards enabling OpenMP offload on Windows.

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

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

5 years agoDiagnose use of _Thread_local as an extension when not in C11 mode.
Aaron Ballman [Mon, 26 Aug 2019 19:44:07 +0000 (19:44 +0000)]
Diagnose use of _Thread_local as an extension when not in C11 mode.

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

5 years ago[OPENMP][NVPTX]Fix critical region codegen.
Alexey Bataev [Mon, 26 Aug 2019 19:07:48 +0000 (19:07 +0000)]
[OPENMP][NVPTX]Fix critical region codegen.

Summary:
Previously critical regions were emitted with the barrier making it a
worksharing construct though it is not. Also, it leads to incorrect
behavior in Cuda9+. Patch fixes this problem.

Reviewers: ABataev, jdoerfert

Subscribers: jholewinski, guansong, cfe-commits, grokos

Tags: #clang

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

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

5 years ago[msvc] Add necessary #include to make compiler intrinsics available.
Richard Smith [Mon, 26 Aug 2019 18:33:15 +0000 (18:33 +0000)]
[msvc] Add necessary #include to make compiler intrinsics available.

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

5 years agoFileManager: Use llvm::Expected in new getFileRef API
Duncan P. N. Exon Smith [Mon, 26 Aug 2019 18:29:51 +0000 (18:29 +0000)]
FileManager: Use llvm::Expected in new getFileRef API

`FileManager::getFileRef` is a modern API which we expect to convert to
over time.  We should modernize the error handling as well, using
`llvm::Expected` instead of `llvm::ErrorOr`, to help clients that care
about errors to ensure nothing is missed.

However, not all clients care.  I've also added another path for those
that don't:

- `FileEntryRef` is now copy- and move-assignable (using a pointer
  instead of a reference).
- `FileManager::getOptionalFileRef` returns an `llvm::Optional` instead
  of `llvm::Expected`.
- Added an `llvm::expectedToOptional` utility in case this is useful
  elsewhere.

https://reviews.llvm.org/D66705

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

5 years agoFix file header.
Richard Smith [Mon, 26 Aug 2019 18:21:13 +0000 (18:21 +0000)]
Fix file header.

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

5 years agoImprove behavior in the case of stack exhaustion.
Richard Smith [Mon, 26 Aug 2019 18:18:07 +0000 (18:18 +0000)]
Improve behavior in the case of stack exhaustion.

Summary:
Clang performs various recursive operations (such as template instantiation),
and may use non-trivial amounts of stack space in each recursive step (for
instance, due to recursive AST walks). While we try to keep the stack space
used by such steps to a minimum and we have explicit limits on the number of
such steps we perform, it's impractical to guarantee that we won't blow out the
stack on deeply recursive template instantiations on complex ASTs, even with
only a moderately high instantiation depth limit.

The user experience in these cases is generally terrible: we crash with
no hint of what went wrong. Under this patch, we attempt to do better:

 * Detect when the stack is nearly exhausted, and produce a warning with a
   nice template instantiation backtrace, telling the user that we might
   run slowly or crash.

 * For cases where we're forced to trigger recursive template
   instantiation in arbitrarily-deeply-nested contexts, check whether
   we're nearly out of stack space and allocate a new stack (by spawning
   a new thread) after producing the warning.

Reviewers: rnk, aaron.ballman

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[driver] add a new option `-gen-cdb-fragment-path` to emit
Alex Lorenz [Mon, 26 Aug 2019 17:59:41 +0000 (17:59 +0000)]
[driver] add a new option `-gen-cdb-fragment-path` to emit
a fragment of a compilation database for each compilation

This patch adds a new option called -gen-cdb-fragment-path to the driver,
which can be used to specify a directory path to which clang can emit a fragment
of a CDB for each compilation it needs to invoke.

This option emits the same CDB contents as -MJ, and will be ignored if -MJ is specified.

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

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

5 years agoFix use of invalidated iterator introduced by r369680.
Richard Smith [Mon, 26 Aug 2019 17:31:06 +0000 (17:31 +0000)]
Fix use of invalidated iterator introduced by r369680.

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

5 years ago[libclang][index][NFCi] Refactor machinery for skipping function bodies
Jan Korous [Mon, 26 Aug 2019 17:25:23 +0000 (17:25 +0000)]
[libclang][index][NFCi] Refactor machinery for skipping function bodies

Refactor machinery for skipping inline function bodies that have already
been parsed in other frontend actions.

Preparations for moving this code to libIndex.

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

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

5 years ago[NFC] Add comments to some bool arguments for better readability
Gabor Horvath [Mon, 26 Aug 2019 17:03:01 +0000 (17:03 +0000)]
[NFC] Add comments to some bool arguments for better readability

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

5 years agoFix -dA flag, it is not a preprocessor flag.
Erich Keane [Mon, 26 Aug 2019 17:00:13 +0000 (17:00 +0000)]
Fix -dA flag, it is not a preprocessor flag.

-dA was in the d_group, which is a preprocessor state dumping group.
However -dA is a debug flag to cause a verbose asm.  It was already
implemented to do the same thing as -fverbose-asm, so make it just be an
alias.

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

5 years agoclang-format: [JS] handle `as const`.
Martin Probst [Mon, 26 Aug 2019 15:37:05 +0000 (15:37 +0000)]
clang-format: [JS] handle `as const`.

Summary:
TypeScript 3.4 supports casting into a const type using `as const`:

    const x = {x: 1} as const;

Previously, clang-format would insert a space after the `const`. With
this patch, no space is inserted after the sequence `as const`.

Reviewers: krasimir

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[Wdocumentation] improve wording of a warning message
Dmitri Gribenko [Sun, 25 Aug 2019 18:20:18 +0000 (18:20 +0000)]
[Wdocumentation] improve wording of a warning message

Based on @davezarzycki remarks in D64696 improved the wording of the warning
message.

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

Patch by Mark de Wever.

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

5 years agoFileManager: Factor duplicated code in getBufferForFile, NFC
Duncan P. N. Exon Smith [Sun, 25 Aug 2019 01:18:35 +0000 (01:18 +0000)]
FileManager: Factor duplicated code in getBufferForFile, NFC

Incidentally, this also unifies the two versions (removing an
unnecessary call to `SmallString::c_str`).

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

5 years ago[OpenCL] Microoptimize OCL2Qual a bit
Benjamin Kramer [Sat, 24 Aug 2019 13:04:34 +0000 (13:04 +0000)]
[OpenCL] Microoptimize OCL2Qual a bit

Still not optimal, but makes clang 25k smaller.

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

5 years ago[analyzer] Analysis: Fix checker silencing
Csaba Dabis [Sat, 24 Aug 2019 12:17:49 +0000 (12:17 +0000)]
[analyzer] Analysis: Fix checker silencing

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

5 years ago[Testing] Unbreak r369830
David Zarzycki [Sat, 24 Aug 2019 08:12:51 +0000 (08:12 +0000)]
[Testing] Unbreak r369830

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

5 years agoPR42513: Enter the proper DeclContext before substituting into an
Richard Smith [Sat, 24 Aug 2019 02:30:00 +0000 (02:30 +0000)]
PR42513: Enter the proper DeclContext before substituting into an
default template argument expression.

We already did this for type template parameters and template template
parameters, but apparently forgot to do so for non-type template
parameters. This causes the substituted default argument expression to
be substituted in the proper context, and in particular to properly mark
its subexpressions as odr-used.

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

5 years agoRe-enable DependencyScannerTest on windows with the right fixes
Alex Lorenz [Sat, 24 Aug 2019 01:53:40 +0000 (01:53 +0000)]
Re-enable DependencyScannerTest on windows with the right fixes

It should now pass.

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

5 years agoNFC: Rename some sanitizer related lifetime checks
Vitaly Buka [Sat, 24 Aug 2019 01:31:38 +0000 (01:31 +0000)]
NFC: Rename some sanitizer related lifetime checks

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

5 years agoPR40674: fix assertion failure if a structured binding declaration has a
Richard Smith [Sat, 24 Aug 2019 01:23:57 +0000 (01:23 +0000)]
PR40674: fix assertion failure if a structured binding declaration has a
tuple-like decomposition that produces value-dependent reference
bindings.

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

5 years ago[libclang][index][NFC] Fix test for skipping already parsed function bodies
Jan Korous [Fri, 23 Aug 2019 22:51:23 +0000 (22:51 +0000)]
[libclang][index][NFC] Fix test for skipping already parsed function bodies

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

5 years agoFix a test to test what the name suggest.
Gabor Horvath [Fri, 23 Aug 2019 22:26:49 +0000 (22:26 +0000)]
Fix a test to test what the name suggest.

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

5 years ago[LifetimeAnalysis] Make it possible to disable the new warnings
Gabor Horvath [Fri, 23 Aug 2019 22:21:33 +0000 (22:21 +0000)]
[LifetimeAnalysis] Make it possible to disable the new warnings

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

5 years agoDo a sweep of symbol internalization. NFC.
Benjamin Kramer [Fri, 23 Aug 2019 19:59:23 +0000 (19:59 +0000)]
Do a sweep of symbol internalization. NFC.

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

5 years ago[OPENMP5]Use nonmonotonic modifier by default for non-static and
Alexey Bataev [Fri, 23 Aug 2019 19:52:05 +0000 (19:52 +0000)]
[OPENMP5]Use nonmonotonic modifier by default for non-static and
non-ordered loops.

According to OpenMP 5.0, 2.9.2 Worksharing-Loop Construct, Desription, If the static schedule kind is specified or if the ordered clause is specified, and if the nonmonotonic modifier is not specified, the effect is as if the monotonic modifier is specified. Otherwise, unless the monotonic modifier is specified, the effect is as if the nonmonotonic modifier is specified.
The first part of this requirement is implemented in runtime. Patch adds
support for the second, nonmonotonic, part of this requirement.

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

5 years ago[Sema] Don't warn on printf('%hd', [char]) (PR41467)
Nathan Huckleberry [Fri, 23 Aug 2019 18:01:57 +0000 (18:01 +0000)]
[Sema] Don't warn on printf('%hd', [char]) (PR41467)

Link: https://bugs.llvm.org/show_bug.cgi?id=41467
Reviewers: rsmith, nickdesaulniers, aaron.ballman, lebedev.ri

Reviewed By: nickdesaulniers, aaron.ballman, lebedev.ri

Subscribers: lebedev.ri, nickdesaulniers, cfe-commits

Tags: #clang

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

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

5 years ago[OpenCL] Renamed value of std flag in C++ mode.
Anastasia Stulova [Fri, 23 Aug 2019 17:10:33 +0000 (17:10 +0000)]
[OpenCL] Renamed value of std flag in C++ mode.

Clang should accept -std=clc++ (not -std=c++!) for OpenCL.

This was forgotten in r367008.

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

5 years agoFixed a typo.
Artem Belevich [Fri, 23 Aug 2019 16:24:17 +0000 (16:24 +0000)]
Fixed a typo.

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

5 years ago[OPENMP5.0]Add support for device_type clause in declare target
Alexey Bataev [Fri, 23 Aug 2019 16:11:14 +0000 (16:11 +0000)]
[OPENMP5.0]Add support for device_type clause in declare target
construct.

OpenMP 5.0 introduced new clause for declare target directive, device_type clause, which may accept values host, nohost, and any. Host means
that the function must be emitted only for the host, nohost - only for
the device, and any - for both, device and the host.

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

5 years ago[NFC] Move some variable declarations into their 'if' conditions.
Erich Keane [Fri, 23 Aug 2019 15:58:35 +0000 (15:58 +0000)]
[NFC] Move some variable declarations into their 'if' conditions.

A couple of variables are being declared outside of the 'if' condition
that is their only actual use.  Additionally, switch a few 'const TYPE
*' to 'const auto *' for consistency.

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

5 years ago[analyzer] Avoid unnecessary enum range check on LValueToRValue casts
Kristof Umann [Fri, 23 Aug 2019 14:21:13 +0000 (14:21 +0000)]
[analyzer] Avoid unnecessary enum range check on LValueToRValue casts

Summary: EnumCastOutOfRangeChecker should not perform enum range checks on LValueToRValue casts, since this type of cast does not actually change the underlying type.   Performing the unnecessary check actually triggered an assertion failure deeper in EnumCastOutOfRange for certain input (which is captured in the accompanying test code).

Reviewers: #clang, Szelethus, gamesh411, NoQ

Reviewed By: Szelethus, gamesh411, NoQ

Subscribers: NoQ, gamesh411, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, Charusso, bjope, cfe-commits

Tags: #clang

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

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

5 years agoclang-format: Disable across-block include reordering.
Nico Weber [Fri, 23 Aug 2019 14:04:09 +0000 (14:04 +0000)]
clang-format: Disable across-block include reordering.

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

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

5 years ago[Docs][OpenCL] Several corrections to C++ for OpenCL
Anastasia Stulova [Fri, 23 Aug 2019 11:43:49 +0000 (11:43 +0000)]
[Docs][OpenCL] Several corrections to C++ for OpenCL

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

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

5 years ago[clang-format] Recognize ECMAScript module .mjs as JavaScript
Fangrui Song [Fri, 23 Aug 2019 04:46:01 +0000 (04:46 +0000)]
[clang-format] Recognize ECMAScript module .mjs as JavaScript

PR43085.

Recognize .mjs files as JavaScript. .mjs is the extension for ECMAScript modules.
A specific extension (and associated content type javascript/esm) is
introduced to differentiate it from CommonJS modules and solve some
interoperability problems.

Differential Revision: https://reviews.llvm.org/D66584
Patch by Fergal Daly

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

5 years ago[analyzer] CastValueChecker: Correctly model results of based-to-derived casts.
Artem Dergachev [Fri, 23 Aug 2019 03:24:04 +0000 (03:24 +0000)]
[analyzer] CastValueChecker: Correctly model results of based-to-derived casts.

Our SVal hierarchy doesn't allow modeling pointer casts as no-op. The
pointer type is instead encoded into the pointer object. Defer to our
usual pointer casting facility, SValBuilder::evalBinOp().

Fixes a crash.

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

5 years ago[analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.
Artem Dergachev [Fri, 23 Aug 2019 03:24:01 +0000 (03:24 +0000)]
[analyzer] CastValueChecker: Provide DynamicTypeMap with pointer types only.

The idea to drop this requirement is good, but for now every other user
of DynamicTypeInfo expects pointer types.

Fixes a crash.

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

5 years ago[analyzer] CastValueChecker: Avoid modeling casts between objects.
Artem Dergachev [Fri, 23 Aug 2019 03:23:58 +0000 (03:23 +0000)]
[analyzer] CastValueChecker: Avoid modeling casts between objects.

Our method only works correctly when casting a pointer to a pointer
or a reference to a reference.

Fixes a crash.

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

5 years ago[analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.
Artem Dergachev [Fri, 23 Aug 2019 03:23:55 +0000 (03:23 +0000)]
[analyzer] DynamicTypeInfo: Avoid putting null regions into dynamic typemap.

Fixes a crash.

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

5 years agoRevert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to...
Richard Smith [Fri, 23 Aug 2019 02:33:46 +0000 (02:33 +0000)]
Revert "PR42587: diagnose unexpanded uses of a pack parameter of a generic" due to buildbot breakage.

This reverts commit r369722.

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

5 years agoPR42587: diagnose unexpanded uses of a pack parameter of a generic
Richard Smith [Fri, 23 Aug 2019 01:41:48 +0000 (01:41 +0000)]
PR42587: diagnose unexpanded uses of a pack parameter of a generic
lambda from within the lambda-declarator.

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

5 years ago[clang][ifs] Dropping older experimental interface stub formats.
Puyan Lotfi [Thu, 22 Aug 2019 23:44:34 +0000 (23:44 +0000)]
[clang][ifs] Dropping older experimental interface stub formats.

I've been working on a new tool, llvm-ifs, for merging interface stub files
generated by clang and I've iterated on my derivative format of TBE to a newer
format. llvm-ifs will only support the new format, so I am going to drop the
older experimental interface stubs formats in this commit to make things
simpler.

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

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

5 years ago[clang][ifs] New interface stubs format (llvm triple based).
Puyan Lotfi [Thu, 22 Aug 2019 23:29:22 +0000 (23:29 +0000)]
[clang][ifs] New interface stubs format (llvm triple based).

After posting llvm-ifs on phabricator, I made some progress in hardening up how
I think the format for Interface Stubs should look. There are a number of
things I think the TBE format was missing (no endianness, no info about the
Object Format because it assumes ELF), so I have added those and broken off
from being as similar to the TBE schema. In a subsequent commit I can drop the
other formats.

An example of how The format will look is as follows:

--- !experimental-ifs-v1
IfsVersion: 1.0
Triple: x86_64-unknown-linux-gnu
ObjectFileFormat: ELF
Symbols:
  _Z9nothiddenv: { Type: Func }
  _Z10cmdVisiblev: { Type: Func }
...

The format is still marked experimental.

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

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

5 years ago[libclang][NFC] Remove debug comment
Jan Korous [Thu, 22 Aug 2019 23:29:10 +0000 (23:29 +0000)]
[libclang][NFC] Remove debug comment

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

5 years ago[Bugfix] fix r369705 unit test
Nick Desaulniers [Thu, 22 Aug 2019 23:18:46 +0000 (23:18 +0000)]
[Bugfix] fix r369705 unit test

Summary:
Aliases aren't supported on OSX.  Add a GNU target triple.

Reported-by: leonardchan
Reported-by: erik.pilkington
Reviewers: leonardchan, erik.pilkington

Reviewed By: leonardchan, erik.pilkington

Subscribers: dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[Clang][CodeGen] set alias linkage on QualType
Nick Desaulniers [Thu, 22 Aug 2019 20:47:12 +0000 (20:47 +0000)]
[Clang][CodeGen] set alias linkage on QualType

Summary:
It seems that CodeGen was always using ExternalLinkage when emitting a
GlobalDecl with __attribute__((alias)). This leads to symbol
redefinitions (ODR) that cause failures at link time for static aliases.
This is readily attempting to link an ARM (32b) allyesconfig Linux
kernel built with Clang.

Reported-by: nathanchance
Suggested-by: ihalip
Link: https://bugs.llvm.org/show_bug.cgi?id=42377
Link: https://github.com/ClangBuiltLinux/linux/issues/631
Reviewers: rsmith, aaron.ballman, erichkeane

Reviewed By: aaron.ballman

Subscribers: javed.absar, kristof.beyls, cfe-commits, srhines, ihalip, nathanchance

Tags: #clang

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

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

5 years agoIR. Change strip* family of functions to not look through aliases.
Peter Collingbourne [Thu, 22 Aug 2019 19:56:14 +0000 (19:56 +0000)]
IR. Change strip* family of functions to not look through aliases.

I noticed another instance of the issue where references to aliases were
being replaced with aliasees, this time in InstCombine. In the instance that
I saw it turned out to be only a QoI issue (a symbol ended up being missing
from the symbol table due to the last reference to the alias being removed,
preventing HWASAN from symbolizing a global reference), but it could easily
have manifested as incorrect behaviour.

Since this is the third such issue encountered (previously: D65118, D65314)
it seems to be time to address this common error/QoI issue once and for all
and make the strip* family of functions not look through aliases.

Includes a test for the specific issue that I saw, but no doubt there are
other similar bugs fixed here.

As with D65118 this has been tested to make sure that the optimization isn't
load bearing. I built Clang, Chromium for Linux, Android and Windows as well
as the test-suite and there were no size regressions.

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

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

5 years agoDisable the ScanDepsReuseFilemanager test on Windows
Alex Lorenz [Thu, 22 Aug 2019 19:00:08 +0000 (19:00 +0000)]
Disable the ScanDepsReuseFilemanager test on Windows

Right now it fails.
I'm going to investigate it and fix it in follow-up commits.

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

5 years agoImprove the documentation for OpenCL vector types.
Aaron Ballman [Thu, 22 Aug 2019 18:57:46 +0000 (18:57 +0000)]
Improve the documentation for OpenCL vector types.

This fixes some minor grammatical issues I noticed when reading the docs, and changes the recommended feature testing approach to use __has_attribute instead of __has_extension.

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

5 years agoFix the nullPointerConstant() test to get bots back to green.
Aaron Ballman [Thu, 22 Aug 2019 18:56:18 +0000 (18:56 +0000)]
Fix the nullPointerConstant() test to get bots back to green.

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

5 years agoImplement nullPointerConstant() using a better API.
Aaron Ballman [Thu, 22 Aug 2019 18:26:44 +0000 (18:26 +0000)]
Implement nullPointerConstant() using a better API.

Instead of manually attempting to identify whether something is a null pointer constant, use Expr::isNullPointerConstant().

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

5 years agoIntroduce FileEntryRef and use it when handling includes to report correct dependencies
Alex Lorenz [Thu, 22 Aug 2019 18:15:50 +0000 (18:15 +0000)]
Introduce FileEntryRef and use it when handling includes to report correct dependencies
when the FileManager is reused across invocations

This commit introduces a parallel API to FileManager's getFile: getFileEntryRef, which returns
a reference to the FileEntry, and the name that was used to access the file. In the case of
a VFS with 'use-external-names', the FileEntyRef contains the external name of the file,
not the filename that was used to access it.

The new API is adopted only in the HeaderSearch and Preprocessor for include file lookup, so that the
accessed path can be propagated to SourceManager's FileInfo. SourceManager's FileInfo now can report this accessed path, using
the new getName method. This API is then adopted in the dependency collector, which now correctly reports dependencies when a file
is included both using a symlink and a real path in the case when the FileManager is reused across multiple Preprocessor invocations.

Note that this patch does not fix all dependency collector issues, as the same problem is still present in other cases when dependencies
are obtained using FileSkipped, InclusionDirective, and HasInclude. This will be fixed in follow-up commits.

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

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

5 years agoRevert "[LifetimeAnalysis] Support more STL idioms (template forward declaration...
Richard Smith [Thu, 22 Aug 2019 17:48:11 +0000 (17:48 +0000)]
Revert "[LifetimeAnalysis] Support more STL idioms (template forward declaration and DependentNameType)"

This reverts commit r369591, because it causes the formerly-reliable
-Wreturn-stack-address warning to start issuing false positives.
Testcase provided on the commit thread.

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

5 years agoRetire llvm::less_ptr. llvm::deref is much more flexible.
Benjamin Kramer [Thu, 22 Aug 2019 17:32:16 +0000 (17:32 +0000)]
Retire llvm::less_ptr. llvm::deref is much more flexible.

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

5 years ago[OPENMP]Generalization of handling of declare target attribute.
Alexey Bataev [Thu, 22 Aug 2019 16:48:26 +0000 (16:48 +0000)]
[OPENMP]Generalization of handling of declare target attribute.

Used OMPDeclareTargetDeclAttr::isDeclareTargetDeclaration instead of
direct checking of the OMPDeclareTargetDeclAttr attribute.

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

5 years agoRevert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update...
Hans Wennborg [Thu, 22 Aug 2019 13:15:36 +0000 (13:15 +0000)]
Revert r369402 "win: Enable /Zc:twoPhase by default if targeting MSVC 2017 update 3 or newer"

This broke compiling some ASan tests with never versions of MSVC/the Win
SDK, see https://crbug.com/996675

> MSVC 2017 update 3 (_MSC_VER 1911) enables /Zc:twoPhase by default, and
> so should clang-cl:
> https://docs.microsoft.com/en-us/cpp/build/reference/zc-twophase
>
> clang-cl takes the MSVC version it emulates from the -fmsc-version flag,
> or if that's not passed it tries to check what the installed version of
> MSVC is and uses that, and failing that it uses a default version that's
> currently 1911. So this changes the default if no -fmsc-version flag is
> passed and no installed MSVC is detected. (It also changes the default
> if -fmsc-version is passed or MSVC is detected, and either indicates
> _MSC_VER >= 1911.)
>
> As mentioned in the MSDN article, the Windows SDK header files in
> version 10.0.15063.0 (Creators Update or Redstone 2) and earlier
> versions do not work correctly with /Zc:twoPhase. If you need to use
> these old SDKs with a new clang-cl, explicitly pass /Zc:twoPhase- to get
> the old behavior.
>
> Fixes PR43032.
>
> Differential Revision: https://reviews.llvm.org/D66394

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

5 years ago[OpenCL] Fix declaration of enqueue_marker
Yaxun Liu [Thu, 22 Aug 2019 11:18:59 +0000 (11:18 +0000)]
[OpenCL] Fix declaration of enqueue_marker

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

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

5 years agoRevert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"
Hans Wennborg [Thu, 22 Aug 2019 09:07:25 +0000 (09:07 +0000)]
Revert r369458 "[DebugInfo] Add debug location to dynamic atexit destructor"

It causes the build to fail with

"inlinable function call in a function with debug info must have a !dbg location"

in Chromium. See llvm-commits thread for more info.

(This also reverts the follow-up in r369474.)

> Fixes PR43012
>
> Differential Revision: https://reviews.llvm.org/D66328

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

5 years agoRemove an unused function, suppress -Wunused-function warning.
Haojian Wu [Thu, 22 Aug 2019 08:49:41 +0000 (08:49 +0000)]
Remove an unused function, suppress -Wunused-function warning.

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