]> granicus.if.org Git - clang/log
clang
7 years agoFunction with unparsed body is a definition
Serge Pavlov [Wed, 14 Jun 2017 10:07:02 +0000 (10:07 +0000)]
Function with unparsed body is a definition

While a function body is being parsed, the function declaration is not considered
as a definition because it does not have a body yet. In some cases it leads to
incorrect interpretation, the case is presented in
https://bugs.llvm.org/show_bug.cgi?id=14785:
```
    template<typename T> struct Somewhat {
      void internal() const {}
      friend void operator+(int const &, Somewhat<T> const &) {}
    };
void operator+(int const &, Somewhat<char> const &x) { x.internal(); }
```
When statement `x.internal()` in the body of global `operator+` is parsed, the type
of `x` must be completed, so the instantiation of `Somewhat<char>` is started. It
instantiates the declaration of `operator+` defined inline, and makes a check for
redefinition. The check does not detect another definition because the declaration
of `operator+` is still not defining as does not have a body yet.

To solves this problem the function `isThisDeclarationADefinition` considers
a function declaration as a definition if it has flag `WillHaveBody` set.

This change fixes PR14785.

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

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

7 years agoFix for Itanium mangler issue with templates
Dmitry Polukhin [Wed, 14 Jun 2017 09:47:47 +0000 (09:47 +0000)]
Fix for Itanium mangler issue with templates

Patch by Serge Preis

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

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

7 years ago[coroutines] Fix co_await for range statement
Eric Fiselier [Wed, 14 Jun 2017 03:24:55 +0000 (03:24 +0000)]
[coroutines] Fix co_await for range statement

Summary:
Currently we build the co_await expressions on the wrong implicit statements of the implicit ranged for; Specifically we build the co_await expression wrapping the range declaration, but it should wrap the begin expression.

This patch fixes co_await on range for.

Reviewers: rsmith, GorNishanov

Reviewed By: GorNishanov

Subscribers: cfe-commits

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

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

7 years ago[ODRHash] Remove debugging code from r305361
Richard Trieu [Wed, 14 Jun 2017 03:19:58 +0000 (03:19 +0000)]
[ODRHash] Remove debugging code from r305361

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

7 years ago[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.
Richard Trieu [Wed, 14 Jun 2017 03:17:26 +0000 (03:17 +0000)]
[ODRHash] Hash Template and TemplateExpansion in TemplateArgument.

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

7 years ago[ODRHash] Hash Expr for TemplateArgument::Expression
Richard Trieu [Wed, 14 Jun 2017 01:28:00 +0000 (01:28 +0000)]
[ODRHash] Hash Expr for TemplateArgument::Expression

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

7 years ago[ODRHash] Add TemplateArgument kind to hash.
Richard Trieu [Tue, 13 Jun 2017 22:21:18 +0000 (22:21 +0000)]
[ODRHash] Add TemplateArgument kind to hash.

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

7 years agoPreserve cold attribute for function decls
Xinliang David Li [Tue, 13 Jun 2017 21:14:07 +0000 (21:14 +0000)]
Preserve cold attribute for function decls

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

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

7 years agoFix spurious Wunused-lambda-capture warning
Yi Kong [Tue, 13 Jun 2017 18:38:31 +0000 (18:38 +0000)]
Fix spurious Wunused-lambda-capture warning

Summary:
Clang emits unused-lambda-capture warning for captures in generic lambdas even though they are actually used.

Fixes PR31815.

Reviewers: malcolm.parsons, aaron.ballman, rsmith

Reviewed By: malcolm.parsons

Subscribers: ahatanak, cfe-commits

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

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

7 years agoAlign definition of DW_OP_plus with DWARF spec [2/3]
Florian Hahn [Tue, 13 Jun 2017 18:06:15 +0000 (18:06 +0000)]
Align definition of DW_OP_plus with DWARF spec [2/3]

Summary:
This patch is part of 3 patches that together form a single patch, but must be introduced in stages in order not to break things.
 
The way that LLVM interprets DW_OP_plus in DIExpression nodes is basically that of the DW_OP_plus_uconst operator since LLVM expects an unsigned constant operand. This unnecessarily restricts the DW_OP_plus operator, preventing it from being used to describe the evaluation of runtime values on the expression stack. These patches try to align the semantics of DW_OP_plus and DW_OP_minus with that of the DWARF definition, which pops two elements off the expression stack, performs the operation and pushes the result back on the stack.
 
This is done in three stages:
• The first patch (LLVM) adds support for DW_OP_plus_uconst and changes all uses (and tests) of DW_OP_plus to use DW_OP_plus_uconst.
 
• The second patch (Clang) contains changes to use DW_OP_plus_uconst instead of DW_OP_plus.
 
• The third patch (LLVM) changes the semantics of DW_OP_plus to be in line with it’s DWARF meaning. It also does this for DW_OP_minus.

Patch by Sander de Smalen.

Reviewers: echristo, pcc, aprantl

Reviewed By: aprantl

Subscribers: aprantl, cfe-commits

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

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

7 years agoAdd comma to comment.
Gheorghe-Teodor Bercea [Tue, 13 Jun 2017 15:35:27 +0000 (15:35 +0000)]
Add comma to comment.

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

7 years ago[clang-format] Document the StartOfTokenColumn parameter, NFC
Krasimir Georgiev [Tue, 13 Jun 2017 14:58:55 +0000 (14:58 +0000)]
[clang-format] Document the StartOfTokenColumn parameter, NFC

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

7 years agoRevert "Revert r301742 which made ExprConstant checking apply to all full-exprs."
Diana Picus [Tue, 13 Jun 2017 12:50:06 +0000 (12:50 +0000)]
Revert "Revert r301742 which made ExprConstant checking apply to all full-exprs."

This reverts commit r305239 because it broke the buildbots (the
diag-flags.cpp test is failing).

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

7 years agoclang-format: add option to merge empty function body
Francois Ferrand [Tue, 13 Jun 2017 07:02:43 +0000 (07:02 +0000)]
clang-format: add option to merge empty function body

Summary:
This option supplements the AllowShortFunctionsOnASingleLine flag, to
merge empty function body at the beginning of the line: e.g. when the
function is not short-enough and breaking braces after function.

  int f()
  {}

Reviewers: krasimir, djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years ago[docs] Add some ubsan changes to the release notes
Vedant Kumar [Tue, 13 Jun 2017 02:52:31 +0000 (02:52 +0000)]
[docs] Add some ubsan changes to the release notes

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

7 years agoRevert r301742 which made ExprConstant checking apply to all full-exprs.
Nick Lewycky [Mon, 12 Jun 2017 21:59:18 +0000 (21:59 +0000)]
Revert r301742 which made ExprConstant checking apply to all full-exprs.

This patch also exposed pre-existing bugs in clang, see PR32864 and PR33140#c3 .

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

7 years ago[ODRHash] Add diagnostic messages for typedef and type alias.
Richard Trieu [Mon, 12 Jun 2017 21:58:22 +0000 (21:58 +0000)]
[ODRHash] Add diagnostic messages for typedef and type alias.

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

7 years agoRevert r303316, a change to ExprConstant to evaluate function arguments.
Nick Lewycky [Mon, 12 Jun 2017 21:15:44 +0000 (21:15 +0000)]
Revert r303316, a change to ExprConstant to evaluate function arguments.

The patch was itself correct but it uncovered other bugs which are going to be difficult to fix, per PR33140.

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

7 years agoIR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.
Peter Collingbourne [Mon, 12 Jun 2017 20:10:48 +0000 (20:10 +0000)]
IR: Replace the "Linker Options" module flag with "llvm.linker.options" named metadata.

The new metadata is easier to manipulate than module flags.

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

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

7 years agoCorrect debug info bit offset calculation for big-endian targets
Reid Kleckner [Mon, 12 Jun 2017 19:57:56 +0000 (19:57 +0000)]
Correct debug info bit offset calculation for big-endian targets

Summary:
The change "[CodeView] Implement support for bit fields in
Clang" (r274201, https://reviews.llvm.org/rL274201) broke the
calculation of bit offsets for the debug info describing bitfields on
big-endian targets.

Prior to commit r274201 the debug info for bitfields got their offsets
from the ASTRecordLayout in CGDebugInfo::CollectRecordFields(), the
current field offset was then passed on to
CGDebugInfo::CollectRecordNormalField() and used directly in the
DIDerivedType.

Since commit r274201, the bit offset ending up in the DIDerivedType no
longer comes directly from the ASTRecordLayout. Instead
CGDebugInfo::CollectRecordNormalField() calls the new method
CGDebugInfo::createBitFieldType(), which in turn calls
CodeGenTypes::getCGRecordLayout().getBitFieldInfo() to fetch a
CGBitFieldInfo describing the field. The 'Offset' member of
CGBitFieldInfo is then used to calculate the bit offset of the
DIDerivedType. Unfortunately the previous and current method of
calculating the bit offset are only equivalent for little endian
targets, as CGRecordLowering::setBitFieldInfo() reverses the bit
offsets for big endian targets as the last thing it does.

A simple reproducer for this error is the following module:

struct fields {
  unsigned a : 4;
  unsigned b : 4;
} flags = {0x0f, 0x1};

Compiled for Mips, with commit r274200 both the DIDerivedType bit
offsets on the IR-level and the DWARF information on the ELF-level
will have the expected values: the offsets of 'a' and 'b' are 0 and 4
respectively. With r274201 the offsets are switched to 4 and 0. By
noting that the static initialization of 'flags' in both cases is the
same, we can eliminate a change in record layout as the cause of the
change in the debug info. Also compiling this example with gcc,
produces the same record layout and debug info as commit r274200.

In order to restore the previous function we extend
CGDebugInfo::createBitFieldType() to compensate for the reversal done
in CGRecordLowering::setBitFieldInfo().

Patch by Frej Drejhammar!

Reviewers: cfe-commits, majnemer, rnk, aaboud, echristo, aprantl

Reviewed By: rnk, aprantl

Subscribers: aprantl, arichardson, frej

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

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

7 years agoRecommit r305117: [libclang] Merge multiple availability clauses when
Alex Lorenz [Mon, 12 Jun 2017 19:06:30 +0000 (19:06 +0000)]
Recommit r305117: [libclang] Merge multiple availability clauses when
getting the platform's availability

Patch by Ronald Wampler!

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

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

7 years ago[ubsan] Detect invalid unsigned pointer index expression (clang)
Vedant Kumar [Mon, 12 Jun 2017 18:42:51 +0000 (18:42 +0000)]
[ubsan] Detect invalid unsigned pointer index expression (clang)

Adding an unsigned offset to a base pointer has undefined behavior if
the result of the expression would precede the base. An example from
@regehr:

  int foo(char *p, unsigned offset) {
    return p + offset >= p; // This may be optimized to '1'.
  }

  foo(p, -1); // UB.

This patch extends the pointer overflow check in ubsan to detect invalid
unsigned pointer index expressions. It changes the instrumentation to
only permit non-negative offsets in pointer index expressions when all
of the GEP indices are unsigned.

Testing: check-llvm, check-clang run on a stage2, ubsan-instrumented
build.

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

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

7 years agoAddress David Blaikie comment by replacing grep with FileCheck.
Yaron Keren [Mon, 12 Jun 2017 18:29:37 +0000 (18:29 +0000)]
Address David Blaikie comment by replacing grep with FileCheck.

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

7 years agoAdd regression test for r305179.
Yaron Keren [Mon, 12 Jun 2017 18:05:13 +0000 (18:05 +0000)]
Add regression test for r305179.

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

7 years ago[analyzer] Fix a crash when an ObjC object is constructed in AllocaRegion.
Artem Dergachev [Mon, 12 Jun 2017 17:59:50 +0000 (17:59 +0000)]
[analyzer] Fix a crash when an ObjC object is constructed in AllocaRegion.

Memory region allocated by alloca() carries no implicit type information.
Don't crash when resolving the init message for an Objective-C object
that is being constructed in such region.

rdar://problem/32517077

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

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

7 years ago[Sema] Use the right FoldingSet.
George Burgess IV [Mon, 12 Jun 2017 17:44:30 +0000 (17:44 +0000)]
[Sema] Use the right FoldingSet.

We were doing FindNodeOrInsertPos on SubstTemplateTypeParmPackTypes, so
we should presumably be inserting into SubstTemplateTypeParmPackTypes.

Looks like the FoldingSet API can be tweaked a bit so that we can catch
things like this at compile-time. I'll look into that shortly.

I'm unsure of how to test this; suggestions welcome.

Thanks to Vladimir Voskresensky for bringing this up!

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

7 years ago[Sema][C++1z] Ensure binding in dependent range for have non-null type
Erik Pilkington [Mon, 12 Jun 2017 16:11:06 +0000 (16:11 +0000)]
[Sema][C++1z] Ensure binding in dependent range for have non-null type

Fixes PR32172

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

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

7 years agoRevert r305164/5/7.
Daniel Jasper [Mon, 12 Jun 2017 08:08:18 +0000 (08:08 +0000)]
Revert r305164/5/7.

cc1as does not currently access the "--" version of this flag. At the
very least this needs to be fixed and proper test cases need to be
added.

Simple reproducer:
clang -Wa,--compress-debug-sections /tmp/test.cc

Result:
error: unknown argument: '--compress-debug-sections'

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

7 years agoDon't crash when forming a destructor name on an incomplete type.
John McCall [Sun, 11 Jun 2017 20:33:00 +0000 (20:33 +0000)]
Don't crash when forming a destructor name on an incomplete type.

Fixes PR25156.

Patch by Don Hinton!

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

7 years agotest: attempt to repair build bots
Saleem Abdulrasool [Sun, 11 Jun 2017 18:55:17 +0000 (18:55 +0000)]
test: attempt to repair build bots

Split the no-ias tests and give them a target to ensure that they go
down the GNU toolchain path.  Adjust the no compression support tests.

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

7 years agoDriver: add support for `-gz` and `-gz=`
Saleem Abdulrasool [Sun, 11 Jun 2017 17:49:23 +0000 (17:49 +0000)]
Driver: add support for `-gz` and `-gz=`

These options control the behaviour of the compression of debug info
sections on ELF targets.  Our behaviour slightly diverges from the
behaviour of GCC.  `-gz` maps to the `-compress-debug-sections` rather
than `-compress-debug-sections=zlib` or
`-compress-debug-sections=zlib-gnu`.  This small divergence allows us to
be compatible across versions of binutils (=zlib support was introduced
in 2.26, while earlier versions only support =zlib-gnu).  This also
allows users to not have to worry about the version of the assembler
they may be using if they are not using the IAS.  Previously, users
would have had to go through the internal option
`-compress-debug-sectionss` and pass that through to the assembler,
which is no longer needed.

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

7 years agoDriver: pass along [-]-[no]compress-debug-sections unfiltered
Saleem Abdulrasool [Sun, 11 Jun 2017 17:49:17 +0000 (17:49 +0000)]
Driver: pass along [-]-[no]compress-debug-sections unfiltered

Rather than validating the flags, pass them through without any
validation.  Arguments passed via -Wa or -Xassembler are passed directly
to the assembler without validation.  The validation was previously
required since we did not provide proper driver level support for
controlling the debug compression on ELF targets.  A subsequent change
will add support for the `-gz` and `-gz=` flags which provide proper
driver level control of the ELF compressed debug sections.

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

7 years agoRevert "[clang] Implement -Wcast-qual for C++"
Roman Lebedev [Sat, 10 Jun 2017 17:49:23 +0000 (17:49 +0000)]
Revert "[clang] Implement -Wcast-qual for C++"

Breaks -Werror builders.

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

7 years ago[clang] Implement -Wcast-qual for C++
Roman Lebedev [Sat, 10 Jun 2017 17:19:19 +0000 (17:19 +0000)]
[clang] Implement -Wcast-qual for C++

Summary:
This way, the behavior of that warning flag
more closely resembles that of GCC.

Do note that there is at least one false-negative (see FIXME in tests).

Fixes PR4802.

Testing:
```
ninja check-clang-sema check-clang-semacxx
```

Reviewers: dblaikie, majnemer, rnk

Reviewed By: dblaikie, rnk

Subscribers: cfe-commits, alexfh, rnk

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

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

7 years agoRevert r305110 to fix buildbot
Richard Trieu [Fri, 9 Jun 2017 23:03:40 +0000 (23:03 +0000)]
Revert r305110 to fix buildbot

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

7 years agoSupport operator keywords used in Windows SDK(fix ubsan)
Erich Keane [Fri, 9 Jun 2017 22:50:02 +0000 (22:50 +0000)]
Support operator keywords used in Windows SDK(fix ubsan)

UBSan found an issue with a nullptr being assigned to a reference.
This was because a following function went back and checked the
identifier in the CPPOperatorName case.  This patch corrects that
location with the original logic as well.

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

7 years ago27037: Use correct CVR qualifier on an upcast on method pointer call
Richard Smith [Fri, 9 Jun 2017 22:25:28 +0000 (22:25 +0000)]
27037: Use correct CVR qualifier on an upcast on method pointer call

Patch by Taiju Tsuiki!

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

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

7 years ago[clang] Cleanup fixit.c
Alexander Shaposhnikov [Fri, 9 Jun 2017 22:20:52 +0000 (22:20 +0000)]
[clang] Cleanup fixit.c

This diff removes temporary file t2 in fixit.c and updates the test command accordingly.
NFC.

Test plan:
make check-all

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

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

7 years agoRevert r305117
Alex Lorenz [Fri, 9 Jun 2017 22:06:36 +0000 (22:06 +0000)]
Revert r305117

It caused `Index/availability.c` test failure on Linux

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

7 years agoAttempt to fix shared library build: RewriteFrontend depends on Serialization after...
Richard Smith [Fri, 9 Jun 2017 22:02:33 +0000 (22:02 +0000)]
Attempt to fix shared library build: RewriteFrontend depends on Serialization after r305116.

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

7 years ago[modules] D29951: Load lazily the template specialization in multi-module setups.
Vassil Vassilev [Fri, 9 Jun 2017 21:54:18 +0000 (21:54 +0000)]
[modules] D29951: Load lazily the template specialization in multi-module setups.

Currently, we load all template specialization if we have more than one module
attached and we touch anything around the template definition.

This patch registers the template specializations as lazily-loadable entities.
In some TUs it reduces the amount of deserializations by 1%.

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

7 years ago[modules] Fix that global delete operator get's assigned to a submodule.
Vassil Vassilev [Fri, 9 Jun 2017 21:36:28 +0000 (21:36 +0000)]
[modules] Fix that global delete operator get's assigned to a submodule.

n the current local-submodule-visibility mode, as soon as we discover a virtual
destructor, we declare on demand a global delete operator. However, this causes
that this delete operator is owned by the submodule which contains said virtual
destructor. This means that other modules no longer can see the global delete
operator which is hidden inside another submodule and fail to compile.

This patch unhides those global allocation function once they're created to
prevent this issue.

Patch by Raphael Isemann (D33366)!

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

7 years ago[libclang] Merge multiple availability clauses when getting the platform's
Alex Lorenz [Fri, 9 Jun 2017 21:29:45 +0000 (21:29 +0000)]
[libclang] Merge multiple availability clauses when getting the platform's
availability

Patch by Ronald Wampler!

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

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

7 years agoAdd -frewrite-imports flag.
Richard Smith [Fri, 9 Jun 2017 21:24:02 +0000 (21:24 +0000)]
Add -frewrite-imports flag.

If specified, when preprocessing, the contents of imported .pcm files will be
included in preprocessed output. The resulting preprocessed file can then be
compiled standalone without the module sources or .pcm files.

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

7 years ago[ODRHash] Add support for TemplateArgument types.
Richard Trieu [Fri, 9 Jun 2017 21:00:10 +0000 (21:00 +0000)]
[ODRHash] Add support for TemplateArgument types.

Recommit r304592 that was reverted in r304618.  r305104 should have fixed the
issue.

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

7 years ago[ODRHash] Skip inline namespaces when hashing.
Richard Trieu [Fri, 9 Jun 2017 20:11:51 +0000 (20:11 +0000)]
[ODRHash] Skip inline namespaces when hashing.

Speculatively try to fix the underlying issue from r304592, of underlying types
being confused when inline namespaces are used.

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

7 years agoBringt back -triple so the test passes on non-x86.
Benjamin Kramer [Fri, 9 Jun 2017 19:47:36 +0000 (19:47 +0000)]
Bringt back -triple so the test passes on non-x86.

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

7 years agoAdd #pragma clang module build/endbuild pragmas for performing a module build
Richard Smith [Fri, 9 Jun 2017 19:22:32 +0000 (19:22 +0000)]
Add #pragma clang module build/endbuild pragmas for performing a module build
as part of a compilation.

This is intended for two purposes:

1) Writing self-contained test cases for modules: we can now write a single
source file test that builds some number of module files on the side and
imports them.

2) Debugging / test case reduction. A single-source testcase is much more
amenable to reduction, compared to a VFS tarball or .pcm files.

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

7 years ago[ASTMatchers] Fix use after free.
Benjamin Kramer [Fri, 9 Jun 2017 17:55:42 +0000 (17:55 +0000)]
[ASTMatchers] Fix use after free.

Found by asan.

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

7 years agoRepair 2010-05-31-palignr.c test
Vassil Vassilev [Fri, 9 Jun 2017 16:42:26 +0000 (16:42 +0000)]
Repair 2010-05-31-palignr.c test

This test was silently failing since a long time because it failed to include
stdlib.h (as it's running in a freestanding environment). However, because we
 used just not clang_cc1 instead of the verify mode, this regression was never
 noticed and the test was just always passing.

This adds -ffreestanding to the invocation, so that tmmintrin.h doesn't
indirectly include mm_malloc.h, which in turns includes the unavailable stdlib.h.
We also run now in the -verify mode to prevent that we silently regress again.

I've also updated the test to no longer check the return value of _mm_alignr_epi8
as this is also causing it to fail (and it's not really the job of this test to
test this).

Patch by Raphael Isemann (D34022)

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

7 years agosupport operator keywords used in Windows SDK
Erich Keane [Fri, 9 Jun 2017 16:29:35 +0000 (16:29 +0000)]
support operator keywords used in Windows SDK

to support operator keywords used in Windows SDK, alter token type when
seen in system headers

Hello, I submitted D33505 to address this problem, but the
proposal was rejected as too big a hammer.
This change will allow clang to parse the WindowsSDK header <query.h>
which uses the operator name "or" as a field name. Treat cpp operator
keywords as ordinary identifiers inside the Microsoft headers, but
treat them as usual in the user's program.

Original Submitter: Melanie Blower (mibintc)

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

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

7 years ago[DebugInfo] Fix comment, NFC.
Alexey Bataev [Fri, 9 Jun 2017 13:55:08 +0000 (13:55 +0000)]
[DebugInfo] Fix comment, NFC.

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

7 years ago[DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer.
Alexey Bataev [Fri, 9 Jun 2017 13:40:18 +0000 (13:40 +0000)]
[DebugInfo] Add kind of ImplicitParamDecl for emission of FlagObjectPointer.

Summary:
If the first parameter of the function is the ImplicitParamDecl, codegen
automatically marks it as an implicit argument with `this` or `self`
pointer. Added internal kind of the ImplicitParamDecl to separate
'this', 'self', 'vtt' and other implicit parameters from other kind of
parameters.

Reviewers: rjmccall, aaron.ballman

Subscribers: cfe-commits

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

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

7 years agoRevert of r305066 "Reapply Frontend support for Nios2 target"
Nikolai Bozhenov [Fri, 9 Jun 2017 12:09:29 +0000 (12:09 +0000)]
Revert of r305066 "Reapply Frontend support for Nios2 target"

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

7 years agoReapply "Frontend support for Nios2 target"
Nikolai Bozhenov [Fri, 9 Jun 2017 10:56:18 +0000 (10:56 +0000)]
Reapply "Frontend support for Nios2 target"

Summary:
- Implements TargetInfo class for Nios2 target.
- Enables handling of -march and -mcpu options for Nios2 target.
- Definition of Nios2 builtin functions.

Reviewed By: craig.topper

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

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

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

7 years agoSpeed up preamble loading
Erik Verbruggen [Fri, 9 Jun 2017 08:29:58 +0000 (08:29 +0000)]
Speed up preamble loading

Cache filename - SourceLocation pairs to speed up preamble loading and
global completion. This is especially relevant for windows, where
preamble loading takes a while.

Patch by Ivan Donchevskii!

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

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

7 years agoRemove 'Filename' parameter from BeginSourceFileAction.
Richard Smith [Fri, 9 Jun 2017 01:36:10 +0000 (01:36 +0000)]
Remove 'Filename' parameter from BeginSourceFileAction.

No-one was using this, and it's not meaningful in general -- FrontendActions
can be run on inputs that don't have a corresponding source file. The current
frontend input can be obtained by asking the FrontendAction if any future
action actually needs it.

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

7 years ago[libclang] Introduce a new parsing option 'CXTranslationUnit_SingleFileParse' that...
Argyrios Kyrtzidis [Fri, 9 Jun 2017 01:20:48 +0000 (01:20 +0000)]
[libclang] Introduce a new parsing option 'CXTranslationUnit_SingleFileParse' that puts preprocessor in a mode for parsing a single file only.

This is useful for parsing a single file, as a fast/inaccurate 'mode' that can still provide declarations from the file, like the classes and their methods.

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

7 years agoRepresent debug information compression type fully
Saleem Abdulrasool [Fri, 9 Jun 2017 00:40:30 +0000 (00:40 +0000)]
Represent debug information compression type fully

This is tied with the LLVM side of the change to expose the debug
information compression types to clang.  We now track the compression
type as an enumeration rather than a boolean.  We still use the same
value (GNU) that we did previously.  This is in preparation to support
passing down the compression type and switch it based on the command
line.

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

7 years ago[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit...
Kostya Serebryany [Thu, 8 Jun 2017 22:58:19 +0000 (22:58 +0000)]
[sanitizer-coverage] one more flavor of coverage: -fsanitize-coverage=inline-8bit-counters. Experimental so far, not documenting yet. Reapplying revisions 304630, 304631, 304632, 304673, see PR33308

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

7 years ago[ASTMatchers] temporary disable tests with floating suffix
Peter Wu [Thu, 8 Jun 2017 22:58:12 +0000 (22:58 +0000)]
[ASTMatchers] temporary disable tests with floating suffix

r305022 assumed that floatLiteral(equals(1.2)) would also match 1.2f and
1.2l, but apparently that is not the case. Until it is clear how to
match, temporary disable the test to fix CI.

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

7 years ago[ASTMatchers] Add clang-query support for equals matcher
Peter Wu [Thu, 8 Jun 2017 22:00:58 +0000 (22:00 +0000)]
[ASTMatchers] Add clang-query support for equals matcher

Summary:
This allows the clang-query tool to use matchers like
"integerLiteral(equals(32))". For this to work, an overloaded function
is added for each possible parameter type.

Reviewed By: aaron.ballman

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

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

7 years ago[ASTMatchers] Add support for floatLiterals
Peter Wu [Thu, 8 Jun 2017 22:00:50 +0000 (22:00 +0000)]
[ASTMatchers] Add support for floatLiterals

Summary:
Needed to support something like "floatLiteral(equals(1.0))". The
parser for floating point numbers is kept simple, so instead of ".1" you
have to use "0.1".

Reviewed By: aaron.ballman

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

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

7 years ago[ASTMatchers] Add support for boolean literals
Peter Wu [Thu, 8 Jun 2017 22:00:38 +0000 (22:00 +0000)]
[ASTMatchers] Add support for boolean literals

Summary:
Recognize boolean literals for future extensions ("equals(true)").
Note that a specific VariantValue constructor is added to resolve
ambiguity (like "Value = 5") between unsigned and bool.

Reviewed By: aaron.ballman

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

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

7 years ago[clang] Fix format specifiers fixits
Alexander Shaposhnikov [Thu, 8 Jun 2017 21:44:45 +0000 (21:44 +0000)]
[clang] Fix format specifiers fixits

This diff fixes printf "fixits" in the case when there is
a wrapping macro and the format string needs multiple replacements.
In the presence of a macro there is an extra logic in EditedSource.cpp
to handle multiple uses of the same macro argument
(see the old comment inside EditedSource::canInsertInOffset)
which was mistriggerred when the argument was used only once
but required multiple adjustments), as a result the "fixit"
was breaking down the format string
by dropping the second format specifier, i.e.
Log1("test 4: %s %s", getNSInteger(), getNSInteger())
was getting replaced with
Log1("test 4: %ld ", (long)getNSInteger(), (long)getNSInteger())
(if one removed the macro and used printf directly it would work fine).
In this diff we track the location where the macro argument is used and
(as it was before) the modifications originating from all the locations
except the first one are rejected, but multiple changes are allowed.

Test plan: make check-all

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

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

7 years ago[Sema] Refactor OverloadCandidate::BuiltinTypes. NFC.
George Burgess IV [Thu, 8 Jun 2017 20:55:21 +0000 (20:55 +0000)]
[Sema] Refactor OverloadCandidate::BuiltinTypes. NFC.

As promised in r304996.

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

7 years agoRevert "Frontend support for Nios2 target"
Nikolai Bozhenov [Thu, 8 Jun 2017 18:36:35 +0000 (18:36 +0000)]
Revert "Frontend support for Nios2 target"

As it breaks many buildbots.

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

7 years agoAdded llvm_unreachable to make sure the switch is always exhaustive.
Galina Kistanova [Thu, 8 Jun 2017 18:20:32 +0000 (18:20 +0000)]
Added llvm_unreachable to make sure the switch is always exhaustive.

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

7 years ago[Sema] Remove unused field from OverloadCandidate.
George Burgess IV [Thu, 8 Jun 2017 18:19:25 +0000 (18:19 +0000)]
[Sema] Remove unused field from OverloadCandidate.

The only use in-tree I can find for BuiltinTypes.ResultTy is a single
store to it. We otherwise just recompute what it should be later on (and
sometimes do things like argument conversions in the process of
recomputing it).

Since it's impossible to test if the value stored there is sane, and we
don't use it anyway, we should probably just drop the field.

I'll do a follow-up patch to rename BuiltinTypes.ParamTypes ->
BuiltinParamTypes in a bit. Wanted to keep this patch relatively
minimal.

Thanks to Petr Kudryavtsev for bringing this up!

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

7 years agoFrontend support for Nios2 target.
Nikolai Bozhenov [Thu, 8 Jun 2017 17:40:30 +0000 (17:40 +0000)]
Frontend support for Nios2 target.

Summary:
- Implements TargetInfo class for Nios2 target.
- Enables handling of -march and -mcpu options for Nios2 target.
- Definition of Nios2 builtin functions.

Reviewed By: craig.topper

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

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

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

7 years ago[sanitizer-coverage] Allow using KASAN instrumentation with sancov
Alexander Potapenko [Thu, 8 Jun 2017 16:24:21 +0000 (16:24 +0000)]
[sanitizer-coverage] Allow using KASAN instrumentation with sancov

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

7 years ago[libclang] Expose typedef and address space functions
Sven van Haastregt [Thu, 8 Jun 2017 14:22:04 +0000 (14:22 +0000)]
[libclang] Expose typedef and address space functions

Expose the following functions:
 - clang_getTypedefName
 - clang_getAddressSpace

Patch by Simon Perretta.

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

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

7 years agoDo not inherit default arguments for friend function in class template.
Serge Pavlov [Thu, 8 Jun 2017 06:31:19 +0000 (06:31 +0000)]
Do not inherit default arguments for friend function in class template.

A function declared in a friend declaration may have declarations prior
to the containing class definition. If such declaration defines default
argument, the friend function declaration inherits them. This behavior
causes problems if the class where the friend is declared is a template:
during the class instantiation the friend function looks like if it had
default arguments, so error is triggered.

With this change friend functions declared in class templates do not
inherit default arguments. Actual set of them will be defined at the
point where the containing class is instantiated.

This change fixes PR12724.

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

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

7 years agoImprove diagnostics if friend function redefines file-level function.
Serge Pavlov [Thu, 8 Jun 2017 06:07:07 +0000 (06:07 +0000)]
Improve diagnostics if friend function redefines file-level function.

Clang makes check for function redefinition after it merged the new
declaration with the existing one. As a result, it produces poor
diagnostics in the case of a friend function defined inline, as in
the code:
```
    void func() {}
    class C { friend void func() {} };
```
Error message in this case states that `inline declaration of 'func'
follows non-inline definition`, which is misleading, as `func` does
not have explicit `inline` specifier.

With this changes compiler reports function redefinition if the new
function is a friend defined inline and it does not have explicit
`inline` specifier.

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

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

7 years agoCatch invalid bitwise operation on vector of floats
Serge Pavlov [Thu, 8 Jun 2017 05:25:19 +0000 (05:25 +0000)]
Catch invalid bitwise operation on vector of floats

Bitwise complement applied to vector of floats described with
attribute `ext_vector_type` is not diagnosed as error. Attempt to
compile such construct causes assertion violation in Instruction.cpp.
With this change the complement is treated similar to the case of
vector type described with attribute `vector_size`.

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

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

7 years ago[ODRHash] Make diagnostic message more readable.
Richard Trieu [Thu, 8 Jun 2017 04:47:29 +0000 (04:47 +0000)]
[ODRHash] Make diagnostic message more readable.

Change the diagnostic message from r304956 to be less confusing by reordering
the flow of information.

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

7 years agoSimplify.
Richard Smith [Thu, 8 Jun 2017 02:05:55 +0000 (02:05 +0000)]
Simplify.

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

7 years agoWeaken restriction in r304862 to allow implicit deduction guides to reference
Richard Smith [Thu, 8 Jun 2017 01:08:50 +0000 (01:08 +0000)]
Weaken restriction in r304862 to allow implicit deduction guides to reference
the injected-class-name of a specialization that uses a partial / explicit
specialization.

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

7 years ago[ODRHash] Change the fall-back diagnostic error.
Richard Trieu [Thu, 8 Jun 2017 00:56:21 +0000 (00:56 +0000)]
[ODRHash] Change the fall-back diagnostic error.

Provide a little more information when a ODR violation is detected, but the
specific error could not be diagnosed.

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

7 years agoReapply r304929 [mips] Add runtime options to enable/disable madd/sub.fmt
Petar Jovanovic [Wed, 7 Jun 2017 23:51:52 +0000 (23:51 +0000)]
Reapply r304929 [mips] Add runtime options to enable/disable madd/sub.fmt

The test in r304929 broke multiple buildbots as it expected mips target to
be registered and available (which is not necessarily true). Updating the
test with this condition.

Original commit:

  [mips] Add runtime options to enable/disable madd.fmt and msub.fmt

  Add options to clang: -mmadd4 and -mno-madd4, use it to enable or disable
  generation of madd.fmt and similar instructions respectively, as per GCC.

  Patch by Stefan Maksimovic.

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

7 years agoWhen determining the target function of an explicit instantiation, make
John McCall [Wed, 7 Jun 2017 23:00:05 +0000 (23:00 +0000)]
When determining the target function of an explicit instantiation, make
sure that non-template functions don't end up in the candidate set.

Fixes PR14211.

Patch by Don Hinton!

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

7 years ago[c++1z] Support deducing B in noexcept(B).
Richard Smith [Wed, 7 Jun 2017 21:46:22 +0000 (21:46 +0000)]
[c++1z] Support deducing B in noexcept(B).

This is not required by the standard (yet), but there seems to be reasonable
support for this being a defect according to CWG discussion, and libstdc++ 7.1
relies on it working.

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

7 years agoFinish revert of "r304929, [mips] Add runtime options to enable/disable madd/sub...
Simon Dardis [Wed, 7 Jun 2017 20:02:24 +0000 (20:02 +0000)]
Finish revert of "r304929, [mips] Add runtime options to enable/disable madd/sub.fmt"

The r304935 missed deleting the test case.

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

7 years agoRevert r304929 [mips] Add runtime options to enable/disable madd/sub.fmt
Petar Jovanovic [Wed, 7 Jun 2017 18:57:56 +0000 (18:57 +0000)]
Revert r304929 [mips] Add runtime options to enable/disable madd/sub.fmt

Revert r304929 since the test broke buildbots.

Original commit:

  [mips] Add runtime options to enable/disable madd.fmt and msub.fmt

  Add options to clang: -mmadd4 and -mno-madd4, use it to enable or disable
  generation of madd.fmt and similar instructions respectively, as per GCC.

  Patch by Stefan Maksimovic.

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

7 years ago[mips] Add runtime options to enable/disable madd.fmt and msub.fmt
Petar Jovanovic [Wed, 7 Jun 2017 17:17:57 +0000 (17:17 +0000)]
[mips] Add runtime options to enable/disable madd.fmt and msub.fmt

Add options to clang: -mmadd4 and -mno-madd4, use it to enable or disable
generation of madd.fmt and similar instructions respectively, as per GCC.

Patch by Stefan Maksimovic.

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

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

7 years ago[clang-format] Fix alignment of preprocessor trailing comments
Krasimir Georgiev [Wed, 7 Jun 2017 14:05:06 +0000 (14:05 +0000)]
[clang-format] Fix alignment of preprocessor trailing comments

Summary:
This patch is a follow-up of https://reviews.llvm.org/rL304687, which fixed an
overflow in the comment alignment code in clang-format. The token length of
trailing comments of preprocessor directives is calculated incorrectly by
including the text between consecutive directives. That causes them to not being
aligned.

For example, in this code with column limit 20
```
#if A
#else  // A
int iiii;
#endif // B
```
the length of the token `// A` was wrongly calculated as 14 = 5 (the size of `// A\n`) plus 9 (the size of `int iiii;`) and so `// A` wouldn't be aligned with `// B` and this was produced:
```
#if A
#else // A
int iiii;
#endif // B
```

This patch fixes this case.

Reviewers: alexfh

Reviewed By: alexfh

Subscribers: cfe-commits, klimek

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

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

7 years agoclang-format: [JS] recognize exported type definitions.
Martin Probst [Wed, 7 Jun 2017 12:53:22 +0000 (12:53 +0000)]
clang-format: [JS] recognize exported type definitions.

Summary: Support "export type T = {...};", in addition to just "type T = {...};".

Reviewers: klimek

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

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

7 years agoOnly print registered targets for `--version`
Dimitry Andric [Wed, 7 Jun 2017 12:05:41 +0000 (12:05 +0000)]
Only print registered targets for `--version`

Summary:
In D33900, I added printing of the registered targets in clang's
`PrintVersion` function, which is not only used for `--version` output,
but also for `-v` (verbose mode) and `-###`.  Especially the latter
seems to trip up some test cases, so it is probably better to only print
the registered targets for `--version`.

Reviewers: nemanjai, mehdi_amini

Reviewed By: nemanjai

Subscribers: cfe-commits

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

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

7 years ago[CodeGen] Add thumb-mode to target-features for arm/thumb triples.
Florian Hahn [Wed, 7 Jun 2017 11:50:45 +0000 (11:50 +0000)]
[CodeGen] Add thumb-mode to target-features for arm/thumb triples.

Summary:
The thumb-mode target feature is used to force Thumb or ARM code
generation on a per-function basis. Explicitly adding +thumb-mode to
functions for thumbxx triples enables mixed ARM/Thumb code generation in
places where compilation units with thumbxx and armxx triples are merged
together (e.g. the IR linker or LTO).

For armxx triples, -thumb-mode is added in a similar fashion.

Reviewers: echristo, t.p.northover, kristof.beyls, rengolin

Reviewed By: echristo

Subscribers: rinon, aemerson, mehdi_amini, javed.absar, cfe-commits

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

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

7 years ago[Sema] Silence unused variable warning.
Benjamin Kramer [Wed, 7 Jun 2017 10:23:17 +0000 (10:23 +0000)]
[Sema] Silence unused variable warning.

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

7 years ago[ARM] Fix Neon vector type alignment to 64-bit
Javed Absar [Wed, 7 Jun 2017 10:02:02 +0000 (10:02 +0000)]
[ARM] Fix Neon vector type alignment to 64-bit

This is restricted version of patch - https://reviews.llvm.org/D33205
that I reverted as it was leading to ABI breaks on darwin etc.
This patch restricts the fix to AAPCS (Android remains 128-bit).
Reviewed by: Renato Golin, Stephen Hines
Differential Revision: https://reviews.llvm.org/D33786

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

7 years ago[Driver] Add test to cover case when LSan is not supported
Maxim Ostapenko [Wed, 7 Jun 2017 08:51:15 +0000 (08:51 +0000)]
[Driver] Add test to cover case when LSan is not supported

This commit adds a testcase for uncovered code paths in LSan options parsing logic in driver.

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

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Wed, 7 Jun 2017 06:31:55 +0000 (06:31 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoAdded LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.
Galina Kistanova [Wed, 7 Jun 2017 06:25:05 +0000 (06:25 +0000)]
Added LLVM_FALLTHROUGH to address warning: this statement may fall through. NFC.

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

7 years agoUpdate libdeps to add BinaryFormat, introduced in r304864.
NAKAMURA Takumi [Wed, 7 Jun 2017 04:48:49 +0000 (04:48 +0000)]
Update libdeps to add BinaryFormat, introduced in r304864.

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

7 years agoReorder and reformat.
NAKAMURA Takumi [Wed, 7 Jun 2017 04:48:45 +0000 (04:48 +0000)]
Reorder and reformat.

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

7 years agoFixed warning: 'virtual void clang::ExternalASTSource::CompleteType(clang::ObjCInterf...
Galina Kistanova [Wed, 7 Jun 2017 02:44:42 +0000 (02:44 +0000)]
Fixed warning: 'virtual void clang::ExternalASTSource::CompleteType(clang::ObjCInterfaceDecl*)' was hidden.

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

7 years agoFix a couple of class template argument deduction crashes with libc++'s tuple.
Richard Smith [Wed, 7 Jun 2017 02:42:27 +0000 (02:42 +0000)]
Fix a couple of class template argument deduction crashes with libc++'s tuple.

RecursiveASTVisitor was not properly recursing through a
SubstTemplateTypeParmTypes, resulting in crashes in pack expansion where we
couldn't always find an unexpanded pack within a pack expansion.

We also have an issue where substitution of deduced template arguments for an
implicit deduction guide creates the "impossible" case of naming a
non-dependent member of the current instantiation, but within a specialization
that is actually instantiated from a different (partial/explicit)
specialization of the template. We resolve this by declaring that constructors
that do so can only be used to deduce specializations of the primary template.
I'm running this past CWG to see if people agree this is the right thing to do.

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

7 years ago[WebAssembly] Set MaxAtomicInlineWidth to 64.
Dan Gohman [Wed, 7 Jun 2017 02:22:40 +0000 (02:22 +0000)]
[WebAssembly] Set MaxAtomicInlineWidth to 64.

The WebAssembly threads proposal has changed such that C++
implementations can now declare that atomics up to 64 bits are
"lock free" in C++'s terms.

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

7 years agoImprove error recovery for missing 'template' keyword in contexts where the
Richard Smith [Wed, 7 Jun 2017 00:29:44 +0000 (00:29 +0000)]
Improve error recovery for missing 'template' keyword in contexts where the
template is valid with or without it (with different meanings).

If we see "dependent.x<...", and what follows the '<' is a valid expression,
we must parse the '<' as a comparison rather than a template angle bracket.
When we later come to instantiate, if we find that the LHS of the '<' actually
names an overload set containing function templates, produce a diagnostic
suggesting that the 'template' keyword was missed rather than producing a
mysterious diagnostic saying that the function must be called (and pointing
at what looks to already be a function call!).

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