Commit Graph

69645 Commits

Author SHA1 Message Date
Adrian Prantl 1fa1885acd Adopt to LLVM API change (llvm.dbg.value no longer has an offset)
llvm-svn: 309427
2017-07-28 20:21:08 +00:00
Leo Li 42698d09b8 [CMake] Add Android toolchain CMake cache files.
Summary: Thoes files are used to build Android toolchain. D32816 makes it possible to build runtimes for targets.

Reviewers: beanz, srhines

Reviewed By: srhines

Subscribers: pirama, jroelofs, srhines, cfe-commits, mgorny

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

llvm-svn: 309407
2017-07-28 17:40:28 +00:00
Chris Bieneman 6b5851bb4a [CMake] NFC. Add clang-tablegen-targets utility target
By creating this target other projects that depend on clang-generated headers (like LLDB) will no longer be order-dependent on Clang being processed by CMake first.

Also, by creating a dummy of this target in ClangConfig.cmake, projects that can build against out-of-tree clang can freely depend on the target without needing to have conditionals for if clang is in-tree or out-of-tree.

llvm-svn: 309390
2017-07-28 15:33:47 +00:00
Alex Lorenz 45b4014711 Recommit r308327 3rd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The second recommit (r309106) was reverted because the "non-default #pragma
pack value chages the alignment of struct or union members in the included file"
warning proved to be too aggressive for external projects like Chromium
(https://bugs.chromium.org/p/chromium/issues/detail?id=749197). This recommit
makes the problematic warning a non-default one, and gives it the
-Wpragma-pack-suspicious-include warning option.

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

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

llvm-svn: 309386
2017-07-28 14:41:21 +00:00
Simon Pilgrim 0b37ffbbf9 Strip trailing whitespace. NFCI.
llvm-svn: 309383
2017-07-28 14:01:51 +00:00
Simon Pilgrim 9207fab61a [X86] Add tests showing inability of vector non-temporal load/store intrinsic to force pointer alignment (PR33830)
Clang specifies a max type alignment of 16 bytes on darwin targets, meaning that the builtin nontemporal stores don't correctly align the loads/stores to 32 or 64 bytes when required, resulting in lowering to temporal unaligned loads/stores.

llvm-svn: 309382
2017-07-28 13:47:02 +00:00
Francois Ferrand a64ba70183 clang-format: merge short case labels with trailing comments
Summary:
Allow merging short case labels when they actually end with a comment
(like a comment after the ``break``) and when followed by switch-level
comments (e.g. aligned with next case):

  switch(a) {
  case 0: break; // comment at end of case
  case 1: return value;
  // comment related to next case
  // comment related to next case
  case 2:
  }

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 309370
2017-07-28 07:56:18 +00:00
Francois Ferrand a98a95cca7 clang-format: fix block OpeningLineIndex around preprocessor
Summary:
The current code would return an incorrect value when a preprocessor
directive is present immediately after the opening brace: this causes
the nanespace end comment fixer to break in some places, for exemple it
would not add the comment in this case:

  namespace a {
  #define FOO
  }

Fixing the computation is simple enough, but it was breaking a feature,
as it would cause comments to be added also when the namespace
declaration was dependant on conditional compilation.

To fix this, a hash of the current preprocessor stack/branches is
computed at the beginning of parseBlock(), so that we explicitely do not
store the OpeningLineIndex when the beginning and end of the block are
not in the same preprocessor conditions.

Tthe hash is computed based on the line, but this could propbably be
improved by using the actual condition, so that clang-format would be
able to match multiple identical #ifdef blocks.

Reviewers: krasimir, djasper

Reviewed By: krasimir

Subscribers: klimek, cfe-commits

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

llvm-svn: 309369
2017-07-28 07:56:14 +00:00
Akira Hatanaka 7ce6ed49e8 Update comment in test case after r309308.
llvm-svn: 309352
2017-07-28 01:58:14 +00:00
Kostya Serebryany 6145776720 [sanitizer-coverage] clang flags pumbing for -fsanitize-coverage=pc-table
llvm-svn: 309338
2017-07-28 00:10:10 +00:00
Saleem Abdulrasool b5eca2f9a2 Headers: fix _Unwind_{G,S}etGR for non-EHABI targets
The EHABI definition was being inlined into the users even when EHABI
was not in use.  Adjust the condition to ensure that the right version
is defined.

llvm-svn: 309327
2017-07-27 21:56:25 +00:00
Martin Storsjo 64a5499587 [Headers] Add a test for arm64intr.h
This tests the ARM64 specific constants added in SVN r309081,
similar to the one added in r277928 for armintr.h.

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

llvm-svn: 309314
2017-07-27 19:45:13 +00:00
Alexey Bataev 463a9fea1e [OPENMP] Allow all lvalues in 'depend' clause.
According to upcoming OpenMP 5.0 all addressable lvalue expressions are
allowed in deoend clause.

llvm-svn: 309309
2017-07-27 19:15:30 +00:00
Akira Hatanaka c47fcf0ae5 Revert r264998 and r265035.
r303175 made changes to have __cxa_allocate_exception return a 16-byte
aligned pointer, so it's no longer necessary to specify a lower
alignment (8-bytes) for exception objects on Darwin.

rdar://problem/32363695

llvm-svn: 309308
2017-07-27 18:52:44 +00:00
Florian Hahn ef5bbd61da Update to use enum classes for various ARM *Kind enums
Summary: This updates the relevant Clang parts for the LLVM change D35882.

Reviewers: rengolin, chandlerc, javed.absar, rovka

Reviewed By: rovka

Subscribers: aemerson, cfe-commits, kristof.beyls

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

llvm-svn: 309289
2017-07-27 16:28:39 +00:00
Erich Keane 0026ed2f9c Fix double destruction of objects when OpenMP construct is canceled
When an omp for loop is canceled the constructed objects are being destructed 
twice.

It looks like the desired code is:

{

  Obj o;
  If (cancelled) branch-through-cleanups to cancel.exit.

}
[cleanups]
cancel.exit:

__kmpc_for_static_fini
br cancel.cont (*)

cancel.cont:

__kmpc_barrier
return

The problem seems to be the branch to cancel.cont is currently also going 
through the cleanups calling them again. This change just does a direct branch 
instead.

Patch By: michael.p.rice@intel.com

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

llvm-svn: 309288
2017-07-27 16:28:20 +00:00
Dehao Chen c76a27e325 Make new PM honor -fdebug-info-for-profiling (clang side)
Summary: The new PM needs to invoke add-discriminator pass when building with -fdebug-info-for-profiling.

Reviewers: chandlerc, davidxl

Reviewed By: chandlerc

Subscribers: sanjoy, cfe-commits

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

llvm-svn: 309282
2017-07-27 15:29:53 +00:00
Johannes Altmanninger 914a958e56 [clang-diff] Rename, NFC
llvm-svn: 309276
2017-07-27 15:04:44 +00:00
Alexey Bataev 88202be1f0 [OPENMP] Codegen for 'in_reduction' clause.
Added codegen for task-based directive with in_reduction clause.
```
<body>
```
The next code is emitted:
```
void *td;
...
td = call i8* @__kmpc_task_reduction_init();
...
<type> *priv = (<type> *)call i8* @__kmpc_task_reduction_get_th_data(i32
GTID, i8* td, i8* <orig>)
```

llvm-svn: 309270
2017-07-27 13:20:36 +00:00
Peter Smith 32e2675384 [CodeGen][ARM] ARM runtime helper functions are not always soft-fp
Re-commit r309257 with less precise register checks in arm-float-helpers.c
test.

llvm-svn: 309263
2017-07-27 10:43:53 +00:00
Peter Smith c03956cf73 [CodeGen][ARM] Revert r309257
The test arm-float-helpers.c appears to be failing on some builders and
needs some work to make it more robust.

llvm-svn: 309259
2017-07-27 09:57:13 +00:00
Peter Smith 8459922df7 [CodeGen][ARM] ARM runtime helper functions are not always soft-fp
The ARM Runtime ABI document (IHI0043) defines the AEABI floating point
helper functions in 4.1.2 The floating-point helper functions. These
functions always use the base PCS (soft-fp). However helper functions
defined outside of this document such as the complex-number multiply and
divide helpers are not covered by this requirement and should use
hard-float PCS if the target is hard-float as both compiler-rt and libgcc
for a hard-float sysroot implement these functions with a hard-float PCS.
    
All of the floating point helper functions that are explicitly soft float
are expanded in the llvm ARM backend. This change makes clang not force the
BuiltinCC to AAPCS for AAPCS_VFP. With this change the ARM compiler-rt
tests involving _Complex pass with both hard-fp and soft-fp targets.

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

llvm-svn: 309257
2017-07-27 09:21:41 +00:00
Nemanja Ivanovic f88f81c444 [PowerPC] Pass CPU to assembler with -no-integrated-as
This just adds the CPU to a list of commands passed to GAS when not using the
integrated assembler.

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

llvm-svn: 309256
2017-07-27 08:58:28 +00:00
Vedant Kumar d73696480e [Coverage] NFC: Simplify sanity checks with a SpellingRange utility
This should simplify D35925.

llvm-svn: 309245
2017-07-27 02:20:25 +00:00
Vedant Kumar 7838696ea4 [Coverage] NFC: Save a pair of calls to get{Start,End}
llvm-svn: 309244
2017-07-27 02:20:20 +00:00
Saleem Abdulrasool 9c13bbe953 Headers: improve ARM EHABI coverage of unwind.h
Ensure that we define the `_Unwind_Control_Block` structure used on ARM
EHABI targets.  This is needed for building libc++abi with the unwind.h
from the resource dir.  A minor fallout of this is that we needed to
create a typedef for _Unwind_Exception to work across ARM EHABI and
non-EHABI targets.  The structure definitions here are based originally
on the documentation from ARM under the "Exception Handling ABI for the
ARM® Architecture" Section 7.2.  They are then adjusted to more closely
reflect the definition in libunwind from LLVM.  Those changes are
compatible in layout but permit easier use in libc++abi and help
maintain compatibility between libunwind and the compiler provided
definition.

llvm-svn: 309226
2017-07-26 22:55:23 +00:00
Richard Smith ae8d62c9c5 Add branch weights to branches for static initializers.
The initializer for a static local variable cannot be hot, because it runs at
most once per program. That's not quite the same thing as having a low branch
probability, but under the assumption that the function is invoked many times,
modeling this as a branch probability seems reasonable.

For TLS variables, the situation is less clear, since the initialization side
of the branch can run multiple times in a program execution, but we still
expect initialization to be rare relative to non-initialization uses. It would
seem worthwhile to add a PGO counter along this path to make this estimation
more accurate in future.

For globals with guarded initialization, we don't yet apply any branch weights.
Due to our use of COMDATs, the guard will be reached exactly once per DSO, but
we have no idea how many DSOs will define the variable.

llvm-svn: 309195
2017-07-26 22:01:09 +00:00
Konstantin Zhuravlyov bf106764d9 Convert mac file format to unix
Differential Revision: https://reviews.llvm.org/D35900

llvm-svn: 309193
2017-07-26 21:59:45 +00:00
Eric Beckmann a9337eb72b Clang and LLVM search for different versions of libxml2, reset found
variable before each search so that they don't conflict.

llvm-svn: 309189
2017-07-26 21:47:17 +00:00
Hans Wennborg b4ece98a34 Revert r309106 "Recommit r308327 2nd time: Add a warning for missing"
The warning fires on non-suspicious code in Chromium. Reverting until a
solution is figured out.

> Recommit r308327 2nd time: Add a warning for missing
> '#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files
>
> The first recommit (r308441) caused a "non-default #pragma pack value might
> change the alignment of struct or union members in the included file" warning
> in LLVM itself. This recommit tweaks the added warning to avoid warnings for
> #includes that don't have any records that are affected by the non-default
> alignment. This tweak avoids the previously emitted warning in LLVM.
>
> Original message:
>
> This commit adds a new -Wpragma-pack warning. It warns in the following cases:
>
> - When a translation unit is missing terminating #pragma pack (pop) directives.
> - When entering an included file if the current alignment value as determined
>   by '#pragma pack' directives is different from the default alignment value.
> - When leaving an included file that changed the state of the current alignment
>   value.
>
> rdar://10184173
>
> Differential Revision: https://reviews.llvm.org/D35484

llvm-svn: 309186
2017-07-26 21:29:24 +00:00
Alexey Sotkin 7d7f0dc08b [OpenCL] Fix access qualifiers metadata for kernel arguments with typedef
Subscribers: cfe-commits, yaxunl, Anastasia

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

llvm-svn: 309155
2017-07-26 18:49:54 +00:00
Erich Keane b0c78096a5 Add bitrig removal to release notes
llvm-svn: 309145
2017-07-26 18:04:45 +00:00
Serge Pavlov c0f12e51fb Regression test for PR10856
llvm-svn: 309118
2017-07-26 14:58:55 +00:00
Alex Lorenz 727c21e309 unguarded availability: add a fixit for the "annotate '...'
with an availability attribute to silence" note

rdar://33539233

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

llvm-svn: 309116
2017-07-26 13:58:02 +00:00
Yuka Takahashi 66256906c3 [Bash-autocompletion] Show HelpText with possible flags
Summary:
`clang --autocomplete=-std` will show
```
-std:   Language standard to compile for
-std=   Language standard to compile for
-stdlib=        C++ standard library to use
```
after this change.

However, showing HelpText with completion in bash seems super tricky, so
this feature will be used in other shells (fish, zsh...).

Reviewers: v.g.vassilev, teemperor, ruiu

Subscribers: cfe-commits, hiraditya

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

llvm-svn: 309113
2017-07-26 13:36:58 +00:00
Yuka Takahashi 8c000110cf [Bash-completion] Fixed a bug that file doesn't autocompleted after =
Summary:
File path wasn't autocompleted after `-fmodule-cache-path=[tab]`, so
fixed this bug by checking if $flags contains only a newline or not.

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

llvm-svn: 309112
2017-07-26 13:30:36 +00:00
Alex Lorenz 5d48424a30 Recommit r308327 2nd time: Add a warning for missing
'#pragma pack (pop)' and suspicious uses of '#pragma pack' in included files

The first recommit (r308441) caused a "non-default #pragma pack value might
change the alignment of struct or union members in the included file" warning
in LLVM itself. This recommit tweaks the added warning to avoid warnings for
#includes that don't have any records that are affected by the non-default
alignment. This tweak avoids the previously emitted warning in LLVM.

Original message:

This commit adds a new -Wpragma-pack warning. It warns in the following cases:

- When a translation unit is missing terminating #pragma pack (pop) directives.
- When entering an included file if the current alignment value as determined
  by '#pragma pack' directives is different from the default alignment value.
- When leaving an included file that changed the state of the current alignment
  value.

rdar://10184173

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

llvm-svn: 309106
2017-07-26 12:20:57 +00:00
George Rimar 5dbfa4e65b Update after LLVM change r309087
llvm-svn: 309088
2017-07-26 09:10:17 +00:00
Mandeep Singh Grang 79249e1be7 [clang] Add ARM64 support to armintr.h for MSVC compatibility
Summary: This fixes compiling with headers from the Windows SDK for ARM64.

Reviewers: compnerd, ruiu, mstorsjo

Reviewed By: compnerd, mstorsjo

Subscribers: mgorny, aemerson, javed.absar, kristof.beyls, llvm-commits, cfe-commits

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

llvm-svn: 309081
2017-07-26 05:29:40 +00:00
Peter Szecsi d39a7ed1ac [StaticAnalyzer] LoopUnrolling - Attempt #2 to fix a crash in r309006.
llvm-svn: 309061
2017-07-25 23:49:16 +00:00
David Majnemer 8f94a23505 [CodeGen] Correctly model std::byte's aliasing properties
std::byte, when defined as an enum, needs to be given special treatment
with regards to its aliasing properties. An array of std::byte is
allowed to be used as storage for other types.

This fixes PR33916.

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

llvm-svn: 309058
2017-07-25 23:33:58 +00:00
Richard Smith adae25d35d Reorder tests to match latest SD-6 draft.
llvm-svn: 309054
2017-07-25 23:31:42 +00:00
NAKAMURA Takumi 3c7223837a clang/StaticAnalyzer/Core/PathSensitive/LoopUnrolling.h: Add a forward decl AnalysisManager, to unbreak modules build.
llvm-svn: 309052
2017-07-25 23:23:17 +00:00
Mandeep Singh Grang 8dc8394d5f [clang] Add abi-breaking-checks support to clang
Summary: You can now use REQUIRES:abi-breaking-checks in clang too

Reviewers: chapuni, probinson, ddunbar, jroelofs

Reviewed By: jroelofs

Subscribers: jroelofs, cfe-commits

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

llvm-svn: 309049
2017-07-25 23:00:02 +00:00
Peter Szecsi 4601ebaaf4 [StaticAnalyzer] LoopUnrolling - Attempt to fix a crash in r309006.
llvm-svn: 309036
2017-07-25 21:54:58 +00:00
Sean Callanan bdec541baa Fix a bot by linking clang-import-test against libclangDriver
llvm-svn: 309018
2017-07-25 20:09:30 +00:00
Sean Callanan 1eac879d85 [ExternalASTMerger] Import Objective-C classes
This patch adds functionality and a test for importing Objective-C classes
and their methods.

It also adds a flag to clang-import-test to set the language used for
parsing. This takes the same argument format as the -x option to the
driver.

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

llvm-svn: 309014
2017-07-25 19:54:22 +00:00
Vedant Kumar 525a7f6b17 [Frontend] Mark some ASTUnit methods as const. NFC.
Patch by Hamza Sood!

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

llvm-svn: 309013
2017-07-25 19:53:27 +00:00
Vedant Kumar bbc953fed4 [ubsan] Null-check pointers in -fsanitize=vptr (PR33881)
The instrumentation generated by -fsanitize=vptr does not null check a
user pointer before loading from it. This causes crashes in the face of
UB member calls (this=nullptr), i.e it's causing user programs to crash
only after UBSan is turned on.

The fix is to make run-time null checking a prerequisite for enabling
-fsanitize=vptr, and to then teach UBSan to reuse these run-time null
checks to make -fsanitize=vptr safe.

Testing: check-clang, check-ubsan, a stage2 ubsan-enabled build

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

https://bugs.llvm.org/show_bug.cgi?id=33881

llvm-svn: 309007
2017-07-25 19:34:23 +00:00
Peter Szecsi 657ac14816 [StaticAnalyzer] Completely unrolling specific loops with known bound option
This feature allows the analyzer to consider loops to completely unroll.
New requirements/rules (for unrolling) can be added easily via ASTMatchers.

Right now it is hidden behind a flag, the aim is to find the correct heuristic
and create a solution which results higher coverage % and more precise
analysis, thus can be enabled by default.

Right now the blocks which belong to an unrolled loop are marked by the
LoopVisitor which adds them to the ProgramState.
Then whenever we encounter a CFGBlock in the processCFGBlockEntrance which is
marked then we skip its investigating. That means, it won't be considered to
be visited more than the maximal bound for visiting since it won't be checked.

llvm-svn: 309006
2017-07-25 19:23:23 +00:00