aboutsummaryrefslogtreecommitdiff
path: root/clang
AgeCommit message (Collapse)AuthorFilesLines
2022-01-18[Driver][test] Fix undefined-libs.cpp when CLANG_DEFAULT_UNWINDLIB is libunwindFangrui Song1-1/+1
(cherry picked from commit 3db1ade368e538ba795486eea4923e331a8dde5a)
2022-01-07[Clang][Sema] Avoid crashing for va_arg expressions with bool argumentEgor Zhdan2-1/+3
This change fixes a compiler crash that was introduced in https://reviews.llvm.org/D103611: `Sema::BuildVAArgExpr` attempted to retrieve a corresponding signed type for `bool` by calling `ASTContext::getCorrespondingSignedType`. rdar://86580370 Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D116272 (cherry picked from commit c033f0d9b1c7816b0488a939475d48a100e4dcab)
2022-01-07[Clang][CFG] check children statements of asm gotoNick Desaulniers5-25/+74
When performing CFG based analyses, don't forget to check the child statements of an asm goto, such as the expressions used for inputs+outputs. Fixes: https://github.com/llvm/llvm-project/issues/51024 Fixes: https://github.com/ClangBuiltLinux/linux/issues/1439 Reviewed By: void, jyknight, jyu2, efriedma Differential Revision: https://reviews.llvm.org/D116059 (cherry picked from commit 3a604fdbcd5fd9ca41f6659692bb4ad2151c3cf4)
2022-01-05[AArch64] Avoid crashing on invalid -Wa,-march= valuesDimitry Andric2-4/+20
As reported in https://bugs.freebsd.org/260078, the gnutls Makefiles pass -Wa,-march=all to compile a number of assembly files. Clang does not support this -march value, but because of a mistake in handling the arguments, an unitialized Arg pointer is dereferenced, which can cause a segfault. Work around this by adding a check if the local WaMArch variable is initialized, and if so, using its value in the diagnostic message. Reviewed By: tschuett Differential Revision: https://reviews.llvm.org/D114677 (cherry picked from commit df08b2fe8b35cb63dfb3b49738a3494b9b4e6f8e)
2021-12-22[PowerPC] Define XL-compatible macros only for AIX and LinuxNemanja Ivanovic34-91/+104
Since XLC only ever shipped on PowerPC AIX and Linux, it is not reasonable to provide the compatibility macros on any target other than those two. This patch restricts those macros to AIX/Linux. Differential revision: https://reviews.llvm.org/D110213 (cherry picked from commit c9539f957f57c0c2c59dab98f25215f241d4debf)
2021-12-20[Sparc] Create an error when `__builtin_longjmp` is usedTee KOBAYASHI2-4/+1
Support for builtin setjmp/longjmp was removed by https://reviews.llvm.org/D51487. An error should be created when compiling C code using __builtin_setjmp or __builtin_longjmp. Reviewed By: dcederman Differential Revision: https://reviews.llvm.org/D108901 (cherry picked from commit eeb4266f8137c232f0f218a727dd12b5d4f52adc)
2021-12-14[Analysis] Ignore casts and unary ops for uninitialized valuesBill Wendling2-4/+25
A series of unary operators and casts may obscure the variable we're trying to analyze. Ignore them for the uninitialized value analysis. Other checks determine if the unary operators result in a valid l-value. Link: https://github.com/ClangBuiltLinux/linux/issues/1521 Reviewed By: nickdesaulniers Differential Revision: https://reviews.llvm.org/D114848 (cherry picked from commit c4582a689c2c74e0635309979176c7ada086f066)
2021-11-08[clang] Partially revert d8cd7806310c51af912a647a6ca46de62ff13214.Brad Smith2-5/+1
The C11 atomics part was wrong. (cherry picked from commit 95e6e1cc923d6b88ebb4ac5e8f0887c2c77476cc)
2021-10-27fixes bug #51926 where dangling comma caused overrunFred Grim2-3/+27
bug 51926 identified an issue where a dangling comma caused the cell count to be to off by one Differential Revision: https://reviews.llvm.org/D110481 (cherry picked from commit a36227cb2b6a14fc30bfd303328d1d1abb632010)
2021-10-22[CUDA] Make sure <string.h> is included with original __THROW defined.Artem Belevich1-5/+1
Otherwise we may end up with an inconsistent redeclarations of the standard library functions if _FORTIFY_SOURCE is in effect. https://bugs.llvm.org/show_bug.cgi?id=47869 Differential Revision: https://reviews.llvm.org/D110781 (cherry picked from commit 29e00b29f76adb15a51c1ccd6c1fdb6fce5f4d7b)
2021-10-21[clang] Omit most AttributedStatements from the CFGNico Weber3-2/+56
`[[clang::fallthrough]]` has meaning for the CFG, but all other StmtAttrs we currently have don't. So omit them, as AttributedStatements with children cause several issues and there's no benefit in including them. Fixes PR52103 and PR49454. See PR52103 for details. Differential Revision: https://reviews.llvm.org/D111568 (cherry picked from commit c74ab84ea23f497ac83501473220cd9cfefe81e8)
2021-10-20[clang-format] [PR51640] - New AfterEnum brace wrapping changes have cause ↵mydeveloperday4-8/+264
C# behaviour to change LLVM 13.0.0-rc2 shows change of behaviour in enum and interface BraceWrapping (likely before we simply didn't wrap) but may be related to {D99840} Logged as https://bugs.llvm.org/show_bug.cgi?id=51640 This change ensure AfterEnum works for `internal|public|protected|private enum A {` in the same way as it works for `enum A {` in C++ A similar issue was also observed with `interface` in C# Reviewed By: krasimir, owenpan Differential Revision: https://reviews.llvm.org/D108810 (cherry picked from commit ed367b9dff10ee1df9ac1984eb2ad7544da7ab06)
2021-10-20[HIP] Fix test rcom-detect.hipYaxun (Sam) Liu1-1/+2
This patches fixes https://bugs.llvm.org/show_bug.cgi?id=51404 Some builds use custom resource directory for clang, therefore the test cannot assume default resource directory for clang. Use -resource-dir to force it. Differential Revision: https://reviews.llvm.org/D111726 (cherry picked from commit 1439df00fc5e6dfffeb6a99e3537f6de2e539785)
2021-10-18Remove "In Progress" text from release notesTom Stellard1-7/+1
2021-09-24[clang] don't mark as Elidable CXXConstruct expressions used in NRVOllvmorg-13.0.0-rc4llvmorg-13.0.0Matheus Izvekov13-33/+122
See PR51862. The consumers of the Elidable flag in CXXConstructExpr assume that an elidable construction just goes through a single copy/move construction, so that the source object is immediately passed as an argument and is the same type as the parameter itself. With the implementation of P2266 and after some adjustments to the implementation of P1825, we started (correctly, as per standard) allowing more cases where the copy initialization goes through user defined conversions. With this patch we stop using this flag in NRVO contexts, to preserve code that relies on that assumption. This causes no known functional changes, we just stop firing some asserts in a cople of included test cases. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D109800 (cherry picked from commit d9308aa39b236064a680ca57178af3c731e13e49)
2021-09-23[analyzer] Add 13.0.0 release notesKristóf Umann1-1/+47
Differential Revision: https://reviews.llvm.org/D108912
2021-09-21Thread safety analysis: Warn when demoting locks on back edgesAaron Puchert2-14/+59
Previously in D104261 we warned about dropping locks from back edges, this is the corresponding change for exclusive/shared joins. If we're entering the loop with an exclusive change, which is then relaxed to a shared lock before we loop back, we have already analyzed the loop body with the stronger exclusive lock and thus might have false positives. There is a minor non-observable change: we modify the exit lock set of a function, but since that isn't used further it doesn't change anything. Reviewed By: aaron.ballman Differential Revision: https://reviews.llvm.org/D106713 (cherry picked from commit 9b889f826ff587e9758c80823419512d502e457d)
2021-09-20[clang][scan-build] Use cc/c++ instead of gcc/g++ on OpenBSD.Frederic Cambus1-0/+3
Differential Revision: https://reviews.llvm.org/D109349 (cherry picked from commit b588f5d665aa01fe88921fe2ffb7256fdedfbfb0)
2021-09-18Fix syntax error in Clang release notesAaron Puchert1-0/+2
There needs to be a blank line after ".. code-block:: <lang>".
2021-09-17[OpenMP]Fix PR51349: Remove AlwaysInline for if regions.Joseph Huber2-1/+40
After D94315 we add the `NoInline` attribute to the outlined function to handle data environments in the OpenMP if clause. This conflicted with the `AlwaysInline` attribute added to the outlined function. for better performance in D106799. The data environments should ideally not require NoInline, but for now this fixes PR51349. Reviewed By: mikerice Differential Revision: https://reviews.llvm.org/D107649 (cherry picked from commit 41a6b50c25961addc04438b567ee1f4ef9e40f98)
2021-09-17[clang] disable implicit moves when not in CPlusPLusMatheus Izvekov3-1/+45
See PR51842. This fixes an assert firing in the static analyzer, triggered by implicit moves in blocks in C mode: This also simplifies the AST a little bit when compiling non C++ code, as the xvalue implicit casts are not inserted. We keep and test that the nrvo flag is still being set on the VarDecls, as that is still a bit beneficial while not really making anything more complicated. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: NoQ Differential Revision: https://reviews.llvm.org/D109654 (cherry picked from commit 2d6829bbbe6877920d9be1db93b9f3fc85b43d10)
2021-09-17[clang-repl] Install clang-replVassil Vassilev1-1/+1
This is essentially what D106813 was supposed to do but did not. Differential revision: https://reviews.llvm.org/D108919 (cherry picked from commit c9948e9254fbb6ea00f66c7b4542311d21e060be)
2021-09-14-Wunused-but-set-parameter/-Wunused-but-set-variable Add to the release notesSylvestre Ledru1-0/+3
Differential Revision: https://reviews.llvm.org/D109642
2021-09-13[clang-format] Restrict the special handling for K&R C to C/C++owenca2-4/+17
Commits 58494c856a15, f6bc614546e1, and 0fc27ef19670 added special handlings for K&R C function definitions and caused some JavaScript/TypeScript regressions which were addressed in D107267, D108538, and D108620. This patch would have prevented these known regressions and will fix any unknown ones. Differential Revision: https://reviews.llvm.org/D109582 (cherry picked from commit 3205dd3d59b3cc36f96b7eff6387de8d2f42825f)
2021-09-10[OpenCL][Docs] Update OpenCL 3.0 implementation status.Anastasia Stulova1-35/+37
Update a section of OpenCLSupport page to reflect the latest development in OpenCL 3.0 support for release 13. Differential Revision: https://reviews.llvm.org/D109320 (cherry picked from commit cff03d5fc48700b73ae863d4f25e780e74dff33e)
2021-09-10[OpenCL][Docs] Release 13 notes.Anastasia Stulova1-3/+78
Major OpenCL functionality added in release 13. Differential Revision: https://reviews.llvm.org/D109327
2021-09-09[clang-format] Improve detection of parameter declarations in K&R Cowenca1-14/+16
Clean up the detection of parameter declarations in K&R C function definitions. Also make it more precise by requiring the second token after the r_paren to be either a star or keyword/identifier. Differential Revision: https://reviews.llvm.org/D108094 (cherry picked from commmit 643f2be7b6afd91d9f0d6df89cd3391835763112)
2021-09-09[clang-format] Distinguish K&R C function definition and attributeOwen2-8/+35
This is a follow-up to https://reviews.llvm.org/D107950 which missed user-defined types in K&R C. Differential Revision: https://reviews.llvm.org/D107961 (cherry picked from commit f6928cf45516503deb48f8175a982becc579dc8c)
2021-09-09[clang-format] improve distinction of K&R function definitions vs attributesKrasimir Georgiev2-4/+17
After https://github.com/llvm/llvm-project/commit/9da70ab3d43c79116f80fc06aa7cf517374ce42c we saw a few regressions around trailing attribute definitions and in typedefs (examples in the added test cases). There's some tension distinguishing K&R definitions from attributes at the parser level, where we have to decide if we need to put the type of the K&R definition on a new unwrapped line before we have access to the rest of the line, so we're scanning backwards and looking for a pattern like f(a, b). But this type of pattern could also be an attribute macro, or the whole declaration could be a typedef itself. I updated the code to check for a typedef at the beginning of the line and to not consider raw identifiers as possible first K&R declaration (but treated as an attribute macro instead). This is not 100% correct heuristic, but I think it should be reasonably good in practice, where we'll: * likely be in some very C-ish code when using K&R style (e.g., stuff that uses `struct name a;` instead of `name a;` * likely be in some very C++-ish code when using attributes * unlikely mix up the two in the same declaration. Ideally, we should only decide to add the unwrapped line before the K&R declaration after we've scanned the rest of the line an noticed the variable declarations and the semicolon, but the way the parser is organized I don't see a good way to do this in the current parser, which only has good context for the previously visited tokens. I also tried not emitting an unwrapped line there and trying to resolve the situation later in the token annotator and the continuation indenter, and that approach seems promising, but I couldn't make it to work without messing up a bunch of other cases in unit tests. Reviewed By: MyDeveloperDay Differential Revision: https://reviews.llvm.org/D107950 (cherry picked from commit 45934922fa88b7542c8bcd86889d062fb78efdda)
2021-09-09[clang-format] handle trailing comments in function definition detectionKrasimir Georgiev2-1/+4
A follow-up to https://github.com/llvm/llvm-project/commit/f6bc614546e169bb1b17a29c422ebace038e6c62 where we handle the case where the semicolon is followed by a trailing comment. Reviewed By: MyDeveloperDay Differential Revision: https://reviews.llvm.org/D107907 (cherry picked from commit 0fc27ef19670676689d3317948c81eb171bb25f8)
2021-09-09[clan-format] detect function definitions more conservativelyKrasimir Georgiev2-3/+20
https://reviews.llvm.org/D105964 updated the detection of function definitions. It had the unfortunate effect to start marking object definitions with attribute-like macros as function definitions. This addresses this issue. Reviewed By: owenpan Differential Revision: https://reviews.llvm.org/D107269 (cherry picked from commit f6bc614546e169bb1b17a29c422ebace038e6c62)
2021-09-09[AMDGPU][OpenMP] Use complex definitions from complex_cmath.hPushpinder Singh2-1/+86
Following nvptx approach, this patch uses complex function definitions from complex_cmath.h. With this patch, ovo passes 23/34 complex mathematical test cases. Reviewed By: JonChesterfield Differential Revision: https://reviews.llvm.org/D109344 (cherry picked from commit 12dcbf913c49db839b3669db0dcacd5de25facde)
2021-09-08[clang] fix transformation of template arguments of 'auto' type constraintsMatheus Izvekov2-1/+23
See PR48617. When assigning the new template arguments to the new TypeLoc, we were looping on the argument count of the original TypeLoc instead of the new one, which can be different when packs are present. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D109406 (cherry picked from commit 68b9d8ed7abe4046992ae1557990edfbb3a772bc)
2021-09-08[clang][Driver] Pick the last --driver-mode in case of multiple onesKadir Cetinkaya2-1/+7
This was an accidental behaviour change in D106789 and this patch restores it back to original state. Differential Revision: https://reviews.llvm.org/D109361 (cherry picked from commit 73c00d40bd49ae022f6fbba7200f05facb533e3b)
2021-09-07Fix for commit d8cd7806310c51af912a647a6ca46de62ff13214.Brad Smith1-4/+4
(cherry picked from commit bce178a5ecf10df762cbda59c7f60cca8e52ce3a)
2021-09-07[clang] OpenBSD does not support C11 atomics or threads.Brad Smith2-0/+15
(cherry picked from commit d8cd7806310c51af912a647a6ca46de62ff13214)
2021-09-07PR50294: Fix a performance regression from 2c9dbcd.Richard Smith1-0/+2
Per the contract of ReadLateParsedTemplates, we should not be returning the same results multiple times. No functionality change intended, other than to runtime. Thanks to Luboš Luňák for identifying the cause of the regression! (cherry picked from commit 6eda66b0a9f793c65852aa94430ae9bd891bcf63)
2021-09-07[clang] fix error recovery ICE on copy elision when returing invalid variableMatheus Izvekov2-1/+35
See PR51708. Attempting copy elision in dependent contexts with invalid variable, such as a variable with incomplete type, would cause a crash when attempting to calculate it's alignment. The fix is to just skip this optimization on invalid VarDecl, as otherwise this provides no benefit to error recovery: This functionality does not try to diagnose anything, it only calculates a flag which will affect where the variable will be allocated during codegen. Signed-off-by: Matheus Izvekov <mizvekov@gmail.com> Reviewed By: rtrieu Differential Revision: https://reviews.llvm.org/D109191 (cherry picked from commit d98c34f4d7950f531661ba3f498222ccf6239a0f)
2021-09-07Support linking against OpenMP runtime on OpenBSD.Brad Smith2-1/+23
(cherry picked from commit 775ab780fd2a23cfc80ace571938ddd21d080173)
2021-09-07OpenBSD also needs execinfoBrad Smith1-1/+2
(cherry picked from commit b989662eb000efb54b91b8c82d2b2713e2da20fc)
2021-09-07[clang] Allow the OpenBSD driver to link the libclang_rt.profile library.Frederic Cambus1-0/+2
Differential Revision: https://reviews.llvm.org/D109244 (cherry picked from commit 466451c6616272d8c779618b92b0ae80f394a795)
2021-09-01[OpenMP][FIX] Allow declare variant to work with reference typesJohannes Doerfert2-0/+422
Reference types in the return or parameter position did cause the OpenMP declare variant overload reasoning to give up. We should allow them as we allow any other type. This should fix the bug reported on the mailing list: https://lists.llvm.org/pipermail/openmp-dev/2021-August/004094.html Reviewed By: ABataev, pdhaliwal Differential Revision: https://reviews.llvm.org/D108774 (cherry picked from commit 2930c839a5877356db6966409f4f9f2cdbcf3a07)
2021-09-01libclang: also add a link to the announcementSylvestre Ledru1-2/+3
2021-09-01libclang: Document the soname change in the release notesSylvestre Ledru1-1/+2
Differential Revision: https://reviews.llvm.org/D109023
2021-09-01[clang] Move the soname declaration in a variable at the top of the fileSylvestre Ledru1-4/+7
Currently, it is a bit buried in the file even if this is pretty important for distro. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D108533
2021-08-31[M68k] Update pointer data layoutRicky Taylor1-2/+2
Fixes PR51626. The M68k requires that all instruction, word and long word reads are aligned to word boundaries. From the 68020 onwards, there is a performance benefit from aligning long words to long word boundaries. The M68k uses the same data layout for pointers and integers. In line with this, this commit updates the pointer data layout to match the layout already set for 32-bit integers: 32:16:32. Differential Revision: https://reviews.llvm.org/D108792 (cherry picked from commit 8d3f112f0cdbed2311aead86bcd72e763ad55255)
2021-08-26[CMake] Change -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=off to ↵Fangrui Song2-2/+0
-DLLVM_ENABLE_NEW_PASS_MANAGER=off LLVM_ENABLE_NEW_PASS_MANAGER is set to ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER, so -DLLVM_ENABLE_NEW_PASS_MANAGER=off has no effect. Change the cache variable to LLVM_ENABLE_NEW_PASS_MANAGER instead. A user opting out the new PM needs to switch from -DENABLE_EXPERIMENTAL_NEW_PASS_MANAGER=off to -DLLVM_ENABLE_NEW_PASS_MANAGER=off. Also give a warning that -DLLVM_ENABLE_NEW_PASS_MANAGER=off is deprecated. Reviewed By: aeubanks, phosek Differential Revision: https://reviews.llvm.org/D108775 (cherry picked from commit a42bd1b560524905d3b9aebcb658cf6dc9521d26)
2021-08-26[docs] Update release notes for OpenMP 5.1 loop transformations.llvmorg-13.0.0-rc2Michael Kruse1-0/+18
2021-08-23[clang] Replace asm with __asm__ in cuda headerJon Chesterfield1-102/+174
Asm is a gnu extension for C, so at present -fopenmp -std=c99 and similar fail to compile on nvptx, bug 51344 Changing to `__asm__` or `__asm` works for openmp, all three appear to work for cuda. Suggesting `__asm__` here as `__asm` is used by MSVC with different syntax, so this should make for better error diagnostics if the header is passed to a compiler other than clang. Reviewed By: tra, emankov Differential Revision: https://reviews.llvm.org/D107492 (cherry picked from commit 509854b69cea0c9261ac21ceb22012a53e7a800b)
2021-08-23[openmp] Annotate tmp variables with omp_thread_mem_allocJon Chesterfield2-0/+54
Fixes miscompile of calls into ocml. Bug 51445. The stack variable `double __tmp` is moved to dynamically allocated shared memory by CGOpenMPRuntimeGPU. This is usually fine, but when the variable is passed to a function that is explicitly annotated address_space(5) then allocating the variable off-stack leads to a miscompile in the back end, which cannot decide to move the variable back to the stack from shared. This could be fixed by removing the AS(5) annotation from the math library or by explicitly marking the variables as thread_mem_alloc. The cast to AS(5) is still a no-op once IR is reached. Reviewed By: jdoerfert Differential Revision: https://reviews.llvm.org/D107971 (cherry picked from commit dbd7bad9ad9bc32538e324417c23387bf4ac7747)