]> granicus.if.org Git - clang/log
clang
5 years agoChange std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point...
Fangrui Song [Wed, 3 Jul 2019 08:13:17 +0000 (08:13 +0000)]
Change std::{lower,upper}_bound to llvm::{lower,upper}_bound or llvm::partition_point. NFC

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

5 years ago[clang][HeaderSearch] Shorten paths for includes in mainfile's directory
Kadir Cetinkaya [Wed, 3 Jul 2019 07:47:19 +0000 (07:47 +0000)]
[clang][HeaderSearch] Shorten paths for includes in mainfile's directory

Summary:
Currently HeaderSearch only looks at SearchDir's passed into it, but in
addition to those paths headers can be relative to including file's directory.

This patch makes sure that is taken into account.

Reviewers: gribozavr

Subscribers: jkorous, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.
Artem Dergachev [Wed, 3 Jul 2019 01:26:41 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Implement bug nodes and sink nodes.

Add a label to nodes that have a bug report attached or on which
the analysis was generally interrupted.

Fix printing has_report and implement printing is_sink in the graph dumper.

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

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

5 years ago[analyzer] exploded-graph-rewriter: NFC: Add more comments.
Artem Dergachev [Wed, 3 Jul 2019 01:26:38 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add more comments.

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

5 years ago[analyzer] exploded-graph-rewriter: Collapse very long statement pretty-prints.
Artem Dergachev [Wed, 3 Jul 2019 01:26:35 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Collapse very long statement pretty-prints.

When printing various statements that include braces (compound
statements, lambda expressions, statement-expressions, etc.),
replace the code between braces with '...'.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement checker messages.
Artem Dergachev [Wed, 3 Jul 2019 01:26:32 +0000 (01:26 +0000)]
[analyzer] exploded-graph-rewriter: Implement checker messages.

They are displayed as raw lines and diffed via difflib on a per-checker basis.

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

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

5 years ago[C++2a] Add __builtin_bit_cast, used to implement std::bit_cast
Erik Pilkington [Tue, 2 Jul 2019 18:28:13 +0000 (18:28 +0000)]
[C++2a] Add __builtin_bit_cast, used to implement std::bit_cast

This commit adds a new builtin, __builtin_bit_cast(T, v), which performs a
bit_cast from a value v to a type T. This expression can be evaluated at
compile time under specific circumstances.

The compile time evaluation currently doesn't support bit-fields, but I'm
planning on fixing this in a follow up (some of the logic for figuring this out
is in CodeGen). I'm also planning follow-ups for supporting some more esoteric
types that the constexpr evaluator supports, as well as extending
__builtin_memcpy constexpr evaluation to use the same infrastructure.

rdar://44987528

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

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

5 years agoclang-format: Add new style option AlignConsecutiveMacros
Sam McCall [Tue, 2 Jul 2019 15:53:14 +0000 (15:53 +0000)]
clang-format: Add new style option AlignConsecutiveMacros

This option behaves similarly to AlignConsecutiveDeclarations and
AlignConsecutiveAssignments, aligning the assignment of C/C++
preprocessor macros on consecutive lines.

I've worked in many projects (embedded, mostly) where header files full
of large, well-aligned "#define" blocks are a common pattern. We
normally avoid using clang-format on these files, since it ruins any
existing alignment in said blocks. This style option will align "simple"
PP macros (no parameters) and PP macros with parameter lists on
consecutive lines.

Related Bugzilla entry (thanks mcuddie):
https://llvm.org/bugs/show_bug.cgi?id=20637

Patch by Nick Renieris (VelocityRa)!

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

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

5 years ago[LibTooling] Extend `RewriteRule` with support for adding includes.
Yitzhak Mandelbaum [Tue, 2 Jul 2019 13:11:04 +0000 (13:11 +0000)]
[LibTooling] Extend `RewriteRule` with support for adding includes.

Summary:
This revision allows users to specify the insertion of an included directive (at
the top of the file being rewritten) as part of a rewrite rule.  These
directives are bundled with `RewriteRule` cases, so that different cases can
potentially result in different include actions.

Reviewers: ilya-biryukov, gribozavr

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists
Kadir Cetinkaya [Tue, 2 Jul 2019 10:45:53 +0000 (10:45 +0000)]
[clang][ArgumentAdjusters] Do not add fsyntax-only if already exists

Reviewers: hokein

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoclang-cl: Make /d1reportAllClassLayout actually work and improve test
Nico Weber [Tue, 2 Jul 2019 10:22:11 +0000 (10:22 +0000)]
clang-cl: Make /d1reportAllClassLayout actually work and improve test

See review thread for r301567.

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

5 years ago[clang][Driver][ARM] NFC: Remove unused function parameter
Alexandros Lamprineas [Tue, 2 Jul 2019 09:45:24 +0000 (09:45 +0000)]
[clang][Driver][ARM] NFC: Remove unused function parameter

Removes a vector reference that was added by D62998, since the
preexisting function parameter is sufficient.

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

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

5 years ago[ASTImporter] Make headers self-contained
Benjamin Kramer [Tue, 2 Jul 2019 08:01:41 +0000 (08:01 +0000)]
[ASTImporter] Make headers self-contained

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

5 years ago[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr
Gabor Marton [Tue, 2 Jul 2019 07:36:39 +0000 (07:36 +0000)]
[ASTImporter] Structural eq: handle DependentScopeDeclRefExpr

Summary:
Structural equivalence did not handle dependent template args properly
when the arg contained a DependentScopeDeclRefExpr.

Reviewers: a_sidorin, a.sidorin

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

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement a dark color scheme.
Artem Dergachev [Tue, 2 Jul 2019 02:17:56 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Implement a dark color scheme.

Addresses a popular request. Activated via --dark.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Improve program point dumps.
Artem Dergachev [Tue, 2 Jul 2019 02:17:53 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Improve program point dumps.

- Take advantage of the stmt_point_kind.
- Dump block IDs for BlockEntrance nodes.
- Don't dump huge compound statements on PurgeDeadSymbols nodes.
- Rename Edge to BlockEdge for consistency.
- Tweak colors.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Add support for objects under construction.
Artem Dergachev [Tue, 2 Jul 2019 02:17:50 +0000 (02:17 +0000)]
[analyzer] exploded-graph-rewriter: Add support for objects under construction.

This trait is Environment-like, so there was a chance to re-use a lot of code.

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

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

5 years ago[analyzer] Support kfree in MallocChecker
Nathan Huckleberry [Mon, 1 Jul 2019 23:29:10 +0000 (23:29 +0000)]
[analyzer] Support kfree in MallocChecker

Summary:
kmalloc is freed with kfree in the linux kernel. kmalloc support was
added in r204832, but kfree was not. Adding kfree fixes incorrectly
detected memory leaks.

Reviewers: NoQ, nickdesaulniers, dcoughlin, Szelethus

Reviewed By: NoQ, Szelethus

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

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.
Artem Dergachev [Mon, 1 Jul 2019 23:06:08 +0000 (23:06 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Add a forgotten test file.

This fell off of r364865.

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

5 years ago[analyzer] Fix invalidation when returning into a ctor initializer.
Artem Dergachev [Mon, 1 Jul 2019 23:02:18 +0000 (23:02 +0000)]
[analyzer] Fix invalidation when returning into a ctor initializer.

Due to RVO the target region of a function that returns an object by
value isn't necessarily a temporary object region; it may be an
arbitrary memory region. In particular, it may be a field of a bigger
object.

Make sure we don't invalidate the bigger object when said function is
evaluated conservatively.

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

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

5 years ago[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.
Artem Dergachev [Mon, 1 Jul 2019 23:02:14 +0000 (23:02 +0000)]
[analyzer] NonnullGlobalConstants: Don't be confused by a _Nonnull attribute.

The NonnullGlobalConstants checker models the rule "it doesn't make sense
to make a constant global pointer and initialize it to null"; it makes sure
that whatever it's initialized with is known to be non-null.

Ironically, annotating the type of the pointer as _Nonnull breaks the checker.

Fix handling of the _Nonnull annotation so that it was instead one more reason
to believe that the value is non-null.

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

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

5 years ago[analyzer] CStringChecker: Modernize to use CallDescriptions.
Artem Dergachev [Mon, 1 Jul 2019 23:02:10 +0000 (23:02 +0000)]
[analyzer] CStringChecker: Modernize to use CallDescriptions.

This patch uses the new CDF_MaybeBuiltin flag to handle C library functions.
It's mostly an NFC/refactoring pass, but it does fix a bug in handling memset()
when it expands to __builtin___memset_chk() because the latter has
one more argument and memset() handling code was trying to match
the exact number of arguments. Now the code is deduplicated and there's
less room for mistakes.

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

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

5 years ago[analyzer] NFC: CallDescription: Implement describing C library functions.
Artem Dergachev [Mon, 1 Jul 2019 23:02:07 +0000 (23:02 +0000)]
[analyzer] NFC: CallDescription: Implement describing C library functions.

When matching C standard library functions in the checker, it's easy to forget
that they are often implemented as macros that are expanded to builtins.

Such builtins would have a different name, so matching the callee identifier
would fail, or may sometimes have more arguments than expected, so matching
the exact number of arguments would fail, but this is fine as long as we have
all the arguments that we need in their respective places.

This patch adds a set of flags to the CallDescription class so that to handle
various special matching rules, and adds the first flag into this set,
which enables a more fuzzy matching for functions that
may be implemented as compiler builtins.

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

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

5 years ago[analyzer] NFC: Add a convenient CallDescriptionMap class.
Artem Dergachev [Mon, 1 Jul 2019 23:02:03 +0000 (23:02 +0000)]
[analyzer] NFC: Add a convenient CallDescriptionMap class.

It encapsulates the procedure of figuring out whether a call event
corresponds to a function that's modeled by a checker.

Checker developers no longer need to worry about performance of
lookups into their own custom maps.

Add unittests - which finally test CallDescription itself as well.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Add support for dynamic types.
Artem Dergachev [Mon, 1 Jul 2019 23:01:59 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Add support for dynamic types.

Slightly cleanup emission of horizontal lines and unhardcode the title
for generic maps.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement program point tags.
Artem Dergachev [Mon, 1 Jul 2019 23:01:55 +0000 (23:01 +0000)]
[analyzer] exploded-graph-rewriter: Implement program point tags.

Keep them on a separate line for more visibility.

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

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

5 years agoFix breakage introduced by D60974
JF Bastien [Mon, 1 Jul 2019 21:57:31 +0000 (21:57 +0000)]
Fix breakage introduced by D60974

D60974 added tests which incorrectly assume that llvm-readelf is available. This is a bad assumption, it should instead declare the dependency explicitly in the tests.

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

5 years agoFixed two issues in clang-tidy -help.
Alexander Kornienko [Mon, 1 Jul 2019 18:55:10 +0000 (18:55 +0000)]
Fixed two issues in clang-tidy -help.

HeaderFilter -> HeaderFilterRegex

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

5 years ago[OPENMP]Fix handling of lambda captures in target regions.
Alexey Bataev [Mon, 1 Jul 2019 17:46:52 +0000 (17:46 +0000)]
[OPENMP]Fix handling of lambda captures in target regions.

Previously, lambda captures were processed in the function called during
capturing the variables. It leads to the recursive functions calls and
may result in the compiler crash.

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

5 years ago[ASTImporter] Mark erroneous nodes in shared st
Gabor Marton [Mon, 1 Jul 2019 15:37:07 +0000 (15:37 +0000)]
[ASTImporter] Mark erroneous nodes in shared st

Summary:
Now we store the errors for the Decls in the "to" context too. For
that, however, we have to put these errors in a shared state (among all
the ASTImporter objects which handle the same "to" context but different
"from" contexts).

After a series of imports from different "from" TUs we have a "to" context
which may have erroneous nodes in it. (Remember, the AST is immutable so
there is no way to delete a node once we had created it and we realized
the error later.) All these erroneous nodes are marked in
ASTImporterSharedState::ImportErrors.  Clients of the ASTImporter may
use this as an input. E.g. the static analyzer engine may not try to
analyze a function if that is marked as erroneous (it can be queried via
ASTImporterSharedState::getImportDeclErrorIfAny()).

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[RISCV] Avoid save-restore target feature warning
Sam Elliott [Mon, 1 Jul 2019 14:53:56 +0000 (14:53 +0000)]
[RISCV] Avoid save-restore target feature warning

Summary:
LLVM issues a warning if passed unknown target features. Neither I nor
@asb noticed this until after https://reviews.llvm.org/D63498 landed.

This patch stops passing the (unknown) "save-restore" target feature to
the LLVM backend, but continues to emit a warning if a driver asks for
`-msave-restore`. The default of assuming `-mno-save-restore` (and
emitting no warnings) remains.

Reviewers: asb

Reviewed By: asb

Subscribers: rbar, johnrusso, simoncook, apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, psnobl, benna, Jim, cfe-commits, asb

Tags: #clang

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

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

5 years ago[ASTImporter] Silence unused variable warning in Release builds. NFC.
Benjamin Kramer [Mon, 1 Jul 2019 14:33:26 +0000 (14:33 +0000)]
[ASTImporter] Silence unused variable warning in Release builds. NFC.

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

5 years ago[ASTImporter] Mark erroneous nodes in from ctx
Gabor Marton [Mon, 1 Jul 2019 14:19:53 +0000 (14:19 +0000)]
[ASTImporter] Mark erroneous nodes in from ctx

Summary:
During import of a specific Decl D, it may happen that some AST nodes
had already been created before we recognize an error. In this case we
signal back the error to the caller, but the "to" context remains
polluted with those nodes which had been created. Ideally, those nodes
should not had been created, but that time we did not know about the
error, the error happened later.  Since the AST is immutable (most of
the cases we can't remove existing nodes) we choose to mark these nodes
as erroneous.
Here are the steps of the algorithm:
1) We keep track of the nodes which we visit during the import of D: See
ImportPathTy.
2) If a Decl is already imported and it is already on the import path
(we have a cycle) then we copy/store the relevant part of the import
path. We store these cycles for each Decl.
3) When we recognize an error during the import of D then we set up this
error to all Decls in the stored cycles for D and we clear the stored
cycles.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[ASTImporter] Propagate error from ImportDeclContext
Gabor Marton [Mon, 1 Jul 2019 12:44:39 +0000 (12:44 +0000)]
[ASTImporter] Propagate error from ImportDeclContext

Summary:
During analysis of one project we failed to import one
CXXDestructorDecl. But since we did not propagate the error in
importDeclContext we had a CXXRecordDecl without a destructor. Then the
analyzer engine had a CallEvent where the nonexistent dtor was requested
(crash).

Solution is to propagate the errors we have during importing a
DeclContext.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years agoVarious tweaks to MSVC natvis visualizers
Mike Spertus [Sun, 30 Jun 2019 22:04:25 +0000 (22:04 +0000)]
Various tweaks to MSVC natvis visualizers

Make more consistent use of na format.
Improve visualization of deduction guides.
Add visualizer for explicit specifier (including conditionally explicit)
Fix some typos

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

5 years agoCleanup: llvm::bsearch -> llvm::partition_point after r364719
Fangrui Song [Sun, 30 Jun 2019 11:19:56 +0000 (11:19 +0000)]
Cleanup: llvm::bsearch -> llvm::partition_point after r364719

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

5 years ago[Driver] Fix style issues of --print-supported-cpus after D63105
Fangrui Song [Sat, 29 Jun 2019 01:24:36 +0000 (01:24 +0000)]
[Driver] Fix style issues of --print-supported-cpus after D63105

Reviewed By: ziangwan

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

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

5 years agoRevert "[clang][NewPM] Fix broken profile test"
Leonard Chan [Sat, 29 Jun 2019 00:10:22 +0000 (00:10 +0000)]
Revert "[clang][NewPM] Fix broken profile test"

This reverts commit ab2c0ed01edfec9a9402d03bdf8633b34b73f3a7.

See https://reviews.llvm.org/D63155

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

5 years ago[clang][test][NFC] Explicitly specify clang ABI in AST Dumper test
Jan Korous [Fri, 28 Jun 2019 22:37:31 +0000 (22:37 +0000)]
[clang][test][NFC] Explicitly specify clang ABI in AST Dumper test

Clang <= 4 used the pre-C++11 rule about which structures can be passed in registers.

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

5 years ago[OPENMP]Improve analysis of implicit captures.
Alexey Bataev [Fri, 28 Jun 2019 20:45:14 +0000 (20:45 +0000)]
[OPENMP]Improve analysis of implicit captures.

If the variable is used in the OpenMP region implicitly, we need to
check the data-sharing attributes for such variables and generate
implicit clauses for them. Patch improves analysis of such variables for
better handling of data-sharing rules.

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

5 years agoRevert enabling frame pointer elimination on OpenBSD for now.
Brad Smith [Fri, 28 Jun 2019 19:57:51 +0000 (19:57 +0000)]
Revert enabling frame pointer elimination on OpenBSD for now.

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

5 years ago[ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.
Volodymyr Sapsai [Fri, 28 Jun 2019 17:42:17 +0000 (17:42 +0000)]
[ODRHash] Fix null pointer dereference for ObjC selectors with empty slots.

`Selector::getIdentifierInfoForSlot` returns NULL if a slot has no
corresponding identifier. Add a boolean to the hash and a NULL check.

rdar://problem/51615164

Reviewers: rtrieu

Reviewed By: rtrieu

Subscribers: dexonsmith, cfe-commits, jkorous

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

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

5 years ago[OPENMP]Fix top DSA for static members.
Alexey Bataev [Fri, 28 Jun 2019 16:16:00 +0000 (16:16 +0000)]
[OPENMP]Fix top DSA for static members.

Fixed handling of the data-sharing attributes for static members when
requesting top most attribute. Previously, it might return the incorrect
attributes for static members if they were overriden in the outer
constructs.

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

5 years ago[OPENMP]Fix DSA for loop iteration variables in simd loops.
Alexey Bataev [Fri, 28 Jun 2019 15:16:37 +0000 (15:16 +0000)]
[OPENMP]Fix DSA for loop iteration variables in simd loops.

According to the OpenMP 5.0 standard, the loop iteration variable in the associated
for-loop of a simd construct with just one associated for-loop may be
listed in a private, lastprivate, or linear clause with a linear-step
that is the increment of the associated for-loop. Also, the loop
teration variables in the associated for-loops of a simd construct with
multiple associated for-loops may be listed in a private or lastprivate
clause.

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

5 years ago[Hexagon] driver uses out-of-date option name and binary name
Krzysztof Parzyszek [Fri, 28 Jun 2019 15:08:03 +0000 (15:08 +0000)]
[Hexagon] driver uses out-of-date option name and binary name

Patch by A. Skrobov (t.yomitch).

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

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

5 years ago[OPENMP]Fix checks for DSA in simd constructs.
Alexey Bataev [Fri, 28 Jun 2019 14:59:25 +0000 (14:59 +0000)]
[OPENMP]Fix checks for DSA in simd constructs.

The errors for incorrectly specified data-sharing attributes for simd
constructs must be emitted only for the explicitly provided clauses, not
the predetermined ones.

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

5 years ago[CTU] Add missing statistics
Gabor Marton [Fri, 28 Jun 2019 08:08:51 +0000 (08:08 +0000)]
[CTU] Add missing statistics

Reviewers: xazax.hun

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

Tags: #clang

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

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

5 years ago[analyzer] Fix clang-tidy crash on GCCAsmStmt
Nathan Huckleberry [Thu, 27 Jun 2019 22:46:40 +0000 (22:46 +0000)]
[analyzer] Fix clang-tidy crash on GCCAsmStmt

Summary:
Added entry in switch statement to recognize GCCAsmStmt
as a possible block terminator.

Handling to build CFG using GCCAsmStmt was already implemented.

Reviewers: nickdesaulniers, george.karpenkov, NoQ

Reviewed By: nickdesaulniers, NoQ

Subscribers: xbolva00, tmroeder, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, Charusso, cfe-commits

Tags: #clang

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

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

5 years agoPattern match struct types in test case.
Akira Hatanaka [Thu, 27 Jun 2019 21:16:19 +0000 (21:16 +0000)]
Pattern match struct types in test case.

This simplifies the test cases in a patch I'm planning to send later.

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

5 years ago[OPENMP]Generate correctly implicit flags for mapped data.
Alexey Bataev [Thu, 27 Jun 2019 18:53:07 +0000 (18:53 +0000)]
[OPENMP]Generate correctly implicit flags for mapped data.

Implicit flag must not be emitted for explicitly specified firstprivate
variables, but for implicitly captured sizes of the VLAs.

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

5 years ago[clang] Add DISuprogram and DIE for a func decl
Djordje Todorovic [Thu, 27 Jun 2019 06:44:44 +0000 (06:44 +0000)]
[clang] Add DISuprogram and DIE for a func decl

Attach a unique DISubprogram to a function declaration that will be
used for call site debug info.

([7/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D60714

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

5 years ago[NFC] Return early for types with size zero
Vitaly Buka [Thu, 27 Jun 2019 02:08:15 +0000 (02:08 +0000)]
[NFC] Return early for types with size zero

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

5 years ago[NFC] Remove unneeded local variables
Vitaly Buka [Thu, 27 Jun 2019 01:34:21 +0000 (01:34 +0000)]
[NFC] Remove unneeded local variables

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

5 years ago[ObjC] Improve error message for a malformed objc-type-name
Erik Pilkington [Wed, 26 Jun 2019 23:39:23 +0000 (23:39 +0000)]
[ObjC] Improve error message for a malformed objc-type-name

If the type didn't exist, we used to emit a really bad error:

t.m:3:12: error: expected ')'
-(nullable NoSuchType)foo3;
           ^

rdar://50925632

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

5 years agoFix formatting after r364479
Aaron Puchert [Wed, 26 Jun 2019 21:39:19 +0000 (21:39 +0000)]
Fix formatting after r364479

The reflowing obscurs the functional changes, so here is a separate
commit.

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

5 years ago[Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarf
Aaron Puchert [Wed, 26 Jun 2019 21:36:35 +0000 (21:36 +0000)]
[Clang] Remove unused -split-dwarf and obsolete -enable-split-dwarf

Summary:
The changes in D59673 made the choice redundant, since we can achieve
single-file split DWARF just by not setting an output file name.
Like llc we can also derive whether to enable Split DWARF from whether
-split-dwarf-file is set, so we don't need the flag at all anymore.

The test CodeGen/split-debug-filename.c distinguished between having set
or not set -enable-split-dwarf with -split-dwarf-file, but we can
probably just always emit the metadata into the IR.

The flag -split-dwarf wasn't used at all anymore.

Reviewers: dblaikie, echristo

Reviewed By: dblaikie

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

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

5 years agoRevert r363191 "[MS] Pretend constexpr variable template specializations are inline"
Reid Kleckner [Wed, 26 Jun 2019 21:16:51 +0000 (21:16 +0000)]
Revert r363191 "[MS] Pretend constexpr variable template specializations are inline"

The next Visual Studio update will fix this issue, and it doesn't make
sense to implement this non-conforming behavior going forward.

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

5 years ago[clang-scan-deps] Introduce the DependencyScanning library with the
Alex Lorenz [Wed, 26 Jun 2019 21:11:51 +0000 (21:11 +0000)]
[clang-scan-deps] Introduce the DependencyScanning library with the
thread worker code and better error handling

This commit extracts out the code that will powers the fast scanning
worker into a new file in a new DependencyScanning library. The error
and output handling is improved so that the clients can gather
errors/results from the worker directly.

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

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

5 years ago[WebAssembly] Implement Address Sanitizer for Emscripten
Guanzhong Chen [Wed, 26 Jun 2019 20:16:14 +0000 (20:16 +0000)]
[WebAssembly] Implement Address Sanitizer for Emscripten

Summary:
This diff enables address sanitizer on Emscripten.

On Emscripten, real memory starts at the value passed to --global-base.

All memory before this is used as shadow memory, and thus the shadow mapping
function is simply dividing by 8.

Reviewers: tlively, aheejin, sbc100

Reviewed By: sbc100

Subscribers: dschuff, sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoBitStream reader: propagate errors
JF Bastien [Wed, 26 Jun 2019 19:50:12 +0000 (19:50 +0000)]
BitStream reader: propagate errors

The bitstream reader handles errors poorly. This has two effects:

 * Bugs in file handling (especially modules) manifest as an "unexpected end of
   file" crash
 * Users of clang as a library end up aborting because the code unconditionally
   calls `report_fatal_error`

The bitstream reader should be more resilient and return Expected / Error as
soon as an error is encountered, not way late like it does now. This patch
starts doing so and adopting the error handling where I think it makes sense.
There's plenty more to do: this patch propagates errors to be minimally useful,
and follow-ups will propagate them further and improve diagnostics.

https://bugs.llvm.org/show_bug.cgi?id=42311
<rdar://problem/33159405>

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

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

5 years agoPrint NULL as "(null)" in diagnostic message
Xing Xue [Wed, 26 Jun 2019 19:27:16 +0000 (19:27 +0000)]
Print NULL as "(null)" in diagnostic message

Summary:
Passing a null pointer to the printf family for a %s format specifier leads to undefined behaviour. The tests currently expect (null). Explicitly test for a null pointer and provide the expected string.

Authored By: andusy

Reviewers: hubert.reinterpretcast, xingxue, jasonliu, daltenty, cebowleratibm

Reviewed By: hubert.reinterpretcast

Subscribers: arphaman, jsji, cfe-commits

Tags: #llvm

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

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

5 years agoMake AddLastArg() variadic and use it more. No behavior change.
Nico Weber [Wed, 26 Jun 2019 17:51:47 +0000 (17:51 +0000)]
Make AddLastArg() variadic and use it more. No behavior change.

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

5 years agoMake CodeGen depend on ASTMatchers
Michael Liao [Wed, 26 Jun 2019 14:13:43 +0000 (14:13 +0000)]
Make CodeGen depend on ASTMatchers

- Shared library builds are broken due to the missing dependency.

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

5 years ago[clang/DIVar] Emit the flag for params that have unmodified value
Djordje Todorovic [Wed, 26 Jun 2019 13:32:02 +0000 (13:32 +0000)]
[clang/DIVar] Emit the flag for params that have unmodified value

Emit the debug info flag that indicates that a parameter has unchanged
value throughout a function.

([5/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58035

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

5 years ago[OpenCL] Improve diagnostic for placement new
Sven van Haastregt [Wed, 26 Jun 2019 13:31:24 +0000 (13:31 +0000)]
[OpenCL] Improve diagnostic for placement new

Without an explicit declaration for placement new, clang would reject
uses of placement new with "'default new' is not supported in OpenCL
C++".  This may mislead users into thinking that placement new is not
supported, see e.g. PR42060.

Clarify that placement new requires an explicit declaration.

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

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

5 years ago[clang] Fix test failures after the rL364399
Djordje Todorovic [Wed, 26 Jun 2019 10:23:25 +0000 (10:23 +0000)]
[clang] Fix test failures after the rL364399

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

5 years ago[CC1Option] Add the option to enable the debug entry values
Djordje Todorovic [Wed, 26 Jun 2019 09:38:09 +0000 (09:38 +0000)]
[CC1Option] Add the option to enable the debug entry values

The option enables debug info about parameter's entry values.

The example of using the option:

clang -g -O2 -Xclang -femit-debug-entry-values test.c

In addition, when the option is set add the flag all_call_sites
in a subprogram in order to support GNU extension as well.

([3/13] Introduce the debug entry values.)

Co-authored-by: Ananth Sowda <asowda@cisco.com>
Co-authored-by: Nikola Prica <nikola.prica@rt-rk.com>
Co-authored-by: Ivan Baev <ibaev@cisco.com>
Differential Revision: https://reviews.llvm.org/D58033

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

5 years ago[clang][Tooling] Fix windows build-bots after rL364386
Kadir Cetinkaya [Wed, 26 Jun 2019 08:39:42 +0000 (08:39 +0000)]
[clang][Tooling] Fix windows build-bots after rL364386

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

5 years ago[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase
Kadir Cetinkaya [Wed, 26 Jun 2019 07:39:03 +0000 (07:39 +0000)]
[clang][Tooling] Infer target and mode from argv[0] when using JSONCompilationDatabase

Summary:
Wraps JSON compilation database with a target and mode adding database
wrapper. So that driver can correctly figure out which toolchain to use.

Note that clients that wants to make use of this target discovery mechanism
needs to link in TargetsInfos and initialize them at startup.

Reviewers: ilya-biryukov

Subscribers: mgorny, cfe-commits

Tags: #clang

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

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

5 years ago[HIP] Support attribute hip_pinned_shadow
Yaxun Liu [Wed, 26 Jun 2019 03:47:37 +0000 (03:47 +0000)]
[HIP] Support attribute hip_pinned_shadow

This patch introduces support of hip_pinned_shadow variable for HIP.

A hip_pinned_shadow variable is a global variable with attribute hip_pinned_shadow.
It has external linkage on device side and has no initializer. It has internal
linkage on host side and has initializer or static constructor. It can be accessed
in both device code and host code.

This allows HIP runtime to implement support of HIP texture reference.

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

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

5 years agoFix build failure due to missing break
Yaxun Liu [Wed, 26 Jun 2019 03:33:03 +0000 (03:33 +0000)]
Fix build failure due to missing break

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

5 years ago[analyzer] exploded-graph-rewriter: Prettier location context dumps.
Artem Dergachev [Wed, 26 Jun 2019 00:14:49 +0000 (00:14 +0000)]
[analyzer] exploded-graph-rewriter: Prettier location context dumps.

Make them span wider.

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

5 years agoprint-supported-cpus quality of life patch.
Ziang Wan [Tue, 25 Jun 2019 23:57:14 +0000 (23:57 +0000)]
print-supported-cpus quality of life patch.

Claim all input files so that clang does not give a warning. Add two
short-cut aliases: -mcpu=? and -mtune=?.

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

5 years agoRevert Devirtualize destructor of final class.
Rumeet Dhindsa [Tue, 25 Jun 2019 22:58:25 +0000 (22:58 +0000)]
Revert Devirtualize destructor of final class.

This reverts r364100 (git commit 405c2b16225fc6eaf5eb8ba3ce584699a3b159ef)

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

5 years agoandroid: enable double-word CAS on x64
Saleem Abdulrasool [Tue, 25 Jun 2019 21:43:34 +0000 (21:43 +0000)]
android: enable double-word CAS on x64

The android target assumes that for the x86_64 target, the CPU supports SSE4.2
and popcnt. This implies that the CPU is Nehalem or newer. This should be
sufficiently new to provide the double word compare and exchange instruction.
This allows us to directly lower `__sync_val_compare_and_swap_16` to a `cmpxchg16b`.
It appears that the libatomic in android's NDK does not provide the
implementation for lowering calls to the library function.

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

5 years agoRemove redundant expression evaluation context when substituting into a
Richard Smith [Tue, 25 Jun 2019 20:40:27 +0000 (20:40 +0000)]
Remove redundant expression evaluation context when substituting into a
template argument.

We do need one of these but we don't need two.

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

5 years agoAdd regression test for PR41576 (which is already fixed in trunk,
Richard Smith [Tue, 25 Jun 2019 18:42:53 +0000 (18:42 +0000)]
Add regression test for PR41576 (which is already fixed in trunk,
perhaps by r361300).

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

5 years ago[ARM] Support inline assembler constraints for MVE.
Simon Tatham [Tue, 25 Jun 2019 16:49:32 +0000 (16:49 +0000)]
[ARM] Support inline assembler constraints for MVE.

"To" selects an odd-numbered GPR, and "Te" an even one. There are some
8.1-M instructions that have one too few bits in their register fields
and require registers of particular parity, without necessarily using
a consecutive even/odd pair.

Also, the constraint letter "t" should select an MVE q-register, when
MVE is present. This didn't need any source changes, but some extra
tests have been added.

Reviewers: dmgreen, samparker, SjoerdMeijer

Subscribers: javed.absar, eraman, kristof.beyls, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years ago[OPENMP]Fix PR41966: type mismatch in runtime functions.
Alexey Bataev [Tue, 25 Jun 2019 16:00:43 +0000 (16:00 +0000)]
[OPENMP]Fix PR41966: type mismatch in runtime functions.

Target-based runtime functions use int64_t type for sizes, while the
compiler uses size_t type. It leads to miscompilation in 32 bit mode.

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

5 years ago[clangd] Narrow rename to local symbols.
Haojian Wu [Tue, 25 Jun 2019 08:43:17 +0000 (08:43 +0000)]
[clangd] Narrow rename to local symbols.

Summary:
Previously, we performed rename for all kinds of symbols (local, global).

This patch narrows the scope by only renaming symbols not being used
outside of the main file (with index asisitance). Renaming global
symbols is not supported at the moment (return an error).

Reviewers: sammccall

Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, cfe-commits

Tags: #clang

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

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

5 years ago[ASTImporter] Store import errors for Decls
Gabor Marton [Tue, 25 Jun 2019 08:00:51 +0000 (08:00 +0000)]
[ASTImporter] Store import errors for Decls

Summary:
We add a new member which is a mapping from the already-imported
declarations in the "from" context to the error status of the import of
that declaration.  This map contains only the declarations that were not
correctly imported. The same declaration may or may not be included in
ImportedDecls. This map is updated continuously during imports and never
cleared (like ImportedDecls).  In Import(Decl*) we use this mapping, so
if there was a previous failed import we return with the existing error.

We add/remove from the Lookuptable in consistency with ImportedFromDecls.
When we map a decl in the 'to' context to something in the 'from'
context then and only then we add it to the lookup table. When we
remove a mapping then and only then we remove it from the lookup table.

This patch is the first in a series of patches whose aim is to further
strengthen the error handling in ASTImporter.

Reviewers: a_sidorin, a.sidorin, shafik

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

Tags: #clang

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

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

5 years ago[analyzer] print() JSONify: Create pointers
Csaba Dabis [Tue, 25 Jun 2019 03:17:55 +0000 (03:17 +0000)]
[analyzer] print() JSONify: Create pointers

Summary: -

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin,
             mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] JsonSupport: Escape escapes
Csaba Dabis [Tue, 25 Jun 2019 03:08:32 +0000 (03:08 +0000)]
[analyzer] JsonSupport: Escape escapes

Summary: -

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin,
             mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.
Artem Dergachev [Tue, 25 Jun 2019 02:16:56 +0000 (02:16 +0000)]
[analyzer] exploded-graph-rewriter: Fix escaping for bitwise-or.

'|' is a special character in graphviz, so it needs to be properly
escaped and unescaped.

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

5 years ago[analyzer] exploded-graph-rewriter: Add support for range constraints.
Artem Dergachev [Tue, 25 Jun 2019 02:16:53 +0000 (02:16 +0000)]
[analyzer] exploded-graph-rewriter: Add support for range constraints.

Diff support included.

A cheap solution is implemented that treats range constraints as
"some sort of key-value map", so it's going to be trivial
to add support for other such maps later, such as dynamic type info.

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

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

5 years ago[analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.
Artem Dergachev [Tue, 25 Jun 2019 02:16:50 +0000 (02:16 +0000)]
[analyzer] NFC: exploded-graph-rewriter: Extract some code into functions.

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

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

5 years ago[analyzer] Add more timers for performance profiling.
Artem Dergachev [Tue, 25 Jun 2019 02:16:47 +0000 (02:16 +0000)]
[analyzer] Add more timers for performance profiling.

The -analyzer-stats flag now allows you to find out how much time was spent
on AST-based analysis and on path-sensitive analysis and, separately,
on bug visitors, as they're occasionally a performance problem on their own.

The total timer wasn't useful because there's anyway a total time printed out.
Remove it.

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

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

5 years ago[cxx2a] P1236R1: the validity of a left shift does not depend on the
Richard Smith [Tue, 25 Jun 2019 01:45:26 +0000 (01:45 +0000)]
[cxx2a] P1236R1: the validity of a left shift does not depend on the
value of the LHS operand.

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

5 years ago[analyzer] ExprEngine: Escape pointers in bitwise operations
Csaba Dabis [Tue, 25 Jun 2019 00:44:33 +0000 (00:44 +0000)]
[analyzer] ExprEngine: Escape pointers in bitwise operations

Summary:
After evaluation it would be an Unknown value and tracking would be lost.

Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus

Reviewed By: NoQ

Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy,
             dkrupp, cfe-commits

Tags: #clang

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

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

5 years agoAMDGPU: Fix missing declaration for mbcnt builtins
Matt Arsenault [Mon, 24 Jun 2019 23:34:06 +0000 (23:34 +0000)]
AMDGPU: Fix missing declaration for mbcnt builtins

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

5 years agoFix test cl-response-file.c to work on all platforms including Windows/Solaris.
Douglas Yung [Mon, 24 Jun 2019 22:26:08 +0000 (22:26 +0000)]
Fix test cl-response-file.c to work on all platforms including Windows/Solaris.

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

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

5 years ago[Syntax] Do not glue multiple empty PP expansions to a single mapping
Ilya Biryukov [Mon, 24 Jun 2019 21:39:51 +0000 (21:39 +0000)]
[Syntax] Do not glue multiple empty PP expansions to a single mapping

Summary:
This change makes sure we have a single mapping for each macro expansion,
even if the result of expansion was empty.

To achieve that, we take information from PPCallbacks::MacroExpands into
account. Previously we relied only on source locations of expanded tokens.

Reviewers: sammccall

Reviewed By: sammccall

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoAugment location information when dumping the AST to JSON.
Aaron Ballman [Mon, 24 Jun 2019 20:07:11 +0000 (20:07 +0000)]
Augment location information when dumping the AST to JSON.

Rather than create JSON objects for source locations and ranges, we instead stream them out directly. This allows us to elide duplicate information (without JSON field reordering causing an issue) like file names and line numbers, similar to the text dump. This also adds token length information when dumping the source location.

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

5 years ago[clang][NewPM] Add RUNS for tests that produce slightly different IR under new PM
Leonard Chan [Mon, 24 Jun 2019 16:49:18 +0000 (16:49 +0000)]
[clang][NewPM] Add RUNS for tests that produce slightly different IR under new PM

For CodeGenOpenCL/convergent.cl, the new PM produced a slightly different for
loop, but this still checks for no loop unrolling as intended. This is
committed separately from D63174.

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

5 years ago[clang][NewPM] Remove exception handling before loading pgo sample profile data
Leonard Chan [Mon, 24 Jun 2019 16:44:27 +0000 (16:44 +0000)]
[clang][NewPM] Remove exception handling before loading pgo sample profile data

This patch ensures that SimplifyCFGPass comes before SampleProfileLoaderPass
on PGO runs in the new PM and fixes clang/test/CodeGen/pgo-sample.c.

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

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

5 years ago[analyzer] print() JSONify: ProgramPoint revision
Csaba Dabis [Mon, 24 Jun 2019 16:19:39 +0000 (16:19 +0000)]
[analyzer] print() JSONify: ProgramPoint revision

Summary: Now we also print out the filename with its path.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin,
             mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Fix JSON dumps for ExplodedNodes
Csaba Dabis [Mon, 24 Jun 2019 16:06:44 +0000 (16:06 +0000)]
[analyzer] Fix JSON dumps for ExplodedNodes

Summary:
- Now we could see the `has_report` property in `trim-egraph` mode.
- This patch also removes the trailing comma after each node.

Reviewers: NoQ

Reviewed By: NoQ

Subscribers: xazax.hun, baloghadamsoftware, szepet, a.sidorin,
             mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits

Tags: #clang

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

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

5 years ago[OPENMP]Relax the test checks to pacify 32bit buildbots, NFC.
Alexey Bataev [Mon, 24 Jun 2019 15:30:20 +0000 (15:30 +0000)]
[OPENMP]Relax the test checks to pacify 32bit buildbots, NFC.

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

5 years ago[CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential...
Konstantin Pyzhov [Mon, 24 Jun 2019 14:40:20 +0000 (14:40 +0000)]
[CUDA][HIP] Don't set comdat attribute for CUDA device stub functions.\nDifferential Revision: https://reviews.llvm.org/D63277

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

5 years ago[OpenCL] Restore ATOMIC_VAR_INIT
Sven van Haastregt [Mon, 24 Jun 2019 10:06:40 +0000 (10:06 +0000)]
[OpenCL] Restore ATOMIC_VAR_INIT

We accidentally lost the ATOMIC_VAR_INIT and ATOMIC_FLAG_INIT macros
in r363794.

Also put the `memory_order` typedef back inside a `>= CL2.0` guard.

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