summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Factor out commonality between variable capture initialization andRichard Smith2019-06-022-92/+101
| | | | | | 'this' capture initialization. llvm-svn: 362317
* msabi: Fix exponential mangling time for certain pathological inputsNico Weber2019-06-011-34/+59
| | | | | | | | | | | | | | | | | Template back references used to be recursively recomputed, add a memoization cache to cut down on this. Since there are now two different types of argument maps, rename the existing TypeBackReferences to FunArgBackReferences, and rename mangleArgumentType() to mangleFunctionArgumentType(). Fixes PR42091, the input there now takes 50ms instead of 7s to compile. No intended behavior change. Differential Revision: https://reviews.llvm.org/D62746 llvm-svn: 362293
* [analyzer] print() JSONify: ExplodedNode revisionCsaba Dabis2019-05-311-3/+3
| | | | | | | | | | | | | | | Summary: Revert node-ID removal. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Subscribers: szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62658 llvm-svn: 362249
* Replace 'default' in an enum-over-a-switch with the missing list.Erich Keane2019-05-311-1/+5
| | | | | | | This suppressed the Wswitch warning causing me to miss it and write an assertion failure. llvm-svn: 362245
* Suppress nothrow/Exception spec conflict warning when we dont know the ES.Erich Keane2019-05-311-7/+7
| | | | | | | In any situation where the Exception Spec isn't clear, suppress the warning to avoid false positives. llvm-svn: 362243
* Suppress nothrow/exception spec conflict warning when ES is parsed.Erich Keane2019-05-311-1/+3
| | | | | | | | | | | | | | The previously added warning ended up causing false positives when nothrow was used on member functions, where the exception specification wasn't yet parsed. So, throw() and noexcept(true) both were incorrectly warning. There doesn't seem to be a good way to force these to be parsed to identify which they are (and likely should not be), so suppress the warning. For now, unevaluated/uninstantiated are left as warnings as I am not creative enough to find a reproducer that causes a false positive for either. llvm-svn: 362236
* Fix for PR42089, regression from r362119Erich Keane2019-05-311-1/+8
| | | | | | | | | The implementation of the NoThrow ExceptionSpecificationType missed a switch statement for forming the diagnostic when an out-of-line member redeclaration misses the exception specification. This patch adds the correct case statement. llvm-svn: 362225
* [X86] Add VP2INTERSECT instructionsPengfei Wang2019-05-317-1/+260
| | | | | | | | | | Support intel AVX512 VP2INTERSECT instructions in clang Patch by Xiang Zhang (xiangzhangllvm) Differential Revision: https://reviews.llvm.org/D62367 llvm-svn: 362196
* re-commit r361928: [PowerPC] [Clang] Port SSE intrinsics to PowerPCZi Xuan Wu2019-05-313-0/+1888
| | | | | | | | | | | | | | | Port xmmintrin.h which include Intel SSE intrinsics implementation to PowerPC platform (using Altivec). The new headers containing those implemenations are located into a directory named ppc_wrappers which has higher priority when the platform is PowerPC on Linux. They are mainly developed by Steven Munroe, with contributions from Paul Clarke, Bill Schmidt, Jinsong Ji and Zixuan Wu. Patched by: Qiu Chaofan <qiucf@cn.ibm.com> Reviewed By: Jinsong Ji Differential Revision: https://reviews.llvm.org/D62121 llvm-svn: 362190
* Revert "[X86] Fix i386 struct and union parameter alignment"Pengfei Wang2019-05-311-11/+2
| | | | | | | | | | This reverts commit d61cb749f4ac2c90244906d756e80a5c4a7ffa89 (SVN: 361934). According to James suggestion, revert this change. Please ref: https://reviews.llvm.org/D60748 llvm-svn: 362186
* PR39728: When completing a class, complete the destructor first.Richard Smith2019-05-311-39/+53
| | | | | | | | | We need to know whether the destructor is trivial in order to tell whether other parts of the class are valid (in particular, this affects whether the type is a literal type, which affects whether defaulted special members can be declared constexpr or are implicitly constexpr). llvm-svn: 362184
* Fix the predefined exponent limit macros for the 16-bit IEEE format.John McCall2019-05-311-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The magnitude range of normalized _Float16 is 2^-14 (~6e-5) to (2-2^-10)*2^15 (65504). You might think, then, that the code is correct to defne FLT16_MIN_EXP and FLT16_MAX_EXP to be -14 and 15 respectively. However, for some reason the C specification actually specifies a bias for these macros: C11 5.2.4.2.2: - minimum negative integer such that FLT_RADIX raised to one less than that power is a normalized floating-point number, e_min: FLT_MIN_EXP DBL_MIN_EXP LDBL_MIN_EXP - maximum integer such that FLT_RADIX raised to one less than that power is a representable finite floating-point number, e_max: FLT_MAX_EXP DBL_MAX_EXP LDBL_MAX_EXP FLT16_MIN_EXP and FLT16_MAX_EXP should clearly be biased the same way, and other compilers do in fact do so, as do our OpenCL headers for `half`. Additionally, FLT16_MIN_10_EXP is just wrong. llvm-svn: 362183
* Defer building 'this' captures until we have left the capturing regionRichard Smith2019-05-314-41/+25
| | | | | | | | | | and returned to the context in which 'this' should be captured. This means we now always mark 'this' referenced from the context in which it's actually referenced, rather than potentially from some context nested within that. llvm-svn: 362182
* Fix -DBUILD_SHARED_LIBS=ON build after rL362160Sam Clegg2019-05-311-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D62709 llvm-svn: 362180
* Defer capture initialization for captured regions until after we've leftRichard Smith2019-05-316-64/+132
| | | | | | | | | | | | | | | | the captured region scope. This removes a case where we would build expressions (and mark declarations odr-used) in the wrong scope. Remove the now-unused 'capture initializer' field on sema::Capture (except for 'this' captures, which still need to be cleaned up). No functionality change intended (except that we now very slightly more precisely determine whether we need to use a capture or not when another captured region encloses an OpenMP captured region). llvm-svn: 362179
* Defer capture initialization for blocks until after we've left theRichard Smith2019-05-313-80/+106
| | | | | | | | | function scope. This removes one of the last few cases where we build expressions in the wrong function scope context. No functionality change intended. llvm-svn: 362178
* Refactor OpenMP stack management.Richard Smith2019-05-301-214/+224
| | | | | | | | | | Instead of duplicating access to the directive stack throughout SemaOpenMP.cpp, consolidate it to a few methods and call those everywhere else. In passing, simplify adjacent code where possible. No functionality change intended. llvm-svn: 362172
* Fix "fallthrough annotation in unreachable code" warning.Richard Smith2019-05-301-1/+1
| | | | llvm-svn: 362171
* Add enums as global variables in the IR metadata.Amy Huang2019-05-301-5/+7
| | | | | | | | | | | | | | | | Summary: Keeps track of the enums that were used by saving them as DIGlobalVariables, since CodeView emits debug info for global constants. Reviewers: rnk Subscribers: aprantl, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62635 llvm-svn: 362166
* [Remarks][NFC] Move the serialization to lib/RemarksFrancis Visoiu Mistrih2019-05-301-1/+2
| | | | | | | | | | | | Separate the remark serialization to YAML from the LLVM Diagnostics. This adds a new serialization abstraction: remarks::Serializer. It's completely independent from lib/IR and it provides an easy way to replace YAML by providing a new remarks::Serializer. Differential Revision: https://reviews.llvm.org/D62632 llvm-svn: 362160
* Fix constexpr __builtin_*_overflow issue when unsigned->signed operand.Erich Keane2019-05-301-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | As reported here https://bugs.llvm.org/show_bug.cgi?id=42000, it was possible to get the constexpr version of __builtin_*_overflow to give the wrong answer. This was because when extending the operands to fit the largest type (so that the math could be done), the decision on whether to sign/zero extend the operands was based on the result signedness, not on the operands signedness. In the reported case, (unsigned char)255 - (int)100 needed to have each extended to the int in order to do the math. However, when extending the first operand to 'int', we incorrectly sign extended it instead of zero extending. Thus, the result didnt fit back into the unsigned char. The fix for this was simply to choose zero/sign extension based on the sign of the operand itself. Differential Revision: https://reviews.llvm.org/D62665 llvm-svn: 362157
* [c++2a] Fix assertion failure if we would walk over more than one levelRichard Smith2019-05-301-1/+2
| | | | | | | of derived-to-base conversion path when implicitly starting union subobject lifetimes in constant evaluation. llvm-svn: 362147
* Add Attribute NoThrow as an Exception Specifier TypeErich Keane2019-05-307-4/+72
| | | | | | | | | | | | | | | In response to https://bugs.llvm.org/show_bug.cgi?id=33235, it became clear that the current mechanism of hacking through checks for the exception specification of a function gets confused really quickly when there are alternate exception specifiers. This patch introcues EST_NoThrow, which is the equivilent of EST_noexcept when caused by EST_noThrow. The existing implementation is left in place to cover functions with no FunctionProtoType. Differential Revision: https://reviews.llvm.org/D62435 llvm-svn: 362119
* Revert "clang support gnu asm goto."Erich Keane2019-05-3012-384/+135
| | | | | | | | | | | This reverts commit 954ec09aed4f2be04bb5f4e10dbb4ea8bd19ef9a. Reverting due to test failures as requested by Jennifer Yu. Conflicts: clang/test/CodeGen/asm-goto.c llvm-svn: 362106
* [OpenCL] Fix OpenCL/SPIR version metadata in C++ mode.Anastasia Stulova2019-05-301-4/+9
| | | | | | | | | C++ is derived from OpenCL v2.0 therefore set the versions identically. Differential Revision: https://reviews.llvm.org/D62657 llvm-svn: 362102
* [ARM] Add CLI support for Armv8.1-M and MVESjoerd Meijer2019-05-301-0/+2
| | | | | | | | | | | | Given the existing infrastructure in LLVM side for +fp and +fp.dp, this is more or less trivial, needing only one tiny source change and a couple of tests. Patch by Simon Tatham. Differential Revision: https://reviews.llvm.org/D60699 llvm-svn: 362096
* [OpenCL] Support logical vector operators in C++ modeSven van Haastregt2019-05-301-2/+3
| | | | | | | | | Support logical operators on vectors in C++ for OpenCL mode, to preserve backwards compatibility with OpenCL C. Differential Revision: https://reviews.llvm.org/D62588 llvm-svn: 362087
* Revert "asm goto: fix out-of-bounds read of Constraints after rC362045"Fangrui Song2019-05-301-1/+0
| | | | | | It was fixed by rC362062. llvm-svn: 362079
* asm goto: fix out-of-bounds read of Constraints after rC362045Fangrui Song2019-05-301-0/+1
| | | | | | | | | | | | When parsing goto labels, Names and Exprs are expanded but Constraints is not, this may cause a out-of-bounds read later in: // GCCAsmStmt::GCCAsmStmt // `constraints` has only `NumExprs - NumLabels` elements Constraints = new (C) StringLiteral*[NumExprs]; std::copy(constraints, constraints + NumExprs, Constraints); llvm-svn: 362067
* [AST] asm goto labels don't have constraints, don't try to copy them.Benjamin Kramer2019-05-301-4/+6
| | | | | | Found by asan. llvm-svn: 362062
* Add the `objc_class_stub` attribute.John McCall2019-05-303-13/+100
| | | | | | | | | | | | | | | | | | | | | | | | | Swift requires certain classes to be not just initialized lazily on first use, but actually allocated lazily using information that is only available at runtime. This is incompatible with ObjC class initialization, or at least not efficiently compatible, because there is no meaningful class symbol that can be put in a class-ref variable at load time. This leaves ObjC code unable to access such classes, which is undesirable. objc_class_stub says that class references should be resolved by calling a new ObjC runtime function with a pointer to a new "class stub" structure. Non-ObjC compilers (like Swift) can simply emit this structure when ObjC interop is required for a class that cannot be statically allocated, then apply this attribute to the `@interface` in the generated ObjC header for the class. This attribute can be thought of as a generalization of the existing `objc_runtime_visible` attribute which permits more efficient class resolution as well as supporting the additon of categories to the class. Subclassing these classes from ObjC is currently not allowed. Patch by Slava Pestov! llvm-svn: 362054
* [Driver] Render target options (e.g. -fuse-init-array) for -fembed-bitcodeFangrui Song2019-05-301-0/+3
| | | | | | | | | | | | | | | | | | | | | Modern ELF platforms use -fuse-init-array to emit .init_array instead of .ctors . ld.bfd and gold --ctors-in-init-array merge .init_array and .ctors into .init_array but lld doesn't do that. If crtbegin*.o crtend*.o don't provide .ctors/.dtors, such .ctors in user object files can lead to crash (see PR42002. The first and the last elements in .ctors/.dtors are ignored - they are traditionally provided by crtbegin*.o crtend*.o). Call addClangTargetOptions() to ensure -fuse-init-array is rendered on modern ELF platforms. On Hexagon, this renders -target-feature +reserved-r19 for -ffixed-r19. Reviewed By: compnerd Differential Revision: https://reviews.llvm.org/D62509 llvm-svn: 362052
* [PowerPC] Set the default PLT mode on musl to Secure PLTFangrui Song2019-05-301-1/+1
| | | | | | | | | | | | The musl libc only supports Secure PLT. Patch by A. Wilcox! Reviewed By: jhibbits Differential Revision: https://reviews.llvm.org/D59185 llvm-svn: 362051
* [Driver] -static-pie: add -z textFangrui Song2019-05-301-0/+2
| | | | | | | | | | | | | | | | | | | | | | | This matches gcc -static-pie. The intention is to prevent dynamic relocations in read-only segments. In ld.bfd and gold, -z notext is the default. If text relocations are needed: * -z notext: allow and emit DF_TEXTREL. DF_TEXTREL is not emitted if there is no text relocation. * -z text: error In lld, -z text is the default (this change is a no-op). * -z text: error on text relocations * -z notext: allow text relocations, and emit DF_TEXTREL no matter whether text relocations exist. Reviewed By: sivachandra Differential Revision: https://reviews.llvm.org/D62606 llvm-svn: 362050
* clang support gnu asm goto.Jennifer Yu2019-05-3012-135/+384
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Syntax: asm [volatile] goto ( AssemblerTemplate : : InputOperands : Clobbers : GotoLabels) https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html New llvm IR is "callbr" for inline asm goto instead "call" for inline asm For: asm goto("testl %0, %0; jne %l1;" :: "r"(cond)::label_true, loop); IR: callbr void asm sideeffect "testl $0, $0; jne ${1:l};", "r,X,X,~{dirflag},~{fpsr},~{flags}"(i32 %0, i8* blockaddress(@foo, %label_true), i8* blockaddress(@foo, %loop)) #1 to label %asm.fallthrough [label %label_true, label %loop], !srcloc !3 asm.fallthrough: Compiler need to generate: 1> a dummy constarint 'X' for each label. 2> an unique fallthrough label for each asm goto stmt " asm.fallthrough%number". Diagnostic 1> duplicate asm operand name are used in output, input and label. 2> goto out of scope. llvm-svn: 362045
* CodeView - add static data members to global variable debug info.Amy Huang2019-05-291-4/+14
| | | | | | | | | | | | | | | | | | Summary: Add static data members to IR debug info's list of global variables so that they are emitted as S_CONSTANT records. Related to https://bugs.llvm.org/show_bug.cgi?id=41615. Reviewers: rnk Subscribers: aprantl, cfe-commits, llvm-commits, thakis Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D62167 llvm-svn: 362038
* [ObjC] Fix encoding of ObjC pointer types that are pointers to typedefsAkira Hatanaka2019-05-291-36/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | clang was encoding pointers to typedefs as if they were pointers to structs because that is apparently what gcc is doing. For example: ``` @class Class1; typedef NSArray<Class1 *> MyArray; void foo1(void) { const char *s0 = @encode(MyArray *); // "^{NSArray=#}" const char *s1 = @encode(NSArray<Class1 *> *); // "@" } ``` This commit removes the code that was there to make clang compatible with gcc and make clang emit the correct encoding for ObjC pointers, which is "@". rdar://problem/50563529 Differential Revision: https://reviews.llvm.org/D61974 llvm-svn: 362034
* [analyzer] Remove EndPath function as it is dead codeCsaba Dabis2019-05-291-1/+0
| | | | | | | | | | | | | | | | | Summary: - Reviewers: george.karpenkov Reviewed By: george.karpenkov Subscribers: baloghadamsoftware, cfe-commits, xazax.hun, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D53720 llvm-svn: 362030
* [analyzer] ConditionBRVisitor: Boolean supportCsaba Dabis2019-05-291-4/+11
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, george.karpenkov Reviewed By: NoQ, george.karpenkov Subscribers: cfe-commits, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D58207 llvm-svn: 362027
* [analyzer] ConditionBRVisitor: MemberExpr supportCsaba Dabis2019-05-291-7/+62
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: cfe-commits, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D58206 llvm-svn: 362026
* [analyzer] ConditionBRVisitor: Remove duplicated codeCsaba Dabis2019-05-291-27/+32
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: cfe-commits, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D58199 llvm-svn: 362025
* [analyzer] ConditionBRVisitor: Enhance to write out more informationCsaba Dabis2019-05-291-60/+103
| | | | | | | | | | | | | | | | | | | | Summary: Add extra messages to the bug report to inform the user why the analyzer `Taking true/false branch`. Reviewers: NoQ, george.karpenkov Reviewed By: NoQ Subscribers: gerazo, gsd, dkrupp, whisperity, baloghadamsoftware, xazax.hun, eraman, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D53076 llvm-svn: 362020
* [analyzer] [NFC] PathDiagnostic: Create PathDiagnosticPopUpPieceCsaba Dabis2019-05-296-42/+218
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This new piece is similar to our macro expansion printing in HTML reports: On mouse-hover event it pops up on variables. Similar to note pieces it supports `plist` diagnostics as well. It is optional, on by default: `add-pop-up-notes=true`. Extra: In HTML reports `background-color: LemonChiffon` was too light, changed to `PaleGoldenRod`. Reviewers: NoQ, alexfh Reviewed By: NoQ Subscribers: cfe-commits, gerazo, gsd, george.karpenkov, alexfh, xazax.hun, baloghadamsoftware, szepet, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D60670 llvm-svn: 362014
* [analyzer] print() JSONify: SVal implementationCsaba Dabis2019-05-292-2/+14
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, Szelethus, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62497 llvm-svn: 362008
* Fix an unused-variable error.Haojian Wu2019-05-291-0/+1
| | | | llvm-svn: 362005
* [WebAssembly] Support VPtr sanitizer for EmscriptenThomas Lively2019-05-292-0/+9
| | | | | | | | | | | | | | | | | | | | | | | Summary: After https://github.com/emscripten-core/emscripten/pull/8651, Emscripten supports the full UBSan runtime. This includes the VPtr sanitizer. This diff allows clang to generate code that uses the VPtr sanitizer for Emscripten. Patch by Guanzhong Chen Reviewers: tlively, aheejin Reviewed By: aheejin Subscribers: dschuff, sbc100, jgravelle-google, sunfish, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D62559 llvm-svn: 362004
* [analyzer] print() JSONify: CFG implementationCsaba Dabis2019-05-292-6/+21
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62496 llvm-svn: 362003
* [analyzer] print() JSONify: Decl revisionCsaba Dabis2019-05-291-6/+4
| | | | | | | | | | | | | | | | | Summary: - Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62495 llvm-svn: 362002
* [analyzer][AST] print() JSONify: Stmt implementationCsaba Dabis2019-05-294-54/+39
| | | | | | | | | | | | | | | | | | | | Summary: This patch also adds a function called `JsonFormat()` which: - Flattens the string so removes the new-lines. - Escapes double quotes. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62494 llvm-svn: 362000
* [analyzer] print() JSONify: getNodeLabel implementationCsaba Dabis2019-05-292-112/+146
| | | | | | | | | | | | | | | | | Summary: This patch also rewrites the ProgramPoint printing. Reviewers: NoQ, xazax.hun, ravikandhadai, baloghadamsoftware, Szelethus Reviewed By: NoQ Subscribers: cfe-commits, szepet, rnkovacs, a.sidorin, mikhail.ramalho, donat.nagy, dkrupp Tags: #clang Differential Revision: https://reviews.llvm.org/D62346 llvm-svn: 361997
OpenPOWER on IntegriCloud