]> granicus.if.org Git - clang/log
clang
5 years ago[analyzer] NFC: Drop support for extra text attached to bug reports.
Artem Dergachev [Tue, 20 Aug 2019 02:15:47 +0000 (02:15 +0000)]
[analyzer] NFC: Drop support for extra text attached to bug reports.

It was introduced in 2011 but never used since then.

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

5 years ago[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks
Anton Afanasyev [Mon, 19 Aug 2019 22:58:26 +0000 (22:58 +0000)]
[Support][Time profiler] Make FE codegen blocks to be inside frontend blocks

Summary:
Add `Frontend` time trace entry to `HandleTranslationUnit()` function.
Add test to check all codegen blocks are inside frontend blocks.
Also, change `--time-trace-granularity` option a bit to make sure very small
time blocks are outputed to json-file when using `--time-trace-granularity=0`.

This fixes http://llvm.org/pr41969

Reviewers: russell.gallop, lebedev.ri, thakis

Reviewed By: russell.gallop

Subscribers: vsapsai, aras-p, lebedev.ri, hiraditya, cfe-commits, llvm-commits

Tags: #clang, #llvm

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

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

5 years agoFix poorly formatted HTML in the cxx_status.html file caused by adding
Erich Keane [Mon, 19 Aug 2019 18:14:22 +0000 (18:14 +0000)]
Fix poorly formatted HTML in the cxx_status.html file caused by adding
1668.

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

5 years agoFix test where diagnostics changed in P1668 implementation
Erich Keane [Mon, 19 Aug 2019 18:08:52 +0000 (18:08 +0000)]
Fix test where diagnostics changed in P1668 implementation

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

5 years agoUpdate cxx_status.html with P1668 status.
Erich Keane [Mon, 19 Aug 2019 17:57:27 +0000 (17:57 +0000)]
Update cxx_status.html with P1668 status.

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

5 years agoImplement P1668R1
Erich Keane [Mon, 19 Aug 2019 17:39:59 +0000 (17:39 +0000)]
Implement P1668R1

Allow inline assembly statements in unexecuted branches of constexpr
functions.

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

5 years agoDon't keep stale pointers to LoopInfos.
Aaron Ballman [Mon, 19 Aug 2019 13:37:41 +0000 (13:37 +0000)]
Don't keep stale pointers to LoopInfos.

CGLoopInfo was keeping pointers to parent loop LoopInfos, but when the loop info vector grew, it reallocated the storage and invalidated all of the parent pointers, causing use-after-free. Manage the lifetimes of the LoopInfos separately so that the pointers aren't stale.

Patch by Bevin Hansson.

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

5 years ago[OpenCL] Add generic type handling for builtin functions
Sven van Haastregt [Mon, 19 Aug 2019 11:56:03 +0000 (11:56 +0000)]
[OpenCL] Add generic type handling for builtin functions

Generic types are an abstraction of type sets.  It mimics the way
functions are defined in the OpenCL specification.  For example,
floatN can abstract all the vector sizes of the float type.

This allows to
 * stick more closely to the specification, which uses generic types;
 * factorize definitions of functions with numerous prototypes in the
   tablegen file; and
 * reduce the memory impact of functions with many overloads.

Patch by Pierre Gondois and Sven van Haastregt.

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

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

5 years ago[OpenCL] Fix addr space deduction for pointers/references to arrays.
Anastasia Stulova [Mon, 19 Aug 2019 11:43:16 +0000 (11:43 +0000)]
[OpenCL] Fix addr space deduction for pointers/references to arrays.

Rewrite the logic for detecting if we are deducing addr space of
a pointee type to take into account special logic for arrays. For
pointers/references to arrays we can have any number of parentheses
expressions as well as nested pointers.

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

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

5 years ago[Diagnostics] Diagnose misused xor as pow
David Bolvansky [Sun, 18 Aug 2019 19:14:14 +0000 (19:14 +0000)]
[Diagnostics] Diagnose misused xor as pow

Summary:
Motivation:
https://twitter.com/jfbastien/status/1139298419988549632
https://twitter.com/mikemx7f/status/1139335901790625793
https://codesearch.isocpp.org/cgi-bin/cgi_ppsearch?q=10+%5E&search=Search

Reviewers: jfb, rsmith, regehr, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: lebedev.ri, Quuxplusone, erik.pilkington, riccibruno, dexonsmith, cfe-commits

Tags: #clang

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

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

5 years ago[clang-format] Fix a bug that joins template closer and =
Owen Pan [Sun, 18 Aug 2019 18:51:39 +0000 (18:51 +0000)]
[clang-format] Fix a bug that joins template closer and =

Also fixes the documentation for SpaceBeforeAssignmentOperators.

See discussions at https://reviews.llvm.org/D66332

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

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

5 years ago[Diagnostics] Improve -Wsizeof-pointer-div
David Bolvansky [Sun, 18 Aug 2019 10:10:09 +0000 (10:10 +0000)]
[Diagnostics] Improve -Wsizeof-pointer-div

Emit diag note with a location of pointer declaration.
Revisited/added tests.

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

5 years ago[SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified...
Tan S. B [Sat, 17 Aug 2019 20:57:52 +0000 (20:57 +0000)]
[SemaDeclCXX] Allow inheriting constructor declaration to specify a cv-qualified type

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

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

5 years ago[analyzer] Turn an assert into an if condition
Kristof Umann [Sat, 17 Aug 2019 16:49:54 +0000 (16:49 +0000)]
[analyzer] Turn an assert into an if condition

Shocker, turns out that terminator conditions that are binary operators
aren't always logical operators.

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

5 years ago[X86] Support -mlong-double-80
Troy A. Johnson [Sat, 17 Aug 2019 04:20:24 +0000 (04:20 +0000)]
[X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

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

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

5 years agoReland "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 23:30:16 +0000 (23:30 +0000)]
Reland "[ARM] push LR before __gnu_mcount_nc"

This relands r369147 with fixes to unit tests.

https://reviews.llvm.org/D65019

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

5 years agoRevert "[X86] Support -mlong-double-80"
Troy A. Johnson [Fri, 16 Aug 2019 23:18:22 +0000 (23:18 +0000)]
Revert "[X86] Support -mlong-double-80"

This reverts commit 250aafa2c4a1bc2395edfe8d4365545bbe56fffe.
Caused buildbot failures -- still investigating.

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

5 years ago[doc] Fix some minor formatting issues.
Richard Smith [Fri, 16 Aug 2019 22:08:39 +0000 (22:08 +0000)]
[doc] Fix some minor formatting issues.

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

5 years ago[clang-format] Fix the bug that joins template closer and > or >>
Owen Pan [Fri, 16 Aug 2019 21:49:17 +0000 (21:49 +0000)]
[clang-format] Fix the bug that joins template closer and > or >>

Also fixes a buggy test case.

See PR42404

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

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

5 years ago[X86] Support -mlong-double-80
Troy A. Johnson [Fri, 16 Aug 2019 21:00:22 +0000 (21:00 +0000)]
[X86] Support -mlong-double-80

Add an option group for all of the -mlong-double-* options and make
-mlong-double-80 restore the default long double behavior for X86.  The
motivations are that GNU accepts the -mlong-double-80 option and that complex
Makefiles often need a way of undoing earlier options. Prior to this commit, if
one chooses 64-bit or 128-bit long double for X86, there is no way to undo that
choice and restore the 80-bit behavior.

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

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

5 years agoRevert "[ARM] push LR before __gnu_mcount_nc"
Jian Cai [Fri, 16 Aug 2019 20:40:21 +0000 (20:40 +0000)]
Revert "[ARM] push LR before __gnu_mcount_nc"

This reverts commit f4cf3b959333f62b7a7b2d7771f7010c9d8da388.

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

5 years ago[Test Commit] Fix typo in diagtool.rst
Troy A. Johnson [Fri, 16 Aug 2019 20:26:48 +0000 (20:26 +0000)]
[Test Commit] Fix typo in diagtool.rst

Test commit after obtaining commit access.

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

5 years ago[ARM] push LR before __gnu_mcount_nc
Jian Cai [Fri, 16 Aug 2019 20:21:08 +0000 (20:21 +0000)]
[ARM] push LR before __gnu_mcount_nc

Push LR register before calling __gnu_mcount_nc as it expects the value of LR register to be the top value of
the stack on ARM32.

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

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

5 years ago[OPENMP5.0]Diagnose global variables in lambda not marked as declare
Alexey Bataev [Fri, 16 Aug 2019 20:15:02 +0000 (20:15 +0000)]
[OPENMP5.0]Diagnose global variables in lambda not marked as declare
target.

According to OpenMP 5.0, if a lambda declaration and definition appears between a declare target directive and the matching end declare target directive, all variables that are captured by the lambda expression must also appear in a to clause.

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

5 years agoStop abusing SuppressAllDiagnostics when speculatively determining
Richard Smith [Fri, 16 Aug 2019 19:53:22 +0000 (19:53 +0000)]
Stop abusing SuppressAllDiagnostics when speculatively determining
whether an expression would be valid during error recovery.

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

5 years agoFix typos in LibASTImporter.rst
Gabor Marton [Fri, 16 Aug 2019 12:21:49 +0000 (12:21 +0000)]
Fix typos in LibASTImporter.rst

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

5 years ago[ASTImporter] Import ctor initializers after setting flags.
Balazs Keri [Fri, 16 Aug 2019 12:10:03 +0000 (12:10 +0000)]
[ASTImporter] Import ctor initializers after setting flags.

Summary:
Code to import "ctor initializers" at import of functions
is moved to be after the flags in the newly created function
are imported. This fixes an error when the already created but
incomplete (flags are not set) function declaration is accessed.

Reviewers: martong, shafik, a_sidorin, a.sidorin

Reviewed By: shafik

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

Tags: #clang

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

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

5 years ago[RISCV] Add inline asm constraint A for RISC-V
Lewis Revill [Fri, 16 Aug 2019 10:23:56 +0000 (10:23 +0000)]
[RISCV] Add inline asm constraint A for RISC-V

This allows the constraint A to be used in inline asm for RISC-V, which
allows an address held in a register to be used.

This patch adds the minimal amount of code required to get operands with
the right constraints to compile.

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

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

5 years ago[analyzer] Analysis: Silence checkers
Csaba Dabis [Fri, 16 Aug 2019 01:53:14 +0000 (01:53 +0000)]
[analyzer] Analysis: Silence checkers

Summary:
This patch introduces a new `analyzer-config` configuration:
`-analyzer-config silence-checkers`
which could be used to silence the given checkers.

It accepts a semicolon separated list, packed into quotation marks, e.g:
`-analyzer-config silence-checkers="core.DivideZero;core.NullDereference"`

It could be used to "disable" core checkers, so they model the analysis as
before, just if some of them are too noisy it prevents to emit reports.

This patch also adds support for that new option to the scan-build.
Passing the option `-disable-checker core.DivideZero` to the scan-build
will be transferred to `-analyzer-config silence-checkers=core.DivideZero`.

Reviewed By: NoQ, Szelethus

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

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

5 years ago[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug
Joel E. Denny [Thu, 15 Aug 2019 21:17:48 +0000 (21:17 +0000)]
[Rewrite][NFC] Add FIXMEs and tests for RemoveLineIfEmpty bug

I'd like to add these comments to warn others of problems I
encountered when trying to use `RemoveLineIfEmpty`.  I originally
tried to fix the problem, but I realized I could implement the
functionality more easily and efficiently in my calling code where I
can make the simplifying assumption that there are no prior edits to
the line from which text is being removed.  While I've lost the
motivation to write a fix, which doesn't look easy, I figure a warning
to others is better than silence.

I've added a unit test to demonstrate the problem.  I don't know how
to mark it as an expected failure, so I just marked it disabled.

Reviewed By: jkorous

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

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

5 years agoMark the test as unsupported on darwin, NFC.
Alexey Bataev [Thu, 15 Aug 2019 20:31:47 +0000 (20:31 +0000)]
Mark the test as unsupported on darwin, NFC.

The bundler may fail on darwin, mark the test as not compatible.

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

5 years ago[Sema] Implement DR2386 for C++17 structured binding
Reid Kleckner [Thu, 15 Aug 2019 19:45:28 +0000 (19:45 +0000)]
[Sema] Implement DR2386 for C++17 structured binding

Allow implementations to provide complete definitions of
std::tuple_size<T>, but to omit the 'value' member to signal that T is
not tuple-like. The Microsoft standard library implements
std::tuple_size<const T> this way.

If the value member exists, clang still validates that it is an ICE, but
if it does not, then the type is considered to not be tuple-like.

Fixes PR33236

Reviewers: rsmith

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

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

5 years ago[WebAssembly] Correctly handle va_arg of zero-sized structures
Guanzhong Chen [Thu, 15 Aug 2019 19:33:36 +0000 (19:33 +0000)]
[WebAssembly] Correctly handle va_arg of zero-sized structures

Summary:
D66168 passes size 0 structs indirectly, while the wasm backend expects it to
be passed directly. This causes subsequent variadic arguments to be read
incorrectly.

This diff changes it so that size 0 structs are passed directly.

Reviewers: dschuff, tlively, sbc100

Reviewed By: dschuff

Subscribers: jgravelle-google, aheejin, sunfish, cfe-commits

Tags: #clang

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

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

5 years agoRename this file from cx2.c to c2x.c; NFC.
Aaron Ballman [Thu, 15 Aug 2019 18:37:30 +0000 (18:37 +0000)]
Rename this file from cx2.c to c2x.c; NFC.

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

5 years agoAllow standards-based attributes to have leading and trailing underscores.
Aaron Ballman [Thu, 15 Aug 2019 18:35:44 +0000 (18:35 +0000)]
Allow standards-based attributes to have leading and trailing underscores.

This gives library implementers a way to use standards-based attributes that do not conflict with user-defined macros of the same name. Attributes in C2x require this behavior normatively (C2x 6.7.11p4), but there's no reason to not have the same behavior in C++, especially given that such attributes may be used by a C library consumed by a C++ compilation.

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

5 years agoFix the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 17:53:49 +0000 (17:53 +0000)]
Fix the test, NFC.

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

5 years agoTest commit #2.
George Karpenkov [Thu, 15 Aug 2019 17:17:21 +0000 (17:17 +0000)]
Test commit #2.

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

5 years ago[Driver][Bundler] Improve bundling of object files.
Alexey Bataev [Thu, 15 Aug 2019 17:15:35 +0000 (17:15 +0000)]
[Driver][Bundler] Improve bundling of object files.

Summary:
Previously, object files were bundled using partial linking. It resulted
in the following structure of the bundled objects:
```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
```
But when we tried to unbundle object files, it worked correctly only for
the target objects. The host object remains bundled. It produced a lot of
junk sections in the host object files and in some cases may caused
incorrect linking.

Patch improves bundling of the object files. After this patch the
bundled object looks like this:

```
<host_code>
clang-offload-bundle
__CLANG_OFFLOAD_BUNDLE__<target>
<target_code>
__CLANG_OFFLOAD_BUNDLE__<host>
<host_code>
```

With this structure we are able to unbundle the host object files too so
that after unbundling they are the same as were before.
The host section is bundled twice. The bundled section is used to
unbundle the original host section.

Reviewers: yaxunl, tra, jlebar, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

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

5 years ago[BUNDLER]Improve the test, NFC.
Alexey Bataev [Thu, 15 Aug 2019 16:28:24 +0000 (16:28 +0000)]
[BUNDLER]Improve the test, NFC.

Summary:
Make the test more portable and do not rely on the pre-bundled object
file.

Reviewers: Hahnfeld, hfinkel, jdoerfert

Subscribers: caomhin, kkwli0, cfe-commits

Tags: #clang

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

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

5 years agoReplace llvm::integer_sequence and friends with the C++14 standard version
Benjamin Kramer [Thu, 15 Aug 2019 10:56:05 +0000 (10:56 +0000)]
Replace llvm::integer_sequence and friends with the C++14 standard version

The implementation in libc++ takes O(1) compile time, ours was O(n).

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

5 years agoRevert rL368939 "Remove LVALUE / RVALUE workarounds"
Russell Gallop [Thu, 15 Aug 2019 10:12:11 +0000 (10:12 +0000)]
Revert rL368939 "Remove LVALUE / RVALUE workarounds"

This reverts commit cad8356d699b36c73abb267f65db575ddacbd652.

To unbreak Windows bots

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

5 years ago[analyzer] Warn about -analyzer-configs being meant for development purposes only
Kristof Umann [Thu, 15 Aug 2019 08:53:16 +0000 (08:53 +0000)]
[analyzer] Warn about -analyzer-configs being meant for development purposes only

This is more of a temporary fix, long term, we should convert AnalyzerOptions.def
into the universally beloved (*coughs*) TableGen format, where they can more
easily be separated into developer-only, alpha, and user-facing configs.

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

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

5 years ago[analyzer] Add docs for cplusplus.InnerPointer
Kristof Umann [Thu, 15 Aug 2019 08:52:10 +0000 (08:52 +0000)]
[analyzer] Add docs for cplusplus.InnerPointer

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

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

5 years ago[clang] Loop pragma parsing. NFC.
Sjoerd Meijer [Thu, 15 Aug 2019 07:39:05 +0000 (07:39 +0000)]
[clang] Loop pragma parsing. NFC.

Just a refactoring and a tidy up.

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

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

5 years ago[Clang] Pragma vectorize_predicate implies vectorize
Sjoerd Meijer [Thu, 15 Aug 2019 06:24:40 +0000 (06:24 +0000)]
[Clang] Pragma vectorize_predicate implies vectorize

New pragma "vectorize_predicate(enable)" now implies "vectorize(enable)",
and it is ignored when vectorization is disabled with e.g.
"vectorize(disable) vectorize_predicate(enable)".

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

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

5 years ago[X86] Add test cases for _mm_movepi64_pi64 and _mm_movpi64_epi64.
Craig Topper [Thu, 15 Aug 2019 06:20:33 +0000 (06:20 +0000)]
[X86] Add test cases for _mm_movepi64_pi64 and _mm_movpi64_epi64.

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

5 years ago[Tooling] Add a hack to work around issues with matcher binding in r368681.
David L. Jones [Thu, 15 Aug 2019 04:10:11 +0000 (04:10 +0000)]
[Tooling] Add a hack to work around issues with matcher binding in r368681.

The change in r368681 contains a (probably unintentional) behavioral change for
rewrite rules with a single matcher. Previously, the single matcher would not
need to be bound (`joinCaseMatchers` returned it directly), even though a final
DynTypeMatcher was created and bound by `buildMatcher`. With the new change, a
single matcher will be bound, in addition to the final binding (which is now in
`buildMatchers`, but happens roughly at the same point in the overall flow).

This patch simply duplicates the "final matcher" trick: it creates an extra
DynTypedMatcher for each rewrite rule case matcher, and unconditionally makes it
bindable. This is probably not the right long-term fix, but it does allow
existing code to continue to work with this interface.

Subscribers: cfe-commits, gribozavr, ymandel

Tags: #clang

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

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

5 years ago[NFC] Update doc comment to fix warning.
Jonas Devlieghere [Thu, 15 Aug 2019 03:59:30 +0000 (03:59 +0000)]
[NFC] Update doc comment to fix warning.

This fixes the warning: parameter 'EnableNullFPSuppression' not found in
the function declaration [-Wdocumentation]

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

5 years ago[NFCI] Always initialize BugReport const fields
Alex Langford [Thu, 15 Aug 2019 00:58:51 +0000 (00:58 +0000)]
[NFCI] Always initialize BugReport const fields

Summary:
Some compilers require that const fields of an object must be explicitly
initialized by the constructor. I ran into this issue building with clang
3.8 on Ubuntu 16.04.

Reviewers: compnerd, Szelethus, NoQ

Subscribers: cfe-commits, llvm-commits

Tags: #clang

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

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

5 years ago[Clang] Migrate llvm::make_unique to std::make_unique
Jonas Devlieghere [Wed, 14 Aug 2019 23:04:18 +0000 (23:04 +0000)]
[Clang] Migrate llvm::make_unique to std::make_unique

Now that we've moved to C++14, we no longer need the llvm::make_unique
implementation from STLExtras.h. This patch is a mechanical replacement
of (hopefully) all the llvm::make_unique instances across the monorepo.

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

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

5 years ago[www] Update DR status page to match latest version of CWG issues list.
Richard Smith [Wed, 14 Aug 2019 22:57:51 +0000 (22:57 +0000)]
[www] Update DR status page to match latest version of CWG issues list.

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

5 years agoFix handling of class member access into a vector type.
Richard Smith [Wed, 14 Aug 2019 22:57:50 +0000 (22:57 +0000)]
Fix handling of class member access into a vector type.

When handling a member access into a non-class, non-ObjC-object type, we
would perform a lookup into the surrounding scope as if for an
unqualified lookup. If the member access was followed by a '<' and this
lookup (or the typo-correction for it) found a template name, we'd treat
the member access as naming that template.

Now we treat such accesses as never naming a template if the type of the
object expression is of vector type, so that vector component accesses
are never misinterpreted as naming something else. This is not entirely
correct, since it is in fact valid to name a template from the enclosing
scope in this context, when invoking a pseudo-destructor for the vector
type via an alias template, but that's very much a corner case, and this
change leaves that case only as broken as the corresponding case for
Objective-C types is.

This incidentally adds support for dr2292, which permits a 'template'
keyword at the start of a member access naming a pseudo-destructor.

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

5 years agoRemove LVALUE / RVALUE workarounds
JF Bastien [Wed, 14 Aug 2019 22:48:12 +0000 (22:48 +0000)]
Remove LVALUE / RVALUE workarounds

Summary: LLVM_HAS_RVALUE_REFERENCE_THIS and LLVM_LVALUE_FUNCTION shouldn't be needed anymore because the minimum compiler versions support them.

Subscribers: jkorous, dexonsmith, cfe-commits, llvm-commits, hans, thakis, chandlerc, rnk

Tags: #clang, #llvm

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

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

5 years ago[LifetimeAnalysis] Support std::stack::top() and std::optional::value()
Matthias Gehre [Wed, 14 Aug 2019 21:55:57 +0000 (21:55 +0000)]
[LifetimeAnalysis] Support std::stack::top() and std::optional::value()

Summary: Diagnose dangling pointers that come from std::stack::top() and std::optional::value().

Reviewers: gribozavr

Subscribers: cfe-commits, xazax.hun

Tags: #clang

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

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

5 years ago[AMDGPU] Do not assume a default GCN target
Stanislav Mekhanoshin [Wed, 14 Aug 2019 20:55:15 +0000 (20:55 +0000)]
[AMDGPU] Do not assume a default GCN target

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

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

5 years ago[OPENMP]Support for non-rectangular loops.
Alexey Bataev [Wed, 14 Aug 2019 19:30:06 +0000 (19:30 +0000)]
[OPENMP]Support for non-rectangular loops.

Added basic support for non-rectangular loops. It requires an additional
analysis of min/max boundaries for non-rectangular loops. Since only
linear dependency is allowed, we can do this analysis.

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

5 years ago[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock
Kristof Umann [Wed, 14 Aug 2019 17:05:55 +0000 (17:05 +0000)]
[CFG] Introduce CFGElementRef, a wrapper that knows it's position in a CFGBlock

Previously, collecting CFGElements in a set was practially impossible, because
both CFGBlock::operator[] and both the iterators returned it by value. One
workaround would be to collect the iterators instead, but they don't really
capture the concept of an element, and elements from different iterator types are incomparable.

This patch introduces CFGElementRef, a wrapper around a (CFGBlock, Index) pair,
and a variety of new iterators and iterator ranges to solve this problem.

I guess you could say that this patch took a couple iterations to get right :^)

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

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

5 years ago[NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments
Puyan Lotfi [Wed, 14 Aug 2019 17:02:21 +0000 (17:02 +0000)]
[NFC][clang] Moving argument handling: Driver::BuildActions -> handleArguments

This patch simply moves code that already exists into a new function.
Specifically I think it will make the BuildActions code for building a clang
job pipeline easier to read and work with.

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

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

5 years ago[Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey
Erik Pilkington [Wed, 14 Aug 2019 16:57:11 +0000 (16:57 +0000)]
[Sema][ObjC] Fix a -Wformat false positive with localizedStringForKey

Only honour format_arg attributes on -[NSBundle localizedStringForKey] when its
argument has a format specifier in it, otherwise its likely to just be a key to
fetch localized strings.

Fixes rdar://23622446

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

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

5 years ago[NFC] Updated tests after r368875
David Bolvansky [Wed, 14 Aug 2019 16:50:34 +0000 (16:50 +0000)]
[NFC] Updated tests after r368875

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

5 years agoDocument clang-cpp in the release notes for clang
Chris Bieneman [Wed, 14 Aug 2019 16:49:52 +0000 (16:49 +0000)]
Document clang-cpp in the release notes for clang

This patch adds a line in the release notes about the new clang-cpp library and the CMake option to force clang to link against it.

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

5 years ago[LifetimeAnalysis] Fix false negatives of statement local lifetime analysis for some...
Gabor Horvath [Wed, 14 Aug 2019 16:34:56 +0000 (16:34 +0000)]
[LifetimeAnalysis] Fix false negatives of statement local lifetime analysis for some STL implementation

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

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

5 years ago[NFC] Fix testcase for ARMs
David Bolvansky [Wed, 14 Aug 2019 15:35:40 +0000 (15:35 +0000)]
[NFC] Fix testcase for ARMs

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

5 years ago[libTooling] Fix code to avoid unused-function warning after r368681.
Yitzhak Mandelbaum [Wed, 14 Aug 2019 15:20:06 +0000 (15:20 +0000)]
[libTooling] Fix code to avoid unused-function warning after r368681.

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

5 years ago[analyzer][NFC] Prove that we only track the evaluated part of the condition
Kristof Umann [Wed, 14 Aug 2019 13:51:52 +0000 (13:51 +0000)]
[analyzer][NFC] Prove that we only track the evaluated part of the condition

...because we're working with a BugReporterVisitor, and the non-evaluated part
of the condition isn't in the bugpath.

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

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

5 years ago[Tooling] Added DeclStmtClass to ExtractionSemicolonPolicy
Shaurya Gupta [Wed, 14 Aug 2019 13:37:39 +0000 (13:37 +0000)]
[Tooling] Added DeclStmtClass to ExtractionSemicolonPolicy

Since the DeclStmt range includes the semicolon, it doesn't need a
semicolon at the end during extraction

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

5 years ago[analyzer][CFG] Don't track the condition of asserts
Kristof Umann [Wed, 14 Aug 2019 12:20:08 +0000 (12:20 +0000)]
[analyzer][CFG] Don't track the condition of asserts

Well, what is says on the tin I guess!

Some more changes:

* Move isInevitablySinking() from BugReporter.cpp to CFGBlock's interface
* Rename and move findBlockForNode() from BugReporter.cpp to
ExplodedNode::getCFGBlock()

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

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

5 years agoRemoved ToolExecutor::isSingleProcess, it is not used by anything
Dmitri Gribenko [Wed, 14 Aug 2019 11:35:04 +0000 (11:35 +0000)]
Removed ToolExecutor::isSingleProcess, it is not used by anything

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[NFC] Make test more robust
David Bolvansky [Wed, 14 Aug 2019 11:13:10 +0000 (11:13 +0000)]
[NFC] Make test more robust

Currently fails on ARMs

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

5 years agoImproved the doc comment for getCommentsInFile
Dmitri Gribenko [Wed, 14 Aug 2019 11:11:52 +0000 (11:11 +0000)]
Improved the doc comment for getCommentsInFile

Subscribers: cfe-commits

Tags: #clang

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

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

5 years ago[clang] - An update after LLVM change.
George Rimar [Wed, 14 Aug 2019 11:10:01 +0000 (11:10 +0000)]
[clang] - An update after LLVM change.

SectionRef::getName() was changed to return Expected<> (D66089)

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

5 years agoFix _WIN32 / _WIN64 Wundef warnings
Sven van Haastregt [Wed, 14 Aug 2019 10:30:18 +0000 (10:30 +0000)]
Fix _WIN32 / _WIN64 Wundef warnings

For these macros it is the definedness that matters rather than
the value.  Make new uses of these macros consistent with existing
uses.

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

5 years ago[ASTImporter] Import default expression of param before creating the param.
Balazs Keri [Wed, 14 Aug 2019 09:41:39 +0000 (09:41 +0000)]
[ASTImporter] Import default expression of param before creating the param.

Summary:
The default expression of a parameter variable should be imported before
the parameter variable object is created. Otherwise the function is created
with an incomplete parameter variable (default argument is nullptr) and in
this intermediary state the expression is imported. This import can have
a reference to the incomplete parameter variable that causes crash.

Reviewers: martong, a.sidorin, shafik

Reviewed By: martong

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

Tags: #clang

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

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

5 years ago[analyzer] Note last writes to a condition only in a nested stackframe
Kristof Umann [Wed, 14 Aug 2019 09:39:38 +0000 (09:39 +0000)]
[analyzer] Note last writes to a condition only in a nested stackframe

Exactly what it says on the tin! The comments in the code detail this a
little more too.

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

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

5 years ago[Codegen] Updated test for D66158
David Bolvansky [Wed, 14 Aug 2019 08:32:31 +0000 (08:32 +0000)]
[Codegen] Updated test for D66158

Reviewers: jdoerfert

Reviewed By: jdoerfert

Subscribers: cfe-commits

Tags: #clang

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

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

5 years agoFix the -Wunused-variable warning.
Haojian Wu [Wed, 14 Aug 2019 08:20:42 +0000 (08:20 +0000)]
Fix the -Wunused-variable warning.

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

5 years agoRemoved dead code from clang/tools/libclang/CXIndexDataConsumer.{cpp,h}
Dmitri Gribenko [Wed, 14 Aug 2019 07:32:51 +0000 (07:32 +0000)]
Removed dead code from clang/tools/libclang/CXIndexDataConsumer.{cpp,h}

Reviewers: jkorous

Subscribers: dexonsmith, arphaman, cfe-commits

Tags: #clang

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

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

5 years ago[NewPM][PassInstrumentation] IR printing support from clang driver
Taewook Oh [Wed, 14 Aug 2019 07:11:09 +0000 (07:11 +0000)]
[NewPM][PassInstrumentation] IR printing support from clang driver

Summary: https://reviews.llvm.org/D50923 enabled the IR printing support for the new pass manager, but only for the case when `opt` tool is used as a driver. This patch is to enable the IR printing when `clang` is used as a driver.

Reviewers: fedor.sergeev, philip.pfaffe

Subscribers: cfe-commits, yamauchi, llvm-commits

Tags: #clang

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

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

5 years agoRemove unreachable blocks before splitting a coroutine.
John McCall [Wed, 14 Aug 2019 03:54:13 +0000 (03:54 +0000)]
Remove unreachable blocks before splitting a coroutine.

The suspend-crossing algorithm is not correct in the presence of uses
that cannot be reached on some successor path from their defs.

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

5 years agoAdd __has_builtin support for builtin function-like type traits.
Richard Smith [Wed, 14 Aug 2019 02:30:11 +0000 (02:30 +0000)]
Add __has_builtin support for builtin function-like type traits.

Summary:
Previously __has_builtin(__builtin_*) would return false for
__builtin_*s that we modeled as keywords rather than as functions
(because they take type arguments). With this patch, all builtins
that are called with function-call-like syntax return true from
__has_builtin (covering __builtin_* and also the __is_* and __has_* type
traits and the handful of similar builtins without such a prefix).

Update the documentation on __has_builtin and on type traits to match.
While doing this I noticed the type trait documentation was out of date
and incomplete; that's fixed here too.

Reviewers: aaron.ballman

Subscribers: jfb, kristina, cfe-commits

Tags: #clang

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

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

5 years ago[analyzer] Don't delete TaintConfig copy constructor
Alex Langford [Wed, 14 Aug 2019 01:09:07 +0000 (01:09 +0000)]
[analyzer] Don't delete TaintConfig copy constructor

Summary:
Explicitly deleting the copy constructor makes compiling the function
`ento::registerGenericTaintChecker` difficult with some compilers. When we
construct an `llvm::Optional<TaintConfig>`, the optional is constructed with a
const TaintConfig reference which it then uses to invoke the deleted TaintConfig
copy constructor.

I've observered this failing with clang 3.8 on Ubuntu 16.04.

Reviewers: compnerd, Szelethus, boga95, NoQ, alexshap

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

Tags: #clang

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

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

5 years ago[ORC] Fix clang-interpreter example code broken by r368707.
Douglas Yung [Wed, 14 Aug 2019 01:03:35 +0000 (01:03 +0000)]
[ORC] Fix clang-interpreter example code broken by r368707.

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

5 years ago[analyzer][NFC] Prepare visitors for different tracking kinds
Kristof Umann [Wed, 14 Aug 2019 00:48:57 +0000 (00:48 +0000)]
[analyzer][NFC] Prepare visitors for different tracking kinds

When we're tracking a variable that is responsible for a null pointer
dereference or some other sinister programming error, we of course would like to
gather as much information why we think that the variable has that specific
value as possible. However, the newly introduced condition tracking shows that
tracking all values this thoroughly could easily cause an intolerable growth in
the bug report's length.

There are a variety of heuristics we discussed on the mailing list[1] to combat
this, all of them requiring to differentiate in between tracking a "regular
value" and a "condition".

This patch introduces the new `bugreporter::TrackingKind` enum, adds it to
several visitors as a non-optional argument, and moves some functions around to
make the code a little more coherent.

[1] http://lists.llvm.org/pipermail/cfe-dev/2019-June/062613.html

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

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

5 years ago[analyzer] Track the right hand side of the last store regardless of its value
Kristof Umann [Tue, 13 Aug 2019 23:48:10 +0000 (23:48 +0000)]
[analyzer] Track the right hand side of the last store regardless of its value

Summary:
The following code snippet taken from D64271#1572188 has an issue: namely,
because `flag`'s value isn't undef or a concrete int, it isn't being tracked.

int flag;
bool coin();

void foo() {
  flag = coin();
}

void test() {
  int *x = 0;
  int local_flag;
  flag = 1;

  foo();
  local_flag = flag;
  if (local_flag)
    x = new int;

  foo();
  local_flag = flag;
  if (local_flag)
    *x = 5;
}

This, in my opinion, makes no sense, other values may be interesting too.
Originally added by rC185608.

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

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

5 years ago[analyzer] Prune calls to functions with linear CFGs that return a non-zero constrain...
Kristof Umann [Tue, 13 Aug 2019 23:22:33 +0000 (23:22 +0000)]
[analyzer] Prune calls to functions with linear CFGs that return a non-zero constrained value

During the evaluation of D62883, I noticed a bunch of totally
meaningless notes with the pattern of "Calling 'A'" -> "Returning value"
-> "Returning from 'A'", which added no value to the report at all.

This patch (not only affecting tracked conditions mind you) prunes
diagnostic messages to functions that return a value not constrained to
be 0, and are also linear.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement displaying Store pointers.
Artem Dergachev [Tue, 13 Aug 2019 23:04:56 +0000 (23:04 +0000)]
[analyzer] exploded-graph-rewriter: Implement displaying Store pointers.

They're useful when trying to understand what's going on
inside your LazyCompoundValues.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Implement manual graph trimming.
Artem Dergachev [Tue, 13 Aug 2019 23:04:53 +0000 (23:04 +0000)]
[analyzer] exploded-graph-rewriter: Implement manual graph trimming.

When -trim-egraph is unavailable (say, when you're debugging a crash on
a real-world code that takes too long to reduce), it makes sense to view
the untrimmed graph up to the crashing node's predecessor, then dump the ID
(or a pointer) of the node in the attached debugger, and then trim
the dumped graph in order to keep only paths from the root to the node.

The newly added --to flag does exactly that:

$ exploded-graph-rewriter.py ExprEngine.dot --to 0x12229acd0

Multiple nodes can be specified. Stable IDs of nodes can be used
instead of pointers.

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

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

5 years ago[analyzer] exploded-graph-rewriter: NFC: Refactor explorers into trimmers.
Artem Dergachev [Tue, 13 Aug 2019 23:04:50 +0000 (23:04 +0000)]
[analyzer] exploded-graph-rewriter: NFC: Refactor explorers into trimmers.

Explorers aren't the right abstraction. For the purposes of displaying svg files
we don't care in which order do we explore the nodes. We may care about this for
other analyses, but we're not there yet.

The function of cutting out chunks of the graph is performed poorly by
the explorers, because querying predecessors/successors on the explored nodes
yields original successors/predecessors even if they aren't being explored.

Introduce a new entity, "trimmers", that do one thing but to it right: cut out
chunks of the graph. Trimmers mutate the graph, so stale edges aren't even
visible to their consumers in the pipeline. Additionally, trimmers are
intrinsically composable: multiple trimmers can be applied to the graph
sequentially.

Refactor the single-path explorer into the single-path trimmer.
Rename the test file for consistency.

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

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

5 years ago[analyzer] exploded-graph-rewriter: Open the converted graph immediately.
Artem Dergachev [Tue, 13 Aug 2019 23:04:47 +0000 (23:04 +0000)]
[analyzer] exploded-graph-rewriter: Open the converted graph immediately.

Change the default behavior: the tool no longer dumps the rewritten .dot file
to stdout, but instead it automatically converts it into an .html file
(which essentially wraps an .svg file) and immediately opens it with
the default web browser.

This means that the tool should now be fairly easy to use:

  $ exploded-graph-rewriter.py /tmp/ExprEngine.dot

The benefits of wrapping the .svg file into an .html file are:

    - It'll open in a web browser, which is the intended behavior.
      An .svg file would be open with an image viewer/editor instead.
    - It avoids the white background around the otherwise dark svg area
      in dark mode.

The feature can be turned off by passing a flag '--rewrite-only'.
The LIT substitution is updated to enforce the old mode because
we don't want web browsers opening on our buildbots.

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

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

5 years ago[analyzer] Disable the checker-plugins test on Darwin.
Artem Dergachev [Tue, 13 Aug 2019 23:04:44 +0000 (23:04 +0000)]
[analyzer] Disable the checker-plugins test on Darwin.

Fixes a buildbot.

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

5 years ago[clang][DirectoryWatcher] Fix Windows stub after LLVM change
Jan Korous [Tue, 13 Aug 2019 22:39:50 +0000 (22:39 +0000)]
[clang][DirectoryWatcher] Fix Windows stub after LLVM change

r367979 changed DirectoryWatcher::Create to return an llvm::Expected.
Adjust the Windows stub accordingly.

(upstreamed from github.com/apple/swift-clang)

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

5 years ago[clang] DirectoryWatcher for Windows stubs (to fix build break).
Jan Korous [Tue, 13 Aug 2019 22:39:26 +0000 (22:39 +0000)]
[clang] DirectoryWatcher for Windows stubs (to fix build break).

This is just a code skeleton for DirectoryWatcher-windows.cpp so the
build on Windows stops breaking.

(upstreamed from github.com/apple/swift-clang)

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

5 years ago[analyzer][NFC] Make sure that the BugReport is not modified during the construction...
Kristof Umann [Tue, 13 Aug 2019 22:03:08 +0000 (22:03 +0000)]
[analyzer][NFC] Make sure that the BugReport is not modified during the construction of non-visitor pieces

I feel this is kinda important, because in a followup patch I'm adding different
kinds of interestingness, and propagating the correct kind in BugReporter.cpp is
just one less thing to worry about.

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

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

5 years agoAdd a missing header comment, NFC
Erik Pilkington [Tue, 13 Aug 2019 22:01:39 +0000 (22:01 +0000)]
Add a missing header comment, NFC

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

5 years ago[analyzer][NFC] Refactoring BugReporter.cpp P6.: Completely get rid of interestingnes...
Kristof Umann [Tue, 13 Aug 2019 21:48:17 +0000 (21:48 +0000)]
[analyzer][NFC] Refactoring BugReporter.cpp P6.: Completely get rid of interestingness propagation

Apparently this does literally nothing.

When you think about this, it makes sense. If something is really important,
we're tracking it anyways, and that system is sophisticated enough to mark
actually interesting statements as such. I wouldn't say that it's even likely
that subexpressions are also interesting (array[10 - x + x]), so I guess even
if this produced any effects, its probably undesirable.

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

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

5 years ago[WebAssembly] Make clang emit correct va_arg code for structs
Guanzhong Chen [Tue, 13 Aug 2019 21:41:11 +0000 (21:41 +0000)]
[WebAssembly] Make clang emit correct va_arg code for structs

Summary:
In the WebAssembly backend, when lowering variadic function calls, non-single
member aggregate type arguments are always passed by pointer.

However, when emitting va_arg code in clang, the arguments are instead read as
if they are passed directly. This results in the pointer being read as the
actual structure.

Fixes https://github.com/emscripten-core/emscripten/issues/9042.

Reviewers: tlively, sbc100, kripken, aheejin, dschuff

Reviewed By: dschuff

Subscribers: dschuff, jgravelle-google, sunfish, cfe-commits

Tags: #clang

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

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

5 years agoRemove the extra `;`.
Michael Liao [Tue, 13 Aug 2019 21:26:42 +0000 (21:26 +0000)]
Remove the extra `;`.

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

5 years ago[analyzer][NFC] Address inlines of D65484
Kristof Umann [Tue, 13 Aug 2019 20:42:48 +0000 (20:42 +0000)]
[analyzer][NFC] Address inlines of D65484

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

5 years ago[Refactor] Moving SourceExtraction header from lib to include
Shaurya Gupta [Tue, 13 Aug 2019 20:21:00 +0000 (20:21 +0000)]
[Refactor] Moving SourceExtraction header from lib to include

Summary:
- Moved the SourceExtraction header from lib to include so that it can be used in clangd.

Reviewers: arphaman

Subscribers: ilya-biryukov, dexonsmith, kadircet, cfe-commits

Tags: #clang

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

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

5 years agoDon't use std::errc
Alexey Bataev [Tue, 13 Aug 2019 19:32:36 +0000 (19:32 +0000)]
Don't use std::errc

Summary:
As noted on Errc.h:

// * std::errc is just marked with is_error_condition_enum. This means that
//   common patters like AnErrorCode == errc::no_such_file_or_directory take
//   4 virtual calls instead of two comparisons.

And on some libstdc++ those virtual functions conclude that

------------------------
int main() {
  std::error_code foo = std::make_error_code(std::errc::no_such_file_or_directory);
  return foo == std::errc::no_such_file_or_directory;
}
-------------------------

should exit with 0.

Reviewers: thakis, rnk, jfb

Reviewed By: thakis

Subscribers: lebedev.ri, dexonsmith, xbolva00, cfe-commits, caomhin

Tags: #clang

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

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