]> granicus.if.org Git - clang/log
clang
7 years agoRemove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
Chandler Carruth [Fri, 30 Jun 2017 05:13:31 +0000 (05:13 +0000)]
Remove Clang support for '-fvectorize-slp-aggressive' which used LLVM's
basic block vectorizer. This vectorizer has had no known users for many,
many years and is completely surpassed by the normal
'-fvectorize-slp'-controlled SLP vectorizer in LLVM.

Hal proposed this back in 2014 to no objections:
http://lists.llvm.org/pipermail/llvm-dev/2014-November/079091.html

While this patch completely removes the flag, Joerg is working on
a patch that will add it back in a way that warns users and ignores the
flag in a clear and well factored way (so that we can keep doing this
going forward).

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

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

7 years agoRemove test commit.
Don Hinton [Fri, 30 Jun 2017 03:03:28 +0000 (03:03 +0000)]
Remove test commit.

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

7 years agoTest Commit
Don Hinton [Fri, 30 Jun 2017 02:57:34 +0000 (02:57 +0000)]
Test Commit

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

7 years ago[WebAssembly] Add throw/rethrow builtins for exception handling
Heejin Ahn [Fri, 30 Jun 2017 00:44:01 +0000 (00:44 +0000)]
[WebAssembly] Add throw/rethrow builtins for exception handling

Summary:
Add new builtins for throw/rethrow instructions. This follows exception handling
handling proposal in
https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md

Reviewers: sunfish, dschuff

Reviewed By: dschuff

Subscribers: jfb, dschuff, sbc100, jgravelle-google

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

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

7 years ago[CodeGen] Propagate dllexport to thunks
Shoaib Meenai [Fri, 30 Jun 2017 00:07:54 +0000 (00:07 +0000)]
[CodeGen] Propagate dllexport to thunks

Under Windows Itanium, we need to export virtual and non-virtual thunks
if the functions being thunked are exported. These thunks would
previously inherit their dllexport attribute from the declaration, but
r298330 changed declarations to not have dllexport attributes. We
therefore need to add the dllexport attribute to the definition
ourselves now.

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

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

7 years agoUnified logic for computing target ABI in backend and front end by moving this common...
Eric Christopher [Fri, 30 Jun 2017 00:03:56 +0000 (00:03 +0000)]
Unified logic for computing target ABI in backend and front end by moving this common code to Support/TargetParser.

Modeled Triple::GNU after front end code (aapcs abi) and updated tests that expect apcs abi.

Patch by Ana Pazos!

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

7 years ago[PM] Add support for sample PGO in the new pass manager (clang-side)
Dehao Chen [Thu, 29 Jun 2017 23:33:13 +0000 (23:33 +0000)]
[PM] Add support for sample PGO in the new pass manager (clang-side)

Summary: This implements the clang bits of https://reviews.llvm.org/D34720, and add corresponding test to verify if it worked.

Reviewers: chandlerc, davidxl, davide, tejohnson

Reviewed By: chandlerc, tejohnson

Subscribers: tejohnson, sanjoy, mehdi_amini, eraman, cfe-commits

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

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

7 years agoTeach ASTReader how to read only the Preprocessor state from an AST file, not the...
Richard Smith [Thu, 29 Jun 2017 23:23:46 +0000 (23:23 +0000)]
Teach ASTReader how to read only the Preprocessor state from an AST file, not the ASTContext state.

We use this when running a preprocessor-only action on an AST file in order to
avoid paying the runtime cost of loading the extra information.

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

7 years ago[clang-format] Switch to case-insensitive header matching and use it to
Chandler Carruth [Thu, 29 Jun 2017 23:20:54 +0000 (23:20 +0000)]
[clang-format] Switch to case-insensitive header matching and use it to
improve support for LLVM-style include sorting.

This really is a collection of improvements to the rules for LLVM
include sorting:
- We have gmock headers now, so it adds support for those to one of the
  categories.
- LLVM does use 'FooTest.cpp' files to test 'Foo.h' so it adds that
  suffix for finding a main header.
- At times the test file's case may not match the header file's case, so
  switch to case-insensitive regex matching of header names.

With this set of changes, I can't spot any misbehaviors when re-sorting
all of LLVM's unittest '#include' lines.

Thanks to Eric and Daniel for help testing and refining the patch during
review!

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

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

7 years ago[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.
Tim Shen [Thu, 29 Jun 2017 23:10:13 +0000 (23:10 +0000)]
[NewPM] Add Clang cc1 flag -fdebug-pass-manager for printing debug information.

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

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

7 years ago[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.
Tim Shen [Thu, 29 Jun 2017 23:08:38 +0000 (23:08 +0000)]
[ThinkLTO] Invoke build(Thin)?LTOPreLinkDefaultPipeline.

Previously it doesn't actually invoke the designated new PM builder
functions.

This patch moves NameAnonGlobalPass out from PassBuilder, as Chandler
points out that PassBuilder is used for non-O0 builds, and for
optimizations only.

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

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

7 years ago[ODRHash] Improve typedef handling.
Richard Trieu [Thu, 29 Jun 2017 22:53:04 +0000 (22:53 +0000)]
[ODRHash] Improve typedef handling.

Follow typedef chains to find the root type when processing types, and also
keep track of qualifiers.

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

7 years agoFix openmp-offload.c test on Windows
Reid Kleckner [Thu, 29 Jun 2017 22:31:16 +0000 (22:31 +0000)]
Fix openmp-offload.c test on Windows

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

7 years agoInsert llvm_unreachable at the end of a function to silence gcc's
Akira Hatanaka [Thu, 29 Jun 2017 20:44:20 +0000 (20:44 +0000)]
Insert llvm_unreachable at the end of a function to silence gcc's
-Werror=return-type error.

This is an attempt to fix the following failing bot:

http://lab.llvm.org:8011/builders/ubuntu-gcc7.1-werror

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

7 years ago[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.
George Karpenkov [Thu, 29 Jun 2017 19:58:20 +0000 (19:58 +0000)]
[libFuzzer] Add Fuzzer to the list of sanitizers which support coverage.

Without this change, additional coverage flags specified after
-fsanitize=fuzzer would get discarded.

https://reviews.llvm.org/D34794

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

7 years ago[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared...
George Karpenkov [Thu, 29 Jun 2017 19:52:33 +0000 (19:52 +0000)]
[libFuzzer] Do not link in libFuzzer with -fsanitize=fuzzer when producing a shared object

https://reviews.llvm.org/D34791

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

7 years ago[ASTReader] Add test for previous change r306583 / 145692e.
Graydon Hoare [Thu, 29 Jun 2017 19:42:35 +0000 (19:42 +0000)]
[ASTReader] Add test for previous change r306583 / 145692e.

Summary:
Add a test for the change to ASTReader that reproduces the
logic for consolidating multiple ObjC interface definitions to the
case of multiple ObjC protocol definitions.

This test is a modified copy of the test that accompanied the original
change to interfaces, in 2ba1979.

Reviewers: bruno

Reviewed By: bruno

Subscribers: cfe-commits

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

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

7 years ago[OpenMP] Fix test for revision D29645. NFC
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 18:49:16 +0000 (18:49 +0000)]
[OpenMP] Fix test for revision D29645. NFC

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

7 years ago[Sema] Issue diagnostics if a new/delete expression generates a call to
Akira Hatanaka [Thu, 29 Jun 2017 18:48:40 +0000 (18:48 +0000)]
[Sema] Issue diagnostics if a new/delete expression generates a call to
a c++17 aligned allocation/deallocation function that is unavailable in
the standard library on Apple platforms.

The aligned functions are implemented only in the following versions or
later versions of the OSes, so clang issues diagnostics if the deployment
target being targeted is older than these:

macosx: 10.13
ios: 11.0
tvos: 11.0
watchos: 4.0

The diagnostics are issued whenever the aligned functions are selected
except when the selected function has a definition in the same file.
If there is a user-defined function available somewhere else, option
-Wno-aligned-allocation-unavailable can be used to silence the
diagnostics.

rdar://problem/32664169

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

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

7 years agoCodeGen: Fix invalid bitcast for coerced function argument
Yaxun Liu [Thu, 29 Jun 2017 18:47:45 +0000 (18:47 +0000)]
CodeGen: Fix invalid bitcast for coerced function argument

Clang assumes coerced function argument is in address space 0, which is not always true and results in invalid bitcasts.

This patch fixes failure in OpenCL conformance test api/get_kernel_arg_info with amdgcn---amdgizcl triple, where non-zero alloca address space is used.

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

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

7 years agoFixed -Wexceptions derived-to-base false positives
Stephan Bergmann [Thu, 29 Jun 2017 17:58:59 +0000 (17:58 +0000)]
Fixed -Wexceptions derived-to-base false positives

...as introduced with recent <https://reviews.llvm.org/D33333> "Emit warning
when throw exception in destruct or dealloc functions which has a (possible
implicit) noexcept specifier".  (The equivalent of the goodReference case hit
when building LibreOffice.)

(These warnings are apparently only emitted when no errors have yet been
encountered, so it didn't work to add the test code to the end of the existing
clang/test/SemaCXX/exceptions.cpp.)

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

7 years ago[OPENMP][DEBUG] Generate second function with correct arg types.
Alexey Bataev [Thu, 29 Jun 2017 16:43:05 +0000 (16:43 +0000)]
[OPENMP][DEBUG] Generate second function with correct arg types.

Currently, if the some of the parameters are captured by value, this
argument is converted to uintptr_t type and thus we loosing the debug
info about real type of the argument (captured variable):
```
void @.outlined_function.(uintptr %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.outlined_function.(uintptr %a.casted.val)
...
```

To resolve this problem, in debug mode a speciall external wrapper
function is generated, that calls the outlined function with the correct
parameters types:
```
void @.wrapper.(uintptr %par) {
  %a = alloca i32
  %cast = bitcast i32* %a to uintptr*
  store uintptr %par, uintptr *%cast
  %a.val = load i32, i32* %a
  call void @.outlined_function.(i32 %a)
  ret void
}
void @.outlined_function.(i32 %par);

...
%a = alloca i32
%a.casted = alloca uintptr
%cast = bitcast uintptr* %a.casted to i32*
%a.val = load i32, i32 *%a
store i32 %a.val, i32 *%cast
%a.casted.val = load uintptr, uintptr* %a.casted
call void @.wrapper.(uintptr %a.casted.val)
...
```

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

7 years agoInitialize variable and silence potentially uninitialized warning.
Vassil Vassilev [Thu, 29 Jun 2017 16:08:10 +0000 (16:08 +0000)]
Initialize variable and silence potentially uninitialized warning.

Patch by Liza Sakellari!

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

7 years ago[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generatio...
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:59:19 +0000 (15:59 +0000)]
[OpenMP] Pass -fopenmp-is-device to preprocessing and machine specific code generation stages

Summary: The preprocessing and code generation and optimization stages of the compiler are also passed the "-fopenmp-is-device" flag. This is used to trigger machine specific preprocessing and code generation when performing device offloading to an NVIDIA GPU via OpenMP directives.

Reviewers: arpith-jacob, caomhin, carlo.bertolli, Hahnfeld, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: Hahnfeld, rengolin

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

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

7 years ago[OpenMP] Add support for auxiliary triple specification
Gheorghe-Teodor Bercea [Thu, 29 Jun 2017 15:49:03 +0000 (15:49 +0000)]
[OpenMP] Add support for auxiliary triple specification

Summary: Device offloading requires the specification of an additional flag containing the triple of the //other// architecture the code is being compiled on if such an architecture exists. If compiling for the host, the auxiliary triple flag will contain the triple describing the device and vice versa.

Reviewers: arpith-jacob, sfantao, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar

Reviewed By: Hahnfeld

Subscribers: rengolin, cfe-commits

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

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

7 years agoFix NSAPI constants to reflect the current state of
Alex Lorenz [Thu, 29 Jun 2017 14:18:26 +0000 (14:18 +0000)]
Fix NSAPI constants to reflect the current state of
NSStringMethodKind/NSDictionaryMethodKind enums

Patch by Vladimir Voskresensky!

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

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

7 years ago[Clang][X86][Goldmont]Adding new target-cpu: Goldmont
Michael Zuckerman [Thu, 29 Jun 2017 13:41:04 +0000 (13:41 +0000)]
[Clang][X86][Goldmont]Adding new target-cpu: Goldmont

[Clang-side] Connecting the GoldMont processor to his feature.

Reviewers:
1. igorb
2. delena
3. zvi

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

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

7 years ago[clang-format] Fix parsing of msg{field}-style proto options
Krasimir Georgiev [Thu, 29 Jun 2017 13:30:41 +0000 (13:30 +0000)]
[clang-format] Fix parsing of msg{field}-style proto options

Summary:
This patch makes the `{` in `msg_field{field: OK}` in a proto option scope be
treated as an assignment operator. Previosly the added test case was formatted
as:
```
option (MyProto.options) = {
  field_a: OK
  field_b{field_c: OK} field_d: OKOKOK field_e: OK
}
```

Reviewers: djasper

Reviewed By: djasper

Subscribers: klimek, cfe-commits

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

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

7 years agoRevert r306653, "[OpenCL] Allow function declaration with empty argument list."
NAKAMURA Takumi [Thu, 29 Jun 2017 10:47:23 +0000 (10:47 +0000)]
Revert r306653, "[OpenCL] Allow function declaration with empty argument list."

It broke bots.

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

7 years ago[Tooling] FixedCompilationDatabase should be able to strip positional
Alex Lorenz [Thu, 29 Jun 2017 10:43:44 +0000 (10:43 +0000)]
[Tooling] FixedCompilationDatabase should be able to strip positional
arguments when `-fsyntax-only` is used

Previously, Clang failed to create a fixed compilation database when the
compilation arguments use -fsyntax-only instead of -c. This commit fixes the
issue by forcing Clang to look at the compilation job when stripping the
positional arguments.

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

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

7 years ago[OpenCL] Allow function declaration with empty argument list.
Alexey Bader [Thu, 29 Jun 2017 08:44:10 +0000 (08:44 +0000)]
[OpenCL] Allow function declaration with empty argument list.

Summary:
does it make sense to enable K&R function declaration style for OpenCL?
clang throws following error message for the declaration w/o arguments:

```
int my_func();
error: function with no prototype cannot use the spir_function calling convention
```

Current way to fix this issue is to specify that parameter list is empty by using 'void':

```
int my_func(void);
```

Let me know what do you think about this patch.

Reviewers: Anastasia, yaxunl

Reviewed By: Anastasia

Subscribers: cfe-commits, echuraev

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

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

7 years agoFactor out a functionality from isBeforeInTranslationUnit
Gabor Horvath [Thu, 29 Jun 2017 06:53:13 +0000 (06:53 +0000)]
Factor out a functionality from isBeforeInTranslationUnit

The first user of this API will be the cross translation unit
functionality of the Static Analyzer which will be committed in a
follow-up patch.

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

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

7 years agoTrack the set of module maps read while building a .pcm file and reload those when...
Richard Smith [Thu, 29 Jun 2017 02:19:42 +0000 (02:19 +0000)]
Track the set of module maps read while building a .pcm file and reload those when preprocessing from that .pcm file.

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

7 years agoCodeGen: handle missed case of COMDAT handling
Saleem Abdulrasool [Thu, 29 Jun 2017 00:54:44 +0000 (00:54 +0000)]
CodeGen: handle missed case of COMDAT handling

When Protocol references are constructed, we need to add the reference
symbol to a COMDAT group on non-MachO object file formats (MachO handles
this by having a coalesced attribute).  This adds the missing case.

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

7 years ago[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.
Graydon Hoare [Wed, 28 Jun 2017 18:36:27 +0000 (18:36 +0000)]
[ASTReader] Treat multiple defns of ObjC protocols the same as interfaces.

Summary:
In change 2ba19793512, the ASTReader logic for ObjC interfaces was modified to
preserve the first definition-data read, "merging" later definitions into it
rather than overwriting it (though this "merging" is, in practice, a no-op that
discards the later definition-data).

Unfortunately this change was only made to ObjC interfaces, not protocols; this
means that when (for example) loading a protocol that references an interface,
if both the protocol and interface are multiply defined (as can easily happen
if the same header is read from multiple contexts), an _inconsistent_ pair of
definitions is loaded: first-read for the interface and last-read for the
protocol.

This in turn causes very subtle downstream bugs in the Swift ClangImporter,
which filters the results of name lookups based on the owning module of a
definition; inconsistency between a pair of related definitions causes name
lookup failures at various stages of compilation.

To fix these downstream issues, this change replicates the logic applied to
interfaces in change 2ba19793512, but for ObjC protocols.

rdar://30851899

Reviewers: doug.gregor, rsmith

Reviewed By: doug.gregor

Subscribers: jordan_rose, cfe-commits

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

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

7 years ago[Bash-autocompletion] Invoke clang where user called
Yuka Takahashi [Wed, 28 Jun 2017 16:29:26 +0000 (16:29 +0000)]
[Bash-autocompletion] Invoke clang where user called

Summary:
When user build clang and used completion Eg. `build/bin/clang -fno[tab]`, we want to invoke `build/bin/clang --autocomplete=-fno`, rather than `clang --autocomplete=-fno`.

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

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

7 years ago[Bash-autocompletion] Check clang version in Bash
Yuka Takahashi [Wed, 28 Jun 2017 15:59:55 +0000 (15:59 +0000)]
[Bash-autocompletion] Check clang version in Bash

Summary:
Add check if user's clang version supports --autocomplete or not.
If not, we just autocomplete files.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: cfe-commits

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

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

7 years agoUse vfs::FileSystem in ASTUnit when creating CompilerInvocation.
Ilya Biryukov [Wed, 28 Jun 2017 15:06:34 +0000 (15:06 +0000)]
Use vfs::FileSystem in ASTUnit when creating CompilerInvocation.

Summary: It used to always call into the RealFileSystem before.

Reviewers: bkramer, krasimir, klimek, bruno

Reviewed By: klimek

Subscribers: bruno, cfe-commits

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

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

7 years agoFix crash in clang while handling __has_trivial_destructor.
Karthik Bhat [Wed, 28 Jun 2017 08:52:08 +0000 (08:52 +0000)]
Fix crash in clang while handling __has_trivial_destructor.

Fix crash in clang when an array of unknown bounds of an incomplete type is passed to __has_trivial_destructor.

Patch by Puneetha
https://reviews.llvm.org/D34198

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

7 years agoDiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]
NAKAMURA Takumi [Wed, 28 Jun 2017 06:46:23 +0000 (06:46 +0000)]
DiagnosticRenderer.h: Prune \param SM, corresponding to rL306384. [-Wdocumentation]

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

7 years agoRemove a redundant call to ArgList::hasFlag. NFC.
Vedant Kumar [Wed, 28 Jun 2017 01:56:07 +0000 (01:56 +0000)]
Remove a redundant call to ArgList::hasFlag. NFC.

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

7 years ago[CodeGen] Fix assertion failure in EmitCallArg.
Akira Hatanaka [Wed, 28 Jun 2017 00:42:48 +0000 (00:42 +0000)]
[CodeGen] Fix assertion failure in EmitCallArg.

The assertion was failing when a method of a parameterized class was
called and the types of the argument and parameter didn't match. To fix
the failure, move the assertion in EmitCallArg to its only caller
EmitCallArgs and require the argument and parameter types match only
when the method is not parameterized.

rdar://problem/32874473

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

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

7 years ago[COFF, ARM64] Add support for Windows ARM64 COFF format
Mandeep Singh Grang [Tue, 27 Jun 2017 23:56:34 +0000 (23:56 +0000)]
[COFF, ARM64] Add support for Windows ARM64 COFF format

Summary: This is the clang part of the initial implementation to support Windows ARM64 COFF format.

Reviewers: ruiu, t.p.northover, rnk, compnerd

Reviewed By: ruiu, compnerd

Subscribers: aemerson, kristof.beyls, cfe-commits, llvm-commits

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

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

7 years ago[libclang] Support for querying the exception specification type through libclang
Jonathan Coe [Tue, 27 Jun 2017 22:54:56 +0000 (22:54 +0000)]
[libclang] Support for querying the exception specification type through libclang

Summary: This patch exposes the exception specification type (noexcept,
etc.) of a C++ function through libclang and Python clang.cindex.

Reviewers: rsmith, aaron.ballman

Reviewed By: aaron.ballman

Subscribers: jbcoe, cfe-commits

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

Patch by Andrew Bennieston

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

7 years ago[Sema] Allow unmarked overloadable functions.
George Burgess IV [Tue, 27 Jun 2017 21:31:31 +0000 (21:31 +0000)]
[Sema] Allow unmarked overloadable functions.

This patch extends the `overloadable` attribute to allow for one
function with a given name to not be marked with the `overloadable`
attribute. The overload without the `overloadable` attribute will not
have its name mangled.

So, the following code is now legal:

  void foo(void) __attribute__((overloadable));
  void foo(int);
  void foo(float) __attribute__((overloadable));

In addition, this patch fixes a bug where we'd accept code with
`__attribute__((overloadable))` inconsistently applied. In other words,
we used to accept:

  void foo(void);
  void foo(void) __attribute__((overloadable));

But we will do this no longer, since it defeats the original purpose of
requiring `__attribute__((overloadable))` on all redeclarations of a
function.

This breakage seems to not be an issue in practice, since the only code
I could find that had this pattern often looked like:

  void foo(void);
  void foo(void) __attribute__((overloadable)) __asm__("foo");
  void foo(int) __attribute__((overloadable));

...Which can now be simplified by simply removing the asm label and
overloadable attribute from the redeclaration of `void foo(void);`

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

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

7 years agotest: fix test for release builds
Saleem Abdulrasool [Tue, 27 Jun 2017 18:57:50 +0000 (18:57 +0000)]
test: fix test for release builds

Use a regex capture to avoid hardcoding the name.  This should repair
the failing buildbot.

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

7 years agoCodeGen: load indirect ObjC ARC arguments in prologue
Saleem Abdulrasool [Tue, 27 Jun 2017 18:37:51 +0000 (18:37 +0000)]
CodeGen: load indirect ObjC ARC arguments in prologue

When generating a prologue, add loads for ARC arguments passed
indirectly.

Patch by Dave Lee!

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

7 years agoUpdate the test comment to clarify the intention of the test.
Dehao Chen [Tue, 27 Jun 2017 17:45:40 +0000 (17:45 +0000)]
Update the test comment to clarify the intention of the test.

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

7 years ago[x86] weaken test checks that shouldn't be here in the first place
Sanjay Patel [Tue, 27 Jun 2017 17:39:46 +0000 (17:39 +0000)]
[x86] weaken test checks that shouldn't be here in the first place

This test would fail after the proposed change in:
https://reviews.llvm.org/D34242

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

7 years agoUpdate test for enabling ICP for AutoFDO.
Dehao Chen [Tue, 27 Jun 2017 17:23:42 +0000 (17:23 +0000)]
Update test for enabling ICP for AutoFDO.

Summary: This is the test update patch for https://reviews.llvm.org/D34662

Reviewers: davidxl

Reviewed By: davidxl

Subscribers: cfe-commits, sanjoy, mehdi_amini, eraman, llvm-commits

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

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

7 years ago[OPENMP] Use MapVector instead of DenseMap for stable codegen, NFC.
Alexey Bataev [Tue, 27 Jun 2017 15:46:42 +0000 (15:46 +0000)]
[OPENMP] Use MapVector instead of DenseMap for stable codegen, NFC.

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

7 years ago[clang-format] Fix a clang-tidy warning, NFC
Krasimir Georgiev [Tue, 27 Jun 2017 14:07:45 +0000 (14:07 +0000)]
[clang-format] Fix a clang-tidy warning, NFC

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

7 years ago[clang-format] Fix a buildbot failure after r306406
Krasimir Georgiev [Tue, 27 Jun 2017 13:58:41 +0000 (13:58 +0000)]
[clang-format] Fix a buildbot failure after r306406

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

7 years ago[clang-format] Support <>-style proto message fields
Krasimir Georgiev [Tue, 27 Jun 2017 13:43:07 +0000 (13:43 +0000)]
[clang-format] Support <>-style proto message fields

Summary:
This patch adds support for <>-style proto message fields inside proto options.
Previously these were wrongly treated as binary operators and as such were
working only by chance for a limited number of cases.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years ago[analyzer] Move zero-size allocation checks to optin.portability.
Artem Dergachev [Tue, 27 Jun 2017 11:14:39 +0000 (11:14 +0000)]
[analyzer] Move zero-size allocation checks to optin.portability.

This is a new checker package. It contains checkers that highlight
well-documented implementation-defined behavior. Such checkers are only useful
to developers that intend to write portable code. Code that is only compiled for
a single platform should be allowed to rely on this platform's specific
documented behavior.

rdar://problem/30545046

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

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

7 years agoRecommit r306103: PR26195: Set correct NestedNameSpecifierLoc for the
Alex Lorenz [Tue, 27 Jun 2017 10:35:30 +0000 (10:35 +0000)]
Recommit r306103: PR26195: Set correct NestedNameSpecifierLoc for the
dependent initializer

This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:

template<typename MyBase>
struct Derived: MyBase::InnerIterator
{

Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};

Patch by Serge Preis!

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

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

7 years ago[clang-format] Add a test for associative map proto buffer fields
Krasimir Georgiev [Tue, 27 Jun 2017 10:06:40 +0000 (10:06 +0000)]
[clang-format] Add a test for associative map proto buffer fields

Summary:
The test suite was missing a test about associative maps:
https://developers.google.com/protocol-buffers/docs/proto3#maps

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, klimek

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

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

7 years agoRevert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""
Christof Douma [Tue, 27 Jun 2017 09:50:38 +0000 (09:50 +0000)]
Revert "Revert "[NFC] Refactor DiagnosticRenderer to use FullSourceLoc""

This reverts commit r305688 meaning it reintroduces r305684. To repeat:

[NFC] Refactor DiagnosticRenderer to use FullSourceLoc

Move the DiagnosticRenderer and its dependents to using FullSourceLocs
instead of a SourceLocation and SourceManager pointer. The changeset is
rather large but entirely mechanical.

This is step one to allow DiagnosticRenderer to take either
llvm::SMLocs or clang::SourceLocations.

This breaks clang-tidy and clng-query which will be fixed in a commit
soon after.

Patch by Sanne Wouda

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

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

7 years agoReapply "Frontend support for Nios2 target"
Nikolai Bozhenov [Tue, 27 Jun 2017 09:48:24 +0000 (09:48 +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@306383 91177308-0d34-0410-b5e6-96231b3b80d8

7 years agoMake CastExpr::getSubExprAsWritten look through implicit temporary under CK_Construct...
Stephan Bergmann [Tue, 27 Jun 2017 08:19:09 +0000 (08:19 +0000)]
Make CastExpr::getSubExprAsWritten look through implicit temporary under CK_ConstructorConversion

With

    struct S1 {};
    struct S2 { operator S1(); };
    S1 f(S2 s) { return static_cast<S1>(s); }

the static_cast expr is

    CXXStaticCastExpr 0x... 'struct S1' static_cast<struct S1> <ConstructorConversion>
    `-CXXConstructExpr 0x... 'struct S1' 'void (struct S1 &&) noexcept' elidable

    `-MaterializeTemporaryExpr 0x... 'struct S1' xvalue
      `-ImplicitCastExpr 0x... 'struct S1' <UserDefinedConversion>
        `-CXXMemberCallExpr 0x... 'struct S1'
          `-MemberExpr 0x... '<bound member function type>' .operator S1 0x...
            `-DeclRefExpr 0x... 'struct S2' lvalue ParmVar 0x... 's' 'struct S2'

getSubExprAsWritten used to return the MaterializeTemporaryExpr (of type S1)
under the CXXConstructExpr, instead of unwinding further to the DeclRefExpr (of
type S2) at the bottom.

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

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

7 years agoMake sure TraverseInitListExpr visits InitListExpr exactly twice
Stephan Bergmann [Tue, 27 Jun 2017 08:04:08 +0000 (08:04 +0000)]
Make sure TraverseInitListExpr visits InitListExpr exactly twice

... once each for the syntactic and semantic form. Without this fix, behavior
of the newly added tests would have been

InitListExprIsPreOrderVisitedTwice:
 syntactic: 1
 semantic: 2

InitListExprIsPostOrderVisitedTwice:
 syntactic: 0
 semantic: 1

InitListExprIsPreOrderNoQueueVisitedTwice:
 syntactic: 1
 semantic: 2

InitListExprIsPostOrderNoQueueVisitedTwice:
 syntactic: 0
 semantic: 2

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

7 years agoSwitch TestVisitor to Lang_C via -x c
Stephan Bergmann [Tue, 27 Jun 2017 07:59:56 +0000 (07:59 +0000)]
Switch TestVisitor to Lang_C via -x c

...instead of -std=c99, as the latter lead to

  error: invalid argument '-std=c99' not allowed with 'C++'

complaints in test logs

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

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

7 years agoclang/test/CodeGenObjC/ivar-type-encoding.m: Tweak to satisfy -m32.
NAKAMURA Takumi [Tue, 27 Jun 2017 07:40:47 +0000 (07:40 +0000)]
clang/test/CodeGenObjC/ivar-type-encoding.m: Tweak to satisfy -m32.

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

7 years ago[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.
Akira Hatanaka [Tue, 27 Jun 2017 04:34:04 +0000 (04:34 +0000)]
[CodeGen][ObjC] Fix GNU's encoding of bit-field ivars.

According to the documentation, when encoding a bit-field, GNU runtime
needs its starting position in addition to its type and size.

https://gcc.gnu.org/onlinedocs/gcc/Type-encoding.html

Prior to r297702, the starting position information was not being
encoded, which is incorrect, and after r297702, an assertion started to
fail because an ObjCIvarDecl was being passed to a function expecting a
FieldDecl.

This commit moves LookupFieldBitOffset to ASTContext and uses the
function to encode the starting position of bit-fields.

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

7 years agoRemove redundant check.
Richard Smith [Tue, 27 Jun 2017 00:29:32 +0000 (00:29 +0000)]
Remove redundant check.

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

7 years agoFix this test to use a construct that actually forces struct layout to happen when...
Richard Smith [Tue, 27 Jun 2017 00:22:07 +0000 (00:22 +0000)]
Fix this test to use a construct that actually forces struct layout to happen when testing -Wpadded.

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

7 years agoAST: enhance mangling for blocks with MS ABI
Saleem Abdulrasool [Mon, 26 Jun 2017 23:28:42 +0000 (23:28 +0000)]
AST: enhance mangling for blocks with MS ABI

When generating the decorated name for a static variable inside a
BlockDecl, construct a scope for the block invocation function that
homes the parameter. This allows for arbitrary nesting of the blocks
even if the variables are shadowed. Furthermore, using this for the name
allows for undname to properly undecorated the name for us. It shows up
as the synthetic __block_invocation function that the compiler emitted
in the local scope.

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

7 years agoRevert r301742, which caused us to try to evaluate all full-expressions.
Richard Smith [Mon, 26 Jun 2017 23:19:32 +0000 (23:19 +0000)]
Revert r301742, which caused us to try to evaluate all full-expressions.

Also add testcases for a bunch of expression forms that cause our evaluator to
crash. See PR33140 and PR32864 for crashes that this was causing.

This reverts r305287, which reverted r305239, which reverted r301742. The
previous revert claimed that buildbots were broken, but did not add any
testcases and the buildbots have lost all memory of what was wrong here.

Changes to test/OpenMP are not reverted; another change has triggered those
tests to change their output in the same way that r301742 did.

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

7 years ago[clang] Enable printf check for CFIndex
Alexander Shaposhnikov [Mon, 26 Jun 2017 23:02:27 +0000 (23:02 +0000)]
[clang] Enable printf check for CFIndex

According to
https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html
CFIndex and NSInteger should be treated the same way (see the section Platform Dependencies).
This diff changes the function shouldNotPrintDirectly in SemaChecking.cpp accordingly
and adds tests for the "fixit" and the warning.

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

Test plan: make check-all

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

7 years agoCheck that the initializer of a non-dependent constexpr variable is constant even...
Richard Smith [Mon, 26 Jun 2017 20:33:42 +0000 (20:33 +0000)]
Check that the initializer of a non-dependent constexpr variable is constant even within templates.

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

7 years agoRemove some redundant setup when preprocessing .pcm files.
Richard Smith [Mon, 26 Jun 2017 20:15:21 +0000 (20:15 +0000)]
Remove some redundant setup when preprocessing .pcm files.

Both of these steps are immediately overwritten by the FrontendAction setup.

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

7 years agoWhen preprocessing with -frewrite-imports and -fmodule-file=, do not pass all
Richard Smith [Mon, 26 Jun 2017 19:39:25 +0000 (19:39 +0000)]
When preprocessing with -frewrite-imports and -fmodule-file=, do not pass all
modules to preprocessing of nested .pcm files.

Making those module files available results in loading more .pcm files than
necessary, and potentially in misbehavior if a module makes itself visible
during its own compilation (as parts of that module that have not yet been
processed would then become visible).

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

7 years ago[Sema] Fix a crash-on-invalid when a template parameter list has a class
Akira Hatanaka [Mon, 26 Jun 2017 18:46:12 +0000 (18:46 +0000)]
[Sema] Fix a crash-on-invalid when a template parameter list has a class
definition or non-reference class type.

The crash occurs when there is a template parameter list in a class that
is missing the closing angle bracket followed by a definition of a
struct. For example:

class C0 {
public:
  template<typename T, typename T1 = T // missing closing angle bracket
  struct S0 {};

  C0() : m(new S0<int>) {}
  S0<int> *m;
};

This happens because the parsed struct is added to the scope of the
enclosing class without having its access specifier set, which results
in an assertion failure in SemaAccess.cpp later.

This commit fixes the crash by adding the parsed struct to the enclosing
file scope and marking structs as invalid if they are defined in
template parameter lists.

rdar://problem/31783961
rdar://problem/19570630

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

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

7 years ago[inline asm] dot operator while using imm generates wrong ir + asm - clang part
Marina Yatsina [Mon, 26 Jun 2017 16:09:55 +0000 (16:09 +0000)]
[inline asm] dot operator while using imm generates wrong ir + asm - clang part

Inline asm dot operator while using imm generates wrong ir and asm
This is the test for the llvm changes committed in revision 306300

This also fixes bugzilla 32987:
https://bugs.llvm.org//show_bug.cgi?id=32987

The llvm part of the review that contains the test can be found here:
https://reviews.llvm.org/D33039

commit on behald of zizhar

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

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

7 years ago[inline asm][gcc-compatiblity] "=i" output constraint support
Marina Yatsina [Mon, 26 Jun 2017 15:55:51 +0000 (15:55 +0000)]
[inline asm][gcc-compatiblity] "=i" output constraint support

Ignore ‘i’,’n’,’E’,’F’ as output constraints in inline assembly (gcc compatibility)

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

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

7 years agoImprove const-correctness.
Axel Naumann [Mon, 26 Jun 2017 15:06:40 +0000 (15:06 +0000)]
Improve const-correctness.

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

7 years ago[mips] Enable IAS by default for Android 64-bit MIPS target (N64)
Petar Jovanovic [Mon, 26 Jun 2017 09:58:01 +0000 (09:58 +0000)]
[mips] Enable IAS by default for Android 64-bit MIPS target (N64)

IAS is already used for MIPS64 in majority of Android projects.
Android MIPS64 uses N64 ABI. Set IAS as a default now.

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

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

7 years agoTestcase missed from r306075.
Richard Smith [Mon, 26 Jun 2017 04:41:22 +0000 (04:41 +0000)]
Testcase missed from r306075.

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

7 years agoclang-format - Also reference the list of style option of clang-format in Libformat
Sylvestre Ledru [Mon, 26 Jun 2017 03:19:05 +0000 (03:19 +0000)]
clang-format - Also reference the list of style option of clang-format in Libformat

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

7 years agoFix a typo
Sylvestre Ledru [Mon, 26 Jun 2017 02:45:08 +0000 (02:45 +0000)]
Fix a typo

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

7 years ago[bash-autocompletion] Delete space after flags which has '=' prefix
Yuka Takahashi [Mon, 26 Jun 2017 00:35:36 +0000 (00:35 +0000)]
[bash-autocompletion] Delete space after flags which has '=' prefix

Summary:
This is patch for bash completion for clang project.
We don't need space when completing options like "-stdlib=".

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

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

7 years agoAdd support for Ananas platform
Ed Schouten [Sun, 25 Jun 2017 08:29:09 +0000 (08:29 +0000)]
Add support for Ananas platform

Ananas is a home-brew operating system, mainly for amd64 machines. After
using GCC for quite some time, it has switched to clang and never looked
back - yet, having to manually patch things is annoying, so it'd be much
nicer if this was in the official tree.

More information:

https://github.com/zhmu/ananas/
https://rink.nu/projects/ananas.html

Submitted by: Rink Springer
Differential Revision: https://reviews.llvm.org/D32936

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

7 years agoAdd a warning to a group
Vedant Kumar [Fri, 23 Jun 2017 23:34:32 +0000 (23:34 +0000)]
Add a warning to a group

Add warn_drv_object_size_disabled_O0 to the invalid command line
argument group. This should fix some bot failures:

  lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/13241/steps/test/logs/stdio

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

7 years ago[ubsan] Disable the object size check at -O0
Vedant Kumar [Fri, 23 Jun 2017 23:15:24 +0000 (23:15 +0000)]
[ubsan] Disable the object size check at -O0

This check currently isn't able to diagnose any issues at -O0, not is it
likely to [1]. Disabling the check at -O0 leads to substantial compile
time and binary size savings.

[1] [cfe-dev] Disabling ubsan's object size check at -O0

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

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

7 years agoRevert "[MS] Don't statically initialize dllimport member function pointers"
Reid Kleckner [Fri, 23 Jun 2017 22:39:01 +0000 (22:39 +0000)]
Revert "[MS] Don't statically initialize dllimport member function pointers"

This reverts commit r306137. It has problems on code like this:

  struct __declspec(dllimport) Foo {
    int a;
    int get_a() { return a; }
  };
  template <int (Foo::*Getter)()> struct HasValue {
    int operator()(Foo *p) { return (p->*Getter)(); }
  };
  int main() {
    Foo f;
    f.a = 3;
    int x = HasValue<&Foo::get_a>()(&f);
  }

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

7 years ago[ubsan] Improve diagnostics for return value checks (clang)
Vedant Kumar [Fri, 23 Jun 2017 21:32:38 +0000 (21:32 +0000)]
[ubsan] Improve diagnostics for return value checks (clang)

This patch makes ubsan's nonnull return value diagnostics more precise,
which makes the diagnostics more useful when there are multiple return
statements in a function. Example:

1 |__attribute__((returns_nonnull)) char *foo() {
2 |  if (...) {
3 |    return expr_which_might_evaluate_to_null();
4 |  } else {
5 |    return another_expr_which_might_evaluate_to_null();
6 |  }
7 |} // <- The current diagnostic always points here!

runtime error: Null returned from Line 7, Column 2!
With this patch, the diagnostic would point to either Line 3, Column 5
or Line 5, Column 5.

This is done by emitting source location metadata for each return
statement in a sanitized function. The runtime is passed a pointer to
the appropriate metadata so that it can prepare and deduplicate reports.

Compiler-rt patch (with more tests): https://reviews.llvm.org/D34298

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

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

7 years ago[MSP430] Fix data layout string.
Vadzim Dambrouski [Fri, 23 Jun 2017 21:12:56 +0000 (21:12 +0000)]
[MSP430] Fix data layout string.

Summary:
Change data layout string so it would be compatible with MSP430 EABI.

Depends on D34561

Reviewers: asl, awygle

Reviewed By: asl

Subscribers: cfe-commits

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

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

7 years agoAdd test for 306149, warn on throw from noexcept
Erich Keane [Fri, 23 Jun 2017 20:30:33 +0000 (20:30 +0000)]
Add test for 306149, warn on throw from noexcept

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

7 years agoEmit warning when throw exception in destruct or dealloc functions which has a
Erich Keane [Fri, 23 Jun 2017 20:22:19 +0000 (20:22 +0000)]
Emit warning when throw exception in destruct or dealloc functions which has a
(possible implicit) noexcept specifier

Throwing in the destructor is not good (C++11 change try to not allow see below).
 But in reality, those codes are exist.
C++11 [class.dtor]p3:

A declaration of a destructor that does not have an exception-specification is
implicitly considered to have the same exception specification as an implicit
declaration.

With this change, the application worked before may now run into runtime
termination. My goal here is to emit a warning to provide only possible info to
where the code may need to be changed.

First there is no way, in compile time to identify the “throw” really throw out
of the function. Things like the call which throw out… To keep this simple,
when “throw” is seen, checking its enclosing function(only destructor and
dealloc functions) with noexcept(true) specifier emit warning.

Here is implementation detail:
A new member function CheckCXXThrowInNonThrowingFunc is added for class Sema
in Sema.h. It is used in the call to both BuildCXXThrow and
TransformCXXThrowExpr.

The function basic check if the enclosing function with non-throwing noexcept
specifer, if so emit warning for it.

The example of warning message like:
k1.cpp:18:3: warning: ''~dependent_warn'' has a (possible implicit) non-throwing

    noexcept specifier. Throwing exception may cause termination.
        [-Wthrow-in-dtor]
        throw 1;
        ^

        k1.cpp:43:30: note: in instantiation of member function

        'dependent_warn<noexcept_fun>::~dependent_warn' requested here

        dependent_warn<noexcept_fun> f; // cause warning

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

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

7 years ago[MS] Don't statically initialize dllimport member function pointers
Reid Kleckner [Fri, 23 Jun 2017 18:29:13 +0000 (18:29 +0000)]
[MS] Don't statically initialize dllimport member function pointers

We were already applying the same rules to dllimport function pointers.
David Majnemer added that logic back in r211677 to fix PR20130.  We
failed to extend that logic to non-virtual member function pointers,
which are basically function pointers in a struct with some extra
offsets.

Fixes PR33570.

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

7 years ago[GSoC] Add support for CC1 options.
Yuka Takahashi [Fri, 23 Jun 2017 17:05:50 +0000 (17:05 +0000)]
[GSoC] Add support for CC1 options.

Summary:
Add value completion support for options which are defined in
CC1Options.td, because we only handled options in Options.td.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: llvm-commits

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

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

7 years agoAdd a ThinLTO cache policy for controlling the maximum cache size in bytes.
Peter Collingbourne [Fri, 23 Jun 2017 17:05:03 +0000 (17:05 +0000)]
Add a ThinLTO cache policy for controlling the maximum cache size in bytes.

This is useful when an upper limit on the cache size needs to be
controlled independently of the amount of the amount of free space.

One use case is a machine with a large number of cache directories
(e.g. a buildbot slave hosting a large number of independent build
jobs). By imposing an upper size limit on each cache directory,
users can more easily estimate the server's capacity.

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

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

7 years agodocs: Add documentation for the ThinLTO cache pruning policy string.
Peter Collingbourne [Fri, 23 Jun 2017 16:56:27 +0000 (16:56 +0000)]
docs: Add documentation for the ThinLTO cache pruning policy string.

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

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

7 years agotest: fix negative test case
Saleem Abdulrasool [Fri, 23 Jun 2017 16:52:49 +0000 (16:52 +0000)]
test: fix negative test case

Add missing -### to the driver to ensure that we dont try to run the
actual command.  The host may not support the IAS.  Should fix the SCEI
buildbots.

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

7 years agoSort the autocomplete candidates before printing them out.
Rui Ueyama [Fri, 23 Jun 2017 15:37:52 +0000 (15:37 +0000)]
Sort the autocomplete candidates before printing them out.

Currently, autocompleted options are displayed in the same order as we
wrote them in .td files. This patch sort them out in clang so that they
are sorted alphabetically. This should improve usability.

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

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

7 years agoRevert "Revert r305164/5/7."
Saleem Abdulrasool [Fri, 23 Jun 2017 15:34:16 +0000 (15:34 +0000)]
Revert "Revert r305164/5/7."

Restore the `-gz` option to the driver with some minor tweaks to handle
the additional case for `-Wa,--compress-debug-sections`.

This intends to make the compression of the debug information
controllable from the driver.  The following is the behaviour:

  -gz           enable compression (ambiguous for format, will default to zlib-gnu)
  -gz=none      disable compression
  -gz=zlib-gnu  enable compression (deprecated GNU style zlib compression)
  -gz=zlib      enable compression (zlib based compression)

Although -Wa,-compress-debug-sections works, it should be discouraged
when using the driver to invoke the assembler.  However, we permit the
assembler to accept the GNU as style argument --compress-debug-sections
to maintain compatibility.

Note, -gz/-gz= does *NOT* imply -g.  That is, you need to additionally
specific -g for debug information to be generated.

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

7 years agoRevert r306103: "PR26195: Set correct NestedNameSpecifierLoc for the
Alex Lorenz [Fri, 23 Jun 2017 15:10:54 +0000 (15:10 +0000)]
Revert r306103: "PR26195: Set correct NestedNameSpecifierLoc for the
dependent initializer"

It caused buildbot failures such as this one:
http://bb.pgr.jp/builders/test-clang-msc-x64-on-i686-linux-RA/builds/3777/steps/test_clang/logs/Clang%20%3A%3A%20Index__ctor-init-source-loc.cpp

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

7 years agoPR26195: Set correct NestedNameSpecifierLoc for the dependent initializer
Alex Lorenz [Fri, 23 Jun 2017 14:10:07 +0000 (14:10 +0000)]
PR26195: Set correct NestedNameSpecifierLoc for the dependent initializer

This commit fixes incorrect source positions of dependent c'tor initializers
like in the following code:

template<typename MyBase>
struct Derived: MyBase::InnerIterator
{

Derived() : MyBase::InnerIterator() {} /// This line is problematic: all positions point to InnerIterator and nothing points to MyBase
};

Patch by Serge Preis!

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

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

7 years ago[clang-format] Add a SortUsingDeclaration option and enable it by default
Krasimir Georgiev [Fri, 23 Jun 2017 11:46:03 +0000 (11:46 +0000)]
[clang-format] Add a SortUsingDeclaration option and enable it by default

Summary:
This patch adds a `SortUsingDeclaration` style option and enables it for llvm
style.

Reviewers: klimek

Reviewed By: klimek

Subscribers: klimek

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

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

7 years ago[clang-format] Update dump_format_style.py to indent nested fields
Krasimir Georgiev [Fri, 23 Jun 2017 11:29:40 +0000 (11:29 +0000)]
[clang-format] Update dump_format_style.py to indent nested fields

Summary:
This updates the format options documentation script to indent the
documentation of nested fields. The previous format caused some problems,
as when a bulleted list ends with a multiline comment. See the buildbot failure
http://lab.llvm.org:8011/builders/clang-sphinx-docs/builds/10020/steps/docs-clang-html/logs/stdio

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits

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

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