summaryrefslogtreecommitdiff
path: root/include
Commit message (Collapse)AuthorAgeFilesLines
...
* PR43629: Fix crash evaluating constexpr placement new on a subobject ofRichard Smith2019-10-101-1/+2
| | | | | | an out-of-lifetime object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374465 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 374450 "Fix __builtin_assume_aligned with too large values."Nico Weber2019-10-101-4/+0
| | | | | | | | | | | | | The test fails on Windows, with error: 'warning' diagnostics expected but not seen: File builtin-assume-aligned.c Line 62: requested alignment must be 268435456 bytes or smaller; assumption ignored error: 'warning' diagnostics seen but not expected: File builtin-assume-aligned.c Line 62: requested alignment must be 8192 bytes or smaller; assumption ignored git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374456 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix __builtin_assume_aligned with too large values.Erich Keane2019-10-101-0/+4
| | | | | | | | | | | | | | Code to handle __builtin_assume_aligned was allowing larger values, but would convert this to unsigned along the way. This patch removes the EmitAssumeAligned overloads that take unsigned to do away with this problem. Additionally, it adds a warning that values greater than 1 <<29 are ignored by LLVM. Differential Revision: https://reviews.llvm.org/D68824 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374450 91177308-0d34-0410-b5e6-96231b3b80d8
* Add -fgnuc-version= to control __GNUC__ and other GCC macrosReid Kleckner2019-10-102-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I noticed that compiling on Windows with -fno-ms-compatibility had the side effect of defining __GNUC__, along with __GNUG__, __GXX_RTTI__, and a number of other macros for GCC compatibility. This is undesirable and causes Chromium to do things like mix __attribute__ and __declspec, which doesn't work. We should have a positive language option to enable GCC compatibility features so that we can experiment with -fno-ms-compatibility on Windows. This change adds -fgnuc-version= to be that option. My issue aside, users have, for a long time, reported that __GNUC__ doesn't match their expectations in one way or another. We have encouraged users to migrate code away from this macro, but new code continues to be written assuming a GCC-only environment. There's really nothing we can do to stop that. By adding this flag, we can allow them to choose their own adventure with __GNUC__. This overlaps a bit with the "GNUMode" language option from -std=gnu*. The gnu language mode tends to enable non-conforming behaviors that we'd rather not enable by default, but the we want to set things like __GXX_RTTI__ by default, so I've kept these separate. Helps address PR42817 Reviewed By: hans, nickdesaulniers, MaskRay Differential Revision: https://reviews.llvm.org/D68055 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374449 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Support for 'master taskloop' directive.Alexey Bataev2019-10-107-1/+109
| | | | | | Added full support for master taskloop directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374437 91177308-0d34-0410-b5e6-96231b3b80d8
* [ARM] Fix arm_neon.h with -flax-vector-conversions=none, part 2.Eli Friedman2019-10-101-4/+4
| | | | | | | | | | | | | | | | | | | | | | | Just running -fsyntax-only over arm_neon.h doesn't cover some intrinsics which are defined using macros. Add more test coverage for that. arm-neon-header.c wasn't checking the full set of available NEON target features; change the target architecture of the test to account for that. Fix the generator for arm_neon.h to generate casts in more cases where they are necessary. Fix VFMLAL_LOW etc. to express their signatures differently, so the builtins have the expected type. Maybe the TableGen backend should detect intrinsics that are defined the wrong way, and produce an error. The rules here are sort of strange. Differential Revision: https://reviews.llvm.org/D68743 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374419 91177308-0d34-0410-b5e6-96231b3b80d8
* In openFileForRead don't cache erroneous entries if the error relates to ↵Kousik Kumar2019-10-101-0/+3
| | | | | | | | | | | | | | | | | | | | them being directories. Add tests. Summary: It seems that when the CachingFileSystem is first given a file to open that is actually a directory, it incorrectly caches that path to be errenous and throws an error when subsequently a directory open call is made for the same path. This change makes it so that we do NOT cache a path if it turns out we asked for a file when its a directory. Reviewers: arphaman Subscribers: dexonsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68193 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374366 91177308-0d34-0410-b5e6-96231b3b80d8
* Remove rest of time-trace message as it is inconsistent styleRussell Gallop2019-10-101-1/+6
| | | | | | | | | Other options which create output files don't produce output messages. Improve documentation to help find trace file. Differential Revision: https://reviews.llvm.org/D68710 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374294 91177308-0d34-0410-b5e6-96231b3b80d8
* [ast] Fix indentation. NFC.Michael Liao2019-10-101-6/+2
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374276 91177308-0d34-0410-b5e6-96231b3b80d8
* [sema] Revise `getCurrentMangleNumberContext` interface. NFC.Michael Liao2019-10-101-6/+4
| | | | | | | - Prefer returning mulitple values using a tuple instead of additional pointers/references. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374274 91177308-0d34-0410-b5e6-96231b3b80d8
* [libTooling] Move Transformer files to their own directory/library.Yitzhak Mandelbaum2019-10-106-20/+20
| | | | | | | | | | | | | | | | | | | Summary: The Transformer library has been growing inside of lib/Tooling/Refactoring. However, it's not really related to anything else in that directory. This revision moves all Transformer-related files into their own include & lib directories. A followup revision will (temporarily) add forwarding headers to help any users migrate their code to the new location. Reviewers: gribozavr Subscribers: mgorny, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68637 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374271 91177308-0d34-0410-b5e6-96231b3b80d8
* Re-land [mangle] Fix mangling where an extra mangle context is required.Reid Kleckner2019-10-102-13/+6
| | | | | | | | | | | This reverts r374268 (git commit c34385d07c7d59447bf836b740f032235391d121) I think I reverted this by mistake, so I'm relanding it. While my bisect found this revision, I think the crashes I'm seeing locally must be environmental. Maybe the version of clang I'm using miscompiles tot clang. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374269 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert [mangle] Fix mangling where an extra mangle context is required.Reid Kleckner2019-10-102-6/+13
| | | | | | | | This reverts r374200 (git commit fd18e94697c987d5f24e25aa4e27adaffff3cce4) Causes crashes just compiling `int main() {}` on my machine. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374268 91177308-0d34-0410-b5e6-96231b3b80d8
* [CUDA][HIP] Fix host/device check with -fopenmpYaxun Liu2019-10-091-0/+13
| | | | | | | | | | | | | | | | | CUDA/HIP program may be compiled with -fopenmp. In this case, -fopenmp is only passed to host compilation to take advantages of multi-threads computation. CUDA/HIP and OpenMP both use Sema::DeviceCallGraph to store functions to be analyzed and remove them once they decide the function is sure to be emitted. CUDA/HIP and OpenMP have different functions to determine if a function is sure to be emitted. To check host/device correctly for CUDA/HIP when -fopenmp is enabled, there needs a unified logic to determine whether a function is to be emitted. The logic needs to be aware of both CUDA and OpenMP logic. Differential Revision: https://reviews.llvm.org/D67837 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374263 91177308-0d34-0410-b5e6-96231b3b80d8
* [Clang][OpenMP Offload] Add new tool for wrapping offload device binariesSergey Dmitriev2019-10-093-3/+15
| | | | | | | | | | This patch removes the remaining part of the OpenMP offload linker scripts which was used for inserting device binaries into the output linked binary. Device binaries are now inserted into the host binary with a help of the wrapper bit-code file which contains device binaries as data. Wrapper bit-code file is dynamically created by the clang driver with a help of new tool clang-offload-wrapper which takes device binaries as input and produces bit-code file with required contents. Wrapper bit-code is then compiled to an object and resulting object is appended to the host linking by the clang driver. This is the second part of the patch for eliminating OpenMP linker script (please see https://reviews.llvm.org/D64943). Differential Revision: https://reviews.llvm.org/D68166 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374219 91177308-0d34-0410-b5e6-96231b3b80d8
* [ObjC generics] Fix not inheriting type bounds in categories/extensions.Volodymyr Sapsai2019-10-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When a category/extension doesn't repeat a type bound, corresponding type parameter is substituted with `id` when used as a type argument. As a result, in the added test case it was causing errors like > type argument 'T' (aka 'id') does not satisfy the bound ('id<NSCopying>') of type parameter 'T' We are already checking that type parameters should be consistent everywhere (see `checkTypeParamListConsistency`) and update `ObjCTypeParamDecl` to have correct underlying type. And when we use the type parameter as a method return type or a method parameter type, it is substituted to the bounded type. But when we use the type parameter as a type argument, we check `ObjCTypeParamType` that ignores the updated underlying type and remains `id`. Fix by desugaring `ObjCTypeParamType` to the underlying type, the same way we are doing with `TypedefType`. rdar://problem/54329242 Reviewers: erik.pilkington, ahatanak Reviewed By: erik.pilkington Subscribers: jkorous, dexonsmith, ributzka, cfe-commits Differential Revision: https://reviews.llvm.org/D66696 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374202 91177308-0d34-0410-b5e6-96231b3b80d8
* [mangle] Fix mangling where an extra mangle context is required.Michael Liao2019-10-092-13/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - [Itanium C++ ABI][1], for certain contexts like default parameter and etc., mangling numbering will be local to the particular argument in which it appears. - However, for these cases, the mangle numbering context is allocated per expression evaluation stack entry. That causes, for example, two lambdas defined/used understand the same default parameter are numbered as the same value and, in turn, one of them is not generated at all. - In this patch, an extra mangle numbering context map is maintained in the AST context to map taht extra declaration context to its numbering context. So that, 2 different lambdas defined/used in the same default parameter are numbered differently. [1]: https://itanium-cxx-abi.github.io/cxx-abi/abi.html Reviewers: rsmith, eli.friedman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68715 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374200 91177308-0d34-0410-b5e6-96231b3b80d8
* [WebAssembly] Add builtin and intrinsic for v8x16.swizzleThomas Lively2019-10-091-0/+2
| | | | | | | | | | | | | | | | | | | | | | Summary: This clang builtin and corresponding LLVM intrinsic are necessary to expose the exact semantics of the underlying WebAssembly instruction to users. LLVM produces a poison value if the dynamic swizzle indices are greater than the vector size, but the WebAssembly instruction sets the corresponding output lane to zero. Users who depend on this behavior can safely use this builtin. Depends on D68527. Reviewers: aheejin, dschuff Subscribers: sbc100, jgravelle-google, hiraditya, sunfish, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D68531 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374189 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] P1152R4: warn on any simple-assignment to a volatile lvalueRichard Smith2019-10-092-0/+11
| | | | | | | | | | | | whose value is not ignored. We don't warn on all the cases that are deprecated: specifically, we choose to not warn for now if there are parentheses around the assignment but its value is not actually used. This seems like a more defensible rule, particularly for cases like sizeof(v = a), where the parens are part of the operand rather than the sizeof syntax. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374135 91177308-0d34-0410-b5e6-96231b3b80d8
* [c++20] Implement most of P1152R4.Richard Smith2019-10-092-0/+19
| | | | | | | | | | | | | | Diagnose some now-deprecated uses of volatile types: * as function parameter types and return types * as the type of a structured binding declaration * as the type of the lvalue operand of an increment / decrement / compound assignment operator This does not implement a check for the deprecation of simple assignments whose results are used; that check requires somewhat more complexity and will be addressed separately. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374133 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] enable_trivial_var_init_zero should not be Joined<>Vitaly Buka2019-10-081-1/+1
| | | | | | | | | | | | Reviewers: rnk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68610 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374113 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Multiple vendors in vendor context must be treated as logicalAlexey Bataev2019-10-082-7/+11
| | | | | | | | | | | | | and of vendors, not or. If several vendors are provided in the same vendor context trait, the context shall match only if all vendors are matching, not one of them. This is per OpenMP 5.0, 2.3.3 Matching and Scoring Context Selectors, all selectors in the construct, device, and implementation sets of the context selector appear in the corresponding trait set of the OpenMP context. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374107 91177308-0d34-0410-b5e6-96231b3b80d8
* [BPF] do compile-once run-everywhere relocation for bitfieldsYonghong Song2019-10-085-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A bpf specific clang intrinsic is introduced: u32 __builtin_preserve_field_info(member_access, info_kind) Depending on info_kind, different information will be returned to the program. A relocation is also recorded for this builtin so that bpf loader can patch the instruction on the target host. This clang intrinsic is used to get certain information to facilitate struct/union member relocations. The offset relocation is extended by 4 bytes to include relocation kind. Currently supported relocation kinds are enum { FIELD_BYTE_OFFSET = 0, FIELD_BYTE_SIZE, FIELD_EXISTENCE, FIELD_SIGNEDNESS, FIELD_LSHIFT_U64, FIELD_RSHIFT_U64, }; for __builtin_preserve_field_info. The old access offset relocation is covered by FIELD_BYTE_OFFSET = 0. An example: struct s { int a; int b1:9; int b2:4; }; enum { FIELD_BYTE_OFFSET = 0, FIELD_BYTE_SIZE, FIELD_EXISTENCE, FIELD_SIGNEDNESS, FIELD_LSHIFT_U64, FIELD_RSHIFT_U64, }; void bpf_probe_read(void *, unsigned, const void *); int field_read(struct s *arg) { unsigned long long ull = 0; unsigned offset = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_OFFSET); unsigned size = __builtin_preserve_field_info(arg->b2, FIELD_BYTE_SIZE); #ifdef USE_PROBE_READ bpf_probe_read(&ull, size, (const void *)arg + offset); unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64); #if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ lshift = lshift + (size << 3) - 64; #endif #else switch(size) { case 1: ull = *(unsigned char *)((void *)arg + offset); break; case 2: ull = *(unsigned short *)((void *)arg + offset); break; case 4: ull = *(unsigned int *)((void *)arg + offset); break; case 8: ull = *(unsigned long long *)((void *)arg + offset); break; } unsigned lshift = __builtin_preserve_field_info(arg->b2, FIELD_LSHIFT_U64); #endif ull <<= lshift; if (__builtin_preserve_field_info(arg->b2, FIELD_SIGNEDNESS)) return (long long)ull >> __builtin_preserve_field_info(arg->b2, FIELD_RSHIFT_U64); return ull >> __builtin_preserve_field_info(arg->b2, FIELD_RSHIFT_U64); } There is a minor overhead for bpf_probe_read() on big endian. The code and relocation generated for field_read where bpf_probe_read() is used to access argument data on little endian mode: r3 = r1 r1 = 0 r1 = 4 <=== relocation (FIELD_BYTE_OFFSET) r3 += r1 r1 = r10 r1 += -8 r2 = 4 <=== relocation (FIELD_BYTE_SIZE) call bpf_probe_read r2 = 51 <=== relocation (FIELD_LSHIFT_U64) r1 = *(u64 *)(r10 - 8) r1 <<= r2 r2 = 60 <=== relocation (FIELD_RSHIFT_U64) r0 = r1 r0 >>= r2 r3 = 1 <=== relocation (FIELD_SIGNEDNESS) if r3 == 0 goto LBB0_2 r1 s>>= r2 r0 = r1 LBB0_2: exit Compare to the above code between relocations FIELD_LSHIFT_U64 and FIELD_LSHIFT_U64, the code with big endian mode has four more instructions. r1 = 41 <=== relocation (FIELD_LSHIFT_U64) r6 += r1 r6 += -64 r6 <<= 32 r6 >>= 32 r1 = *(u64 *)(r10 - 8) r1 <<= r6 r2 = 60 <=== relocation (FIELD_RSHIFT_U64) The code and relocation generated when using direct load. r2 = 0 r3 = 4 r4 = 4 if r4 s> 3 goto LBB0_3 if r4 == 1 goto LBB0_5 if r4 == 2 goto LBB0_6 goto LBB0_9 LBB0_6: # %sw.bb1 r1 += r3 r2 = *(u16 *)(r1 + 0) goto LBB0_9 LBB0_3: # %entry if r4 == 4 goto LBB0_7 if r4 == 8 goto LBB0_8 goto LBB0_9 LBB0_8: # %sw.bb9 r1 += r3 r2 = *(u64 *)(r1 + 0) goto LBB0_9 LBB0_5: # %sw.bb r1 += r3 r2 = *(u8 *)(r1 + 0) goto LBB0_9 LBB0_7: # %sw.bb5 r1 += r3 r2 = *(u32 *)(r1 + 0) LBB0_9: # %sw.epilog r1 = 51 r2 <<= r1 r1 = 60 r0 = r2 r0 >>= r1 r3 = 1 if r3 == 0 goto LBB0_11 r2 s>>= r1 r0 = r2 LBB0_11: # %sw.epilog exit Considering verifier is able to do limited constant propogation following branches. The following is the code actually traversed. r2 = 0 r3 = 4 <=== relocation r4 = 4 <=== relocation if r4 s> 3 goto LBB0_3 LBB0_3: # %entry if r4 == 4 goto LBB0_7 LBB0_7: # %sw.bb5 r1 += r3 r2 = *(u32 *)(r1 + 0) LBB0_9: # %sw.epilog r1 = 51 <=== relocation r2 <<= r1 r1 = 60 <=== relocation r0 = r2 r0 >>= r1 r3 = 1 if r3 == 0 goto LBB0_11 r2 s>>= r1 r0 = r2 LBB0_11: # %sw.epilog exit For native load case, the load size is calculated to be the same as the size of load width LLVM otherwise used to load the value which is then used to extract the bitfield value. Differential Revision: https://reviews.llvm.org/D67980 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374099 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Do not allow multiple same context traits in the same contextAlexey Bataev2019-10-081-0/+5
| | | | | | | | | | selector. According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each trait-selector-name can only be specified once. Added check for this restriction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374093 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Prohibit multiple context selector sets in context selectors.Alexey Bataev2019-10-081-0/+4
| | | | | | | | According to OpenMP 5.0, 2.3.2 Context Selectors, Restrictions, each trait-set-selector-name can only be specified once. Added check to implement this restriction. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374072 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang][ifs] Clang Interface Stubs ToolChain plumbing.Puyan Lotfi2019-10-085-2/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | Second Landing Attempt: This patch enables end to end support for generating ELF interface stubs directly from clang. Now the following: clang -emit-interface-stubs -o libfoo.so a.cpp b.cpp c.cpp will product an ELF binary with visible symbols populated. Visibility attributes and -fvisibility can be used to control what gets populated. * Adding ToolChain support for clang Driver IFS Merge Phase * Implementing a default InterfaceStubs Merge clang Tool, used by ToolChain * Adds support for the clang Driver to involve llvm-ifs on ifs files. * Adds -emit-merged-ifs flag, to tell llvm-ifs to emit a merged ifs text file instead of the final object format (normally ELF) Differential Revision: https://reviews.llvm.org/D63978 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374061 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Allow functions in declare variant directive to have differentAlexey Bataev2019-10-081-1/+1
| | | | | | | | | | C linkage. After some discussion with OpenMP developers, it was decided that the functions with the different C linkage can be used in declare variant directive. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374057 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang] Accept -ftrivial-auto-var-init in clang-clVitaly Buka2019-10-071-2/+2
| | | | | | | | | | | | Reviewers: eugenis, rnk Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68608 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373992 91177308-0d34-0410-b5e6-96231b3b80d8
* [Diagnostics] Emit better -Wbool-operation's warning message if we known ↵David Bolvansky2019-10-071-1/+2
| | | | | | that the result is always true git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373973 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP]Fix caonical->canonical, NFC.Alexey Bataev2019-10-071-2/+2
| | | | | | Fixed typo. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373952 91177308-0d34-0410-b5e6-96231b3b80d8
* [OPENMP50]Treat range-based for as canonical loop.Alexey Bataev2019-10-072-2/+19
| | | | | | | According to OpenMP 5.0, range-based for is also considered as a canonical form of loops. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373939 91177308-0d34-0410-b5e6-96231b3b80d8
* [libTooling] Add `toString` method to the Stencil classYitzhak Mandelbaum2019-10-071-0/+21
| | | | | | | | | | | | | | | | | Summary: `toString` generates a string representation of the stencil. Patch by Harshal T. Lehri. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68574 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373916 91177308-0d34-0410-b5e6-96231b3b80d8
* clang-cl: Ignore the new /ZH optionsHans Wennborg2019-10-071-0/+3
| | | | | | | | | These were added to the MS docs in https://github.com/MicrosoftDocs/cpp-docs/commit/85b9b6967e58e485251450f7451673f6fc873e88 and are supposedly available in VS 2019 16.4 (though my 2019 Preview, version 16.4.0-pre.1.0 don't seem to have them.) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373887 91177308-0d34-0410-b5e6-96231b3b80d8
* Fix behavior of __builtin_bit_cast when the From and To types are theRichard Smith2019-10-071-2/+3
| | | | | | | | | | same. We were missing the lvalue-to-rvalue conversion entirely in this case, and in fact still need the full CK_LValueToRValueBitCast conversion to perform a load with no TBAA. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373874 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFCI] Slightly improve warning messageDavid Bolvansky2019-10-051-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373818 91177308-0d34-0410-b5e6-96231b3b80d8
* [Sema] Split out -Wformat-type-confusion from -Wformat-pedanticErik Pilkington2019-10-043-5/+21
| | | | | | | | | The warnings now in -Wformat-type-confusion don't align with how we interpret 'pedantic' in clang, and don't belong in -pedantic. Differential revision: https://reviews.llvm.org/D67775 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373774 91177308-0d34-0410-b5e6-96231b3b80d8
* Further improve -Wbool-operation bitwise negation messageSam McCall2019-10-041-1/+1
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373749 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFCI] Improve the -Wbool-operation's warning messageDavid Bolvansky2019-10-041-1/+1
| | | | | | | | Based on the request from the post commit review. Also added one new test. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373743 91177308-0d34-0410-b5e6-96231b3b80d8
* [lldb][modern-type-lookup] No longer import temporary declarations into the ↵Raphael Isemann2019-10-041-2/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | persistent AST Summary: As we figured out in D67803, importing declarations from a temporary ASTContext that were originally from a persistent ASTContext causes a bunch of duplicated declarations where we end up having declarations in the target AST that have no associated ASTImporter that can complete them. I haven't figured out how/if we can solve this in the current way we do things in LLDB, but in the modern-type-lookup this is solvable as we have a saner architecture with the ExternalASTMerger. As we can (hopefully) make modern-type-lookup the default mode in the future, I would say we try fixing this issue here. As we don't use the hack that was reinstated in D67803 during modern-type-lookup, the test case for this is essentially just printing any kind of container in `std::` as we would otherwise run into the issue that required a hack like D67803. What this patch is doing in essence is that instead of importing a declaration from a temporary ASTContext, we instead check if the declaration originally came from a persistent ASTContext (e.g. the debug information) and we directly import from there. The ExternalASTMerger is already connected with ASTImporters to these different sources, so this patch is essentially just two parts: 1. Mark our temporary ASTContext/ImporterSource as temporary when we import from the expression AST. 2. If the ExternalASTMerger sees we import from the expression AST, instead of trying to import these temporary declarations, check if we can instead import from the persistent ASTContext that is already connected. This ensures that all records from the persistent source actually come from the persistent source and are minimally imported in a way that allows them to be completed later on in the target AST. The next step is to run the ASTImporter for these temporary expressions with the MinimalImport mode disabled, but that's a follow up patch. This patch fixes most test failures with modern-type-lookup enabled by default (down to 73 failing tests, which includes the 22 import-std-module tests which need special treatment). Reviewers: shafik, martong Reviewed By: martong Subscribers: aprantl, rnkovacs, christof, abidh, JDevlieghere, lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D68326 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373711 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] [PR43333] Fix C# breaking before function name when using ↵Paul Hoad2019-10-041-32/+36
| | | | | | | | | | | | | | | | | | | | | | | | | Attributes Summary: This is a fix for https://bugs.llvm.org/show_bug.cgi?id=43333 This comes with 3 main parts - C# attributes cause function names on a new line even when AlwaysBreakAfterReturnType is set to None - Add AlwaysBreakAfterReturnType to None by default in the Microsoft style, - C# unit tests are not using Microsoft style (which we created to define the default C# style to match a vanilla C# project). Reviewers: owenpan, klimek, russellmcc, mitchell-stellar Reviewed By: mitchell-stellar Subscribers: cfe-commits Tags: #clang-tools-extra, #clang, #clang-format Differential Revision: https://reviews.llvm.org/D67629 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373707 91177308-0d34-0410-b5e6-96231b3b80d8
* Properly handle instantiation-dependent array bounds.Richard Smith2019-10-043-45/+50
| | | | | | | | | We previously failed to treat an array with an instantiation-dependent but not value-dependent bound as being an instantiation-dependent type. We now track the array bound expression as part of a constant array type if it's an instantiation-dependent expression. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373685 91177308-0d34-0410-b5e6-96231b3b80d8
* OverloadCandidate::getNumParams - silence static analyzer ↵Simon Pilgrim2019-10-031-2/+2
| | | | | | | | | | getAs<FunctionProtoType> null dereference warning. NFCI. The static analyzer is warning about a potential null dereference, but we should be able to use castAs<FunctionProtoType> directly and if not assert will fire for us. Also replaces an auto to make the type more obvious. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373665 91177308-0d34-0410-b5e6-96231b3b80d8
* [HIP] Use option -nogpulib to disable linking device libYaxun Liu2019-10-031-1/+3
| | | | | | | Differential Revision: https://reviews.llvm.org/D68300 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373649 91177308-0d34-0410-b5e6-96231b3b80d8
* Check for qualified function types after substituting into the operandRichard Smith2019-10-032-0/+4
| | | | | | | | | | of 'typeid'. This is a rare place where it's valid for a function type to be substituted but not valid for a qualified function type to be substituted, so needs a special check. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373648 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang-format] Add ability to wrap braces after multi-line control statementsPaul Hoad2019-10-031-17/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Change the BraceWrappingFlags' AfterControlStatement from a bool to an enum with three values: * "Never": This is the default, and does not do any brace wrapping after control statements. * "MultiLine": This only wraps braces after multi-line control statements (this really only happens when a ColumnLimit is specified). * "Always": This always wraps braces after control statements. The first and last options are backwards-compatible with "false" and "true", respectively. The new "MultiLine" option is useful for when a wrapped control statement's indentation matches the subsequent block's indentation. It makes it easier to see at a glance where the control statement ends and where the block's code begins. For example: ``` if ( foo && bar ) { baz(); } ``` vs. ``` if ( foo && bar ) { baz(); } ``` Short control statements (1 line) do not wrap the brace to the next line, e.g. ``` if (foo) { bar(); } else { baz(); } ``` Reviewers: sammccall, owenpan, reuk, MyDeveloperDay, klimek Reviewed By: MyDeveloperDay Subscribers: MyDeveloperDay, cfe-commits Patch By: mitchell-stellar Tags: #clang-format, #clang, #clang-tools-extra Differential Revision: https://reviews.llvm.org/D68296 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373647 91177308-0d34-0410-b5e6-96231b3b80d8
* [NFC] Added missing changes for rL373614David Bolvansky2019-10-031-0/+3
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373616 91177308-0d34-0410-b5e6-96231b3b80d8
* [libTooling] Add various Stencil combinators for expressions.Yitzhak Mandelbaum2019-10-031-1/+16
| | | | | | | | | | | | | | | | | | | Summary: This revision adds three new Stencil combinators: * `expression`, which idiomatically constructs the source for an expression, including wrapping the expression's source in parentheses if needed. * `deref`, which constructs an idiomatic dereferencing expression. * `addressOf`, which constructs an idiomatic address-taking expression. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68315 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373593 91177308-0d34-0410-b5e6-96231b3b80d8
* [Alignment][Clang][NFC] Add CharUnits::getAsAlignGuillaume Chatelet2019-10-031-0/+5
| | | | | | | | | | | | | | | | | | Summary: This is a prerequisite to removing `llvm::GlobalObject::setAlignment(unsigned)`. This is patch is part of a series to introduce an Alignment type. See this thread for context: http://lists.llvm.org/pipermail/llvm-dev/2019-July/133851.html See this patch for the introduction of the type: https://reviews.llvm.org/D64790 Reviewers: courbet Subscribers: jholewinski, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D68274 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373592 91177308-0d34-0410-b5e6-96231b3b80d8
* [clang][NFC] Fix misspellings in ExternalASTMerger.hRaphael Isemann2019-10-031-4/+4
| | | | git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373577 91177308-0d34-0410-b5e6-96231b3b80d8
* Revert 373538 and follow-ups 373549 and 373552.Nico Weber2019-10-035-21/+2
| | | | | | They break tests on (at least) macOS. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@373556 91177308-0d34-0410-b5e6-96231b3b80d8