]> granicus.if.org Git - clang/log
clang
7 years agoWarning-free clang-format plugin install for VS 15.0
Hans Wennborg [Thu, 13 Apr 2017 17:42:45 +0000 (17:42 +0000)]
Warning-free clang-format plugin install for VS 15.0

With the new release of VS, it's required that all plugins migrate to
the new VSIX manifest format. The new format is backwards compatible
with all versions newer that Visual Studio 2012, so this migration
effectively drops support for older versions of the IDE.

It's also required that these new extensions are built with Visual
Studio 2017, so unfortunately it was necessary to migrate the project
and solution. Also removed COM references to EnvDTE and
Microsoft.VisualStudio.TextManager.Interop from the csproj, as they seem
to both be unnecessary and would trigger build warnings because of
changes to GAC.

Patch by Hugo Puhlmann!

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

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

7 years agoclang-format-vs: Use a separate license.txt copy
Hans Wennborg [Thu, 13 Apr 2017 17:37:17 +0000 (17:37 +0000)]
clang-format-vs: Use a separate license.txt copy

The regular file used to display very poorly in the VSIX installer due
to long lines, wrapping etc.

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

7 years agoUse the clang-cl recognized spelling of --target=
Reid Kleckner [Thu, 13 Apr 2017 16:36:28 +0000 (16:36 +0000)]
Use the clang-cl recognized spelling of --target=

This fixes a warning. The test was passing without this change.

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

7 years agoRe-land "[clang-cl] Make all sanitizer flags available in clang-cl"
Reid Kleckner [Thu, 13 Apr 2017 16:32:26 +0000 (16:32 +0000)]
Re-land "[clang-cl] Make all sanitizer flags available in clang-cl"

Adding RUN lines with %clang_cl was causing these tests to fail on Mac
because absolute paths there tend to start with "/User/", which is
recognized as the "/U" flag.

Re-lands r300122

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

7 years ago[analyzer] Enforce super-region classes for various memory regions.
Artem Dergachev [Thu, 13 Apr 2017 09:56:07 +0000 (09:56 +0000)]
[analyzer] Enforce super-region classes for various memory regions.

We now check the type of the super-region pointer for most SubRegion classes
in compile time; some checks are run-time though.

This is an API-breaking change (we now require explicit casts to specific region
sub-classes), but in practice very few checkers are affected.

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

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

7 years ago[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.
Artem Dergachev [Thu, 13 Apr 2017 09:48:05 +0000 (09:48 +0000)]
[analyzer] Add numerous assertions to SVal, SymExpr, and MemRegion classes.

Clean up vtable anchors (remove anchors for regions that have regular
out-of-line virtual methods, add anchors for regions that don't have those).

Fix private/public methods (all constructors should now be private for leaf
classes, protected for abstract classes).

No functional change intended, only extra sanity checks and cleanups.

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

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

7 years agoRevert "[clang-cl] Make all sanitizer flags available in clang-cl"
Akira Hatanaka [Thu, 13 Apr 2017 08:02:29 +0000 (08:02 +0000)]
Revert "[clang-cl] Make all sanitizer flags available in clang-cl"

This reverts commit 47979b20b475664013d19382fc6875b5b9f3ed9d.

This was causing a couple of bots to fail.

http://lab.llvm.org:8080/green/job/clang-stage1-configure-RA_check/30152

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

7 years ago[analyzer] Simplify values in binary operations a bit more aggressively.
Artem Dergachev [Thu, 13 Apr 2017 07:20:04 +0000 (07:20 +0000)]
[analyzer] Simplify values in binary operations a bit more aggressively.

SValBuilder tries to constant-fold symbols in the left-hand side of the symbolic
expression whenever it fails to evaluate the expression directly. However, it
only constant-folds them when they are atomic expressions, not when they are
complicated expressions themselves. This patch adds recursive constant-folding
to the left-hand side subexpression (there's a lack of symmetry because we're
trying to have symbols on the left and constants on the right). As an example,
we'd now be able to handle operations similar to "$x + 1 < $y", when $x is
constrained to a constant.

rdar://problem/31354676

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

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

7 years ago[IR] Take func, ret, and arg attrs separately in AttributeList::get
Reid Kleckner [Thu, 13 Apr 2017 00:58:09 +0000 (00:58 +0000)]
[IR] Take func, ret, and arg attrs separately in AttributeList::get

This seems like a much more natural API, based on Derek Schuff's
comments on r300015. It further hides the implementation detail of
AttributeList that function attributes come last and appear at index
~0U, which is easy for the user to screw up. git diff says it saves code
as well: 97 insertions(+), 137 deletions(-)

This also makes it easier to change the implementation, which I want to
do next.

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

7 years agoFix broken test. We can't assume that 2MB of args is enough to require a response...
Richard Smith [Thu, 13 Apr 2017 00:46:50 +0000 (00:46 +0000)]
Fix broken test. We can't assume that 2MB of args is enough to require a response file.

This test has apparently been broken for years, but we never noticed before
because it's a long test and long tests approximately never get run.

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

7 years agoExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]
NAKAMURA Takumi [Thu, 13 Apr 2017 00:17:28 +0000 (00:17 +0000)]
ExternalASTMerger.cpp: Silence another warning. [-Wunused-lambda-capture]

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

7 years agoUpdate to match LLVM r300135.
Richard Smith [Wed, 12 Apr 2017 23:21:25 +0000 (23:21 +0000)]
Update to match LLVM r300135.

Remove "REQUIRES: long_tests" from test/Driver/response-file.c since it is now about 10x faster. (We can add that back if it's still too slow for some buildbot.)

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

7 years ago[clang-cl] Make all sanitizer flags available in clang-cl
Reid Kleckner [Wed, 12 Apr 2017 22:50:51 +0000 (22:50 +0000)]
[clang-cl] Make all sanitizer flags available in clang-cl

Summary:
Use a tablegen let {} block so that new sanitizer flags are available by
default in all driver modes. This should cut down on time wasted with
bugs like http://crbug.com/710928.

Reviewers: vitalybuka, hans

Subscribers: kcc, llvm-commits

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

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

7 years ago[Sema] Add __is_aggregate type-trait
Eric Fiselier [Wed, 12 Apr 2017 22:12:15 +0000 (22:12 +0000)]
[Sema] Add __is_aggregate type-trait

Summary:
[LWG 2911](http://cplusplus.github.io/LWG/lwg-defects.html#2911) adds `std::is_aggregate` to the library, which requires a new builtin trait. This patch implements `__is_aggregate`.

Reviewers: rsmith, majnemer, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: STL_MSFT, cfe-commits

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

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

7 years ago[analyzer] Add a check for IvarRegion in getExtraInvalidatedValues
Alexander Shaposhnikov [Wed, 12 Apr 2017 22:00:13 +0000 (22:00 +0000)]
[analyzer] Add a check for IvarRegion in getExtraInvalidatedValues

This diff adds a defensive check in getExtraInvalidatedValues
for the case when there are no regions for the ivar associated with
a property. Corresponding test case added.

Test plan:
make check-clang
make check-clang-analysis

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

7 years ago[modules] Delay calling DeclMustBeEmitted until it's safe.
Vassil Vassilev [Wed, 12 Apr 2017 21:56:05 +0000 (21:56 +0000)]
[modules] Delay calling DeclMustBeEmitted until it's safe.

This patch implements the suggestion in D29753 that calling DeclMustBeEmitted in
the middle of deserialization should be avoided and that the actual check should
be deferred until it's safe to do so.

This patch fixes a crash when accessing the invalid redecl chains while trying
to evaluate the value of a const VarDecl that contains a function call.

Patch by Raphael Isemann (D30793)!

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

7 years ago[Driver] Add compiler option to generate a reproducer
Bruno Cardoso Lopes [Wed, 12 Apr 2017 21:46:20 +0000 (21:46 +0000)]
[Driver] Add compiler option to generate a reproducer

One way to currently test the reproducers is to setup
"FORCE_CLANG_DIAGNOSTICS_CRASH=1" before invoking clang. This simulates
a crash and produces the same contents needed by the reproducers.  The
reproducers are specially useful when triaging Modules issues, not only
on crashes, but also for reproducing misleading warnings, errors, etc.

Add a '-gen-reproducer' driver option to clang (or any similar name) and
give users a flag option.

Note that clang already has a -fno-crash-diagnostics, which disables the
crash reproducers. I've decided not to propose "-fcrash-diagnostics"
since it doesn't convey the ideia of reproduction despite a crash.

rdar://problem/24114619

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

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

7 years ago[Modules] Enable local submodule visibility for ObjC/C
Bruno Cardoso Lopes [Wed, 12 Apr 2017 21:46:16 +0000 (21:46 +0000)]
[Modules] Enable local submodule visibility for ObjC/C

Remove the restriction where this is only valid with C++

rdar://problem/29055656

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

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

7 years agoModular Codegen: Include testing for inline asm as well as some commentary on the...
David Blaikie [Wed, 12 Apr 2017 21:14:04 +0000 (21:14 +0000)]
Modular Codegen: Include testing for inline asm as well as some commentary on the implementaiton choice.

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

7 years agoFix up test to handle the now split -fmodules-codegen and -fmodules-debuginfo flags
David Blaikie [Wed, 12 Apr 2017 21:09:34 +0000 (21:09 +0000)]
Fix up test to handle the now split -fmodules-codegen and -fmodules-debuginfo flags

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

7 years agoModular Codegen: Separate flags for function and debug info support
David Blaikie [Wed, 12 Apr 2017 20:58:33 +0000 (20:58 +0000)]
Modular Codegen: Separate flags for function and debug info support

This allows using and testing these two features separately. (noteably,
debug info is, so far as I know, always a win (basically). But function
modular codegen is currently a loss for highly optimized code - where
most of the linkonce_odr definitions are optimized away, so providing
weak_odr definitions is only overhead)

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

7 years agoRevert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"
Hans Wennborg [Wed, 12 Apr 2017 16:40:26 +0000 (16:40 +0000)]
Revert r300001 "Revert r298824 & r298816, recommit r298742 & r298754"

It caused PR32640.

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

7 years agoMoving a C++ test out of Sema and into SemaCXX; NFC.
Aaron Ballman [Wed, 12 Apr 2017 15:56:02 +0000 (15:56 +0000)]
Moving a C++ test out of Sema and into SemaCXX; NFC.

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

7 years ago[x86] fix AVX FP cmp intrinsic documentation (PR28110)
Sanjay Patel [Wed, 12 Apr 2017 15:19:08 +0000 (15:19 +0000)]
[x86] fix AVX FP cmp intrinsic documentation (PR28110)

This copies the text used in the #define statements to the code comments.
The conflicting text comes from AMD manuals, but those are wrong. Sadly,
that FP cmp text has not been updated even after some docs were updated
for Zen:
http://support.amd.com/en-us/search/tech-docs
( AMD64 Architecture Programmer's Manual Volume 4 )

See PR28110 for more discussion:
https://bugs.llvm.org/show_bug.cgi?id=28110

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

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

7 years agoAdd support for __builtin_available to __has_builtin
Alex Lorenz [Wed, 12 Apr 2017 11:03:25 +0000 (11:03 +0000)]
Add support for __builtin_available to __has_builtin

rdar://31576715

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

7 years agoRangify for loop, NFC.
Yaron Keren [Wed, 12 Apr 2017 10:05:48 +0000 (10:05 +0000)]
Rangify for loop, NFC.

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

7 years agoRemove Sema::addOverloadedOperatorToUnresolvedSet declaration. Its definition was...
Yaron Keren [Wed, 12 Apr 2017 08:17:44 +0000 (08:17 +0000)]
Remove Sema::addOverloadedOperatorToUnresolvedSet declaration. Its definition was removed in r206436.

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

7 years agoUpdate Clang for an API change to LLVM's switch case iterator (it is now
Chandler Carruth [Wed, 12 Apr 2017 08:12:30 +0000 (08:12 +0000)]
Update Clang for an API change to LLVM's switch case iterator (it is now
an actual iterator and so we need to look through it to the case
handle).

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

7 years ago[Modules] Remove darwin specific code to check for SystemVersion.plist
Bruno Cardoso Lopes [Wed, 12 Apr 2017 04:49:00 +0000 (04:49 +0000)]
[Modules] Remove darwin specific code to check for SystemVersion.plist

This isn't need anymore and modules options -fbuild-session-file and
-fmodules-validate-once-per-build-session already provide a sane
mechanism to validate the system headers.

rdar://problem/19767523

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

7 years agoSerialization: Simulate -Werror settings in implicit modules
Duncan P. N. Exon Smith [Wed, 12 Apr 2017 03:58:58 +0000 (03:58 +0000)]
Serialization: Simulate -Werror settings in implicit modules

r293123 started serializing diagnostic pragma state for modules.  This
makes the serialization work properly for implicit modules.

An implicit module build (using Clang's internal build system) uses the
same PCM file location for different `-Werror` levels.

E.g., if a TU has `-Werror=format` and tries to load a PCM built without
`-Werror=format`, a new PCM will be built in its place (and the new PCM
should have the same signature, since r297655).  In the other direction,
if a TU does not have `-Werror=format` and tries to load a PCM built
with `-Werror=format`, it should "just work".

The idea is to evolve the PCM toward the strictest -Werror flags that
anyone tries.

r293123 started serializing the diagnostic pragma state for each PCM.
Since this encodes the -Werror settings at module-build time, it breaks
the implicit build model.

This commit filters the diagnostic state in order to simulate the
current compilation's diagnostic settings.  Firstly, it ignores the
module's serialized first diagnostic state, replacing it with the state
from this compilation's command-line.  Secondly, if a pragma warning was
upgraded to error/fatal when generating the PCM (e.g., due to `-Werror`
on the command-line), it checks whether it should still be upgraded in
its current context.

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

7 years agoSerialization: Emit the final diagnostic state last, almost NFC
Duncan P. N. Exon Smith [Wed, 12 Apr 2017 03:45:32 +0000 (03:45 +0000)]
Serialization: Emit the final diagnostic state last, almost NFC

Emit the final diagnostic state last to match source order.  This also
prepares for a follow-up commit for implicit modules.

There's no real functionaliy change, just a slightly different AST file
format.

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

7 years agoSerialization: Skip check in WritePragmaDiagnosticMappings, NFC
Duncan P. N. Exon Smith [Wed, 12 Apr 2017 02:31:17 +0000 (02:31 +0000)]
Serialization: Skip check in WritePragmaDiagnosticMappings, NFC

The record is never empty, since we always serialize the initial state.
Skip the check.

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

7 years ago[IR] Add AttributeSet to hide AttributeSetNode* again, NFC
Reid Kleckner [Wed, 12 Apr 2017 00:38:00 +0000 (00:38 +0000)]
[IR] Add AttributeSet to hide AttributeSetNode* again, NFC

Summary:
For now, it just wraps AttributeSetNode*. Eventually, it will hold
AvailableAttrs as an inline bitset, and adding and removing enum
attributes will be super cheap.

This sinks AttributeSetNode back down to lib/IR/AttributeImpl.h.

Reviewers: pete, chandlerc

Subscribers: llvm-commits, jfb

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

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

7 years agoSilence unused variable warning in release builds.
Benjamin Kramer [Tue, 11 Apr 2017 23:06:49 +0000 (23:06 +0000)]
Silence unused variable warning in release builds.

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

7 years agoRevert r298824 & r298816, recommit r298742 & r298754
Richard Trieu [Tue, 11 Apr 2017 22:32:03 +0000 (22:32 +0000)]
Revert r298824 & r298816, recommit r298742 & r298754

r299989 fixes the underlying issue by waiting long enough to late parsed
arguments to be processed before doing an calculating the hash.

r298742
[ODRHash] Add error messages for mismatched parameters in methods.

r298754
[ODRHash] Add support for array and decayed types.

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

7 years ago[Sema][ObjC] Check whether a variable has a definition, rather than
Akira Hatanaka [Tue, 11 Apr 2017 22:01:33 +0000 (22:01 +0000)]
[Sema][ObjC] Check whether a variable has a definition, rather than
checking its storage class, when determining whether casting a C pointer
to an ObjC pointer is allowed.

This change allows casting variables whose declarations are directly
contained in a linkage specification to an ObjC pointer type. Those
variables are treated as if they contain the extern specifier for the
purpose of determining whether they are definitions or not.

rdar://problem/29249853

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

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

7 years ago[ODRHash] Improve handling of hash values
Richard Trieu [Tue, 11 Apr 2017 21:31:00 +0000 (21:31 +0000)]
[ODRHash] Improve handling of hash values

Calculating the hash in Sema::ActOnTagFinishDefinition could happen before
all sub-Decls were parsed or processed, which would produce the wrong hash
value.  Change to calculating the hash on the first use and storing the value
instead.  Also, avoid using the macros that were only for Boolean fields and
use an explicit checker during the DefintionData merge.  No functional change,
but was this blocking other ODRHash patches.

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

7 years agoModular Codegen: Support homing debug info for types in modular objects
David Blaikie [Tue, 11 Apr 2017 21:13:37 +0000 (21:13 +0000)]
Modular Codegen: Support homing debug info for types in modular objects

Matching the function-homing support for modular codegen. Any type
implicitly (implicit template specializations) or explicitly defined in
a module is attached to that module's object file and omitted elsewhere
(only a declaration used if necessary for references).

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

7 years ago[ExternalASTMerger] Removed a move constructor to address MSVC build failure
Sean Callanan [Tue, 11 Apr 2017 20:51:21 +0000 (20:51 +0000)]
[ExternalASTMerger] Removed a move constructor to address MSVC build failure

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

7 years agoModular Codegen: Add/use a bit in serialized function definitions to track whether...
David Blaikie [Tue, 11 Apr 2017 20:46:34 +0000 (20:46 +0000)]
Modular Codegen: Add/use a bit in serialized function definitions to track whether they are the subject of modular codegen

Some decls are created not where they are written, but in other module
files/users (implicit special members and function template implicit
specializations). To correctly identify them, use a bit next to the definition
to track the modular codegen property.

Discussed whether the module file bit could be omitted in favor of
reconstituting from the modular codegen decls list - best guess today is that
the efficiency improvement of not having to deserialize the whole list whenever
any function is queried by a module user is worth it for the small size
increase of this redundant (list + bit-on-def) representation.

Reviewers: rsmith

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

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

7 years agoAdd const children() accessors to match the existing non-const children() accessors.
Aaron Ballman [Tue, 11 Apr 2017 20:21:30 +0000 (20:21 +0000)]
Add const children() accessors to match the existing non-const children() accessors.

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

7 years ago[ExternalASTMerger] Fix the MSVC build
Sean Callanan [Tue, 11 Apr 2017 19:50:37 +0000 (19:50 +0000)]
[ExternalASTMerger] Fix the MSVC build

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

7 years ago[clang-import-test] Lookup inside contexts
Sean Callanan [Tue, 11 Apr 2017 19:33:35 +0000 (19:33 +0000)]
[clang-import-test] Lookup inside contexts

clang-import-test has until now been only able to report top-level Decls.
This is clearly insufficient; we should be able to look inside structs
and namespaces also.  This patch adds new test cases for a variety of
lookups inside existing ASTContexts, and adds the functionality necessar
to make most of these testcases work.  (One testcase is known to fail
because of ASTImporter limitations when importing templates; I'll look
into that separately.)

This patch also separates the core functionality out into
ExternalASTMerger, an interface that allows clients like LLDB to make
use of it.  clang-import-test now only has the machinery necessary to
set up the tests.

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

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

7 years ago[OpenCL] Map default address space to alloca address space
Yaxun Liu [Tue, 11 Apr 2017 17:24:23 +0000 (17:24 +0000)]
[OpenCL] Map default address space to alloca address space

For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier
is always mapped to target address space 0. As now target private address space is specified by
alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.

With contributions from Matt Arsenault, Tony Tye and Wen-Heng (Jack) Chung

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

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

7 years ago[ASTPrinter] Print nested name specifiers for out-of-line functions
Alex Lorenz [Tue, 11 Apr 2017 16:46:03 +0000 (16:46 +0000)]
[ASTPrinter] Print nested name specifiers for out-of-line functions

rdar://31501863

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

7 years agoRevert temporarily D29877 "Warn about unused static file scope function template...
Vassil Vassilev [Tue, 11 Apr 2017 16:05:23 +0000 (16:05 +0000)]
Revert temporarily D29877 "Warn about unused static file scope function template declarations."

We need to address cases (breaking libc++) such as

template <class _Up> static int __test(...);

template<typename _Tp>
auto v = __test<_Tp>(0);

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

7 years ago[clang-format] Recognize Java logical shift assignment operator
Nico Weber [Tue, 11 Apr 2017 15:50:04 +0000 (15:50 +0000)]
[clang-format] Recognize Java logical shift assignment operator

At present, clang-format mangles Java containing logical right shift operators
('>>>=' or '>>>'), splitting them in two, resulting in invalid code:

 public class Minimal {
   public void func(String args) {
     int i = 42;
-    i >>>= 1;
+    i >> >= 1;
     return i;
   }
 }

This adds both forms of logical right shift to the FormatTokenLexer, so
clang-format won't attempt to split them and insert bogus whitespace.

https://reviews.llvm.org/D31652
Patch from Richard Bradfield <bradfier@fstab.me>!

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

7 years agoFix PR13910: Don't warn that __builtin_unreachable() is unreachable
Alex Lorenz [Tue, 11 Apr 2017 15:36:06 +0000 (15:36 +0000)]
Fix PR13910: Don't warn that __builtin_unreachable() is unreachable

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

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

7 years ago[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
Alex Lorenz [Tue, 11 Apr 2017 15:01:53 +0000 (15:01 +0000)]
[Parser][ObjC++] Improve diagnostics and recovery when C++ keywords are used
as identifiers in Objective-C++

This commit improves the 'expected identifier' errors that are presented when a
C++ keyword is used as an identifier in Objective-C++ by mentioning that this is
a C++ keyword in the diagnostic message. It also improves the error recovery:
the parser will now treat the C++ keywords as identifiers to prevent unrelated
parsing errors.

rdar://20626062

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

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

7 years agoWarn about unused static file scope function template declarations.
Vassil Vassilev [Tue, 11 Apr 2017 10:13:54 +0000 (10:13 +0000)]
Warn about unused static file scope function template declarations.

Reviewed by Richard Smith (D29877)!

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

7 years ago[clang-format] Handle NSString literals by merging tokens.
Alexander Kornienko [Tue, 11 Apr 2017 09:55:00 +0000 (09:55 +0000)]
[clang-format] Handle NSString literals by merging tokens.

Summary:
This fixes a few outstanding bugs:
  * incorrect breaking of NSString literals containing double-width characters;
  * inconsistent formatting of ObjC dictionary literals containing NSString
    literals;
  * AlwaysBreakBeforeMultilineStrings ignoring implicitly-concatenated NSString
    literals.

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[lsan] Enable LSan on arm Linux, clang part
Maxim Ostapenko [Tue, 11 Apr 2017 07:22:11 +0000 (07:22 +0000)]
[lsan] Enable LSan on arm Linux, clang part

This is a compiler part of https://reviews.llvm.org/D29586. Enable LSan on arm Linux.

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

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

7 years agoAdd more examples to clang-format configuration
Sylvestre Ledru [Tue, 11 Apr 2017 07:07:05 +0000 (07:07 +0000)]
Add more examples to clang-format configuration

Reviewers: djasper

Reviewed By: djasper

Subscribers: Eugene.Zelenko, klimek, cfe-commits

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

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

7 years agodocs: Use the term "whole-program devirtualization" instead of "virtual function...
Peter Collingbourne [Mon, 10 Apr 2017 23:54:28 +0000 (23:54 +0000)]
docs: Use the term "whole-program devirtualization" instead of "virtual function call optimization".

The former term is probably more familiar to users. Also add references to
the command line flags used to enable the features described in the doc.

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

7 years agoReland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"
Reid Kleckner [Mon, 10 Apr 2017 23:31:05 +0000 (23:31 +0000)]
Reland "[IR] Make AttributeSetNode public, avoid temporary AttributeList copies"

This re-lands r299875.

I introduced a bug in Clang code responsible for replacing K&R, no
prototype declarations with a real function definition with a prototype.
The bug was here:

       // Collect any return attributes from the call.
  -    if (oldAttrs.hasAttributes(llvm::AttributeList::ReturnIndex))
  -      newAttrs.push_back(llvm::AttributeList::get(newFn->getContext(),
  -                                                  oldAttrs.getRetAttributes()));
  +    newAttrs.push_back(oldAttrs.getRetAttributes());

Previously getRetAttributes() carried AttributeList::ReturnIndex in its
AttributeList. Now that we return the AttributeSetNode* directly, it no
longer carries that index, and we call this overload with a single node:
  AttributeList::get(LLVMContext&, ArrayRef<AttributeSetNode*>)

That aborted with an assertion on x86_32 targets. I added an explicit
triple to the test and added CHECKs to help find issues like this in the
future sooner.

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

7 years agoUpdate for AllocaInst construction changes
Matt Arsenault [Mon, 10 Apr 2017 22:28:02 +0000 (22:28 +0000)]
Update for AllocaInst construction changes

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

7 years agoUpdate for lifetime intrinsic signature change
Matt Arsenault [Mon, 10 Apr 2017 20:18:45 +0000 (20:18 +0000)]
Update for lifetime intrinsic signature change

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

7 years ago[OPENMP] Fix for PR32333: Crash in call of outlined Function.
Alexey Bataev [Mon, 10 Apr 2017 19:16:45 +0000 (19:16 +0000)]
[OPENMP] Fix for PR32333: Crash in call of outlined Function.

If the type of the captured variable is a pointer(s) to variably
modified type, this type was not processed correctly. Need to drill into
the type, find the innermost variably modified array type and convert it
to canonical parameter type.

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

7 years ago[cmake] Support Gentoo install for z3
Michal Gorny [Sat, 8 Apr 2017 14:38:06 +0000 (14:38 +0000)]
[cmake] Support Gentoo install for z3

Add the 'z3' subdirectory to the list of possible path suffixes for
libz3 header search. The z3 headers are installed in /usr/include/z3
on Gentoo.

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

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

7 years ago[cfi] Emit __cfi_check stub in the frontend.
Evgeniy Stepanov [Fri, 7 Apr 2017 23:00:38 +0000 (23:00 +0000)]
[cfi] Emit __cfi_check stub in the frontend.

Previously __cfi_check was created in LTO optimization pipeline, which
means LLD has no way of knowing about the existence of this symbol
without rescanning the LTO output object. As a result, LLD fails to
export __cfi_check, even when given --export-dynamic-symbol flag.

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

7 years agoToolchains: remove crtbegin on xwindows
Saleem Abdulrasool [Fri, 7 Apr 2017 20:47:06 +0000 (20:47 +0000)]
Toolchains: remove crtbegin on xwindows

crtbegin is not really a proper windows support thing.  This was
duplicated when the toolchain was initially built.  If the injection of
crtbegin is needed, it can be done via the `/include` directive.
Furthermore, since `-fPIC` doesnt make sense on PE/COFF, crtbegin and
crtbeginS dont really need to be different.

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

7 years agoAttempt to fix ms-intrinsics.c test
Hans Wennborg [Fri, 7 Apr 2017 17:01:56 +0000 (17:01 +0000)]
Attempt to fix ms-intrinsics.c test

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

7 years agoImplement _interlockedbittestandset as a builtin
Hans Wennborg [Fri, 7 Apr 2017 16:41:47 +0000 (16:41 +0000)]
Implement _interlockedbittestandset as a builtin

It's used by MS headers in VS 2017 without including intrin.h, so we
can't implement it in the header anymore.

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

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

7 years agoSema: prevent __declspec(naked) use on x64
Saleem Abdulrasool [Fri, 7 Apr 2017 15:13:47 +0000 (15:13 +0000)]
Sema: prevent __declspec(naked) use on x64

MSDN (https://msdn.microsoft.com/en-us/library/h5w10wxs.aspx) indicates
that `__declspec(naked)` is only permitted on x86 and ARM targets.
Testing with cl does confirm this behaviour.  Provide a warning for use
of `__declspec(naked)` on x64.

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

7 years agoCloneDetection.h: Fix warnings. [-Wdocumentation]
NAKAMURA Takumi [Fri, 7 Apr 2017 11:06:31 +0000 (11:06 +0000)]
CloneDetection.h: Fix warnings. [-Wdocumentation]

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

7 years ago[scan-build-py] merge runner module to analyzer
Laszlo Nagy [Fri, 7 Apr 2017 11:04:49 +0000 (11:04 +0000)]
[scan-build-py] merge runner module to analyzer

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

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

7 years agoSkip Unicode character expansion in assembly files
Sanne Wouda [Fri, 7 Apr 2017 10:13:00 +0000 (10:13 +0000)]
Skip Unicode character expansion in assembly files

Summary: When using the C preprocessor with assembly files, either with a
capital `S` file extension, or with `-xassembler-with-cpp`, the Unicode escape
sequence `\u` is ignored. The `\u` pattern can be used for expanding a macro
argument that starts with `u`.

Author: Salman Arif <salman.arif@arm.com>

Reviewers: rengolin, olista01

Reviewed By: olista01

Subscribers: cfe-commits

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

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

7 years ago[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address...
Yaxun Liu [Thu, 6 Apr 2017 19:18:36 +0000 (19:18 +0000)]
[AMDGPU] Temporarily change constant address space from 4 to 2 for the new address space mapping

Change constant address space from 4 to 2 for the new address space mapping in Clang.

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

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

7 years ago[Basic] getColumnNumber returns location of CR+LF on Windows
Chih-Hung Hsieh [Thu, 6 Apr 2017 18:36:50 +0000 (18:36 +0000)]
[Basic] getColumnNumber returns location of CR+LF on Windows

When fixing a Clang-Tidy bug in D31406,
reuse of FileID enabled the missing highlightRange function.
Assertion in highlightRange failed because the end-of-range column
number was 2 + the last column of a line on Windows.
This fix is required to enable D31406.

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

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

7 years ago[AMDGPU] Translate reqd_work_group_size into amdgpu_flat_work_group_size
Stanislav Mekhanoshin [Thu, 6 Apr 2017 18:15:44 +0000 (18:15 +0000)]
[AMDGPU] Translate reqd_work_group_size into amdgpu_flat_work_group_size

These two attributes specify the same info in a different way.
AMGPU BE only checks the latter as a target specific attribute
as opposed to language specific reqd_work_group_size.

This change produces amdgpu_flat_work_group_size out of
reqd_work_group_size if specified.

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

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

7 years agoFix unused lambda capture. Follow up to r299653.
Ivan Krasin [Thu, 6 Apr 2017 17:42:05 +0000 (17:42 +0000)]
Fix unused lambda capture. Follow up to r299653.

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

7 years ago[analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector"
Artem Dergachev [Thu, 6 Apr 2017 14:34:07 +0000 (14:34 +0000)]
[analyzer] Reland r299544 "Add a modular constraint system to the CloneDetector"

Hopefully fix crashes by unshadowing the variable.

Original commit message:

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

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

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

7 years agoAvoid the -Wdocumentation-unknown-command warning in Clang's C API docs
Alex Lorenz [Thu, 6 Apr 2017 14:03:25 +0000 (14:03 +0000)]
Avoid the -Wdocumentation-unknown-command warning in Clang's C API docs

rdar://20441985

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

7 years ago[ObjC++] Conversions from specialized to non-specialized Objective-C generic
Alex Lorenz [Thu, 6 Apr 2017 13:06:34 +0000 (13:06 +0000)]
[ObjC++] Conversions from specialized to non-specialized Objective-C generic
object types should be preferred over conversions to other object pointers

This change ensures that Clang will select the correct overload for the
following code sample:

  void overload(Base *b);
  void overload(Derived *d);
  void test(Base<Base *> b) {
    overload(b); // Select overload(Base *), not overload(Derived *)
  }

rdar://20124827

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

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

7 years agoFix lambda to block conversion in C++17 by avoiding copy elision for the
Alex Lorenz [Thu, 6 Apr 2017 12:53:43 +0000 (12:53 +0000)]
Fix lambda to block conversion in C++17 by avoiding copy elision for the
lambda capture used by the created block

The commit r288866 introduced guaranteed copy elision to C++ 17. This
unfortunately broke the lambda to block conversion in C++17 (the compiler
crashes when performing IRGen). This commit fixes the conversion by avoiding
copy elision for the capture that captures the lambda that's used in the block
created by the lambda to block conversion process.

rdar://31385153

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

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

7 years ago[Sema] Retarget test to a specific platform for consistent datasizes
Simon Dardis [Thu, 6 Apr 2017 11:12:14 +0000 (11:12 +0000)]
[Sema] Retarget test to a specific platform for consistent datasizes

Attempt to satisfy llvm-clang-x86_64-expensive-checks-win by targeting
x86_64-apple-darwin10 for Sema/vector-ops.c. The underlying failure is
due to datatype differences between platforms.

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

7 years ago[Sema] Extend GetSignedVectorType to deal with non ExtVector types
Simon Dardis [Thu, 6 Apr 2017 10:38:03 +0000 (10:38 +0000)]
[Sema] Extend GetSignedVectorType to deal with non ExtVector types

This improves some error messages which would otherwise refer to
ext_vector_type types in contexts where there are no such types.

Factored out from D25866 at reviewer's request.

Reviewers: bruno

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

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

7 years agoPR16106: Correct the docs to reflect the actual behavior of the interface.
Vassil Vassilev [Thu, 6 Apr 2017 10:05:46 +0000 (10:05 +0000)]
PR16106: Correct the docs to reflect the actual behavior of the interface.

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

7 years ago[Sema] Update CheckOverload docs
George Burgess IV [Thu, 6 Apr 2017 00:23:31 +0000 (00:23 +0000)]
[Sema] Update CheckOverload docs

- Replace documented return values (true/false) with what's actually
  returned
- Doxygenify the comment
- Reflow said comment to 80 cols

Not overly familiar with Doxygen, so nits are welcome. :)

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

7 years agoSimplify. NFC.
George Burgess IV [Thu, 6 Apr 2017 00:08:35 +0000 (00:08 +0000)]
Simplify. NFC.

Two simplifications:
- We check `!Previous.empty()` above and only use `Previous` in const
  contexts after that check, so the `!Previous.empty()` check seems
  redundant.
- The null check looks pointless, as well: AFAICT, `LookupResults`
  should never contain null entries, and `OldDecl` should always be
  non-null if `Redeclaration` is true.

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

7 years ago[Driver] Print a newline when invoking `-print-resource-dir`
Meador Inge [Wed, 5 Apr 2017 22:27:20 +0000 (22:27 +0000)]
[Driver] Print a newline when invoking `-print-resource-dir`

The commit yesterday (r299473) to add the `-print-resource-dir`
option was supposed to emit a newline after the resource dir.

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

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

7 years ago[lit] Fix Analysis test format pickling error
Reid Kleckner [Wed, 5 Apr 2017 18:56:48 +0000 (18:56 +0000)]
[lit] Fix Analysis test format pickling error

Move the test format into a standalone .py file and add it to the site
module search path. This allows us to run the test on Windows, and it
makes it compatible with the multiprocessing.Pool lit test execution
strategy.

I think this test was only passing everywhere else because
multiprocessing uses 'fork' to spawn workers, so the test format never
needs to be pickled.

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

7 years agoclang-format: Support formatting utf-8 character literals in C++11+ mode.
Nico Weber [Wed, 5 Apr 2017 18:10:42 +0000 (18:10 +0000)]
clang-format: Support formatting utf-8 character literals in C++11+ mode.

clang-format <<END
auto c1 = u8'a';
auto c2 = u'a';
END

Before:
  auto c1 = u8 'a';
  auto c2 = u'a';

Now:
  auto c1 = u8'a';
  auto c2 = u'a';

Patch from Denis Gladkikh <llvm@denis.gladkikh.email>!

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

7 years agoRevert "[analyzer] Add a modular constraint system to the CloneDetector"
Artem Dergachev [Wed, 5 Apr 2017 15:06:17 +0000 (15:06 +0000)]
Revert "[analyzer] Add a modular constraint system to the CloneDetector"

This reverts commit r299544.

Crashes on tests on some buildbots.

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

7 years ago[analyzer] Add a modular constraint system to the CloneDetector
Artem Dergachev [Wed, 5 Apr 2017 14:17:36 +0000 (14:17 +0000)]
[analyzer] Add a modular constraint system to the CloneDetector

A big part of the clone detection code is functionality for filtering clones and
clone groups based on different criteria. So far this filtering process was
hardcoded into the CloneDetector class, which made it hard to understand and,
ultimately, to extend.

This patch splits the CloneDetector's logic into a sequence of reusable
constraints that are used for filtering clone groups. These constraints
can be turned on and off and reodreder at will, and new constraints are easy
to implement if necessary.

Unit tests are added for the new constraint interface.

This is a refactoring patch - no functional change intended.

Patch by Raphael Isemann!

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

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

7 years agoclang-format-vsix: Add "Format on Save" feature
Antonio Maiorano [Wed, 5 Apr 2017 14:13:45 +0000 (14:13 +0000)]
clang-format-vsix: Add "Format on Save" feature

This change adds a feature to the clang-format VS extension that optionally
enables the automatic formatting of documents when saving. Since developers
always need to save their files, this eases the workflow of making sure source
files are properly formatted.

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

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

7 years ago-Wunreachable-code: 'true' and 'false' should not be treated as configuration
Alex Lorenz [Wed, 5 Apr 2017 14:07:21 +0000 (14:07 +0000)]
-Wunreachable-code: 'true' and 'false' should not be treated as configuration
macros

Clang should emit -Wunreachable-code warnings in C mode for code that's
unreachable because of a 'false' or '!true' condition.

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

7 years ago[OpenCL] Extended diagnostics for atomic initialization
Egor Churaev [Wed, 5 Apr 2017 12:47:10 +0000 (12:47 +0000)]
[OpenCL] Extended diagnostics for atomic initialization

Summary:
I saw the same changes in the following review: https://reviews.llvm.org/D17438

I don't know in that way I could determine that atomic variable was initialized by macro ATOMIC_VAR_INIT. Anyway I added check that atomic variables can be initialize only in global scope.
I think that we can discuss this change.

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: bader, yaxunl

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

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

7 years agoclang-format: [JS] fix whitespace around "of" operator.
Martin Probst [Wed, 5 Apr 2017 10:56:07 +0000 (10:56 +0000)]
clang-format: [JS] fix whitespace around "of" operator.

Summary:
Previously:
    import {of } from 'x';
    of (null);

Now:
    import {of} from 'x';
    of(null);

Reviewers: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[OpenCL] Enables passing sampler initializer to function argument
Egor Churaev [Wed, 5 Apr 2017 09:02:56 +0000 (09:02 +0000)]
[OpenCL] Enables passing sampler initializer to function argument

Reviewers: Anastasia, cfe-commits

Reviewed By: Anastasia

Subscribers: yaxunl, bader

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

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

7 years ago[analyzer] alpha.core.Conversion - Fix false positive for 'U32 += S16;' expression...
Daniel Marjamaki [Wed, 5 Apr 2017 08:57:04 +0000 (08:57 +0000)]
[analyzer] alpha.core.Conversion - Fix false positive for 'U32 += S16;' expression, that is not unsafe

Summary:
The alpha.core.Conversion was too strict about compound assignments and could warn even though there is no problem.

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

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

7 years agoDon't issue a warning if the shadowing declaration is in a class
Stephan Bergmann [Wed, 5 Apr 2017 08:36:58 +0000 (08:36 +0000)]
Don't issue a warning if the shadowing declaration is in a class

Follow-up to r299363 "Enhance -Wshadow to warn when shadowing typedefs or type
aliases".

Patch by Ahmed Asadi.

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

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

7 years ago[coroutines] Add coro.end handling
Gor Nishanov [Wed, 5 Apr 2017 04:55:03 +0000 (04:55 +0000)]
[coroutines] Add coro.end handling

Summary:
For WinEH, We add a funclet bundle to a coro.end call, so that CoroSplit in LLVM can replace it with cleanup ret and cut the rest out.
For landing pad, we add a branch to resume block if coro.end returns true.

LLVM Part: https://reviews.llvm.org/D25445

Reviewers: majnemer

Reviewed By: majnemer

Subscribers: EricWF, cfe-commits, rsmith, mehdi_amini

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

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

7 years agoAnother attempt to fix the sphinx warning from r299470
Adam Nemet [Tue, 4 Apr 2017 23:46:34 +0000 (23:46 +0000)]
Another attempt to fix the sphinx warning from r299470

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

7 years agoFix sphinx warning from r299470
Adam Nemet [Tue, 4 Apr 2017 22:45:20 +0000 (22:45 +0000)]
Fix sphinx warning from r299470

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

7 years ago[Driver] Add option to print the resource directory
Meador Inge [Tue, 4 Apr 2017 21:46:50 +0000 (21:46 +0000)]
[Driver] Add option to print the resource directory

This patch adds the option -print-resource-dir. It simply
prints the resource directory. This information will eventually
be used in compiler-rt to setup COMPILER_RT_LIBRARY_INSTALL_DIR.

Patch by Catherine Moore!

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

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

7 years agoAdd #pragma clang fp
Adam Nemet [Tue, 4 Apr 2017 21:18:36 +0000 (21:18 +0000)]
Add #pragma clang fp

This adds the new pragma and the first variant, contract(on/off/fast).

The pragma has the same block scope rules as STDC FP_CONTRACT, i.e. it can be
placed at the beginning of a compound statement or at file scope.

Similarly to STDC FP_CONTRACT there is no need to use attributes.  First an
annotate token is inserted with the parsed details of the pragma.  Then the
annotate token is parsed in the proper contexts and the Sema is updated with
the corresponding FPOptions using the shared ActOn function with STDC
FP_CONTRACT.

After this the FPOptions from the Sema is propagated into the AST expression
nodes.  There is no change here.

I was going to add a 'default' option besides 'on/off/fast' similar to STDC
FP_CONTRACT but then decided against it. I think that we'd have to make option
uppercase then to avoid using 'default' the keyword.  Also because of the
scoped activation of pragma I am not sure there is really a need a for this.

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

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

7 years agoSet FMF for -ffp-contract=fast
Adam Nemet [Tue, 4 Apr 2017 21:18:30 +0000 (21:18 +0000)]
Set FMF for -ffp-contract=fast

With this, FMF(contract) becomes an alternative way to express the request to
contract.

These are currently only propagated for FMul, FAdd and FSub.  The rest will be
added as more FMFs are hooked up for this.

This is toward fixing PR25721.

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

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

7 years ago[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)
Matthias Gehre [Tue, 4 Apr 2017 20:11:13 +0000 (20:11 +0000)]
[clang-format] fix crash in NamespaceEndCommentsFixer (PR32438)

Summary:
The new test case was crashing before. Now it passes
as expected.

Reviewers: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[analyzer] Add new Z3 constraint manager backend
Dominic Chen [Tue, 4 Apr 2017 19:52:25 +0000 (19:52 +0000)]
[analyzer] Add new Z3 constraint manager backend

Summary: Implement new Z3 constraint manager backend.

Reviewers: zaks.anna, dcoughlin, NoQ, xazax.hun

Subscribers: mgorny, cfe-commits

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

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