Commit Graph

90883 Commits

Author SHA1 Message Date
Mircea Trofin 7d541eb4d4 [inliner] Mandatory inlining decisions produce remarks
This also removes the need to disable the mandatory inlining phase in
tests.

In a departure from the previous remark, we don't output a 'cost' in
this case, because there's no such thing. We just report that inlining
happened because of the attribute.

Differential Revision: https://reviews.llvm.org/D110891
2021-10-05 14:01:25 -07:00
Aaron Ballman 939712734a Fix some Sphinx warnings in the static analyzer docs
A heading wasn't underlined properly, and two links share the same text
and so they should use an anonymous hyperlink instead of a named one.
2021-10-05 16:43:55 -04:00
Aaron Ballman 1ddcb804f7 Update the release notes for consteval if support; NFC
This support was landed in 424733c12a.
2021-10-05 16:39:23 -04:00
Amy Huang c7104e5066 [Sema] Allow comparisons between different ms ptr size address space types.
We're currently using address spaces to implement __ptr32/__ptr64 attributes;
this patch fixes a bug where clang doesn't allow types with different pointer
size attributes to be compared.

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

Differential Revision: https://reviews.llvm.org/D110670
2021-10-05 10:56:29 -07:00
Simon Pilgrim 9503ad3b53 [clang] FatalErrorHandler.cpp - add explicit <stdio.h> include
Required for fprintf/stderr usage in the error handler, noticed while trying to remove the <string> dependency described in D111049
2021-10-05 17:03:17 +01:00
Hsiangkai Wang 80a6456306 [RISCV] Update to vlm.v and vsm.v according to v1.0-rc1.
vle1.v  -> vlm.v
vse1.v  -> vsm.v

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D106044
2021-10-05 21:49:54 +08:00
Vassil Vassilev f4f9ad0f5d Reland "[clang-repl] Allow loading of plugins in clang-repl."
Differential revision: https://reviews.llvm.org/D110484
2021-10-05 13:04:01 +00:00
Kamau Bridgeman 8737c74fab [PowerPC][MMA] Allow MMA builtin types in pre-P10 compilation units
This patch allows the use of __vector_quad and __vector_pair, PPC MMA builtin
types, on all PowerPC 64-bit compilation units. When these types are
made available the builtins that use them automatically become available
so semantic checking for mma and pair vector memop __builtins is also
expanded to ensure these builtin function call are only allowed on
Power10 and new architectures. All related test cases are updated to
ensure test coverage.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D109599
2021-10-05 07:59:32 -05:00
Aaron Ballman aa4f4d18e8 consteval if is now fully supported
This amends 424733c12a which accidentally
dropped the change to the status page.
2021-10-05 08:21:29 -04:00
Corentin Jabot 424733c12a Implement if consteval (P1938)
Modify the IfStmt node to suppoort constant evaluated expressions.

Add a new ExpressionEvaluationContext::ImmediateFunctionContext to
keep track of immediate function contexts.

This proved easier/better/probably more efficient than walking the AST
backward as it allows diagnosing nested if consteval statements.
2021-10-05 08:04:14 -04:00
Balázs Kéri bcefea80a4 [clang][ASTImporter] Add import of thread safety attributes.
Attributes of "C/C++ Thread safety attributes" section in Attr.td
are added to ASTImporter. The not added attributes from this section
do not need special import handling.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D110528
2021-10-05 13:08:31 +02:00
Simon Pilgrim e463b69736 [Support] Change fatal_error_handler_t to take a const char* instead of std::string
https://commondatastorage.googleapis.com/chromium-browser-clang/llvm-include-analysis.html

Excessive use of the <string> header has a massive impact on compile time; its most commonly included via the ErrorHandling.h header, which has to be included in many key headers, impacting many source files that have no need for std::string.

As an initial step toward removing the <string> include from ErrorHandling.h, this patch proposes to update the fatal_error_handler_t handler to just take a raw const char* instead.

The next step will be to remove the report_fatal_error std::string variant, which will involve a lot of cleanup and better use of Twine/StringRef.

Differential Revision: https://reviews.llvm.org/D111049
2021-10-05 10:55:40 +01:00
Vassil Vassilev 3e9d04f7e4 Revert "[clang-repl] Allow loading of plugins in clang-repl."
This reverts commit 81fb640f83 due to bot failures:
https://lab.llvm.org/buildbot#builders/57/builds/10807
2021-10-05 06:10:38 +00:00
Vassil Vassilev 81fb640f83 [clang-repl] Allow loading of plugins in clang-repl.
Differential revision: https://reviews.llvm.org/D110484
2021-10-05 05:20:30 +00:00
Leonard Chan 95f824ad7c Revert "[clang][Fuchsia] Re-enable compiler-rt tests in runtimes build"
This reverts commit 8480063f25.

We're seeing some test failures on our builders.
2021-10-04 16:11:43 -07:00
Arthur Eubanks 2568286892 [clang] Don't use the AST to display backend diagnostics
We keep a map from function name to source location so we don't have to
do it via looking up a source location from the AST. However, since
function names can be long, we actually use a hash of the function name
as the key.

Additionally, we can't rely on Clang's printing of function names via
the AST, so we just demangle the name instead.

This is necessary to implement
https://lists.llvm.org/pipermail/cfe-dev/2021-September/068930.html.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D110665
2021-10-04 14:14:32 -07:00
Leonard Chan 8480063f25 [clang][Fuchsia] Re-enable compiler-rt tests in runtimes build
Differential Revision: https://reviews.llvm.org/D110778
2021-10-04 14:11:49 -07:00
serge-sans-paille 0f0e31cf51 Update inline builtin handling to honor gnu inline attribute
Per the GCC info page:

    If the function is declared 'extern', then this definition of the
    function is used only for inlining.  In no case is the function
    compiled as a standalone function, not even if you take its address
    explicitly.  Such an address becomes an external reference, as if
    you had only declared the function, and had not defined it.

Respect that behavior for inline builtins: keep the original definition, and
generate a copy of the declaration suffixed by '.inline' that's only referenced
in direct call.

This fixes holes in c3717b6858.

Differential Revision: https://reviews.llvm.org/D111009
2021-10-04 22:26:25 +02:00
Kamau Bridgeman 8328966520 [PowerPC] Fix to guard fetch and cas 64-bit builtin versions
The builtins: `__compare_and_swaplp`, `__fetch_and_addlp`,
` __fetch_and_andlp`, `__fetch_and_orlp`, `__fetch_and_swaplp` are
64 bit only. This patch ensures the compiler produces an error in 32 bit mode.

Reviewed By: #powerpc, nemanjai

Differential Revision: https://reviews.llvm.org/D110824
2021-10-04 14:45:36 -05:00
James King 56e72a40c1 Update `DynTypedNode` to support the conversion of `TypeLoc`s.
This provides better support for `TypeLoc`s to allow `TypeLoc`-related
matchers to feature stricter typing and to avoid relying on the dynamic
casting of `TypeLoc`s in matchers.

Reviewed By: ymandel, tdl-g, sbenza

Differential Revision: https://reviews.llvm.org/D110586
2021-10-04 19:25:24 +00:00
Lei Huang 8b3d944a97 [PowerPC] Disable vector types when not supported by subtarget features
Update clang to treat vector unsigned long long and friends as invalid
for AltiVec without VSX.

Reported in: https://bugs.llvm.org/show_bug.cgi?id=47782

Reviewed By: nemanjai, amyk

Differential Revision: https://reviews.llvm.org/D109178
2021-10-04 14:16:47 -05:00
Corentin Jabot 922863e75f Add core papers added in the October 2021 WG21 plenary 2021-10-04 14:42:13 -04:00
Zurab Tsinadze 811b1736d9 [analyzer] Add InvalidPtrChecker
This patch introduces a new checker: `alpha.security.cert.env.InvalidPtr`

Checker finds usage of invalidated pointers related to environment.

Based on the following SEI CERT Rules:
ENV34-C: https://wiki.sei.cmu.edu/confluence/x/8tYxBQ
ENV31-C: https://wiki.sei.cmu.edu/confluence/x/5NUxBQ

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D97699
2021-10-04 17:08:34 +02:00
Alexey Bataev bfc8f9e9b0 [clang] Fix computation of number of dependencies using OpenMP iterator,
by Raul Penacoba.

The size of kmp_depend_info and the number of dependencies are computed multiplying the iterator sizes, which not right.
Now size is computed as:

itersize1*numclausedeps1 + itersize2*numclausedeps2 + ... + itersizeN*numclausedepsN

where itersizeX is the size of the iterator and numclausedepsX the number of dependencies in that depend clause.

Reviewed By: ABataev

Differential Revision: https://reviews.llvm.org/D111045
2021-10-04 07:06:51 -07:00
Stefan Pintilie 4fc2f4979c [PowerPC] Fix __builtin_ppc_load2r to return short instead of int.
This patch fixes the return value of the builtin __builtin_ppc_load2r to
correctly return short instead of int.

Reviewed By: nemanjai, #powerpc

Differential Revision: https://reviews.llvm.org/D110771
2021-10-04 06:17:02 -05:00
Jay Foad 566690b067 [APFloat] Remove BitWidth argument from getAllOnesValue
There's no need to pass this in explicitly because it is
trivially available from the semantics.
2021-10-04 11:32:16 +01:00
Jay Foad d933adeaca [APInt] Stop using soft-deprecated constructors and methods in clang. NFC.
Stop using APInt constructors and methods that were soft-deprecated in
D109483. This fixes all the uses I found in clang.

Differential Revision: https://reviews.llvm.org/D110808
2021-10-04 09:38:11 +01:00
Yuanfang Chen a944f801ca [Clang][NFC] Fix the comment for Sema::DiagIfReachable 2021-10-03 13:03:24 -07:00
Dávid Bolvanský fb84aa2a8f Fixed warnings in target/parser codes produced by -Wbitwise-instead-of-logicala 2021-10-03 15:04:01 +02:00
Dávid Bolvanský a76355d570 Unbreak hexagon-check-builtins.c due to rGb1fcca388441 2021-10-03 13:19:34 +02:00
mydeveloperday 5aca8bb963 [clang-format] allow clang-format to be passed a file of filenames so we can add a regression suite of "clean clang-formatted files" from LLVM
This change now generates that list, and the change to clang-format allows
us to run clang-format quickly over these files via the list of files.

clang-format.exe -verbose -n --files=./clang/docs/tools/clang-formatted-files.txt

```
Clang-formating 7926 files
Formatting [1/7925] clang/bindings/python/tests/cindex/INPUTS/header1.h
..
Formatting [7925/7925] utils/bazel/llvm-project-overlay/llvm/include/llvm/Config/config.h
```

This is needed because putting all those files on the command line is too
long, and invoking 7900+ clang-formats is much slower (too slow to be honest)

Using this method it takes on 7.5 minutes (on my machine) to run
`clang-format -n` over all of the files (7925), this should result in us
testing any change quickly and easily.

We should be able to use rerunning this list to ensure that we don't regress
clang-format over a large code base, but also use it to ensure none of the
previous files which were 100% clang-formatted remain so.
(which the LLVM premerge checks should be enforcing)

Reviewed By: HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D111000
2021-10-03 12:10:33 +01:00
Dávid Bolvanský f59cc9542b Reland "[Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects"
This reverts commit a4933f57f3. New warnings were fixed.
2021-10-03 13:05:09 +02:00
Dávid Bolvanský b1fcca3884 Fixed warnings in LLVM produced by -Wbitwise-instead-of-logical 2021-10-03 13:04:18 +02:00
Dávid Bolvanský a4933f57f3 Revert "[Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects"
This reverts commit f62d18ff14. Found some cases in LLVM itself.
2021-10-03 12:47:12 +02:00
Dávid Bolvanský f62d18ff14 [Clang] Extend -Wbool-operation to warn about bitwise and of bools with side effects
Motivation: https://arstechnica.com/gadgets/2021/07/google-pushed-a-one-character-typo-to-production-bricking-chrome-os-devices/

Warn for pattern boolA & boolB or boolA | boolB where boolA and boolB has possible side effects.

Casting one operand to int is enough to silence this warning: for example (int)boolA & boolB or boolA| (int)boolB

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

Differential Revision: https://reviews.llvm.org/D108003
2021-10-03 11:06:40 +02:00
Hsiangkai Wang c274384cff [NFC][RISCV] Update test cases through update_cc_test_checks.py. 2021-10-03 15:44:06 +08:00
mydeveloperday ac21e3922b [clang-format] NFC 1% improvement in the overall clang-formatted status 2021-10-02 18:05:45 +01:00
Josh Learn 3d209c76dd [clang-format] Constructor initializer lists format with pp directives
Currently constructor initializer lists sometimes format incorrectly
when there is a preprocessor directive in the middle of the list.
This patch fixes the issue when parsing the initilizer list by
ignoring the preprocessor directive when checking if a block is
part of an initializer list.

rdar://82554274

Reviewed By: MyDeveloperDay, HazardyKnusperkeks

Differential Revision: https://reviews.llvm.org/D109951
2021-10-02 13:23:43 +01:00
mydeveloperday dd3caa99bd [clang-format] [docs] [NFC] improve clarity in the QualifierAlignment warning
Improve the clarity and guidance of the warning when using code modifying option in clang-format see {D69764}

Reviewed By: HazardyKnusperkeks, curdeius

Differential Revision: https://reviews.llvm.org/D110801
2021-10-02 13:18:42 +01:00
Jinsong Ji 9c31969e8d [AIX] Don't pass namedsects in LTO mode
LTO don't need binder option , don't pass it in LTO mode.

Reviewed By: Whitney

Differential Revision: https://reviews.llvm.org/D110955
2021-10-01 19:22:40 +00:00
Manas a3d0b5805e [analyzer] Fix deprecated plistlib functions
It replaces the usage of readPlist,writePlist functions with load,dump
in plistlib package.

This fixes deprecation issues when analyzer reports are being generated
outside of docker.

Patch by Manas!

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D107312
2021-10-01 17:07:24 +02:00
Nico Weber ec4a822866 [clang] Try to unbreak crash-report.cpp on PS4 bot after 8dfbe9b0a
Looks like exceptions are off-by-default with the PS4 triple.
Since adding -fexceptions defeats the purpose of the test change
in 8dfbe9b0a, pass an explicit triple instead.
2021-10-01 09:33:13 -04:00
Nemanja Ivanovic 369d785574 [PowerPC] Optimal sequence for doubleword vec_all_{eq|ne} on Power7
These builtins produce inefficient code for CPU's prior to Power8
due to vcmpequd being unavailable. The predicate forms can actually
leverage the available vcmpequw along with xxlxor to produce a better
sequence.
2021-10-01 08:27:15 -05:00
Balázs Kéri cad9ff531c [clang][ASTImporter] Import ConstructorUsingShadowDecl correctly.
Fix import of ConstructorUsingShadowDecl and add tests.

Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D110398
2021-10-01 11:41:08 +02:00
Gabor Marton a3a0b06626 [clang][ASTImporter] Import InheritedConstructor and ConstructorUsingShadowDecl.
Reviewed By: martong

Differential Revision: https://reviews.llvm.org/D110395
2021-10-01 10:16:11 +02:00
Albion Fung 29bb877499 [PowerPC] Fix lharx and lbarx builtin signatures
The signatures for the PowerPC builtins lharx and
lbarx are incorrect, and causes issues when used in a function
that requires the return of the builtin to be promoted.
This patch fixes these signatures.

Differential revision: https://reviews.llvm.org/D110273
2021-09-30 22:36:13 -05:00
Craig Topper a21c557955 [RISCV] Remove Zbproposedc extension
This consists of 3 compressed instructions, c.not, c.neg, and c.zext.w.
I believe these have been picked up by the Zce effort using different
encodings. I don't think it makes sense to keep them in bitmanip. It
will eventually cause a conflict if/when Zce is implemented in llvm.

Differential Revision: https://reviews.llvm.org/D110871
2021-09-30 14:23:05 -07:00
Jinsong Ji 2443320d68 [AIX] Rename binder option for PGO support
Update the binder option.
2021-09-30 19:58:42 +00:00
Nico Weber e31899c708 Reland "[clang-cl] Accept `#pragma warning(disable : N)` for some N"
This reverts commit 0cd9d8a48b and
adds the changes described in https://reviews.llvm.org/D110668#3034461.
2021-09-30 15:03:23 -04:00
Arthur Eubanks 76902079e4 [clang] Don't modify OptRemark if the argument is not relevant
A followup to D110201.

 For example, we'd set OptimizationRemarkMissed's Regex to '.*' when
encountering -Rpass. Normally this doesn't actually affect remarks we
emit because in clang::ProcessWarningOptions() we'll separately look at
all -R arguments and turn on/off corresponding diagnostic groups.
However, this is reproducible with -round-trip-args.

Reviewed By: JamesNagurne

Differential Revision: https://reviews.llvm.org/D110673
2021-09-30 11:36:30 -07:00