]> granicus.if.org Git - clang/log
clang
6 years ago[analyzer] Highlight sink nodes in red
George Karpenkov [Fri, 21 Sep 2018 20:37:01 +0000 (20:37 +0000)]
[analyzer] Highlight sink nodes in red

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

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

6 years ago[analyzer] Associate diagnostics created in checkEndFunction with a return statement...
George Karpenkov [Fri, 21 Sep 2018 20:36:41 +0000 (20:36 +0000)]
[analyzer] Associate diagnostics created in checkEndFunction with a return statement, if possible

If not possible, use the last line of the declaration, as before.

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

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

6 years ago[analyzer] [NFC] Prefer make_unique over "new"
George Karpenkov [Fri, 21 Sep 2018 20:36:21 +0000 (20:36 +0000)]
[analyzer] [NFC] Prefer make_unique over "new"

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

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

6 years ago[analyzer] Fix bug in isInevitablySinking
George Karpenkov [Fri, 21 Sep 2018 20:36:01 +0000 (20:36 +0000)]
[analyzer] Fix bug in isInevitablySinking

If the non-sink report is generated at the exit node, it will be
suppressed by the current functionality in isInevitablySinking, as it
only checks the successors of the block, but not the block itself.

The bug shows up in RetainCountChecker checks.

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

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

6 years ago[analyzer] [NFC] Dead code removal
George Karpenkov [Fri, 21 Sep 2018 20:35:39 +0000 (20:35 +0000)]
[analyzer] [NFC] Dead code removal

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

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

6 years agoAdd necessary support for storing code-model to module IR.
Caroline Tice [Fri, 21 Sep 2018 18:34:59 +0000 (18:34 +0000)]
Add necessary support for storing code-model to module IR.

Currently the code-model does not get saved in the module IR, so if a
code model is specified when compiling with LTO, it gets lost and is
not propagated properly to LTO. This patch does what is necessary in
the front end to pass the code-model to the module, so that the back
end can store it in the Module .

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

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

6 years ago[CUDA] Fixed parsing of optional template-argument-list.
Artem Belevich [Fri, 21 Sep 2018 17:46:28 +0000 (17:46 +0000)]
[CUDA] Fixed parsing of optional template-argument-list.

We need to consider all tokens that start with '>' when
we're checking for the end of an empty template argument list.

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

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

6 years ago[NFC] remove unused variable
JF Bastien [Fri, 21 Sep 2018 17:38:41 +0000 (17:38 +0000)]
[NFC] remove unused variable

It was causing a warning.

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

6 years ago[CUDA] Ignore uncallable functions when we check for usual deallocators.
Artem Belevich [Fri, 21 Sep 2018 17:29:33 +0000 (17:29 +0000)]
[CUDA] Ignore uncallable functions when we check for usual deallocators.

Previously clang considered function variants from both sides of
compilation and that resulted in picking up wrong deallocation function.

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

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

6 years ago[OPENMP] Disable emission of the class with vptr if they are not used in
Alexey Bataev [Fri, 21 Sep 2018 14:55:26 +0000 (14:55 +0000)]
[OPENMP] Disable emission of the class with vptr if they are not used in
target constructs.

Prevent compilation of the classes with the virtual tables when
compiling for the device.

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

6 years ago[OPENMP][NVPTX] Enable support for lastprivates in SPMD constructs.
Alexey Bataev [Fri, 21 Sep 2018 14:22:53 +0000 (14:22 +0000)]
[OPENMP][NVPTX] Enable support for lastprivates in SPMD constructs.

Previously we could not use lastprivates in SPMD constructs, patch
allows supporting lastprivates in SPMD with uninitialized runtime.

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

6 years ago[AST][NFC] DeclarationName.h : add missing parentheses to silence warnings
Bruno Ricci [Fri, 21 Sep 2018 14:03:32 +0000 (14:03 +0000)]
[AST][NFC] DeclarationName.h : add missing parentheses to silence warnings

Some bots are complaining about missing parentheses in assertions added in
r342729: [AST] Various optimizations + refactoring in DeclarationName(Table)

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

6 years agoNFC: deduplicate isRepeatedBytePattern from clang to LLVM's isBytewiseValue
JF Bastien [Fri, 21 Sep 2018 13:54:09 +0000 (13:54 +0000)]
NFC: deduplicate isRepeatedBytePattern from clang to LLVM's isBytewiseValue

Summary:
This code was in CGDecl.cpp and really belongs in LLVM. It happened to have isBytewiseValue which served a very similar purpose but wasn't as powerful as clang's version. Remove the clang version, and augment isBytewiseValue to be as powerful so that clang does the same thing it used to.

LLVM part of this patch: D51751

Subscribers: dexonsmith, cfe-commits

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

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

6 years ago[AST][NFC] Remove a superfluous enum in ObjCMethodDeclBitfields added in r338641
Bruno Ricci [Fri, 21 Sep 2018 13:11:39 +0000 (13:11 +0000)]
[AST][NFC] Remove a superfluous enum in ObjCMethodDeclBitfields added in r338641

I originally added this enum to avoid including Basic/IdentifierTable.h
in AST/DeclBase.h. However I did not realise it is already included
transitively by AST/DeclarationName.h. Therefore remove this enum and
explicitly include Basic/IdentifierTable.h

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

6 years ago[AST] Various optimizations + refactoring in DeclarationName(Table)
Bruno Ricci [Fri, 21 Sep 2018 12:53:22 +0000 (12:53 +0000)]
[AST] Various optimizations + refactoring in DeclarationName(Table)

Introduce the following optimizations in DeclarationName(Table):

 1. Store common kinds inline in DeclarationName instead of
    DeclarationNameExtra. Currently the kind of C++ constructor, destructor,
    conversion function and overloaded operator names is stored in
    DeclarationNameExtra. Instead store it inline in DeclarationName.
    To do this align IdentifierInfo, CXXSpecialName, DeclarationNameExtra
    and CXXOperatorIdName to 8 bytes so that we can use the lower 3 bits of
    DeclarationName::Ptr. This is already the case on 64 bits archs anyway.
    This also allow us to remove DeclarationNameExtra from CXXSpecialName
    and CXXOperatorIdName, which shave off a pointer from CXXSpecialName.

 2. Synchronize the enumerations DeclarationName::NameKind,
    DeclarationName::StoredNameKind and Selector::IdentifierInfoFlag.
    This makes DeclarationName::getNameKind much more efficient since we can
    replace the switch table by a single comparison and an addition.

 3. Put the overloaded operator names inline in DeclarationNameTable to remove
    an indirection. This increase the size of DeclarationNameTable a little
    bit but this is not important since it is only used in ASTContext, and
    never copied nor moved from. This also get rid of the last dynamic
    allocation in DeclarationNameTable.

Altogether these optimizations cut the run time of parsing all of Boost by
about 0.8%. While we are at it, do the following NFC modifications:

 1. Put the internal classes CXXSpecialName, CXXDeductionGuideNameExtra,
    CXXOperatorIdName, CXXLiteralOperatorIdName and DeclarationNameExtra
    in a namespace detail since these classes are only meant to be used by
    DeclarationName and DeclarationNameTable. Make this more explicit by making
    the members of these classes private and friending DeclarationName(Table).

 2. Make DeclarationName::getFETokenInfo a non-template since every users are
    using it to get a void *. It was supposed to be used with a type to avoid
    a subsequent static_cast.

 3. Change the internal functions DeclarationName::getAs* to castAs* since when
    we use them we already know the correct kind. This has no external impact
    since all of these are private.

Reviewed By: erichkeane, rjmccall

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

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

6 years ago[CodeComplete] Generate completion fix-its for C code as well
Ivan Donchevskii [Fri, 21 Sep 2018 11:23:22 +0000 (11:23 +0000)]
[CodeComplete] Generate completion fix-its for C code as well

Current completion fix-its approach does not provide OtherOpBase for C code.
But we can easily proceed in this case taking the original Base type.

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

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

6 years ago[CodeGen] Add to emitted DebugLoc information about coverage when it's required
Calixte Denizet [Fri, 21 Sep 2018 09:17:06 +0000 (09:17 +0000)]
[CodeGen] Add to emitted DebugLoc information about coverage when it's required

Summary:
Some lines have a hit counter where they should not have one.
Cleanup stuff is located to the last line of the body which is most of the time a '}'.
And Exception stuff is added at the beginning of a function and at the end (represented by '{' and '}').
So in such cases, the DebugLoc used in GCOVProfiling.cpp must be marked as not covered.
This patch is a followup of https://reviews.llvm.org/D49915.
Tests in projects/compiler_rt are fixed by: https://reviews.llvm.org/D49917

Reviewers: marco-c, davidxl

Reviewed By: marco-c

Subscribers: dblaikie, cfe-commits, sylvestre.ledru

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

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

6 years ago[XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1
Dean Michael Berris [Fri, 21 Sep 2018 08:32:49 +0000 (08:32 +0000)]
[XRay][clang] Propagate -fxray-instrumentation-bundle to -cc1

Summary:
Add a test and ensure that we propagate the
-fxray-instrumentation-bundle flag from the driver invocation to the
-cc1 options.

Reviewers: mboerger, tejohnson

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Do not merge short case labels if followed by a block.
Owen Pan [Fri, 21 Sep 2018 03:46:36 +0000 (03:46 +0000)]
[clang-format] Do not merge short case labels if followed by a block.

Do not allow short case labels on a single line if the label is followed by a
left brace.

Fixes PR38926.

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

6 years agoRemove failing test.
Zachary Turner [Thu, 20 Sep 2018 22:32:51 +0000 (22:32 +0000)]
Remove failing test.

Removing on behalf of Jorge Moya.  This test is broken on
Windows due to it actually being able to resolve the path.  There
is an actual Windows-specific bug somewhere, but we already have
sufficient test coverage of this with a different test, so removing
this was the approach suggested by Jorge.

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

6 years agoFix an assert in -Wquoted-include-in-framework-header
Erik Pilkington [Thu, 20 Sep 2018 19:00:03 +0000 (19:00 +0000)]
Fix an assert in -Wquoted-include-in-framework-header

Fixes rdar://43692300

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

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

6 years ago[Sema] Retain __restrict qualifiers when substituting a reference type.
Erik Pilkington [Thu, 20 Sep 2018 18:12:24 +0000 (18:12 +0000)]
[Sema] Retain __restrict qualifiers when substituting a reference type.

Fixes rdar://43760099

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

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

6 years agoAdd testcases for r342667.
Eric Christopher [Thu, 20 Sep 2018 17:22:43 +0000 (17:22 +0000)]
Add testcases for r342667.

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

6 years agor342177 introduced a hint in cases where an #included file is not found. It tries...
Eric Christopher [Thu, 20 Sep 2018 17:21:56 +0000 (17:21 +0000)]
r342177 introduced a hint in cases where an #included file is not found. It tries to find a suggestion by removing leading or trailing non-alphanumeric characters and checking if a matching file exists, then it reports an error like:

include-likely-typo.c:3:10: error: '<empty_file_to_include.h>' file not found, did you mean 'empty_file_to_include.h'?
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~
         "empty_file_to_include.h"
1 error generated.
However, if a hint is not found, the error message will show only the trimmed name we use to look for a hint, so:

will result in:

include-leading-nonalpha-no-suggest.c:3:10: fatal error: 'non_existing_file_to_include.h' file not found
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
where the name reported after "fatal error:" doesn't match what the user wrote.

Patch by Jorge Gorbe!

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

This change reports the original file name instead of the trimmed one when a suggestion is not found.

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

6 years ago[OPENMP] Fix spelling of getLoopCounter (NFC)
Mike Rice [Thu, 20 Sep 2018 17:19:41 +0000 (17:19 +0000)]
[OPENMP] Fix spelling of getLoopCounter (NFC)

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

6 years ago[OPENMP] Add support for mapping memory pointed by member pointer.
Alexey Bataev [Thu, 20 Sep 2018 13:54:02 +0000 (13:54 +0000)]
[OPENMP] Add support for mapping memory pointed by member pointer.

Added support for map(s, s.ptr[0:1]) kind of mapping.

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

6 years ago[OpenCL] Diagnose redundant address space conversion
Sven van Haastregt [Thu, 20 Sep 2018 10:07:27 +0000 (10:07 +0000)]
[OpenCL] Diagnose redundant address space conversion

Add a warning if a parameter with a named address space is passed
to a to_addr builtin.

For example:

  int i;
  to_private(&i); // generate warning as conversion from private to private is redundant.

Patch by Alistair Davies.

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

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

6 years agoFileCheckify test/Driver/Xarch.c
Hans Wennborg [Thu, 20 Sep 2018 09:29:35 +0000 (09:29 +0000)]
FileCheckify test/Driver/Xarch.c

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

6 years ago[PowerPC] [Clang] Add vector int128 pack/unpack builtins
QingShan Zhang [Thu, 20 Sep 2018 05:04:57 +0000 (05:04 +0000)]
[PowerPC] [Clang] Add vector int128 pack/unpack builtins

unsigned long long builtin_unpack_vector_int128 (vector int128_t, int);
vector int128_t builtin_pack_vector_int128 (unsigned long long, unsigned long long);

Builtins should behave the same way as in GCC.

Patch By: wuzish (Zixuan Wu)
Differential Revision: https://reviews.llvm.org/D52074

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

6 years agoThread Safety Analysis: warnings for attributes without arguments
Aaron Puchert [Thu, 20 Sep 2018 00:39:27 +0000 (00:39 +0000)]
Thread Safety Analysis: warnings for attributes without arguments

Summary:
When thread safety annotations are used without capability arguments,
they are assumed to apply to `this` instead. So we warn when either
`this` doesn't exist, or the class is not a capability type.

This is based on earlier work by Josh Gao that was committed in r310403,
but reverted in r310698 because it didn't properly work in template
classes. See also D36237.

The solution is not to go via the QualType of `this`, which is then a
template type, hence the attributes are not known because it could be
specialized. Instead we look directly at the class in which we are
contained.

Additionally I grouped two of the warnings together. There are two
issues here: the existence of `this`, which requires us to be a
non-static member function, and the appropriate annotation on the class
we are contained in. So we don't distinguish between not being in a
class and being static, because in both cases we don't have `this`.

Fixes PR38399.

Reviewers: aaron.ballman, delesley, jmgao, rtrieu

Reviewed By: delesley

Subscribers: cfe-commits

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

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

6 years agoThread safety analysis: Handle ObjCIvarRefExpr in SExprBuilder::translate
Aaron Puchert [Wed, 19 Sep 2018 23:57:38 +0000 (23:57 +0000)]
Thread safety analysis: Handle ObjCIvarRefExpr in SExprBuilder::translate

Summary:
This imitates the code for MemberExpr.

Fixes PR38896.

Reviewers: aaron.ballman, delesley, lukasza, rjmccall

Reviewed By: delesley

Subscribers: cfe-commits

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

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

6 years ago[NFC] Declare instead of define non-void functions in unit tests.
Shuai Wang [Wed, 19 Sep 2018 20:27:25 +0000 (20:27 +0000)]
[NFC] Declare instead of define non-void functions in unit tests.

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

6 years agotest: actually fix the condition properly
Saleem Abdulrasool [Wed, 19 Sep 2018 19:20:30 +0000 (19:20 +0000)]
test: actually fix the condition properly

I had locally changed the test to add an explicit triple to figure out the issue
with the SCEI buildbots, and that hid the error.  This now works with and
without the explicit triple.

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

6 years agotest: improve condition for the check
Saleem Abdulrasool [Wed, 19 Sep 2018 18:41:07 +0000 (18:41 +0000)]
test: improve condition for the check

When the type of `wint_t` is `int`, the promotion will allow this to pass.
Check this explicitly rather than using the size.

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

6 years agoredirecting to llvm.org/devmtg
Sylvestre Ledru [Wed, 19 Sep 2018 18:39:15 +0000 (18:39 +0000)]
redirecting to llvm.org/devmtg

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

6 years agoSema: handle `wint_t` more carefully for printf checking
Saleem Abdulrasool [Wed, 19 Sep 2018 18:13:34 +0000 (18:13 +0000)]
Sema: handle `wint_t` more carefully for printf checking

In the case that `win_t` is an `unsigned short` (e.g. on Windows), we would
previously incorrectly diagnose the conversion because we would immediately
promote the argument type from `wint_t` (aka `unsigned short`) to `int` before
checking if the type matched.  This should repair the Windows hosted bots.

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

6 years ago[analyzer] Fix nullptr access when processing instantiated function in ExprMutationAn...
Shuai Wang [Wed, 19 Sep 2018 18:00:55 +0000 (18:00 +0000)]
[analyzer] Fix nullptr access when processing instantiated function in ExprMutationAnalyzer.

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

6 years agoBasic: correct `__WINT_TYPE__` on Windows
Saleem Abdulrasool [Wed, 19 Sep 2018 16:18:55 +0000 (16:18 +0000)]
Basic: correct `__WINT_TYPE__` on Windows

Windows uses `unsigned short` for `wint_t`.  Correct the type definition as
vended by the compiler.  This type is defined in corecrt.h and is
unconditionally typedef'ed.  cl does not have an equivalent to `__WINT_TYPE__`
which is why this was never detected.

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

6 years ago[Sema] Do not load macros from preamble when LoadExternal is false.
Eric Liu [Wed, 19 Sep 2018 09:34:55 +0000 (09:34 +0000)]
[Sema] Do not load macros from preamble when LoadExternal is false.

Reviewers: ilya-biryukov

Reviewed By: ilya-biryukov

Subscribers: cfe-commits

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

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

6 years ago[NFC] Fix uncompilable test cases of ExprMutationAnalyzer.
Shuai Wang [Wed, 19 Sep 2018 03:50:03 +0000 (03:50 +0000)]
[NFC] Fix uncompilable test cases of ExprMutationAnalyzer.

And ensure future test cases doesn't have compile errors.

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

6 years agoThread safety analysis: Fix crash for function pointers
Aaron Puchert [Wed, 19 Sep 2018 00:19:38 +0000 (00:19 +0000)]
Thread safety analysis: Fix crash for function pointers

For function pointers, the FunctionDecl of the callee is unknown, so
getDirectCallee will return nullptr. We have to catch that case to avoid
crashing. We assume there is no attribute then.

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

6 years agoAdd a callback for `__has_include` and use it for dependency scanning.
Volodymyr Sapsai [Tue, 18 Sep 2018 23:27:02 +0000 (23:27 +0000)]
Add a callback for `__has_include` and use it for dependency scanning.

This adds a preprocessor callback for the `__has_include` and
`__has_include_next` directives.

Successful checking for the presence of a header should add it to the list of
header dependencies so this overrides the callback in the dependency scanner.

Patch by Pete Cooper with some additions by me.

rdar://problem/39545636

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

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

6 years ago[MS] Defer dllexport inline friend functions like other inline methods
Reid Kleckner [Tue, 18 Sep 2018 23:16:30 +0000 (23:16 +0000)]
[MS] Defer dllexport inline friend functions like other inline methods

This special case was added in r264841, but the code breaks our
invariants by calling EmitTopLevelDecl without first creating a
HandlingTopLevelDeclRAII scope.

This fixes the PCH crash in https://crbug.com/884427. I was never able
to make a satisfactory reduction, unfortunately. I'm not very worried
about this regressing since this change makes the code simpler while
passing the existing test that shows we do emit dllexported friend
function definitions. Now we just defer their emission until the tag is
fully complete, which is generally good.

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

6 years agoDriver: extract a local variable for the Toolchain (NFC)
Saleem Abdulrasool [Tue, 18 Sep 2018 22:14:50 +0000 (22:14 +0000)]
Driver: extract a local variable for the Toolchain (NFC)

Create and store a reference to the current toolchain rather than calling
`getToolChain` throughout the function.  NFC.

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

6 years agoDriver: hoist `-mlimit-float-precision` (NFC)
Saleem Abdulrasool [Tue, 18 Sep 2018 21:12:39 +0000 (21:12 +0000)]
Driver: hoist `-mlimit-float-precision` (NFC)

Move the floating point argument handling into the RenderFloatingPointOptions
helper.  This relocation just puts the floating point related options into a
single location.

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

6 years agoFix fomit-frame-pointe+pg error
David Blaikie [Tue, 18 Sep 2018 20:11:45 +0000 (20:11 +0000)]
Fix fomit-frame-pointe+pg error

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

6 years agoFix logic around determining use of frame pointer with -pg.
Stephen Hines [Tue, 18 Sep 2018 18:34:33 +0000 (18:34 +0000)]
Fix logic around determining use of frame pointer with -pg.

Summary:
As part of r342165, I rewrote the logic to check whether
-fno-omit-frame-pointer was passed after a -fomit-frame-pointer
argument. This CL switches that logic to use the consolidated
shouldUseFramePointer() function. This fixes a potential issue where -pg
gets used with -fomit-frame-pointer on a platform that must always retain
frame pointers.

Reviewers: dblaikie

Reviewed By: dblaikie

Subscribers: cfe-commits

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

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

6 years ago[Modules] Add platform and environment features to requires clause
Bruno Cardoso Lopes [Tue, 18 Sep 2018 17:11:13 +0000 (17:11 +0000)]
[Modules] Add platform and environment features to requires clause

Allows module map writers to add build requirements based on
platform/os. This helps when target features and language dialects
aren't enough to conditionalize building a module, among other things,
it allow module maps for different platforms to live in the same file.

rdar://problem/43909745

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

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

6 years ago[index] Enhance indexing for module references
Argyrios Kyrtzidis [Tue, 18 Sep 2018 15:02:56 +0000 (15:02 +0000)]
[index] Enhance indexing for module references

* Create a USR for the occurrences of the 'module' symbol kind
* Record module references for each identifier in an import declaration

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

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