Commit Graph

94778 Commits

Author SHA1 Message Date
Martin Storsjö 20ca739701 [doc] Add release notes about SEH unwind information on ARM
Differential Revision: https://reviews.llvm.org/D127150
2022-06-08 11:32:17 +03:00
Kevin Athey 69cd7417f0 Add checks for -lresolv to sanitizer-ld test.
These were missed in https://reviews.llvm.org/D127145.

Reviewed By: vitalybuka

Differential Revision: https://reviews.llvm.org/D127177
2022-06-07 16:07:02 -07:00
owenca b5b33fbffb [clang-format] Skip parsing a block if it's nested too deep
Fixes #55912.

Differential Revision: https://reviews.llvm.org/D127183
2022-06-07 15:28:03 -07:00
Douglas Yung 7805ae257f Revert "[clang-diff] Fix assertion error when dealing with wide strings"
This reverts commit e80748ff88.

This was causing a test failure on a buildbot: https://lab.llvm.org/buildbot/#/builders/139/builds/22964
2022-06-07 14:58:10 -07:00
Vitaly Buka d7df3f0a4b [NFC] Exctract getNoSanitizeMask lambda 2022-06-07 14:08:43 -07:00
Vitaly Buka f32ad5703e [NFC] Move part of SanitizerMetadata into private method 2022-06-07 14:08:43 -07:00
Mitch Phillips 5d9de5f446 [NFC] Clang-format parts of D126929 and D126100 2022-06-07 14:08:43 -07:00
Mitch Phillips f49a5844b6 [NFC][CodeGen] Rename method
Extracted from D84652.
2022-06-07 14:08:42 -07:00
Joseph Huber f06731e3c3 [Binary] Make the OffloadingImage type own the memory
Summary:
The OffloadingBinary uses a convenience struct to help manage the memory
that will be serialized using the binary format. This currently uses a
reference to an existing buffer, but this should own the memory instead
so it is easier to work with seeing as its only current use requires
saving the buffer anyway.
2022-06-07 15:56:09 -04:00
Aaron Ballman d46e7aecb4 Update the C2x status page from latest working draft
This adds the papers for the Jun, Sep, and Dec 2021 meetings. 2022
papers will be handled in a follow-up.
2022-06-07 15:53:47 -04:00
Sam Estep dcb4950d5b [clang][dataflow][NFC] Fix filename typos in tests
Reviewed By: ymandel

Differential Revision: https://reviews.llvm.org/D127008
2022-06-07 19:20:20 +00:00
Erich Keane 5c3bde9625 [CodeGen] Fix an issue when the 'extern C' replacement names broke
Originally broken by me in D122608, this is a regression where we
attempt to replace an extern-C thing with 'itself'.  The problem is that
we end up deleting it, causing the value to fail when it gets put into
llvm.used.
2022-06-07 11:30:59 -07:00
Kaining Zhong e80748ff88 [clang-diff] Fix assertion error when dealing with wide strings
Directly using StringLiteral::getString for wide string is not
currently supported; therefore in ASTDiff, getStmtValue will fail when
asserting that the StringLiteral has a width of 1. This patch also
covers cases for UTF16 and UTF32 encoding, along with corresponding
test cases.

Fixes https://github.com/llvm/llvm-project/issues/55771.

Reviewed By: johannes

Differential Revision: https://reviews.llvm.org/D126651
2022-06-07 20:24:34 +02:00
Vince Bridgers c7fa4e8a8b [analyzer] Fix null pointer deref in CastValueChecker
A crash was seen in CastValueChecker due to a null pointer dereference.

The fix uses QualType::getAsString to avoid the null dereference
when a CXXRecordDecl cannot be obtained. A small reproducer is added,
and cast value notes LITs are updated for the new debug messages.

Reviewed By: steakhal

Differential Revision: https://reviews.llvm.org/D127105
2022-06-07 13:34:06 -04:00
Benjamin Kramer 1fd6f06b9e [format] Fix an uninitialized variable
parseBlock may decide to leave it unchanged. Found by msan.
2022-06-07 18:18:29 +02:00
David Truby 133a5f22d3 [clang][AArch64][SVE] Improve diagnostics for SVE operators
This patch corrects some diagnostics for the SVE sizeless vector
operators, including correctly diagnosing when the vectors are
different sizes.

Differential Revision: https://reviews.llvm.org/D126377
2022-06-07 15:35:36 +01:00
Pengxuan Zheng e3a6784ac9 [clang-cl] Add support for /kernel
MSVC defines _KERNEL_MODE when /kernel is passed.
Also, /kernel disables RTTI and C++ exception handling.

https://docs.microsoft.com/en-us/cpp/build/reference/kernel-create-kernel-mode-binary?view=msvc-170

Reviewed By: thakis

Differential Revision: https://reviews.llvm.org/D126719
2022-06-07 06:42:35 -07:00
Guillaume Chatelet 19647e5b3b Fix change of variable name in test 2022-06-07 11:20:57 +00:00
Gabor Marton 8131ee4c43 [analyzer] Remove NotifyAssumeClients
Depends on D126560.

Differential Revision: https://reviews.llvm.org/D126878
2022-06-07 13:02:03 +02:00
Gabor Marton 17e9ea6138 [analyzer][NFC] Add LLVM_UNLIKELY to assumeDualImpl
Aligned with the measures we had in D124674, this condition seems to be
unlikely.

Nevertheless, I've made some new measurments with stats just for this,
and data confirms this is indeed unlikely.

Differential Revision: https://reviews.llvm.org/D127190
2022-06-07 12:48:48 +02:00
Yuki Okushi aa9b3389ff
[clang] Remove some `U+C2AD`s in `__cpp_multidimensional_subscript`
The `Builder.defineMacro("__cpp_multidimensional_subscript", "202110L");` line has
some `U+C2AD`s that shouldn't necessary here. So removed them.

Differential Revision: https://reviews.llvm.org/D127066
2022-06-07 19:29:01 +09:00
owenca ec90bc0ea4 [clang-format][NFC] Clean up the unwrapped line parser
Change the signatures of parseBlock(), parseLevel(), and
parseStructuralElement() to support combining else and if when
removing braces. See #55663.

Differential Revision: https://reviews.llvm.org/D127005
2022-06-07 02:58:57 -07:00
Guillaume Chatelet d8b540cd31 Cleanup sema checking for buitlin_memcpy_inline 2022-06-07 09:49:36 +00:00
Gabor Marton f66f4d3b07 [analyzer] Track assume call stack to detect fixpoint
Assume functions might recurse (see `reAssume` or `tryRearrange`).
During the recursion, the State might not change anymore, that means we
reached a fixpoint. In this patch, we avoid infinite recursion of assume
calls by checking already visited States on the stack of assume function
calls. This patch renders the previous "workaround" solution (D47155)
unnecessary. Note that this is not an NFC patch. If we were to limit the
maximum stack depth of the assume calls to 1 then would it be equivalent
with the previous solution in D47155.

Additionally, in D113753, we simplify the symbols right at the beginning
of evalBinOpNN. So, a call to `simplifySVal` in `getKnownValue` (added
in D51252) is no longer needed.

Fixes https://github.com/llvm/llvm-project/issues/55851

Differential Revision: https://reviews.llvm.org/D126560
2022-06-07 08:36:11 +02:00
Evgeny Shulgin a4f8590247 [clang] Allow consteval functions in default arguments
We should not mark a function as "referenced" if we call it within a
ConstantExpr, because the expression will be folded to a value in LLVM
IR. To prevent emitting consteval function declarations, we should not "jump
over" a ConstantExpr when it is a top-level ParmVarDecl's subexpression.

Fixes https://github.com/llvm/llvm-project/issues/48230

Reviewed By: erichkeane, aaron.ballman, ChuanqiXu

Differenitial Revision: https://reviews.llvm.org/D119646
2022-06-07 10:54:37 +08:00
Akira Hatanaka 3ba6ace3cc [gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in
DebugTypeVisitor

This recommits d1346e2. I've added a line to the test case to enable it
only on assert builds.

Differential Revision: https://reviews.llvm.org/D125839
2022-06-06 19:12:26 -07:00
Akira Hatanaka 834e5d12c7 Revert "[gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in"
This reverts commit d1346e2ee2.

The commit broke a few bots.
2022-06-06 18:48:24 -07:00
Kevin Athey 6dce56b2a3 [Driver] add -lresolv for all but Android.
As there 3 intercepts that depend on libresolv, link tests in ./configure scripts may be confuse by the presence of resolv symbols (i.e. dn_expand) even with -lresolv and get a runtime error.

Android provides the functionality in libc.

https://reviews.llvm.org/D122849
https://reviews.llvm.org/D126851

Reviewed By: eugenis, MaskRay

Differential Revision: https://reviews.llvm.org/D127145
2022-06-06 15:49:42 -07:00
Matheus Izvekov 43ef17cac1
[clang] P2266: apply move elision rules on throw expr nested in function prototypes
Our rules to determine if the throw expression are within the variable
scope were giving a false negative result in case the throw expression
would appear within a decltype in a nested function declaration.

Per P2266R3, the relevant rule is: [expr.prim.id.unqual]/2
```
    if the id-expression (possibly parenthesized) is the operand of a throw-expression, and names an implicitly movable entity that belongs to a scope that does not contain the compound-statement of the innermost lambda-expression, try-block , or function-try-block (if any) whose compound-statement or ctor-initializer encloses the throw-expression.
```

This fixes PR54341.

Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D127075
2022-06-07 00:08:24 +02:00
Sam Clegg 47039a1a4b [WebAssembly] Remove restriction on main name mangling
Summary: Emscripten now handles/supports this new mode.

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, cfe-commits

Tags: #clang

Differential Revision: https://reviews.llvm.org/D75277
2022-06-06 14:04:27 -07:00
Martin Storsjö fcb784db49 [clang] [MinGW] Default to WinEH (SEH) exception handling instead of Dwarf
The relevant runtime libraries have been updated to support this
now.

Differential Revision: https://reviews.llvm.org/D126871
2022-06-06 23:27:31 +03:00
Martin Storsjö 2293d46a01 [clang] [Headers] Check __SEH__, when checking if ARM EHABI is implied
ARM EHABI isn't signalled by any specific compiler builtin define,
but is implied by the lack of defines specifying any other
exception handling mechanism, `__USING_SJLJ_EXCEPTIONS__` or
`__ARM_DWARF_EH__`.

As Windows SEH also can be used for unwinding, check for the
`__SEH__` define too, in the same way.

This is the same change as 4a3722a2c3 /
D126866, applied on the clang headers.

Differential Revision: https://reviews.llvm.org/D126865
2022-06-06 23:21:05 +03:00
Akira Hatanaka d1346e2ee2 [gmodules] Skip CXXDeductionGuideDecls when visiting FunctionDecls in
DebugTypeVisitor

Differential Revision: https://reviews.llvm.org/D125839
2022-06-06 12:51:36 -07:00
Aaron Ballman cc30d43ce4 Fix a -Wlogical-op-parentheses warning; NFC
This should address bot failures like:
https://lab.llvm.org/buildbot/#/builders/77/builds/18317
2022-06-06 07:52:12 -04:00
Aaron Ballman 881125ad91 Allow use of an elaborated type specifier in a _Generic association in C++
Currently, Clang accepts this code in C mode (where the tag is required
to be used) but rejects it in C++ mode thinking that the association is
defining a new type.

void foo(void) {
  struct S { int a; };
  _Generic(something, struct S : 1);
}
Clang thinks this in C++ because it sees struct S : when parsing the
class specifier and decides that must be a type definition (because the
colon signifies the presence of a base class type). This patch adds a
new declarator context to represent a _Generic association so that we
can distinguish these situations properly.

Fixes #55562

Differential Revision: https://reviews.llvm.org/D126969
2022-06-06 07:17:35 -04:00
Qingyuan Zheng c119a17e7f [AST] Fix clang RecursiveASTVisitor for definition of XXXTemplateSpecializationDecl
Fixes https://github.com/clangd/clangd/issues/1132
where clangd's semantic highlighting is missing for symbols of a template
specialization definition. It turns out the visitor didn't traverse the
base classes of Class/Var##TemplateSpecializationDecl, i.e.
CXXRecordDecl/VarDecl. This patch adds them back as what is done in
DEF_TRAVERSE_TMPL_PART_SPEC_DECL.

Reviewed By: rsmith

Differential Revision: https://reviews.llvm.org/D126757
2022-06-06 02:35:34 -04:00
Chuanqi Xu 448995c521 [NFC] [Coroutines] Add test for ambiguous allocation functions in
promise_type

Address the post-commit comment in
https://reviews.llvm.org/D125517#inline-1217244
2022-06-06 14:23:35 +08:00
Chris Bieneman f06abbb393 LLVM Driver Multicall tool
This patch adds an llvm-driver multicall tool that can combine multiple
LLVM-based tools. The build infrastructure is enabled for a tool by
adding the GENERATE_DRIVER option to the add_llvm_executable CMake
call, and changing the tool's main function to a canonicalized
tool_name_main format (i.e. llvm_ar_main, clang_main, etc...).

As currently implemented llvm-driver contains dsymutil, llvm-ar,
llvm-cxxfilt, llvm-objcopy, and clang (if clang is included in the
build).

llvm-driver can be enabled from builds by setting
LLVM_TOOL_LLVM_DRIVER_BUILD=On.

There are several limitations in the current implementation, which can
be addressed in subsequent patches:

(1) the multicall binary cannot currently properly handle
multi-dispatch tools. This means symlinking llvm-ranlib to llvm-driver
will not properly result in llvm-ar's main being called.
(2) the multicall binary cannot be comprised of tools containing
conflicting cl::opt options as the global cl::opt option list cannot
contain duplicates.

These limitations can be addressed in subsequent patches.

Differential revision: https://reviews.llvm.org/D109977
2022-06-06 04:27:32 +00:00
Phoebe Wang 52818fd97f [Clang][FP16] Add 4 builtins for _Float16
We are lacking builtins support for `_Float16`. In most cases, we can use other floating-type builtins and truncate them to `_Float16`.
But it's a problem to SNaN, e.g., https://gcc.godbolt.org/z/cqr5nG1jh
This patch adds `__builtin_nansf16` support as well as other 3 ones since they are usually used together.

Reviewed By: LuoYuanke

Differential Revision: https://reviews.llvm.org/D127050
2022-06-06 09:00:26 +08:00
Kazu Hirata d93728978b [clang] Use llvm::is_contained (NFC) 2022-06-05 17:56:40 -07:00
Fangrui Song 332d5204c5 [Driver][test] Remove unneeded -no-canonical-prefixes and -o %t.o
Similar to 980679981f
2022-06-05 16:06:09 -07:00
owenca fc1c160f73 [clang-format] Handle attributes for for/while loops
Fixes #55853.

Differential Revision: https://reviews.llvm.org/D127054
2022-06-05 15:45:25 -07:00
Aditya Kumar 8f7b14898f [NFC] Make comment consistent with allow|ignore list renamings
Reviewed By: thakis
Differential Revision: https://reviews.llvm.org/D123640
2022-06-05 14:49:01 -07:00
Matheus Izvekov f62433f17c
[NFC] Add test cases reported in PR54341
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>

Differential Revision: https://reviews.llvm.org/D127074
2022-06-05 20:34:28 +02:00
Fangrui Song 95a134254a Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options 2022-06-05 01:07:51 -07:00
Fangrui Song d86a206f06 Remove unneeded cl::ZeroOrMore for cl::opt/cl::list options 2022-06-05 00:31:44 -07:00
Fangrui Song d0d1c416cb Remove unneeded cl::ZeroOrMore for cl::list options 2022-06-04 23:51:13 -07:00
Kazu Hirata e0039b8d6a Use llvm::less_second (NFC) 2022-06-04 22:48:32 -07:00
Kazu Hirata 8cc9fa6f78 Use static_cast from SmallString to std::string (NFC) 2022-06-04 22:09:27 -07:00
Kazu Hirata 4969a6924d Use llvm::less_first (NFC) 2022-06-04 21:23:18 -07:00