]> granicus.if.org Git - clang/log
clang
7 years agoTest commit access
Henry Wong [Wed, 14 Feb 2018 07:32:27 +0000 (07:32 +0000)]
Test commit access

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

7 years agoFix a couple of places where we assumed that non-type template parameters are always...
Richard Smith [Wed, 14 Feb 2018 02:07:53 +0000 (02:07 +0000)]
Fix a couple of places where we assumed that non-type template parameters are always rvalues.

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

7 years agoImplement function attribute artificial
Erich Keane [Wed, 14 Feb 2018 00:14:07 +0000 (00:14 +0000)]
Implement function attribute artificial

Added support in clang for GCC function attribute 'artificial'. This attribute
is used to control stepping behavior of debugger with respect to inline
functions.

Patch By: Elizabeth Andrews (eandrews)

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

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

7 years ago[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded envir...
George Karpenkov [Tue, 13 Feb 2018 23:36:01 +0000 (23:36 +0000)]
[analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment

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

7 years agoTeach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat...
Nico Weber [Tue, 13 Feb 2018 21:31:47 +0000 (21:31 +0000)]
Teach Wreturn-type, Wunreachable-code, and alpha.deadcode.UnreachableCode to treat __assume(0) like __builtin_unreachable.

Fixes PR29134.
https://reviews.llvm.org/D43221

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

7 years agoUpdate StmtProfile.cpp to handle zero template arguments.
Richard Trieu [Tue, 13 Feb 2018 19:53:40 +0000 (19:53 +0000)]
Update StmtProfile.cpp to handle zero template arguments.

Treat having no templates arguments differently than having zero template
arguments when profiling.

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

7 years ago[AMDGPU] Change constant addr space to 4
Yaxun Liu [Tue, 13 Feb 2018 18:01:21 +0000 (18:01 +0000)]
[AMDGPU] Change constant addr space to 4

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

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

7 years agoAn updated test to show the current warnings produced for implicit conversions from...
Andrew V. Tischenko [Tue, 13 Feb 2018 15:20:29 +0000 (15:20 +0000)]
An updated test to show the current warnings produced for implicit conversions from 'double' to 'float'.

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

7 years ago[clang-format] Support text proto extensions
Krasimir Georgiev [Tue, 13 Feb 2018 10:20:39 +0000 (10:20 +0000)]
[clang-format] Support text proto extensions

Summary:
This adds support for text proto extensions, like:
```
msg {
  [type.type/ext] {
    key: value
  }
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoFix for PR32992. Static const classes not exported.
Hans Wennborg [Tue, 13 Feb 2018 09:19:43 +0000 (09:19 +0000)]
Fix for PR32992. Static const classes not exported.

Patch by zahiraam!

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

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

7 years ago[DebugInfo] Avoid name conflict of generated VLA expression variable.
Sander de Smalen [Tue, 13 Feb 2018 07:49:34 +0000 (07:49 +0000)]
[DebugInfo] Avoid name conflict of generated VLA expression variable.

Summary:
This patch also adds the 'DW_AT_artificial' flag to the generated variable.

Addresses the issues mentioned in http://llvm.org/PR30553.

Reviewers: CarlosAlbertoEnciso, probinson, aprantl

Reviewed By: aprantl

Subscribers: JDevlieghere, cfe-commits

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

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

7 years ago[Modules] Fix remapping from Foo.Private to Foo_Private to happen before typo correction
Bruno Cardoso Lopes [Mon, 12 Feb 2018 23:43:21 +0000 (23:43 +0000)]
[Modules] Fix remapping from Foo.Private to Foo_Private to happen before typo correction

Typo correction is the last step here, remapping should come first.

rdar://problem/37351970

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

7 years ago[analyzer] Exploration strategy prioritizing unexplored coverage first
George Karpenkov [Mon, 12 Feb 2018 22:39:57 +0000 (22:39 +0000)]
[analyzer] Exploration strategy prioritizing unexplored coverage first

See reviews.llvm.org/M1 for evaluation, and
lists.llvm.org/pipermail/cfe-dev/2018-January/056718.html for
discussion.

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

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

7 years ago[X86] Reverse the operand order of the implementation of the kunpack builtins.
Craig Topper [Mon, 12 Feb 2018 22:38:52 +0000 (22:38 +0000)]
[X86] Reverse the operand order of the implementation of the kunpack builtins.

The second operand needs to be in the lower bits of the concatenation. This matches llvm 5.0, gcc, and icc behavior.

Fixes PR36360.

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

7 years ago[CFG] Provide construction contexts for return value constructors.
Artem Dergachev [Mon, 12 Feb 2018 22:36:36 +0000 (22:36 +0000)]
[CFG] Provide construction contexts for return value constructors.

When the current function returns a C++ object by value, CFG elements for
constructors that construct the return values can now be queried to discover
that they're indeed participating in construction of the respective return value
at the respective return statement.

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

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

7 years agoLook for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.
John Baldwin [Mon, 12 Feb 2018 22:22:01 +0000 (22:22 +0000)]
Look for 32-bit libraries in /usr/lib32 for MIPS O32 on FreeBSD.

Summary:
FreeBSD N64 MIPS systems can include 32-bit libraries for O32 in
/usr/lib32 similar to the 32-bit compatibility libraries provided
for FreeBSD/amd64 and FreeBSD/powerpc64.

Reviewers: dim

Reviewed By: dim

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

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

7 years ago[analyzer] [tests] Fix a typo in analyzer testing script.
George Karpenkov [Mon, 12 Feb 2018 22:13:01 +0000 (22:13 +0000)]
[analyzer] [tests] Fix a typo in analyzer testing script.

Incorrect option instance construction.

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

7 years ago[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portion
Abderrazek Zaafrani [Mon, 12 Feb 2018 21:26:06 +0000 (21:26 +0000)]
[AArch64] Fixes for ARMv8.2-A FP16 scalar intrinsic - clang portion

https://reviews.llvm.org/D42993

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

7 years ago[DebugInfo] Update Checksum handling in CGDebugInfo
Scott Linder [Mon, 12 Feb 2018 19:47:05 +0000 (19:47 +0000)]
[DebugInfo] Update Checksum handling in CGDebugInfo

Update to match new DIFile API.

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

7 years agoAdd a unit test for Driver::getDefaultModuleCachePath().
Adrian Prantl [Mon, 12 Feb 2018 17:59:54 +0000 (17:59 +0000)]
Add a unit test for Driver::getDefaultModuleCachePath().

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

7 years agoFurther cleanup to Driver mode code, as suggested by dblaikie [NFC]
Erich Keane [Mon, 12 Feb 2018 17:47:01 +0000 (17:47 +0000)]
Further cleanup to Driver mode code, as suggested by dblaikie [NFC]

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

7 years ago[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo
Fangrui Song [Mon, 12 Feb 2018 17:42:09 +0000 (17:42 +0000)]
[libclang] Add `CXSymbolRole role` to CXIdxEntityRefInfo

Summary:
CXIdxEntityRefInfo contains the member `CXIdxEntityRefKind kind;` to
differentiate implicit and direct calls. However, there are more roles
defined in SymbolRole. Among them, `Read/Write` are probably the most
useful ones as they can be used to differentiate Read/Write occurrences
of a symbol for document highlight in a text document.

See `export namespace DocumentHighlightKind`
on https://microsoft.github.io/language-server-protocol/specification

Subscribers: cfe-commits

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

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

7 years ago[Sema] Don't mark plain MS enums as fixed
Reid Kleckner [Mon, 12 Feb 2018 17:37:06 +0000 (17:37 +0000)]
[Sema] Don't mark plain MS enums as fixed

Summary:
This fixes a flaw in our AST: PR27098

MSVC always gives plain enums the underlying type 'int'. Clang does this
as well, but we claim the enum is "fixed", as if the user actually wrote
': int'. It means we end up emitting spurious -Wsign-compare warnings on
code like this:

  enum Vals { E1, E2, E3 };
  bool f(unsigned v1, Vals v2) {
    return v1 == v2;
  }

We think 'v2' can take on negative values because we think 'Vals' is
fixed. This fixes that.

Reviewers: rsmith

Subscribers: cfe-commits

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

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

7 years agoUpdate target-note-test to be current with the AMDGPU changes
Erich Keane [Mon, 12 Feb 2018 17:19:57 +0000 (17:19 +0000)]
Update target-note-test to be current with the AMDGPU changes

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

7 years agoMake attribute-target on a Definition-after-use update the LLVM attributes
Erich Keane [Mon, 12 Feb 2018 17:01:41 +0000 (17:01 +0000)]
Make attribute-target on a Definition-after-use update the LLVM attributes

As reported here: https://bugs.llvm.org/show_bug.cgi?id=36301
The issue is that the 'use' causes the plain declaration to emit
the attributes to LLVM-IR. However, if the definition added it
later, these would silently disappear.

This commit extracts that logic to its own function in CodeGenModule,
and has the attribute-applications done during 'definition' update
the attributes properly.

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

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

7 years agoAdd Invalid-note test negllected in R324673,324674,324675,324676
Erich Keane [Mon, 12 Feb 2018 16:24:08 +0000 (16:24 +0000)]
Add Invalid-note test negllected in R324673,324674,324675,324676

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

7 years agoRe-commit r324490: [DebugInfo] Improvements to representation of enumeration types...
Momchil Velikov [Mon, 12 Feb 2018 16:12:52 +0000 (16:12 +0000)]
Re-commit r324490: [DebugInfo] Improvements to representation of enumeration types (PR36168)

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

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

7 years ago[clang-format] Fix comment indentation in text protos
Krasimir Georgiev [Mon, 12 Feb 2018 15:49:09 +0000 (15:49 +0000)]
[clang-format] Fix comment indentation in text protos

Summary: This patch fixes a bug where the comment indent of comments in text protos gets messed up because by default paren states get created with AlignColons = true (which makes snese for ObjC).

Subscribers: klimek, cfe-commits

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

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

7 years agoAllow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attribu...
Aaron Ballman [Mon, 12 Feb 2018 13:38:25 +0000 (13:38 +0000)]
Allow the NS, CF, and ObjC attributes to be used with -fdouble-square-bracket-attributes. The syntactic locations for such attributes on ObjC constructs have been specifically chosen to follow the GNU attribute syntactic locations.

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

7 years agoASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning
Filipe Cabecinhas [Mon, 12 Feb 2018 11:49:02 +0000 (11:49 +0000)]
ASan+operator new[]: Add an option for more thorough operator new[] cookie poisoning

Summary:
Right now clang is skipping array cookie poisoning for any operator
new[] which is not part of the set of replaceable global allocation
functions.

This commit adds a flag to tell clang to poison all operator new[]
cookies.

A previous review was poisoning all array cookies unconditionally, but
there is an edge case which would stop working under ASan (a custom
operator new[] saves whatever pointer it returned, and then accesses
it).

This newer revision adds a command line argument to toggle this feature.

Original revision: https://reviews.llvm.org/D41301
Compiler-rt test revision with an explanation of the edge case: https://reviews.llvm.org/D41664

Reviewers: rjmccall, kcc, rsmith

Subscribers: cfe-commits

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

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

7 years ago[CUDA] Add option to generate relocatable device code
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:45 +0000 (10:46 +0000)]
[CUDA] Add option to generate relocatable device code

As a first step, pass '-c/--compile-only' to ptxas so that it
doesn't complain about references to external function. This
will successfully generate object files, but they won't work
at runtime because the registration routines need to adapted.

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

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

7 years ago[CUDA] Fix test cuda-external-tools.cu
Jonas Hahnfeld [Mon, 12 Feb 2018 10:46:34 +0000 (10:46 +0000)]
[CUDA] Fix test cuda-external-tools.cu

This didn't verify the CHECK prefix before!

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

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

7 years ago[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1...
Craig Topper [Sat, 10 Feb 2018 23:34:27 +0000 (23:34 +0000)]
[X86] Change the signature of the AVX512 packed fp compare intrinsics to return vXi1 mask. Make bitcasts to scalar explicit in IR

Summary: This is the clang equivalent of r324827

Reviewers: zvi, delena, RKSimon, spatel

Reviewed By: RKSimon

Subscribers: llvm-commits

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

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

7 years agoFix test clang-diff-json.cpp
Aaron Smith [Sat, 10 Feb 2018 21:28:55 +0000 (21:28 +0000)]
Fix test clang-diff-json.cpp

Summary:
This test would fail if the python path had spaces. Add a quote around the path to fix this problem and update some test values changed by the addition of quotes around the path.

Tested on Windows and Linux with Python 3.x

Reviewers: zturner, llvm-commits

Subscribers: klimek, cfe-commits

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

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

7 years agoAdd vector add/sub/mul/div by scalar tests (PR27085)
Simon Pilgrim [Sat, 10 Feb 2018 17:55:23 +0000 (17:55 +0000)]
Add vector add/sub/mul/div by scalar tests (PR27085)

Ensure the scalar is correctly splatted to all lanes

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

7 years agoMake a build bot happy.
Gabor Horvath [Sat, 10 Feb 2018 14:26:53 +0000 (14:26 +0000)]
Make a build bot happy.

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

7 years ago[Templight] Template Instantiation Observer
Gabor Horvath [Sat, 10 Feb 2018 14:04:45 +0000 (14:04 +0000)]
[Templight] Template Instantiation Observer

This patch adds a base-class called TemplateInstantiationObserver which gets
notified whenever a template instantiation is entered or exited during
semantic analysis. This is a base class used to implement the template
profiling and debugging tool called
Templight (https://github.com/mikael-s-persson/templight).

The patch also makes a few more changes:

* ActiveTemplateInstantiation class is moved out of the Sema class (so it can be used with inclusion of Sema.h).
* CreateFrontendAction function in front-end utilities is given external linkage (not longer a hidden static function).
* TemplateInstObserverChain data member added to Sema class to hold the list of template-inst observers.
* Notifications to the template-inst observer are added at the key places where templates are instantiated.

Patch by: Abel Sinkovics!

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

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

7 years ago[analyzer] NFC: Assert that our fix for noreturn destructors keeps working.
Artem Dergachev [Sat, 10 Feb 2018 03:14:22 +0000 (03:14 +0000)]
[analyzer] NFC: Assert that our fix for noreturn destructors keeps working.

Massive false positives were known to be caused by continuing the analysis
after a destructor with a noreturn attribute has been executed in the program
but not modeled in the analyzer due to being missing in the CFG.

Now that work is being done on enabling the modeling of temporary constructors
and destructors in the CFG, we need to make sure that the heuristic that
suppresses these false positives keeps working when such modeling is disabled.
In particular, different code paths open up when the corresponding constructor
is being inlined during analysis.

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

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

7 years ago[analyzer] Fix a merge error in -analyzer-config tests.
Artem Dergachev [Sat, 10 Feb 2018 03:04:59 +0000 (03:04 +0000)]
[analyzer] Fix a merge error in -analyzer-config tests.

It was introduced when two -analyzer-config options were added almost
simultaneously in r324793 and r324668 and the option count was not
rebased correctly in the tests.

Fixes the buildbots.

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

7 years ago[analyzer] NFC: Use CFG construction contexts instead of homemade lookahead.
Artem Dergachev [Sat, 10 Feb 2018 02:55:08 +0000 (02:55 +0000)]
[analyzer] NFC: Use CFG construction contexts instead of homemade lookahead.

The analyzer was relying on peeking the next CFG element during analysis
whenever it was trying to figure out what object is being constructed
by a given constructor. This information is now available in the current CFG
element in all cases that were previously supported by the analyzer,
so no complicated lookahead is necessary anymore.

No functional change intended - the context in the CFG should for now be
available if and only if it was previously discoverable via CFG lookahead.

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

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

7 years ago[CFG] Provide construction contexts when constructors have cleanups.
Artem Dergachev [Sat, 10 Feb 2018 02:46:14 +0000 (02:46 +0000)]
[CFG] Provide construction contexts when constructors have cleanups.

Now that we make it possible to query the CFG constructor element to find
information about the construction site, possible cleanup work represented by
ExprWithCleanups should not prevent us from providing this information.

This allows us to have a correct construction context for variables initialized
"by value" via elidable copy-constructors, such as 'i' in

  iterator i = vector.begin();

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

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

7 years ago[CFG] Add construction context for constructor initializers.
Artem Dergachev [Sat, 10 Feb 2018 02:18:04 +0000 (02:18 +0000)]
[CFG] Add construction context for constructor initializers.

CFG elements for constructors of fields and base classes that are being
initialized before the body of the whole-class constructor starts can now be
queried to discover that they're indeed participating in initialization of their
respective fields or bases before the whole-class constructor kicks in.

CFG construction contexts are now capable of representing CXXCtorInitializer
triggers, which aren't considered to be statements in the Clang AST.

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

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

7 years ago[CFG] Add construction context for simple variable declarations.
Artem Dergachev [Sat, 10 Feb 2018 01:55:23 +0000 (01:55 +0000)]
[CFG] Add construction context for simple variable declarations.

Constructors of simple variables now can be queried to discover that they're
constructing into simple variables.

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

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

7 years ago[analyzer] Serialize statistics to plist when serialize-stats=true is set
George Karpenkov [Sat, 10 Feb 2018 01:49:20 +0000 (01:49 +0000)]
[analyzer] Serialize statistics to plist when serialize-stats=true is set

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

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

7 years ago[analyzer] Add missing pre-post-statement callbacks for OffsetOfExpr.
Artem Dergachev [Sat, 10 Feb 2018 00:55:49 +0000 (00:55 +0000)]
[analyzer] Add missing pre-post-statement callbacks for OffsetOfExpr.

This expression may or may not be evaluated in compile time, so tracking the
result symbol is of potential interest. However, run-time offsetof is not yet
supported by the analyzer, so for now this callback is only there to assist
future implementation.

Patch by Henry Wong!

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

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

7 years ago[analyzer] Add support for __builtin_constant_p.
Artem Dergachev [Sat, 10 Feb 2018 00:51:47 +0000 (00:51 +0000)]
[analyzer] Add support for __builtin_constant_p.

This builtin is evaluated in compile time. But in the analyzer we don't yet
automagically evaluate all calls that can be evaluated in compile time.

Patch by Felix Kostenzer!

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

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

7 years ago[analyzer] Introduce statistics for the total number of visited basic blocks
George Karpenkov [Fri, 9 Feb 2018 23:37:47 +0000 (23:37 +0000)]
[analyzer] Introduce statistics for the total number of visited basic blocks

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

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

7 years ago[NFC] Extract method to SourceManager for traversing the macro "stack"
George Karpenkov [Fri, 9 Feb 2018 23:30:07 +0000 (23:30 +0000)]
[NFC] Extract method to SourceManager for traversing the macro "stack"

The code for going up the macro arg expansion is duplicated in many
places (and we need it for the analyzer as well, so I did not want to
duplicate it two more times).

This patch is an NFC, so the semantics should remain the same.

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

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

7 years ago[CodeGen] Use the zero initializer instead of storing an all zero representation.
Matt Davis [Fri, 9 Feb 2018 22:10:09 +0000 (22:10 +0000)]
[CodeGen] Use the zero initializer instead of storing an all zero representation.

Summary:
This change avoids the overhead of storing, and later crawling,
an initializer list of all zeros for arrays. When LLVM
visits this (llvm/IR/Constants.cpp) ConstantArray::getImpl()
it will scan the list looking for an array of all zero.

We can avoid the store, and short-cut the scan, by detecting
all zeros when clang builds-up the initialization representation.

This was brought to my attention when investigating PR36030

Reviewers: majnemer, rjmccall

Reviewed By: rjmccall

Subscribers: cfe-commits

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

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

7 years agoRemove "CHECK: entry" in test case.
Akira Hatanaka [Fri, 9 Feb 2018 19:25:31 +0000 (19:25 +0000)]
Remove "CHECK: entry" in test case.

rdar://problem/37397814

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

7 years ago[analyzer] [tests] Fixing an error after non-atomic cherry-pick
George Karpenkov [Fri, 9 Feb 2018 18:48:31 +0000 (18:48 +0000)]
[analyzer] [tests] Fixing an error after non-atomic cherry-pick

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

7 years agoIntroduce an API for LLDB to compute the default module cache path
Adrian Prantl [Fri, 9 Feb 2018 18:43:10 +0000 (18:43 +0000)]
Introduce an API for LLDB to compute the default module cache path

LLDB creates Clang modules and had an incomplete copy of the clang
Driver code that compute the -fmodule-cache-path. This patch makes the
clang driver code accessible to LLDB.

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

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

7 years ago[analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser...
George Karpenkov [Fri, 9 Feb 2018 18:39:47 +0000 (18:39 +0000)]
[analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser output

...when we can just use the real parser instead.

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

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

7 years agoAMDGPU: Update for datalayout change
Matt Arsenault [Fri, 9 Feb 2018 16:58:41 +0000 (16:58 +0000)]
AMDGPU: Update for datalayout change

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

7 years agoclang-format: keep ObjC colon alignment with short object name
Francois Ferrand [Fri, 9 Feb 2018 15:41:56 +0000 (15:41 +0000)]
clang-format: keep ObjC colon alignment with short object name

Summary:
When the target object expression is short and the first selector name
is long, clang-format used to break the colon alignment:

  [I performSelectorOnMainThread:@selector(loadAccessories)
                       withObject:nil
                    waitUntilDone:false];

This happens because the colon is placed at `ContinuationIndent +
LongestObjCSelectorName`, so that any selector can be wrapped. This is
however not needed in case the longest selector is the firstone, and
not wrapped.

To overcome this, this patch does not include the first selector in
`LongestObjCSelectorName` computation (in TokenAnnotator), and lets
`ContinuationIndenter` decide how to account for the first selector
when wrapping. (Note this was already partly the case, see line 521
of ContinuationIndenter.cpp)

This way, the code gets properly aligned whenever possible without
breaking the continuation indent.

  [I performSelectorOnMainThread:@selector(loadAccessories)
                      withObject:nil
                   waitUntilDone:false];
  [I // force break
      performSelectorOnMainThread:@selector(loadAccessories)
                       withObject:nil
                    waitUntilDone:false];
  [I perform:@selector(loadAccessories)
      withSelectorOnMainThread:true
                 waitUntilDone:false];

Reviewers: krasimir, djasper, klimek

Subscribers: cfe-commits

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

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

7 years agoFif for an issue when Clang permits assignment to vector/extvector elements in a...
Andrew V. Tischenko [Fri, 9 Feb 2018 09:30:42 +0000 (09:30 +0000)]
Fif for an issue when Clang permits assignment to vector/extvector elements in a const method.

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

7 years agoAMDGPU/GCN: Bring processors in sync with AMDGPUUsage
Konstantin Zhuravlyov [Fri, 9 Feb 2018 07:02:28 +0000 (07:02 +0000)]
AMDGPU/GCN: Bring processors in sync with AMDGPUUsage

- Remove gfx800
- Remove gfx804
- Remove gfx901
- Remove gfx903

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

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

7 years agoAST: support ObjC lifetime qualifiers in MS ABI
Saleem Abdulrasool [Fri, 9 Feb 2018 03:23:54 +0000 (03:23 +0000)]
AST: support ObjC lifetime qualifiers in MS ABI

Adjust the ObjC protocol conformance workaround to be more extensible.
Use a synthetic type for the protocol (`struct Protocol`).  Embed this
within a reserved namespace to permit extending the extended pointer
type qualifiers similarly for ObjC lifetime qualifiers.

Introduce additional special handling for `__autoreleasing`, `__strong`,
and `__weak` Objective C lifetime qualifiers.  We decorate these by
creating an artificial template type `Autoreleasing`, `Strong`, or
`Weak` in the `__ObjC` namespace.  These are only considered in the
template type specialization and not the function parameter.

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

7 years ago[CFG] Squash an unused variable introduced in r324668.
Artem Dergachev [Fri, 9 Feb 2018 01:43:26 +0000 (01:43 +0000)]
[CFG] Squash an unused variable introduced in r324668.

Found by -Werror buildbot.

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

7 years ago[modules] Fix incorrect diagnostic mapping computation when a module changes
Richard Smith [Fri, 9 Feb 2018 01:15:13 +0000 (01:15 +0000)]
[modules] Fix incorrect diagnostic mapping computation when a module changes
diagnostic settings using _Pragma within a macro.

The AST writer had previously been assuming that all diagnostic state
transitions would occur within a FileID corresponding to a file. When a
diagnostic state change occured within a macro, it was unable to form a
location for that state change and would instead corrupt the diagnostic state
of the "root" node (and thus that of the main compilation).

Also introduce a "#pragma clang __debug diag_mapping" debugging utility
that I added to track this issue down.

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

7 years ago[WinEH] Put funclet bundles on inline asm calls
Reid Kleckner [Fri, 9 Feb 2018 00:16:41 +0000 (00:16 +0000)]
[WinEH] Put funclet bundles on inline asm calls

Summary:
Fixes PR36247, which is where WinEHPrepare replaces inline asm in
funclets with unreachable.

Make getBundlesForFunclet return by value to simplify some call sites.

Reviewers: smeenai, majnemer

Subscribers: eraman, cfe-commits

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

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

7 years agoFix UBSan issue with PPC::isValidCPUName
Erich Keane [Fri, 9 Feb 2018 00:13:49 +0000 (00:13 +0000)]
Fix UBSan issue with PPC::isValidCPUName

Apparently storing the pointer to a StringLiteral as
a StringRef caused this section of code to issue a ubsan
warning.  This will hopefully fix that.

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

7 years agoAdd size to constexpr Arrays
Erich Keane [Thu, 8 Feb 2018 23:49:40 +0000 (23:49 +0000)]
Add size to constexpr Arrays

What seems to be a bug in older versions of MSVC, constexpr
member arrays with a redefinition (to force emission) require
their initial definition to have the size between the brackets.

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

7 years ago[analyzer] MallocChecker: Fix one more bug category.
Artem Dergachev [Thu, 8 Feb 2018 23:28:29 +0000 (23:28 +0000)]
[analyzer] MallocChecker: Fix one more bug category.

Even though most of the inconsistencies in MallocChecker's bug categories were
fixed in r302016, one more was introduced in r301913 which was later missed.

Patch by Henry Wong!

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

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

7 years agoAdd Rest of Targets Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:55 +0000 (23:16 +0000)]
Add Rest of Targets Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978

Most of the rest of the Targets were pretty rote, so this
patch knocks them all out at once.

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

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

7 years agoAdd NVPTX Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:16:00 +0000 (23:16 +0000)]
Add NVPTX Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds NVPTX support for
enabling the march notes.

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

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

7 years agoAdd X86 Support to ValidCPUList (enabling march notes)
Erich Keane [Thu, 8 Feb 2018 23:15:02 +0000 (23:15 +0000)]
Add X86 Support to ValidCPUList (enabling march notes)

A followup to: https://reviews.llvm.org/D42978
This patch adds X86 and X86_64 support for
enabling the march notes.

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

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

7 years agoMake march/target-cpu print a note with the list of valid values for ARM
Erich Keane [Thu, 8 Feb 2018 23:14:15 +0000 (23:14 +0000)]
Make march/target-cpu print a note with the list of valid values for ARM

When rejecting a march= or target-cpu command line parameter,
the message is quite lacking. This patch adds a note that prints
all possible values for the current target, if the target supports it.

This adds support for the ARM/AArch64 targets (more to come!).

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

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

7 years ago[CFG] Add extra context to C++ constructor statement elements.
Artem Dergachev [Thu, 8 Feb 2018 22:58:15 +0000 (22:58 +0000)]
[CFG] Add extra context to C++ constructor statement elements.

This patch adds a new CFGStmt sub-class, CFGConstructor, which replaces
the regular CFGStmt with CXXConstructExpr in it whenever the CFG has additional
information to provide regarding what sort of object is being constructed.

It is useful for figuring out what memory is initialized in client of the
CFG such as the Static Analyzer, which do not operate by recursive AST
traversal, but instead rely on the CFG to provide all the information when they
need it. Otherwise, the statement that triggers the construction and defines
what memory is being initialized would normally occur after the
construct-expression, and the client would need to peek to the next CFG element
or use statement parent map to understand the necessary facts about
the construct-expression.

As a proof of concept, CFGConstructors are added for new-expressions
and the respective test cases are provided to demonstrate how it works.

For now, the only additional data contained in the CFGConstructor element is
the "trigger statement", such as new-expression, which is the parent of the
constructor. It will be significantly expanded in later commits. The additional
data is organized as an auxiliary structure - the "construction context",
which is allocated separately from the CFGElement.

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

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

7 years ago[analyzer] Self-debug: Dump the core's internal state traits to the egraph.
Artem Dergachev [Thu, 8 Feb 2018 22:32:38 +0000 (22:32 +0000)]
[analyzer] Self-debug: Dump the core's internal state traits to the egraph.

It is useful for debugging problems with C++ operator new() or temporaries.

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

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

7 years ago[analyzer] Self-debug: Dump environment frame-by-frame.
Artem Dergachev [Thu, 8 Feb 2018 22:24:38 +0000 (22:24 +0000)]
[analyzer] Self-debug: Dump environment frame-by-frame.

It makes it easier to discriminate between values of similar expressions
in different stack frames.

It also makes the separate backtrace section in ExplodedGraph dumps redundant.

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

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

7 years ago[analyzer] [tests] Test different projects concurrently
George Karpenkov [Thu, 8 Feb 2018 21:22:42 +0000 (21:22 +0000)]
[analyzer] [tests] Test different projects concurrently

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

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

7 years agoPR36307: Consume the #pragma options align annotation token after
Alex Lorenz [Thu, 8 Feb 2018 21:20:43 +0000 (21:20 +0000)]
PR36307: Consume the #pragma options align annotation token after
semantic analysis to prevent incorrect -Wpragma-pack warning for an included
file

rdar://37354951

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

7 years ago[X86] Replace kortest intrinsics with native IR.
Craig Topper [Thu, 8 Feb 2018 20:16:17 +0000 (20:16 +0000)]
[X86] Replace kortest intrinsics with native IR.

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

7 years agoFix improper indentation issue in CodeGenModule [NFC]
Erich Keane [Thu, 8 Feb 2018 20:04:22 +0000 (20:04 +0000)]
Fix improper indentation issue in CodeGenModule [NFC]

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

7 years agoFix crash on array initializer with non-0 alloca addrspace
Matt Arsenault [Thu, 8 Feb 2018 19:37:09 +0000 (19:37 +0000)]
Fix crash on array initializer with non-0 alloca addrspace

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

7 years ago[clang-format] Do not break Objective-C string literals inside array literals
Ben Hamilton [Thu, 8 Feb 2018 16:07:25 +0000 (16:07 +0000)]
[clang-format] Do not break Objective-C string literals inside array literals

Summary:
Concatenating Objective-C string literals inside an array literal
raises the warning -Wobjc-string-concatenation (which is enabled by default).

clang-format currently splits and concatenates string literals like
the following:

  NSArray *myArray = @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ];

into:

  NSArray *myArray =
        @[ @"aaaaaaaaaaaaaaaaaaaaaaaaaaaa"
           @"aaaaaaaaa" ];

which raises the warning. This is https://bugs.llvm.org/show_bug.cgi?id=36153 .

The options I can think of to fix this are:

1) Have clang-format disable Wobjc-string-concatenation by emitting
pragmas around the formatted code
2) Have clang-format wrap the string literals in a macro (which
disables the warning)
3) Disable string splitting for Objective-C string literals inside
array literals

I think 1) has no precedent, and I couldn't find a good
identity() macro for 2). So, this diff implements 3).

Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, stephanemoore, djasper

Reviewed By: jolesiak

Subscribers: klimek, cfe-commits

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

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

7 years ago[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo
Jan Korous [Thu, 8 Feb 2018 14:37:58 +0000 (14:37 +0000)]
[Parser][FixIt] Better diagnostics for "typedef" instead of "typename" typo

rdar://problem/10214588

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

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

7 years agoFix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.
Alexander Ivchenko [Thu, 8 Feb 2018 11:15:21 +0000 (11:15 +0000)]
Fix for #31362 - ms_abi is implemented incorrectly for values >=16 bytes.

Summary:
This patch is a fix for following issue:
https://bugs.llvm.org/show_bug.cgi?id=31362 The problem was caused by front end
lowering C calling conventions without taking into account calling conventions
enforced by attribute. In this case win64cc was no correctly lowered on targets
other than Windows.

Reviewed By: rnk (Reid Kleckner)

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

Author: belickim <mateusz.belicki@intel.com>

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

7 years ago[clang-format] Do not break before long string literals in protos
Krasimir Georgiev [Thu, 8 Feb 2018 10:47:12 +0000 (10:47 +0000)]
[clang-format] Do not break before long string literals in protos

Summary:
This patch is a follow-up to r323319 (which disables string literal breaking for
text protos) and it disables breaking before long string literals.

For example this:
```
keyyyyy: "long string literal"
```
used to get broken into:
```
keyyyyy:
    "long string literal"
```

While at it, I also enabled it for LK_Proto and fixed a bug in the mustBreak code.

Reviewers: djasper, sammccall

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[clang-format] Set ObjCBinPackProtocolList to Never for google style
Ben Hamilton [Thu, 8 Feb 2018 01:49:10 +0000 (01:49 +0000)]
[clang-format] Set ObjCBinPackProtocolList to Never for google style

Summary:
This is split off from D42650, and sets ObjCBinPackProtocolList
to Never for the google style.

Depends On D42650

Test Plan: New tests added. make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, jolesiak, stephanemoore

Reviewed By: krasimir, jolesiak, stephanemoore

Subscribers: klimek, cfe-commits, hokein, Wizard

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

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

7 years agoAdd a testcase for PR36268.
Rafael Espindola [Thu, 8 Feb 2018 01:17:26 +0000 (01:17 +0000)]
Add a testcase for PR36268.

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

7 years ago[NFCi] Replace a couple of usages of const StringRef& with StringRef
Erich Keane [Wed, 7 Feb 2018 23:04:38 +0000 (23:04 +0000)]
[NFCi] Replace a couple of usages of const StringRef& with StringRef

No sense passing these by reference when a copy is about as free, and
saves on potential indirection later.

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

7 years agoDon't try to use copy relocations with tls variables.
Rafael Espindola [Wed, 7 Feb 2018 23:04:06 +0000 (23:04 +0000)]
Don't try to use copy relocations with tls variables.

Should fix the lldb bot.

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

7 years agoPR36055: fix computation of *-dependence in nested initializer lists.
Richard Smith [Wed, 7 Feb 2018 22:25:16 +0000 (22:25 +0000)]
PR36055: fix computation of *-dependence in nested initializer lists.

When we synthesize an implicit inner initializer list when analyzing an outer
initializer list, we add it to the outer list immediately, and then fill in the
inner list. This gives the outer list no chance to update its *-dependence bits
with those of the completed inner list. To fix this, re-add the inner list to
the outer list once it's completed.

Note that we do not recompute the *-dependence bits from scratch when we
complete an outer list; this would give the wrong result for the case where a
designated initializer overwrites a dependent initializer with a non-dependent
one. The resulting list in that case should still be dependent, even though all
traces of the dependence were removed from the semantic form.

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

7 years agoRecommit r324107 again.
Rafael Espindola [Wed, 7 Feb 2018 22:15:33 +0000 (22:15 +0000)]
Recommit r324107 again.

The difference from the previous try is that we no longer directly
access function declarations from position independent executables. It
should work, but currently doesn't with some linkers.

It now includes a fix to not mark available_externally definitions as
dso_local.

Original message:

Start setting dso_local in clang.

This starts adding dso_local to clang.

The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go
away. My objective for now is to move enough of it to clang to remove
the need for the TargetMachine one to handle PIE copy relocations and
-fno-plt. With that it should then be easy to implement a
-fno-copy-reloc in clang.

This patch just adds the cases where we assume a symbol to be local
based on the file being compiled for an executable or a shared
library.

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

7 years ago[clang-import-test] Run clang-format, NFC
Vedant Kumar [Wed, 7 Feb 2018 21:17:22 +0000 (21:17 +0000)]
[clang-import-test] Run clang-format, NFC

I ran across clang-import-test while looking into testing for lldb.
There shouldn't be any harm in running clang-format over it.

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

7 years ago[PR36008] Avoid -Wsign-compare warning for enum constants in
Alex Lorenz [Wed, 7 Feb 2018 20:45:39 +0000 (20:45 +0000)]
[PR36008] Avoid -Wsign-compare warning for enum constants in
typeof expressions

This commit looks through typeof type at the original expression when diagnosing
-Wsign-compare to avoid an unfriendly diagnostic.

rdar://36588828

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

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

7 years agoRevert [DebugInfo] Improvements to representation of enumeration types (PR36168)"
Momchil Velikov [Wed, 7 Feb 2018 19:57:04 +0000 (19:57 +0000)]
Revert [DebugInfo] Improvements to representation of enumeration types (PR36168)"

Revert due to breaking buildbots (LLDB tests)

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

7 years ago[analyzer] [NFC] Factor out generating path diagnostics for a statement into a function
George Karpenkov [Wed, 7 Feb 2018 19:56:52 +0000 (19:56 +0000)]
[analyzer] [NFC] Factor out generating path diagnostics for a statement into a function

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

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

7 years agoRevert "Recommit r324107."
Rafael Espindola [Wed, 7 Feb 2018 19:44:15 +0000 (19:44 +0000)]
Revert "Recommit r324107."

This reverts commit r324500.

The bots found two failures:

    ThreadSanitizer-x86_64 :: Linux/pie_no_aslr.cc
    ThreadSanitizer-x86_64 :: pie_test.cc

when using gold. The issue is a limitation in gold when building pie
binaries. I will investigate how to work around it.

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

7 years agoFix r324498: the commit removed the '-' before the disable-llvm-verifier flag
Eric Fiselier [Wed, 7 Feb 2018 19:17:03 +0000 (19:17 +0000)]
Fix r324498: the commit removed the '-' before the disable-llvm-verifier flag

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

7 years agoRecommit r324107.
Rafael Espindola [Wed, 7 Feb 2018 19:16:49 +0000 (19:16 +0000)]
Recommit r324107.

It now includes a fix to not mark available_externally definitions as
dso_local.

Original message:

Start setting dso_local in clang.

This starts adding dso_local to clang.

The hope is to eventually have TargetMachine::shouldAssumeDsoLocal go
away. My objective for now is to move enough of it to clang to remove
the need for the TargetMachine one to handle PIE copy relocations and
-fno-plt. With that it should then be easy to implement a
-fno-copy-reloc in clang.

This patch just adds the cases where we assume a symbol to be local
based on the file being compiled for an executable or a shared
library.

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

7 years agoDon't pass ForDefinition_t in places it is redundant.
Rafael Espindola [Wed, 7 Feb 2018 19:04:41 +0000 (19:04 +0000)]
Don't pass ForDefinition_t in places it is redundant.

I found this while looking at the ppc failures caused by the dso_local
change.

The issue was that the patch would produce the wrong answer for
available_externally. Having ForDefinition_t available in places where
the code can just check the linkage is a bit of a foot gun.

This patch removes the ForDefiniton_t argument in places where the
linkage is already know.

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

7 years ago[Driver] Add option to manually control discarding value names in LLVM IR.
Eric Fiselier [Wed, 7 Feb 2018 18:36:51 +0000 (18:36 +0000)]
[Driver] Add option to manually control discarding value names in LLVM IR.

Summary:
Currently, assertion-disabled Clang builds emit value names when generating LLVM IR. This is controlled by the `NDEBUG` macro, and is not easily overridable. In order to get IR output containing names from a release build of Clang, the user must manually construct the CC1 invocation w/o the `-discard-value-names` option. This is less than ideal.

For example, Godbolt uses a release build of Clang, and so when asked to emit LLVM IR the result lacks names, making it harder to read. Manually invoking CC1 on Compiler Explorer is not feasible.

This patch adds the driver options `-fdiscard-value-names` and `-fno-discard-value-names` which allow the user to override the default behavior. If neither is specified, the old behavior remains.

Reviewers: erichkeane, aaron.ballman, lebedev.ri

Reviewed By: aaron.ballman

Subscribers: bogner, cfe-commits

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

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

7 years ago[DebugInfo] Improvements to representation of enumeration types (PR36168)
Momchil Velikov [Wed, 7 Feb 2018 16:52:02 +0000 (16:52 +0000)]
[DebugInfo] Improvements to representation of enumeration types (PR36168)

This patch:

* fixes an incorrect sign-extension of unsigned values, when emitting
  debug info metadata for enumerators
* the enumerators metadata is created with a flag, which determines
  interpretation of the value bits (signed or unsigned)
* the enumerations metadata contains the underlying integer type and a
  flag, indicating whether this is a C++ "fixed enum"

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

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

7 years ago[clang-format] Fix ObjC message arguments formatting.
Jacek Olesiak [Wed, 7 Feb 2018 10:35:08 +0000 (10:35 +0000)]
[clang-format] Fix ObjC message arguments formatting.

Summary:
Fixes formatting of ObjC message arguments when inline block is a first
argument.

Having inline block as a first argument when method has multiple parameters is
discouraged by Apple:
"It’s best practice to use only one block argument to a method. If the
method also needs other non-block arguments, the block should come last"
(https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/ProgrammingWithObjectiveC/WorkingwithBlocks/WorkingwithBlocks.html#//apple_ref/doc/uid/TP40011210-CH8-SW7),
it should be correctly formatted nevertheless.

Current formatting:
```
[object blockArgument:^{
  a = 42;
}
    anotherArg:42];
```

Fixed (colon alignment):
```
[object
  blockArgument:^{
    a = 42;
  }
     anotherArg:42];
```

Test Plan: make -j12 FormatTests && tools/clang/unittests/Format/FormatTests

Reviewers: krasimir, benhamilton

Reviewed By: krasimir, benhamilton

Subscribers: benhamilton, klimek, cfe-commits

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

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

7 years agoAST: support SwiftCC on MS ABI
Saleem Abdulrasool [Wed, 7 Feb 2018 01:55:08 +0000 (01:55 +0000)]
AST: support SwiftCC on MS ABI

Microsoft has reserved the identifier 'S' as the swift calling
convention.  Decorate the symbols appropriately.  This enables swift on
Windows.

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

7 years agoSupport `#pragma comment(lib, "name")` in the frontend for ELF
Saleem Abdulrasool [Wed, 7 Feb 2018 01:46:46 +0000 (01:46 +0000)]
Support `#pragma comment(lib, "name")` in the frontend for ELF

This adds the frontend support required to support the use of the
comment pragma to enable auto linking on ELFish targets. This is a
generic ELF extension supported by LLVM. We need to change the handling
for the "dependentlib" in order to accommodate the previously discussed
encoding for the dependent library descriptor. Without the custom
handling of the PCK_Lib directive, the -l prefixed option would be
encoded into the resulting object (which is treated as a frontend
error).

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

7 years ago[NFC] Change odd cast-through-unknown behavior to an Optional
Erich Keane [Wed, 7 Feb 2018 00:37:19 +0000 (00:37 +0000)]
[NFC] Change odd cast-through-unknown behavior to an Optional

This bit of code in the driver uses '~0U' as a sentinel value.
The result is an odd mishmash of casts just to work.  This replaces
it with an optional,  which is a little less crazy looking.
--ehis line, and those below, will be ignored--

M    lib/Driver/Driver.cpp

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