]> granicus.if.org Git - clang/log
clang
6 years agocl-options.c: Fix negative -cfguard check
Hans Wennborg [Tue, 18 Sep 2018 13:07:55 +0000 (13:07 +0000)]
cl-options.c: Fix negative -cfguard check

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

6 years ago[Index] Add an option to collect macros from preprocesor.
Eric Liu [Tue, 18 Sep 2018 08:51:08 +0000 (08:51 +0000)]
[Index] Add an option to collect macros from preprocesor.

Summary: Also added unit tests for the index library; lit+c-index-test is painful...

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: mgorny, cfe-commits

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

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

6 years ago[CodeComplete] Add completions for filenames in #include directives.
Sam McCall [Tue, 18 Sep 2018 08:40:41 +0000 (08:40 +0000)]
[CodeComplete] Add completions for filenames in #include directives.

Summary:
The dir component ("somedir" in #include <somedir/fo...>) is considered fixed.
We append "foo" to each directory on the include path, and then list its files.

Completions are of the forms:
 #include <somedir/fo^
                   foo.h>
                   fox/

The filter is set to the filename part ("fo"), so fuzzy matching can be
applied to the filename only.

No fancy scoring/priorities are set, and no information is added to
CodeCompleteResult to make smart scoring possible. Could be in future.

Reviewers: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years agoThread safety analysis: Run more tests with capability attributes [NFC]
Aaron Puchert [Mon, 17 Sep 2018 21:37:22 +0000 (21:37 +0000)]
Thread safety analysis: Run more tests with capability attributes [NFC]

Summary:
We run the tests for -Wthread-safety-{negative,verbose} with the new
attributes as well as the old ones. Also put the macros in a header so
that we don't have to copy them all around.

The warn-thread-safety-parsing.cpp test checks for warnings depending on
the actual attribute name, so it can't undergo the same treatment.

Together with D49275 this should fix PR33754.

Reviewers: aaron.ballman, delesley, grooverdan

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[analyzer] ExplodedGraph printing fixes
George Karpenkov [Mon, 17 Sep 2018 20:46:53 +0000 (20:46 +0000)]
[analyzer] ExplodedGraph printing fixes

Fixes a number of issues:

 - Global variables are not used for communication
 - Trait should be defined on a graph, not on a node
 - Defining the trait on a graph allows us to use a correct allocator,
   no longer crashing while printing trimmed graphs

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

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

6 years ago[analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.
Shuai Wang [Mon, 17 Sep 2018 20:10:56 +0000 (20:10 +0000)]
[analyzer] Treat std::{move,forward} as casts in ExprMutationAnalyzer.

Summary:
This is a follow up of D52008 and should make the analyzer being able to handle perfect forwardings in real world cases where forwardings are done through multiple layers of function calls with `std::forward`.

Fixes PR38891.

Reviewers: lebedev.ri, JonasToth, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits

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

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

6 years ago[ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr
Shuai Wang [Mon, 17 Sep 2018 18:48:43 +0000 (18:48 +0000)]
[ASTMatchers] Let isArrow also support UnresolvedMemberExpr, CXXDependentScopeMemberExpr

Reviewers: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[ASTImporter] Fix import of VarDecl init
Gabor Marton [Mon, 17 Sep 2018 12:04:52 +0000 (12:04 +0000)]
[ASTImporter] Fix import of VarDecl init

Summary:
The init expression of a VarDecl is overwritten in the "To" context if we
import a VarDecl without an init expression (and with a definition).  Please
refer to the added tests, especially InitAndDefinitionAreInDifferentTUs.  This
patch fixes the malfunction by importing the whole Decl chain similarly as we
did that in case of FunctionDecls.  We handle the init expression similarly to
a  definition, alas only one init expression will be in the merged ast.

Reviewers: a_sidorin, xazax.hun, r.stahl, a.sidorin

Subscribers: rnkovacs, dkrupp, cfe-commits

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

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

6 years ago[OpenCL] Allow blocks to capture arrays in OpenCL
Andrew Savonichev [Mon, 17 Sep 2018 11:19:42 +0000 (11:19 +0000)]
[OpenCL] Allow blocks to capture arrays in OpenCL

Summary: Patch by Egor Churaev

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: asavonic, bader, cfe-commits

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

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

6 years agoMerge two attribute diagnostics into one
Andrew Savonichev [Mon, 17 Sep 2018 10:39:46 +0000 (10:39 +0000)]
Merge two attribute diagnostics into one

Summary:
Merged the recently added `err_attribute_argument_negative` diagnostic
with existing `err_attribute_requires_positive_integer` diagnostic:
the former allows only strictly positive integer, while the latter
also allows zero.

Reviewers: aaron.ballman

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[Analyzer] Define and use diff_plist in tests, NFC
Mikhail Maltsev [Mon, 17 Sep 2018 10:19:46 +0000 (10:19 +0000)]
[Analyzer] Define and use diff_plist in tests, NFC

This patch defines a new substitution and uses it to reduce
duplication in the Clang Analyzer test cases.

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

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

6 years ago[clang-Format] Fix indentation of member call after block
Ilya Biryukov [Mon, 17 Sep 2018 07:46:20 +0000 (07:46 +0000)]
[clang-Format] Fix indentation of member call after block

Summary:
before patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  })
      .as();
});
```

after patch:
> echo "test() {([]() -> {int b = 32;return 3;}).as("");});" | clang-format -style=Google

```
test() {
  ([]() -> {
    int b = 32;
    return 3;
  }).as();
});
```

Patch by Anders Karlsson (ank)!

Reviewers: klimek

Reviewed By: klimek

Subscribers: danilaml, acoomans, klimek, cfe-commits

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

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

6 years agoscan-build: Add support of the option --exclude like in scan-build-py
Sylvestre Ledru [Mon, 17 Sep 2018 06:31:46 +0000 (06:31 +0000)]
scan-build: Add support of the option --exclude like in scan-build-py

Summary:
To exclude thirdparty code.

To test:
With /tmp/foo.c

```
void test() {
    int x;
    x = 1; // warn
}
```

```
$ scan-build --exclude non-existing/  --exclude /tmp/ -v gcc -c foo.c

scan-build: Using '/usr/lib/llvm-7/bin/clang' for static analysis
scan-build: Emitting reports for this run to '/tmp/scan-build-2018-09-16-214531-8410-1'.
foo.c:3:3: warning: Value stored to 'x' is never read
  x = 1; // warn
  ^   ~
1 warning generated.
scan-build: File '/tmp/foo.c' deleted: part of an ignored directory.
scan-build: 0 bugs found.
```

Reviewers: jroelofs

Reviewed By: jroelofs

Subscribers: whisperity, cfe-commits

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

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

6 years ago[Lexer] Add xray_instrument feature
Petr Hosek [Mon, 17 Sep 2018 05:25:47 +0000 (05:25 +0000)]
[Lexer] Add xray_instrument feature

This can be used to detect whether the code is being built with XRay
instrumentation using the __has_feature(xray_instrument) predicate.

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

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

6 years ago[NFC] Minor refactoring to setup the stage for supporting pointers in ExprMutationAna...
Shuai Wang [Sun, 16 Sep 2018 21:09:50 +0000 (21:09 +0000)]
[NFC] Minor refactoring to setup the stage for supporting pointers in ExprMutationAnalyzer

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

6 years agoscan-build: remove trailing whitespaces
Sylvestre Ledru [Sun, 16 Sep 2018 19:51:16 +0000 (19:51 +0000)]
scan-build: remove trailing whitespaces

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

6 years agoAlso manages clang-X as tool for scan-build
Sylvestre Ledru [Sun, 16 Sep 2018 19:36:59 +0000 (19:36 +0000)]
Also manages clang-X as tool for scan-build

Summary:
This will make
scan-build-7 clang-7 -c foo.c &> /dev/null

Reviewers: jroelofs

Subscribers: kristina, cfe-commits

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

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

6 years ago[NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistent
Shuai Wang [Sat, 15 Sep 2018 21:38:18 +0000 (21:38 +0000)]
[NFC] cosmetic tweaks to ExprMutationAnalyzer to be more consistent
especially considering future changes.

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

6 years ago[OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)
Kelvin Li [Sat, 15 Sep 2018 13:54:15 +0000 (13:54 +0000)]
[OPENMP] Move OMPClauseReader/Writer classes to ASTReader/Writer (NFC)

Move declarations for OMPClauseReader, OMPClauseWriter to ASTReader.h
and ASTWriter.h and move implementation to ASTReader.cpp and
ASTWriter.cpp. This change helps generalize the serialization of
OpenMP clauses and will be used in the future implementation of new
OpenMP directives (e.g. requires).

Patch by Patrick Lyster

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

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

6 years ago[analyzer] Temporary disabling svalbuilder-rearrange-comparisons test
George Karpenkov [Sat, 15 Sep 2018 02:35:06 +0000 (02:35 +0000)]
[analyzer] Temporary disabling svalbuilder-rearrange-comparisons test

As debug printing has changed, and format was not guaranteed to be
stable.
Artem is currently working on a better solution.

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

6 years ago[analyzer] Further printing improvements: use declarations,
George Karpenkov [Sat, 15 Sep 2018 02:34:45 +0000 (02:34 +0000)]
[analyzer] Further printing improvements: use declarations,

skip pointers whenever redundant, use unique prefixes.

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

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

6 years agoGenerate unique identifiers for Decl objects
George Karpenkov [Sat, 15 Sep 2018 02:03:58 +0000 (02:03 +0000)]
Generate unique identifiers for Decl objects

The generated identifier is stable across multiple runs,
and can be a great visualization or debugging aide.

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

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

6 years ago[analyzer] Generate and use stable identifiers for LocationContext
George Karpenkov [Sat, 15 Sep 2018 02:03:36 +0000 (02:03 +0000)]
[analyzer] Generate and use stable identifiers for LocationContext

Those are not created in the allocator.
Since they are created fairly rarely, a counter overhead should not
affect the memory consumption.

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

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

6 years ago[analyzer] Dump reproducible identifiers for statements in exploded graph in store
George Karpenkov [Sat, 15 Sep 2018 02:03:17 +0000 (02:03 +0000)]
[analyzer] Dump reproducible identifiers for statements in exploded graph in store

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

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

6 years ago[analyzer] Use correct end-of-line character when printing statements for exploded...
George Karpenkov [Sat, 15 Sep 2018 02:02:56 +0000 (02:02 +0000)]
[analyzer] Use correct end-of-line character when printing statements for exploded graph

Prevents bad centering.

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

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

6 years agoStmtPrinter: allow customizing the end-of-line character
George Karpenkov [Sat, 15 Sep 2018 02:02:31 +0000 (02:02 +0000)]
StmtPrinter: allow customizing the end-of-line character

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

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

6 years ago[analyzer] Dump unique identifiers for statements in exploded graph
George Karpenkov [Sat, 15 Sep 2018 02:02:09 +0000 (02:02 +0000)]
[analyzer] Dump unique identifiers for statements in exploded graph

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

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

6 years agoSupport generating unique identifiers for Stmt objects
George Karpenkov [Sat, 15 Sep 2018 02:01:47 +0000 (02:01 +0000)]
Support generating unique identifiers for Stmt objects

The generated identifiers are stable across multiple runs, and can be a
great debug or visualization aid.

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

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

6 years ago[analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors...
George Karpenkov [Sat, 15 Sep 2018 02:01:26 +0000 (02:01 +0000)]
[analyzer] Skip printing duplicate nodes, even if nodes have multiple predecessors/successors

Still generate a node, but leave the redundant field empty.

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

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

6 years ago[modules] Don't bother creating a global module fragment when building a
Richard Smith [Sat, 15 Sep 2018 01:59:39 +0000 (01:59 +0000)]
[modules] Don't bother creating a global module fragment when building a
header module.

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

6 years ago[modules] Support use of -E on modules built from the command line.
Richard Smith [Sat, 15 Sep 2018 01:21:18 +0000 (01:21 +0000)]
[modules] Support use of -E on modules built from the command line.

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

6 years ago[modules] Driver support for precompiling a collection of files as a single
Richard Smith [Sat, 15 Sep 2018 01:21:16 +0000 (01:21 +0000)]
[modules] Driver support for precompiling a collection of files as a single
action.

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

6 years ago[modules] Frontend support for building a header module from a list of
Richard Smith [Sat, 15 Sep 2018 01:21:15 +0000 (01:21 +0000)]
[modules] Frontend support for building a header module from a list of
headaer files.

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

6 years agotest/Driver/output-file-cleanup.c: delete non-readable temporary file
Fangrui Song [Fri, 14 Sep 2018 21:36:35 +0000 (21:36 +0000)]
test/Driver/output-file-cleanup.c: delete non-readable temporary file

%t-dir/2.c made tools (rsync, ripgrep, ...) sad (EACCES warning).

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

6 years agoRelax assumption about default method calling convention in new test
Reid Kleckner [Fri, 14 Sep 2018 20:50:39 +0000 (20:50 +0000)]
Relax assumption about default method calling convention in new test

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

6 years ago[analyzer] Handle forwarding reference better in ExprMutationAnalyzer.
Shuai Wang [Fri, 14 Sep 2018 20:07:18 +0000 (20:07 +0000)]
[analyzer] Handle forwarding reference better in ExprMutationAnalyzer.

Summary:
We used to treat an `Expr` mutated whenever it's passed as non-const
reference argument to a function. This results in false positives in
cases like this:
```
int x;
std::vector<int> v;
v.emplace_back(x); // `x` is passed as non-const reference to `emplace_back`
```
In theory the false positives can be suppressed with
`v.emplace_back(std::as_const(x))` but that's considered overly verbose,
inconsistent with existing code and spammy as diags.

This diff handles such cases by following into the function definition
and see whether the argument is mutated inside.

Reviewers: lebedev.ri, JonasToth, george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits

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

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

6 years agoRemove PseudoConstantAnalysis
Shuai Wang [Fri, 14 Sep 2018 17:27:27 +0000 (17:27 +0000)]
Remove PseudoConstantAnalysis

Summary: It's not used anywhere for years. The last usage is removed in https://reviews.llvm.org/rL198476 in 2014.

Subscribers: mgorny, cfe-commits

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

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

6 years ago[clang-cl] Fix PR38934: failing to dllexport class template member w/ explicit instan...
Hans Wennborg [Fri, 14 Sep 2018 15:18:30 +0000 (15:18 +0000)]
[clang-cl] Fix PR38934: failing to dllexport class template member w/ explicit instantiation and PCH

The code in ASTContext::DeclMustBeEmitted was supposed to handle this,
but didn't take into account that synthesized members such as operator=
might not get marked as template specializations, because they're
synthesized on the instantiation directly when handling the class-level
dllexport attribute.

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

6 years ago[clang] Make sure attributes on member classes are applied properly
Louis Dionne [Fri, 14 Sep 2018 14:07:16 +0000 (14:07 +0000)]
[clang] Make sure attributes on member classes are applied properly

Summary:
Attributes on member classes of class templates and member class templates
of class templates are not currently instantiated. This was discovered by
Richard Smith here:

  http://lists.llvm.org/pipermail/cfe-dev/2018-September/059291.html

This commit makes sure that attributes are instantiated properly. This
commit does not fix the broken behavior for member partial and explicit
specializations of class templates.

PR38913

Reviewers: rsmith

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[VFS] vfs::directory_iterator yields path and file type instead of full Status
Sam McCall [Fri, 14 Sep 2018 12:47:38 +0000 (12:47 +0000)]
[VFS] vfs::directory_iterator yields path and file type instead of full Status

Summary:
Most callers I can find are using only `getName()`. Type is used by the
recursive iterator.

Now we don't have to call stat() on every listed file (on most platforms).
Exceptions are e.g. Solaris where readdir() doesn't include type information.
On those platforms we'll still stat() - see D51918.

The result is significantly faster (stat() can be slow).
My motivation: this may allow us to improve clang IO on large TUs with long
include search paths. Caching readdir() results may allow us to skip many stat()
and open() operations on nonexistent files.

Reviewers: bkramer

Subscribers: fedor.sergeev, cfe-commits

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

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

6 years ago[Driver] Fix missing MultiArch include dir on powerpcspe
Kristina Brooks [Fri, 14 Sep 2018 12:42:13 +0000 (12:42 +0000)]
[Driver] Fix missing MultiArch include dir on powerpcspe

On powerpc-linux-gnuspe, the header files are located in their
own include directory named /usr/lib/powerpc-linux-gnuspe,
so add this directory to PPCMultiarchIncludeDirs.

Patch by glaubitz (John Paul Adrian Glaubitz)

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

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

6 years ago[Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files
Sam McCall [Fri, 14 Sep 2018 12:24:09 +0000 (12:24 +0000)]
[Tooling] JSONCompilationDatabasePlugin infers compile commands for missing files

Summary:
See the existing InterpolatingCompilationDatabase for details on how this works.
We've been using this in clangd for a while, the heuristics seem to work well.

Reviewers: bkramer

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

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

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

6 years ago[analyzer] Restore final on NeedsCastLocField. NFC
Ilya Biryukov [Fri, 14 Sep 2018 11:28:48 +0000 (11:28 +0000)]
[analyzer] Restore final on NeedsCastLocField. NFC

To fix compiler warning about non-virtual dtor introduced in r342221.

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

6 years ago[analyzer] Attempt to make a windows buildbot happy.
Kristof Umann [Fri, 14 Sep 2018 11:20:16 +0000 (11:20 +0000)]
[analyzer] Attempt to make a windows buildbot happy.

Got an error that a cast is happening from a pointer type to long, which is
smaller.

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

6 years ago[analyzer][UninitializedObjectChecker] Support for nonloc::LocAsInteger
Kristof Umann [Fri, 14 Sep 2018 10:18:26 +0000 (10:18 +0000)]
[analyzer][UninitializedObjectChecker] Support for nonloc::LocAsInteger

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

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

6 years ago[analyzer][UninitializedObjectChecker] New flag to ignore records based on it's fields
Kristof Umann [Fri, 14 Sep 2018 10:10:09 +0000 (10:10 +0000)]
[analyzer][UninitializedObjectChecker] New flag to ignore records based on it's fields

Based on a suggestion from @george.karpenkov.

In some cases, structs are used as unions with a help of a tag/kind field.
This patch adds a new string flag (a pattern), that is matched against the
fields of a record, and should a match be found, the entire record is ignored.

For more info refer to http://lists.llvm.org/pipermail/cfe-dev/2018-August/058906.html
and to the responses to that, especially http://lists.llvm.org/pipermail/cfe-dev/2018-August/059215.html.

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

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

6 years ago[analyzer][UninitializedObjectChecker] Refactored checker options
Kristof Umann [Fri, 14 Sep 2018 09:39:26 +0000 (09:39 +0000)]
[analyzer][UninitializedObjectChecker] Refactored checker options

Since I plan to add a number of new flags, it made sense to encapsulate
them in a new struct, in order not to pollute FindUninitializedFields's
constructor with new boolean options with super long names.

This revision practically reverts D50508, since FindUninitializedFields
now accesses the pedantic flag anyways.

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

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

6 years ago[analyzer][UninitializedObjectChecker] Correct dynamic type is acquired for record...
Kristof Umann [Fri, 14 Sep 2018 09:13:36 +0000 (09:13 +0000)]
[analyzer][UninitializedObjectChecker] Correct dynamic type is acquired for record pointees

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

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

6 years agoUse Chrome and Firefox as example of success for clang
Sylvestre Ledru [Fri, 14 Sep 2018 09:08:21 +0000 (09:08 +0000)]
Use Chrome and Firefox as example of success for clang

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

6 years ago[analyzer][UninitializedObjectChecker] Updated comments
Kristof Umann [Fri, 14 Sep 2018 09:07:40 +0000 (09:07 +0000)]
[analyzer][UninitializedObjectChecker] Updated comments

Some of the comments are incorrect, imprecise, or simply nonexistent.
Since I have a better grasp on how the analyzer works, it makes sense
to update most of them in a single swoop.

I tried not to flood the code with comments too much, this amount
feels just right to me.

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

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

6 years agoremove 11 years old videos from the homepage. if you have a suggestion, please drop...
Sylvestre Ledru [Fri, 14 Sep 2018 09:00:48 +0000 (09:00 +0000)]
remove 11 years old videos from the homepage. if you have a suggestion, please drop me an email

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

6 years ago[analyzer][UninitializedObjectChecker] Fixed dereferencing
Kristof Umann [Fri, 14 Sep 2018 08:58:21 +0000 (08:58 +0000)]
[analyzer][UninitializedObjectChecker] Fixed dereferencing

iThis patch aims to fix derefencing, which has been debated for months now.

Instead of working with SVals, the function now relies on TypedValueRegion.

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

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

6 years agoupdate the doc to compare with gcc 4.9 instead of 4.2
Sylvestre Ledru [Fri, 14 Sep 2018 08:55:09 +0000 (08:55 +0000)]
update the doc to compare with gcc 4.9 instead of 4.2

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

6 years agogcc is now returning the same output on this example, removing this example
Sylvestre Ledru [Fri, 14 Sep 2018 08:52:18 +0000 (08:52 +0000)]
gcc is now returning the same output on this example, removing this example

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

6 years ago[XRay][clang] Emit "never-instrument" attribute
Dean Michael Berris [Fri, 14 Sep 2018 01:59:12 +0000 (01:59 +0000)]
[XRay][clang] Emit "never-instrument" attribute

Summary:
Before this change, we only emit the XRay attributes in LLVM IR when the
-fxray-instrument flag is provided. This may cause issues with thinlto
when the final binary is being built/linked with -fxray-instrument, and
the constitutent LLVM IR gets re-lowered with xray instrumentation.

With this change, we can honour the "never-instrument "attributes
provided in the source code and preserve those in the IR. This way, even
in thinlto builds, we retain the attributes which say whether functions
should never be XRay instrumented.

This change addresses llvm.org/PR38922.

Reviewers: mboerger, eizan

Subscribers: mehdi_amini, dexonsmith, cfe-commits, llvm-commits

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

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

6 years ago[ODRHash] Fix early exit that skipped code.
Richard Trieu [Fri, 14 Sep 2018 01:15:28 +0000 (01:15 +0000)]
[ODRHash] Fix early exit that skipped code.

There is a bit of code at the end of AddDeclaration that should be run on
every exit of the function.  However, there was an early exit beforehand
that could be triggered, which causes a small amount of data to skip the
hashing, leading to false positive mismatch.  Use a separate function so
that this code is always run.

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

6 years agoRelax alignment assumptions in a test after r342194
Vedant Kumar [Fri, 14 Sep 2018 00:16:37 +0000 (00:16 +0000)]
Relax alignment assumptions in a test after r342194

Don't hardcode align 8.

Fixes a bot failure:
http://lab.llvm.org:8011/builders/clang-cmake-armv8-full/builds/6373

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

6 years ago[Sema] Remove location from implicit capture init expr
Vedant Kumar [Thu, 13 Sep 2018 23:28:25 +0000 (23:28 +0000)]
[Sema] Remove location from implicit capture init expr

A lambda's closure is initialized when the lambda is declared. For
implicit captures, the initialization code emitted from EmitLambdaExpr
references source locations *within the lambda body* in the function
containing the lambda. This results in a poor debugging experience: we
step to the line containing the lambda, then into lambda, out again,
over and over, until every capture's field is initialized.

To improve stepping behavior, assign the starting location of the lambda
to expressions which initialize an implicit capture within it.

rdar://39807527

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

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

6 years agoFix crash on call to __builtin_memcpy with a null pointer to an
Richard Smith [Thu, 13 Sep 2018 22:47:33 +0000 (22:47 +0000)]
Fix crash on call to __builtin_memcpy with a null pointer to an
incomplete type.

Also improve the diagnostics for similar situations.

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

6 years agoDiagnose likely typos in #include directives.
Richard Smith [Thu, 13 Sep 2018 21:10:08 +0000 (21:10 +0000)]
Diagnose likely typos in #include directives.

Summary:
When someone writes

  #include "<some_file>"

or

  #include " some_file "

the compiler returns "file not fuond..." with fonts and quotes that may
make it hard to see there are excess quotes or surprising bytes in the
filename.  Assuming that files are usually logically named and start and
end with an alphanumeric character, we can check for the file's
existence by stripping the non-alphanumeric leading or trailing
characters.  If the file is found, emit a non-fatal error with a
FixItHint.

Patch by Christy Lee!

Reviewers: aaron.ballman, erikjv, rsmith

Reviewed By: rsmith

Subscribers: lebedev.ri, xbolva00, sammccall, modocache, erikjv, aaron.ballman, cfe-commits

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

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

6 years agoSupport -fno-omit-frame-pointer with -pg.
Stephen Hines [Thu, 13 Sep 2018 19:50:02 +0000 (19:50 +0000)]
Support -fno-omit-frame-pointer with -pg.

Summary:
Previously, any instance of -fomit-frame-pointer would make it such that
-pg was an invalid flag combination. If -fno-omit-frame-pointer is
passed later on the command line (such that it actually takes effect),
-pg should be allowed.

Reviewers: nickdesaulniers

Reviewed By: nickdesaulniers

Subscribers: manojgupta, nickdesaulniers, cfe-commits, kongyi, chh, pirama

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

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

6 years ago[NFC]Refactor MultiVersion Resolver Emission to combine types
Erich Keane [Thu, 13 Sep 2018 16:58:24 +0000 (16:58 +0000)]
[NFC]Refactor MultiVersion Resolver Emission to combine types

Previously, both types (plus the future target-clones) of
multiversioning had a separate ResolverOption structure and emission
function.  This patch combines the two, at the expense of a slightly
more expensive sorting function.

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

6 years ago[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
Alexey Bataev [Thu, 13 Sep 2018 16:54:05 +0000 (16:54 +0000)]
[OPENMP] Fix PR38903: Crash on instantiation of the non-dependent
declare reduction.

If the declare reduction construct with the non-dependent type is
defined in the template construct, the compiler might crash on the
template instantition. Reworked the whole instantiation scheme for the
declare reduction constructs to fix this problem correctly.

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

6 years agoPrint correctly dependency paths on Windows
David Bolvansky [Thu, 13 Sep 2018 14:27:32 +0000 (14:27 +0000)]
Print correctly dependency paths on Windows

Summary:
Before:
main.o: main.c ../include/lib\test.h

After:
main.o: main.c ../include/lib/test.h

Fixes PR38877

Reviewers: zturner

Subscribers: xbolva00, cfe-commits

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

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

6 years ago[AArch64] Enable return address signing for static ctors
Oliver Stannard [Thu, 13 Sep 2018 10:25:36 +0000 (10:25 +0000)]
[AArch64] Enable return address signing for static ctors

Functions generated by clang and included in the .init_array section (such as
static constructors) do not follow the usual code path for adding
target-specific function attributes, so we have to add the return address
signing attribute here too, as is currently done for the sanitisers.

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

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

6 years agoFix MSVC "illegal conversion; more than one user-defined conversion has been implicit...
Simon Pilgrim [Thu, 13 Sep 2018 10:10:18 +0000 (10:10 +0000)]
Fix MSVC "illegal conversion; more than one user-defined conversion has been implicitly applied" warning. NFCI.

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

6 years ago[clang-format] Wrapped block after case label should not be merged into one line
Owen Pan [Thu, 13 Sep 2018 07:27:15 +0000 (07:27 +0000)]
[clang-format] Wrapped block after case label should not be merged into one line

PR38854

Differential Revision: http://reviews.llvm.org/D51719

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

6 years ago[AArch64] Support reserving x1-7 registers.
Tri Vo [Wed, 12 Sep 2018 23:45:04 +0000 (23:45 +0000)]
[AArch64] Support reserving x1-7 registers.

Summary: Reserving registers x1-7 is used to support CONFIG_ARM64_LSE_ATOMICS in Linux kernel. This change adds support for reserving registers x1 through x7.

Reviewers: javed.absar, efriedma, nickdesaulniers, srhines, phosek

Reviewed By: nickdesaulniers

Subscribers: manojgupta, jfb, cfe-commits, kristof.beyls

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

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

6 years agoRemove dead code made unnecessary by r342018.
Richard Smith [Wed, 12 Sep 2018 23:37:58 +0000 (23:37 +0000)]
Remove dead code made unnecessary by r342018.

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

6 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 23:37:00 +0000 (23:37 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

This reinstates r342019, reverted in r342020. The regression previously
observed after this commit was fixed in r342096.

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

6 years agoWhen we leave a module header, make that header visible in its
Richard Smith [Wed, 12 Sep 2018 23:09:23 +0000 (23:09 +0000)]
When we leave a module header, make that header visible in its
includer's context, even if its overall module is unavailable.

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

6 years ago[Hexagon] Remove fp-contract=fast setting for at O3
Brendon Cahoon [Wed, 12 Sep 2018 20:35:56 +0000 (20:35 +0000)]
[Hexagon] Remove fp-contract=fast setting for at O3

Change Hexagon so that the setting for fp-contract is the default setting.
This makes Hexagon consistent with all other targets.

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

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

6 years ago[Diagnostic] Fix a warning typo. NFC.
Matt Davis [Wed, 12 Sep 2018 18:27:21 +0000 (18:27 +0000)]
[Diagnostic] Fix a warning typo. NFC.

s/aligment/alignment/

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

6 years ago[OPENMP] Fix PR38902: support ADL for declare reduction constructs.
Alexey Bataev [Wed, 12 Sep 2018 16:31:59 +0000 (16:31 +0000)]
[OPENMP] Fix PR38902: support ADL for declare reduction constructs.

Added support for argument-dependent lookup when trying to find the
required declare reduction decl.

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

6 years ago[RISCV] Explicitly set an empty --sysroot in the test
Roger Ferrer Ibanez [Wed, 12 Sep 2018 15:55:14 +0000 (15:55 +0000)]
[RISCV] Explicitly set an empty --sysroot in the test

In rL341655 we added additional behaviour to the Driver for riscv32-unknown-elf
when the sysroot is empty.

The new tests that check the new behaviour expect that the absence of --sysroot
in the command-line implies that the sysroot empty. This doesn't hold if clang
is built with a non-empty DEFAULT_SYSROOT in cmake. When this is the case, this
test fails.

Since the new behaviour is triggered when the sysroot is empty, pass an empty
--sysroot to avoid using the default (if any).

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

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

6 years ago[CodeGen] Align rtti and vtable data
David Green [Wed, 12 Sep 2018 14:09:06 +0000 (14:09 +0000)]
[CodeGen] Align rtti and vtable data

Previously the alignment on the newly created rtti/typeinfo data was largely
not set, meaning that DataLayout::getPreferredAlignment was free to overalign
it to 16 bytes. This causes unnecessary code bloat.

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

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

6 years ago[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed
Mikhail Maltsev [Wed, 12 Sep 2018 09:19:19 +0000 (09:19 +0000)]
[CodeGen][ARM] Coerce FP16 vectors to integer vectors when needed

Summary:
On targets that do not support FP16 natively LLVM currently legalizes
vectors of FP16 values by scalarizing them and promoting to FP32. This
causes problems for the following code:

  void foo(int, ...);

  typedef __attribute__((neon_vector_type(4))) __fp16 float16x4_t;
  void bar(float16x4_t x) {
    foo(42, x);
  }

According to the AAPCS (appendix A.2) float16x4_t is a containerized
vector fundamental type, so 'foo' expects that the 4 16-bit FP values
are packed into 2 32-bit registers, but instead bar promotes them to
4 single precision values.

Since we already handle scalar FP16 values in the frontend by
bitcasting them to/from integers, this patch adds similar handling for
vector types and homogeneous FP16 vector aggregates.

One existing test required some adjustments because we now generate
more bitcasts (so the patch changes the test to target a machine with
native FP16 support).

Reviewers: eli.friedman, olista01, SjoerdMeijer, javed.absar, efriedma

Reviewed By: javed.absar, efriedma

Subscribers: efriedma, kristof.beyls, cfe-commits, chrib

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

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

6 years agoFix Check test to avoid output string mismatch
Christian Bruel [Wed, 12 Sep 2018 08:59:17 +0000 (08:59 +0000)]
Fix Check test to avoid output string mismatch

Differential Revision: http://reviews.llvm.org/D51354

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

6 years ago[Tooling] Wait for all threads to finish before resetting CWD.
Eric Liu [Wed, 12 Sep 2018 08:29:47 +0000 (08:29 +0000)]
[Tooling] Wait for all threads to finish before resetting CWD.

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

6 years ago[Driver] Search LibraryPaths when handling -print-file-name
Petr Hosek [Wed, 12 Sep 2018 03:26:10 +0000 (03:26 +0000)]
[Driver] Search LibraryPaths when handling -print-file-name

This is necessary to handle the multiarch runtime directories.

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

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

6 years agoRevert r342019, "Track definition merging on the canonical declaration
Richard Smith [Wed, 12 Sep 2018 02:28:14 +0000 (02:28 +0000)]
Revert r342019, "Track definition merging on the canonical declaration
even when [...]"

Further testing has revealed that this causes build breaks during
explicit module compilations.

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

6 years agoTrack definition merging on the canonical declaration even when local
Richard Smith [Wed, 12 Sep 2018 02:13:48 +0000 (02:13 +0000)]
Track definition merging on the canonical declaration even when local
submodule visibility is disabled.

Attempting to pick a specific declaration to make visible when the
module containing the merged declaration becomes visible is error-prone,
as we don't yet know which declaration we'll choose to be the definition
when we are informed of the merging.

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

6 years agoConsistently create a new declaration when merging a pre-existing but
Richard Smith [Wed, 12 Sep 2018 02:13:47 +0000 (02:13 +0000)]
Consistently create a new declaration when merging a pre-existing but
hidden definition with a would-be-parsed redefinition.

This permits a bunch of cleanups. In particular, we no longer need to
take merged definitions into account when checking declaration
visibility, only when checking definition visibility, which makes
certain visibility checks take linear instead of quadratic time.

We could also now remove the UPD_DECL_EXPORTED update record and track
on each declaration whether it was demoted from a definition (as we
already do for variables), but I'm not doing that in this patch to keep
the changes here simpler.

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

6 years agoFix tracking of merged definitions when the merge target is also merged
Richard Smith [Wed, 12 Sep 2018 02:13:46 +0000 (02:13 +0000)]
Fix tracking of merged definitions when the merge target is also merged
into something else.

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

6 years ago[NFC] Fix build breakage caused by D51948
Shuai Wang [Tue, 11 Sep 2018 22:41:14 +0000 (22:41 +0000)]
[NFC] Fix build breakage caused by D51948

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

6 years ago[analyzer] Add ExprMutationAnalyzer
Shuai Wang [Tue, 11 Sep 2018 21:13:20 +0000 (21:13 +0000)]
[analyzer] Add ExprMutationAnalyzer

Summary:
This is 1/2 of moving ExprMutationAnalyzer from clangtidy to
clang/Analysis.
This diff along simply copies the ExprMutationAnalyzer over with trivial
modifications (e.g. include path, namespace)
2/2 will migrate existing usage of ExprMutationAnalyzer and remove the
original copy inside clangtidy.

Reviewers: george.karpenkov

Subscribers: mgorny, xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, cfe-commits, JonasToth

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

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

6 years agoIntroduce the VTable interleaving scheme to the CFI design documentation
Peter Collingbourne [Tue, 11 Sep 2018 20:43:52 +0000 (20:43 +0000)]
Introduce the VTable interleaving scheme to the CFI design documentation

Dimitar et. al. in [1] proposed a novel VTable layout scheme that enables efficient implementation of virtual call CFI.

This patch adds an introduction of this scheme to the CFI design documentation.

[1] Protecting C++ Dynamic Dispatch Through VTable Interleaving. Dimitar Bounov, Rami Gökhan Kıcı, Sorin Lerner. https://cseweb.ucsd.edu/~lerner/papers/ivtbl-ndss16.pdf

Patch by Zhaomo Yang!

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

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

6 years ago[gcov] Update a clang test for r341977
Vedant Kumar [Tue, 11 Sep 2018 19:42:58 +0000 (19:42 +0000)]
[gcov] Update a clang test for r341977

Update test/CodeGen/code-coverage.c so that it doesn't refer to a gcov
function which is no longer emitted after r341977.

Fixes bot failure:
http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/23831

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

6 years ago[analyzer] [NFC] Change the tests by making the version check more resilient
George Karpenkov [Tue, 11 Sep 2018 18:45:15 +0000 (18:45 +0000)]
[analyzer] [NFC] Change the tests by making the version check more resilient

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

6 years ago[clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop
Mike Rice [Tue, 11 Sep 2018 17:10:44 +0000 (17:10 +0000)]
[clang-cl, PCH] Support for /Yc and /Yu without filename and #pragma hdrstop

With clang-cl, when the user specifies /Yc or /Yu without a filename
the compiler uses a #pragma hdrstop in the main source file to
determine the end of the PCH. If a header is specified with /Yc or
/Yu #pragma hdrstop has no effect.

The optional #pragma hdrstop filename argument is not yet supported.

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

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

6 years ago[ASTMatchers] add three matchers for dependent expressions
Jonas Toth [Tue, 11 Sep 2018 16:09:19 +0000 (16:09 +0000)]
[ASTMatchers] add three matchers for dependent expressions

Summary:
The new matchers can be used to check if an expression is type-, value- or instantiation-dependent
in a templated context.
These matchers are used in a clang-tidy check and generally useful as the
problem of unresolved templates occurs more often in clang-tidy and they
provide an easy way to check for this issue.

Reviewers: aaron.ballman, alexfh, klimek

Reviewed By: aaron.ballman

Subscribers: cfe-commits

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

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

6 years ago[CodeCompletion] Enable signature help when initializing class/struct/union members.
Kadir Cetinkaya [Tue, 11 Sep 2018 15:02:18 +0000 (15:02 +0000)]
[CodeCompletion] Enable signature help when initializing class/struct/union members.

Summary:
Factors out member decleration gathering and uses it in parsing to call signature
help. Doesn't support signature help for base class constructors, the code was too
coupled with diagnostic handling, but still can be factored out but just needs
more afford.

Reviewers: sammccall, ilya-biryukov, ioeric

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[OPENMP] Simplified checks for declarations in declare target regions.
Alexey Bataev [Tue, 11 Sep 2018 13:59:10 +0000 (13:59 +0000)]
[OPENMP] Simplified checks for declarations in declare target regions.

Sema analysis should not mark functions as an implicit declare target,
it may break codegen. Simplified semantic analysis and removed extra
code for implicit declare target functions.

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

6 years ago[python bindings] Expose getNumTemplateArguments
Jonathan Coe [Tue, 11 Sep 2018 12:44:52 +0000 (12:44 +0000)]
[python bindings] Expose getNumTemplateArguments

Expose the C bindings for clang_Type_getNumTemplateArguments() and
clang_Type_getTemplateArgumentAsType() in the python API.

Patch by kjteske (Kyle Teske).

Reviewed By: jbcoe

Subscribers: cfe-commits

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

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

6 years ago[Tooling] Restore working dir in ClangTool.
Ilya Biryukov [Tue, 11 Sep 2018 07:29:09 +0000 (07:29 +0000)]
[Tooling] Restore working dir in ClangTool.

Summary:
And add an option to disable this behavior. The option is only used in
AllTUsExecutor to avoid races when running concurrently on multiple
threads.

This fixes PR38869 introduced by r340937.

Reviewers: ioeric, steveire

Reviewed By: ioeric

Subscribers: cfe-commits

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

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

6 years agoMake test more robust in case the expected output appears in clang version string.
Douglas Yung [Tue, 11 Sep 2018 06:48:45 +0000 (06:48 +0000)]
Make test more robust in case the expected output appears in clang version string.

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

6 years ago[Modules] Add imported modules to the output of -module-file-info
Bruno Cardoso Lopes [Tue, 11 Sep 2018 05:17:13 +0000 (05:17 +0000)]
[Modules] Add imported modules to the output of -module-file-info

Fix a bug in the deserialization of IMPORTS section and allow for
imported modules to also be printed with -module-file-info.

rdar://problem/43867753

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

6 years agoclang-check: rename the local FixItAction
Saleem Abdulrasool [Mon, 10 Sep 2018 22:57:26 +0000 (22:57 +0000)]
clang-check: rename the local FixItAction

Resolve the ambiguity in the FixItAction definition by renaming the type.  With
Xcode 9.2, you would fail to build this with:

  llvm/tools/clang/tools/clang-check/ClangCheck.cpp:183:48: error: reference to 'FixItAction' is ambiguous
      FrontendFactory = newFrontendActionFactory<FixItAction>();
                                                 ^

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

6 years ago[Sema][ObjC] Infer availability of +new from availability of -init.
Erik Pilkington [Mon, 10 Sep 2018 22:20:09 +0000 (22:20 +0000)]
[Sema][ObjC] Infer availability of +new from availability of -init.

When defined in NSObject, +new will call -init. If -init has been marked
unavailable, diagnose uses of +new.

rdar://18335828

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

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

6 years agoFix test regression in r341862
Erich Keane [Mon, 10 Sep 2018 21:57:53 +0000 (21:57 +0000)]
Fix test regression in r341862

The commit updates when AES is enabled, but failed to update the tests.
This patch fixes them.

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