Commit Graph

1114 Commits

Author SHA1 Message Date
Erich Keane 873de98661 revert r338831 - Fix unused variable warning in tablegen generated code
No longer necessary thanks to r338889 (and friends).

llvm-svn: 338893
2018-08-03 14:24:34 +00:00
Karl-Johan Karlsson cd75901de3 Fix unused variable warning in tablegen generated code
llvm-svn: 338831
2018-08-03 09:13:15 +00:00
Richard Smith f4e248c23e [P0936R0] add [[clang::lifetimebound]] attribute
This patch adds support for a new attribute, [[clang::lifetimebound]], that
indicates that the lifetime of a function result is related to one of the
function arguments. When walking an initializer to make sure that the lifetime
of the initial value is at least as long as the lifetime of the initialized
object, we step through parameters (including the implicit object parameter of
a non-static member function) that are marked with this attribute.

There's nowhere to write an attribute on the implicit object parameter, so in
lieu of that, it may be applied to a function type (where it appears
immediately after the cv-qualifiers and ref-qualifier, which is as close to a
declaration of the implicit object parameter as we have). I'm currently
modeling this in the AST as the attribute appertaining to the function type.

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

llvm-svn: 338464
2018-08-01 00:33:25 +00:00
George Karpenkov 8f6d65c685 [analyzer] [tests] Add an option for showing statistics after running tests.
Do not show statistics by default.

llvm-svn: 338323
2018-07-30 23:01:47 +00:00
George Karpenkov 13d3748e7c [analyzer] [tests] Style fixes for testing harness.
llvm-svn: 338322
2018-07-30 23:01:20 +00:00
Erich Keane 3efe00206f Implement cpu_dispatch/cpu_specific Multiversioning
As documented here: https://software.intel.com/en-us/node/682969 and
https://software.intel.com/en-us/node/523346. cpu_dispatch multiversioning
is an ICC feature that provides for function multiversioning.

This feature is implemented with two attributes: First, cpu_specific,
which specifies the individual function versions. Second, cpu_dispatch,
which specifies the location of the resolver function and the list of
resolvable functions.

This is valuable since it provides a mechanism where the resolver's TU
can be specified in one location, and the individual implementions
each in their own translation units.

The goal of this patch is to be source-compatible with ICC, so this
implementation diverges from the ICC implementation in a few ways:
1- Linux x86/64 only: This implementation uses ifuncs in order to
properly dispatch functions. This is is a valuable performance benefit
over the ICC implementation. A future patch will be provided to enable
this feature on Windows, but it will obviously more closely fit ICC's
implementation.
2- CPU Identification functions: ICC uses a set of custom functions to identify
the feature list of the host processor. This patch uses the cpu_supports
functionality in order to better align with 'target' multiversioning.
1- cpu_dispatch function def/decl: ICC's cpu_dispatch requires that the function
marked cpu_dispatch be an empty definition. This patch supports that as well,
however declarations are also permitted, since the linker will solve the
issue of multiple emissions.

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

llvm-svn: 337552
2018-07-20 14:13:28 +00:00
Erich Keane e891aa971a [NFC] Rename clang::AttributeList to clang::ParsedAttr
Since The type no longer contains the 'next' item anymore, it isn't a list,
so rename it to ParsedAttr to be more accurate.

llvm-svn: 337005
2018-07-13 15:07:47 +00:00
George Karpenkov 6e4ddf49d8 [analyzer] [tests] Pass clang executable path to prefix-less executor scripts.
llvm-svn: 336124
2018-07-02 17:10:40 +00:00
George Karpenkov 5c23d6ab3c [analyzer] [tests] Allow the tested project to specify it's own analyzer wrapper
llvm-svn: 336023
2018-06-29 22:05:32 +00:00
George Karpenkov a262cf3146 [analyzer] [tests] Fix 80 column violation in SATestBuild.py
llvm-svn: 336022
2018-06-29 22:05:13 +00:00
Mikhail R. Gadelha afc62b7032 [analyzer] Fix string not being formatted with extra arguments
Signed-off-by: Mikhail Ramalho <mikhail.ramalho@gmail.com>
llvm-svn: 335739
2018-06-27 14:39:41 +00:00
George Karpenkov 30130b78c5 [analyzer] [tests] Include statistics in tests.
llvm-svn: 335685
2018-06-26 23:17:35 +00:00
Bruno Cardoso Lopes dc3f88ad98 Re-apply: Add python tool to dump and construct header maps
Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

Thanks to Stella Stamenova for helping make this work on Windows.

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

rdar://problem/39994722

llvm-svn: 335295
2018-06-21 21:45:24 +00:00
Bruno Cardoso Lopes 1f3cc8c1d3 Revert "Add python tool to dump and construct header maps"
This reverts commit fcfa2dd517ec1a6045a81e8247e346d630a22618.

Broke bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

llvm-svn: 335196
2018-06-21 01:23:58 +00:00
Bruno Cardoso Lopes 17d52f65d8 Revert "Fix hmaptool cmake file to work on Windows"
This reverts commit 63711c3cd337a0d22617579a904af07481139611, due to
breaking bots:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

llvm-svn: 335194
2018-06-21 01:23:42 +00:00
Bruno Cardoso Lopes 9dd5090086 Fix hmaptool cmake file to work on Windows
Unbreak a few windows buildbots:
http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/11315
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/10411/steps/test-check-all/logs/stdio

llvm-svn: 335190
2018-06-20 23:08:43 +00:00
Bruno Cardoso Lopes f3003a92c1 Add python tool to dump and construct header maps
Header maps are binary files used by Xcode, which are used to map
header names or paths to other locations. Clang has support for
those since its inception, but there's not a lot of header map
testing around.

Since it's a binary format, testing becomes pretty much brittle
and its hard to even know what's inside if you don't have the
appropriate tools.

Add a python based tool that allows creating and dumping header
maps based on a json description of those. While here, rewrite
tests to use the tool and remove the binary files from the tree.

This tool was initially written by Daniel Dunbar.

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

rdar://problem/39994722

llvm-svn: 335177
2018-06-20 21:16:37 +00:00
Luke Geeson dc54b37414 [AArch64] Corrected FP16 Intrinsic range checks in Clang + added Sema tests
Summary:
This fixes the ranges for the vcvth family of FP16 intrinsics in the clang front end. Previously it was accepting incorrect ranges
-Changed builtin range checking in SemaChecking
-added tests SemaCheck changes - included in  their own file since no similar one exists
-modified existing tests to reflect new ranges

Reviewers: SjoerdMeijer, javed.absar

Reviewed By: SjoerdMeijer

Subscribers: kristof.beyls, cfe-commits

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

llvm-svn: 334489
2018-06-12 09:54:27 +00:00
Mikhail R. Gadelha 690a99a5fb Fix a (possible) division by zero check in the CmpRuns script
I missed updating the check in r333375

llvm-svn: 333529
2018-05-30 11:17:55 +00:00
Mikhail R. Gadelha 8af2e690f3 Introduces --stats-only option to only show changes in statistics.
llvm-svn: 333375
2018-05-28 15:40:39 +00:00
David Bolvansky 05a9bc176e [ClangDiagnostics] Silence warning about fallthrough after PrintFatalError
Summary:
ClangDiagnosticsEmitter.cpp:1047:57: warning: this statement may fall through [-Wimplicit-fallthrough=]
       Builder.PrintFatalError("Unknown modifier type: " + Modifier);
                               ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
ClangDiagnosticsEmitter.cpp:1048:5: note: here
     case MT_Select: {
                   ^

Reviewers: rsmith, rtrieu

Reviewed By: rtrieu

Subscribers: rtrieu, ilya-biryukov, ioeric, MaskRay, jkorous, cfe-commits

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

llvm-svn: 333340
2018-05-26 09:24:00 +00:00
Ben Langmuir 0486c8c3af [bash-completion] Fix tab separation on macOS
We have a regex that needs to match a tab character in the command
output, but on macOS sed doesn't support '\t', causing it to split on
the 't' character instead. Fix by having bash expand the \t first.

llvm-svn: 333202
2018-05-24 16:25:40 +00:00
Mark Searles bcf611ab36 [Clang Tablegen] Add llvm_unreachable() to getModifierName()
Fix internal build failure:

../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o
../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef
{anonymous}::getModifierName({anonymous}::ModifierType)':
../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type]
}
^

Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8

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

llvm-svn: 332854
2018-05-21 17:29:08 +00:00
Eric Fiselier b87be18d8e [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` messages.
Summary:
There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now!

This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted.

The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example:

```
def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">;
```
when used as
```
"candidate `%sub{select_ovl_candidate}3,2,1 not viable"
```
will act as if we wrote:
```
"candidate %select{function|constructor}3%select{| template| %1}2 not viable"
```

Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin

Reviewed By: rjmccall

Subscribers: cfe-commits

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

llvm-svn: 332799
2018-05-19 03:12:04 +00:00
Adrian Prantl 9fc8faf9e6 Remove \brief commands from doxygen comments.
This is similar to the LLVM change https://reviews.llvm.org/D46290.

We've been running doxygen with the autobrief option for a couple of
years now. This makes the \brief markers into our comments
redundant. Since they are a visual distraction and we don't want to
encourage more \brief markers in new code either, this patch removes
them all.

Patch produced by

for i in $(git grep -l '\@brief'); do perl -pi -e 's/\@brief //g' $i & done
for i in $(git grep -l '\\brief'); do perl -pi -e 's/\\brief //g' $i & done

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

llvm-svn: 331834
2018-05-09 01:00:01 +00:00
Aaron Ballman b9a457af35 Allow writing calling convention attributes on function types.
Calling convention attributes notionally appertain to the function type -- they modify the mangling of the function, change the behavior of assignment operations, etc. This commit allows the calling convention attributes to be written in the type position as well as the declaration position.

llvm-svn: 331459
2018-05-03 15:33:50 +00:00
Oliver Stannard 2fcee8bd52 [ARM,AArch64] Add intrinsics for dot product instructions
The ACLE spec which describes these intrinsics hasn't been published yet, but
this is based on the final draft which will be published soon, and these have
already been implemented by GCC.

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

llvm-svn: 331039
2018-04-27 14:03:32 +00:00
Alexander Kornienko 2a8c18d991 Fix typos in clang
Found via codespell -q 3 -I ../clang-whitelist.txt
Where whitelist consists of:

  archtype
  cas
  classs
  checkk
  compres
  definit
  frome
  iff
  inteval
  ith
  lod
  methode
  nd
  optin
  ot
  pres
  statics
  te
  thru

Patch by luzpaz! (This is a subset of D44188 that applies cleanly with a few
files that have dubious fixes reverted.)

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

llvm-svn: 329399
2018-04-06 15:14:32 +00:00
George Karpenkov 711058165c [analyzer] [testing] Be less verbose by default in integration testing.
llvm-svn: 328752
2018-03-29 01:23:54 +00:00
Mandeep Singh Grang c205d8cc8d [clang] Change std::sort to llvm::sort in response to r327219
r327219 added wrappers to std::sort which randomly shuffle the container before
sorting.  This will help in uncovering non-determinism caused due to undefined
sorting order of objects having the same key.

To make use of that infrastructure we need to invoke llvm::sort instead of
std::sort.

llvm-svn: 328636
2018-03-27 16:50:00 +00:00
Joel E. Denny 8150810556 Reland "[Attr] Fix parameter indexing for several attributes"
Relands r326602 (reverted in r326862) with new test and fix for
PR36620.

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

llvm-svn: 327405
2018-03-13 14:51:22 +00:00
Nico Weber bbf648253d Revert r326602, it caused PR36620.
llvm-svn: 326862
2018-03-07 02:22:41 +00:00
Nicolai Haehnle 846e578e71 TableGen: Give up on exact fixits for diagnostic groups
With recent changes in the TableGen frontend, we no longer have usable
location information for anonymous defs.

Fixes test breakage caused by r326788.

The normal, non-error TableGen output is not affected by this change.

llvm-svn: 326822
2018-03-06 17:55:00 +00:00
Yuka Takahashi 41789e46a6 [Bash-autocompletion] Pass all flags in shell command-line to Clang
Previously, we passed "#" to --autocomplete to indicate to enable cc1
flags. For example, when -cc1 or -Xclang was passed to bash, bash
executed `clang --autocomplete=#-<flag they want to complete>`.

However, this was not a good implementation because it depends -Xclang
and -cc1 parsing to shell. So I changed this to pass all flags shell
has, so that Clang can handle them internally.

I had to change many testcases because API spec changed quite a lot.

Reviewers: teemperor, v.g.vassilev

Subscribers: cfe-commits

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

llvm-svn: 326684
2018-03-05 08:54:20 +00:00
Joel E. Denny 4925445958 [Attr] Fix parameter indexing for several attributes
The patch fixes a number of bugs related to parameter indexing in
attributes:

* Parameter indices in some attributes (argument_with_type_tag,
  pointer_with_type_tag, nonnull, ownership_takes, ownership_holds,
  and ownership_returns) are specified in source as one-origin
  including any C++ implicit this parameter, were stored as
  zero-origin excluding any this parameter, and were erroneously
  printing (-ast-print) and confusingly dumping (-ast-dump) as the
  stored values.

* For alloc_size, the C++ implicit this parameter was not subtracted
  correctly in Sema, leading to assert failures or to silent failures
  of __builtin_object_size to compute a value.

* For argument_with_type_tag, pointer_with_type_tag, and
  ownership_returns, the C++ implicit this parameter was not added
  back to parameter indices in some diagnostics.

This patch fixes the above bugs and aims to prevent similar bugs in
the future by introducing careful mechanisms for handling parameter
indices in attributes.  ParamIdx stores a parameter index and is
designed to hide the stored encoding while providing accessors that
require each use (such as printing) to make explicit the encoding that
is needed.  Attribute declarations declare parameter index arguments
as [Variadic]ParamIdxArgument, which are exposed as ParamIdx[*].  This
patch rewrites all attribute arguments that are processed by
checkFunctionOrMethodParameterIndex in SemaDeclAttr.cpp to be declared
as [Variadic]ParamIdxArgument.  The only exception is xray_log_args's
argument, which is encoded as a count not an index.

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

llvm-svn: 326602
2018-03-02 19:03:22 +00:00
George Karpenkov dc0abcb87b [analyzer] [tests] Create a directory for the log file
llvm-svn: 326408
2018-03-01 02:18:54 +00:00
Joel E. Denny 6053ec22eb Test commit access: apply clang-format suggestion
llvm-svn: 326332
2018-02-28 16:57:33 +00:00
George Karpenkov 3f560daf37 [analyzer] [tests] Write to logfile instead of stdout while updating
reference results

llvm-svn: 326295
2018-02-28 01:55:23 +00:00
Aaron Ballman 48a533d005 Improve the way attribute argument printing happens for omitted optional arguments when pretty printing.
Patch by Joel Denny.

llvm-svn: 326266
2018-02-27 23:49:28 +00:00
Jonas Hahnfeld 3c7b136a82 [docs] Fix duplicate arguments for JoinedAndSeparate
We can't see how many arguments are in the meta var name, so just
assume that it is the right number.

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

llvm-svn: 325805
2018-02-22 17:06:27 +00:00
Alexey Bataev cbecfdfefe [OpenMP] Fix trailing space when printing pragmas, by Joel. E. Denny
Summary:
-ast-print prints omp pragmas with a trailing space.  While this
behavior is likely of little concern to most users, surely it's
unintentional, and it's annoying for some source-level work I'm
pursuing.  This patch focuses on omp pragmas, but it also fixes
init_seg and loop hint pragmas because they share implementation.

The testing strategy here is to add usually just one '{{$}}' per
relevant -ast-print test file.  This seems to achieve good code
coverage.  However, this strategy is probably easy to forget as the
tests evolve.  That's probably fine as this fix is far from critical.
The main goal of the testing is to aid the initial review.

This patch also adds a fixme for "#pragma unroll", which prints as
"#pragma unroll (enable)", which is invalid syntax.

Reviewers: ABataev

Reviewed By: ABataev

Subscribers: guansong, cfe-commits

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

llvm-svn: 325145
2018-02-14 17:38:47 +00:00
George Karpenkov b7120c944b [analyzer] [tests] Update CmpRuns to write to stdout correctly in multithreaded environment
llvm-svn: 325070
2018-02-13 23:36:01 +00:00
George Karpenkov 192d9a186f [analyzer] [tests] Fix a typo in analyzer testing script.
Incorrect option instance construction.

llvm-svn: 324946
2018-02-12 22:13:01 +00:00
George Karpenkov 3959041d4e [analyzer] [tests] Fixing an error after non-atomic cherry-pick
llvm-svn: 324762
2018-02-09 18:48:31 +00:00
George Karpenkov fc782a341a [analyzer] [tests] [NFC] Remove a fragile tightly-coupled component emulating parser output
...when we can just use the real parser instead.

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

llvm-svn: 324759
2018-02-09 18:39:47 +00:00
George Karpenkov f37d3a5f84 [analyzer] [tests] Test different projects concurrently
Differential Revision: https://reviews.llvm.org/D43031

llvm-svn: 324652
2018-02-08 21:22:42 +00:00
George Karpenkov 986dd45a78 [analyzer] [tests] Show function name in CmpRuns output
Combined with enabled flag for stable filenames, this greatly simplifies
finding the offending report.

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

llvm-svn: 324362
2018-02-06 17:22:09 +00:00
George Karpenkov 78809e53cc [analyzer] [tests] Fix crash in SATestBuild.py
llvm-svn: 324114
2018-02-02 18:27:14 +00:00
George Karpenkov f37c07c313 [analyzer] [tests] [NFC] Remove dead code from CmpRuns
Indeed, "CHANGE" is not a thing yet, and we should probably not carry
around dead code which does not do anything apart from confusing the
reader.

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

llvm-svn: 324027
2018-02-01 22:40:01 +00:00
George Karpenkov b7043222bf [analyzer] [tests] Add an option to show the histogram of path differences between the analyzer runs
Differential Revision: https://reviews.llvm.org/D42778

llvm-svn: 324021
2018-02-01 22:25:18 +00:00