summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.Bruno Ricci2018-12-2118-200/+200
| | | | | | | | | All of the other constructors already take a reference to the AST context. This avoids calling Decl::getASTContext in most cases. Additionally move the definition of the constructor from Expr.h to Expr.cpp since it is calling DeclRefExpr::computeDependence. NFC. llvm-svn: 349901
* Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in ↵Simon Pilgrim2018-12-212-38/+23
| | | | | | | | | | | | | | RetainCountChecker on type mismatch even for inlined functions The fix done in D55465 did not previously apply when the function was inlined. rdar://46889541 Differential Revision: https://reviews.llvm.org/D55976 ........ Fixes broken buildbot: http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/14764 llvm-svn: 349894
* [Sema] Produce diagnostics when C++17 aligned allocation/deallocationAkira Hatanaka2018-12-216-22/+112
| | | | | | | | | | | functions that are unavailable on Darwin are explicitly called or called from deleting destructors. rdar://problem/40736230 Differential Revision: https://reviews.llvm.org/D47757 llvm-svn: 349890
* [analyzer] Perform escaping in RetainCountChecker on type mismatch even for ↵George Karpenkov2018-12-212-23/+38
| | | | | | | | | | | | inlined functions The fix done in D55465 did not previously apply when the function was inlined. rdar://46889541 Differential Revision: https://reviews.llvm.org/D55976 llvm-svn: 349876
* [analyzer] Fix a bug in RetainCountDiagnostics while printing a note on ↵George Karpenkov2018-12-212-3/+18
| | | | | | | | | | | | mismatched summary in inlined functions Previously, we were not printing a note at all if at least one of the parameters was not annotated. rdar://46888422 Differential Revision: https://reviews.llvm.org/D55972 llvm-svn: 349875
* [mingw] Don't mangle thiscall like fastcall etcReid Kleckner2018-12-212-6/+21
| | | | | | | | | | | | | | | GCC does not mangle it when it is not explicit in the source. The mangler as currently written cannot differentiate between explicit and implicit calling conventions, so we can't match GCC. Explicit thiscall conventions are rare, so mangle as if the convention was implicit to be as ABI compatible as possible. Also fixes some tests using %itanium_abi_triple in some configurations as a side effect. Fixes PR40107. llvm-svn: 349872
* [driver] [analyzer] Fix --analyze -Xanalyzer after r349863.Artem Dergachev2018-12-213-2/+21
| | | | | | | | | | | | | | If an -analyzer-config is passed through -Xanalyzer, it is not found while looking for -Xclang. Additionally, don't emit -analyzer-config-compatibility-mode for *every* -analyzer-config flag we encounter; one is enough. https://reviews.llvm.org/D55823 rdar://problem/46504165 llvm-svn: 349866
* Revert "Revert "[driver] [analyzer] Fix a backward compatibility issue after ↵George Karpenkov2018-12-213-3/+92
| | | | | | | | | | r348038."" This reverts commit 144927939587b790c0536f4ff08245043fc8d733. Fixes the bug in the original commit. llvm-svn: 349863
* [analyzer] RetainCount: Suppress retain detection heuristic on some CM methods.Artem Dergachev2018-12-212-2/+39
| | | | | | | | | | | | If it ends with "Retain" like CFRetain and returns a CFTypeRef like CFRetain, then it is not necessarily a CFRetain. But it is indeed true that these two return something retained. Differential Revision: https://reviews.llvm.org/D55907 rdar://problem/39390714 llvm-svn: 349862
* [CodeGen] Fix a test from r349848 by replacing `objc_` with `llvm.objc.`Volodymyr Sapsai2018-12-201-2/+2
| | | | llvm-svn: 349853
* [CodeGen] Fix assertion on emitting cleanup for object with inlined ↵Volodymyr Sapsai2018-12-203-0/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | inherited constructor and non-trivial destructor. Fixes assertion > Assertion failed: (isa<X>(Val) && "cast<Ty>() argument of incompatible type!"), function cast, file llvm/Support/Casting.h, line 255. It was triggered by trying to cast `FunctionDecl` to `CXXMethodDecl` as `CGF.CurCodeDecl` in `CallBaseDtor::Emit`. It was happening because cleanups were emitted in `ScalarExprEmitter::VisitExprWithCleanups` after destroying `InlinedInheritingConstructorScope`, so `CodeGenFunction.CurCodeDecl` didn't correspond to expected cleanup decl. Fix the assertion by emitting cleanups before leaving `InlinedInheritingConstructorScope` and changing `CurCodeDecl`. Test cases based on a patch by Shoaib Meenai. Fixes PR36748. rdar://problem/45805151 Reviewers: rsmith, rjmccall Reviewed By: rjmccall Subscribers: jkorous, dexonsmith, cfe-commits, smeenai, compnerd Differential Revision: https://reviews.llvm.org/D55543 llvm-svn: 349848
* Add support for namespaces on #pragma clang attributeErik Pilkington2018-12-208-21/+152
| | | | | | | | | | | | | | | | Namespaces are introduced by adding an "identifier." before a push/pop directive. Pop directives with namespaces can only pop a attribute group that was pushed with the same namespace. Push and pop directives that don't opt into namespaces have the same semantics. This is necessary to prevent a pitfall of using multiple #pragma clang attribute directives spread out in a large file, particularly when macros are involved. It isn't easy to see which pop corripsonds to which push, so its easy to inadvertently pop the wrong group. Differential revision: https://reviews.llvm.org/D55628 llvm-svn: 349845
* Revert "[driver] [analyzer] Fix a backward compatibility issue after r348038."Artem Dergachev2018-12-203-95/+3
| | | | | | | | | | | | This reverts commits r349824, r349828, r349835. More buildbot failures were noticed. Differential Revision: https://reviews.llvm.org/D55823 rdar://problem/46504165 llvm-svn: 349843
* [ObjC] Messages to 'self' in class methods that return 'instancetype' shouldAlex Lorenz2018-12-203-29/+88
| | | | | | | | | | | | | | | | | | | | | | | | use the pointer to the class as the result type of the message Prior to this commit, messages to self in class methods were treated as instance methods to a Class value. When these methods returned instancetype the compiler only saw id through the instancetype, and not the Interface *. This caused problems when that return value was a receiver in a message send, as the compiler couldn't select the right method declaration and had to rely on a selection from the global method pool. This commit modifies the semantics of such message sends and uses class messages that are dispatched to the interface that corresponds to the class that contains the class method. This ensures that instancetypes are correctly interpreted by the compiler. This change is safe under ARC (as self can't be reassigned), however, it also applies to MRR code as we are assuming that the user isn't doing anything unreasonable. rdar://20940997 Differential Revision: https://reviews.llvm.org/D36790 llvm-svn: 349841
* cmake: Remove uses of add_llvm_loadable_module macroTom Stellard2018-12-203-3/+3
| | | | | | This was removed from llvm in r349839. llvm-svn: 349840
* [driver] [analyzer] Fix redundant test output.Artem Dergachev2018-12-202-2/+4
| | | | | | | | | | | The -c flag causes a .o file to appear every time we run a test. Remove it. Differential Revision: https://reviews.llvm.org/D55823 rdar://problem/46504165 llvm-svn: 349835
* [driver] [analyzer] Fix buildbots after r349824.Artem Dergachev2018-12-202-2/+2
| | | | | | | | | | Buildbots can't find the linker, which we don't really need in our tests. Differential Revision: https://reviews.llvm.org/D55823 rdar://problem/46504165 llvm-svn: 349828
* Declares __cpu_model as dso localHaibo Huang2018-12-203-0/+14
| | | | | | | | __builtin_cpu_supports and __builtin_cpu_is use information in __cpu_model to decide cpu features. Before this change, __cpu_model was not declared as dso local. The generated code looks up the address in GOT when reading __cpu_model. This makes it impossible to use these functions in ifunc, because at that time GOT entries have not been relocated. This change makes it dso local. Differential Revision: https://reviews.llvm.org/D53850 llvm-svn: 349825
* [driver] [analyzer] Fix a backward compatibility issue after r348038.Artem Dergachev2018-12-203-3/+93
| | | | | | | | | | | | | | | | | | | Since r348038 we emit an error every time an -analyzer-config option is not found. The driver, however, suppresses this error with another flag, -analyzer-config-compatibility-mode, so backwards compatibility is maintained, while analyzer developers still enjoy the new typo-free experience. The backwards compatibility turns out to be still broken when the -analyze action is not specified; it is still possible to specify -analyzer-config in that case. This should be fixed now. Patch by Kristóf Umann! Differential Revision: https://reviews.llvm.org/D55823 rdar://problem/46504165 llvm-svn: 349824
* [CodeGen] Generate llvm.loop.parallel_accesses instead of ↵Michael Kruse2018-12-2017-262/+326
| | | | | | | | | | | | | | llvm.mem.parallel_loop_access metadata. Instead of generating llvm.mem.parallel_loop_access metadata, generate llvm.access.group on instructions and llvm.loop.parallel_accesses on loops. There is one access group per generated loop. This is clang part of D52116/r349725. Differential Revision: https://reviews.llvm.org/D52117 llvm-svn: 349823
* Make the "too many braces in scalar initialization" extension causeRichard Smith2018-12-202-1/+24
| | | | | | SFINAE failures. llvm-svn: 349820
* Fix the example checker plugin after r349812.Aaron Ballman2018-12-201-1/+3
| | | | llvm-svn: 349816
* Fix build failures from r349812 due to a missing argument.Aaron Ballman2018-12-201-1/+2
| | | | llvm-svn: 349815
* Allow direct navigation to static analysis checker documentation through ↵Aaron Ballman2018-12-2012-421/+635
| | | | | | | | SARIF exports. This adds anchors to all of the documented checks so that you can directly link to a check by a stable name. This is useful because the SARIF file format has a field for specifying a URI to documentation for a rule and some viewers, like CodeSonar, make use of this information. These links are then exposed through the SARIF exporter. llvm-svn: 349812
* [Sema] Don't try to account for the size of an incomplete type in ↵Bruno Ricci2018-12-202-2/+19
| | | | | | | | | | | | | | | | | CheckArrayAccess When checking that the array access is not out-of-bounds in CheckArrayAccess it is possible that the type of the base expression after IgnoreParenCasts is incomplete, even though the type of the base expression before IgnoreParenCasts is complete. In this case we have no information about whether the array access is out-of-bounds and we should just bail-out instead. This fixes PR39746 which was caused by trying to obtain the size of an incomplete type. Differential Revision: https://reviews.llvm.org/D55862 Reviewed By: efriedma llvm-svn: 349811
* Revert "[analyzer] pr38668: Do not attempt to cast loaded values..."Artem Dergachev2018-12-203-34/+10
| | | | | | | | | | | | | | | This reverts commit r349701. The patch was incorrect. The whole point of CastRetrievedVal() is to handle the case in which the type from which the cast is made (i.e., the "type" of value `V`) has nothing to do with the type of the region it was loaded from (i.e., `R->getValueType()`). Differential Revision: https://reviews.llvm.org/D55875 rdar://problem/45062567 llvm-svn: 349798
* [X86] Auto upgrade XOP/AVX512 rotation intrinsics to generic funnel shift ↵Simon Pilgrim2018-12-204-81/+133
| | | | | | | | | | | | intrinsics (clang) This emits FSHL/FSHR generic intrinsics for the XOP VPROT and AVX512 VPROL/VPROR rotation intrinsics. LLVM counterpart: https://reviews.llvm.org/D55938 Differential Revision: https://reviews.llvm.org/D55937 llvm-svn: 349796
* Use @llvm.objc.clang.arc.use intrinsic instead of clang.arc.use function.Pete Cooper2018-12-208-22/+19
| | | | | | | | Calls to this function are deleted in the ARC optimizer. However when the ARC optimizer was updated to use intrinsics instead of functions (r349534), the corresponding clang change (r349535) to use intrinsics missed this one so it wasn't being deleted. llvm-svn: 349782
* Correct the diagnose_if attribute documentation. Fixes PR35845.Aaron Ballman2018-12-201-2/+2
| | | | llvm-svn: 349776
* [Sema][NFC] Add test for static_assert diagnistics with constexpr template ↵Clement Courbet2018-12-201-0/+7
| | | | | | functions. llvm-svn: 349755
* [Driver] Fix accidentally reversed condition in r349752Michal Gorny2018-12-201-1/+1
| | | | llvm-svn: 349754
* [SystemZ] Improve testing of vecintrin.h intrinsicsUlrich Weigand2018-12-202-3/+1819
| | | | | | | | This adds assembly-level tests to verify that the high-level intrinsics generate the instructions they're supposed to. These tests would have caught the codegen bugs I just fixed. llvm-svn: 349753
* Replace getOS() == llvm::Triple::*BSD with isOS*BSD() [NFCI]Michal Gorny2018-12-2012-43/+43
| | | | | | | | | | | | Replace multiple comparisons of getOS() value with FreeBSD, NetBSD, OpenBSD and DragonFly with matching isOS*BSD() methods. This should improve the consistency of coding style without changing the behavior. Direct getOS() comparisons were left whenever used in switch or switch- like context. Differential Revision: https://reviews.llvm.org/D55916 llvm-svn: 349752
* [SystemZ] Fix wrong codegen caused by typos in vecintrin.hUlrich Weigand2018-12-202-8/+8
| | | | | | | | | | | | | | | The following two bugs in SystemZ high-level vector intrinsics are fixes by this patch: - The float case of vec_insert_and_zero should generate a VLLEZF pattern, but currently erroneously generates VLLEZLF. - The float and double versions of vec_orc erroneously generate and-with-complement instead of or-with-complement. The patch also fixes a couple of typos in the associated test. llvm-svn: 349751
* [X86][SSE] Auto upgrade PADDS/PSUBS intrinsics to SADD_SAT/SSUB_SAT generic ↵Simon Pilgrim2018-12-205-42/+57
| | | | | | | | | | | | intrinsics (clang) This emits SADD_SAT/SSUB_SAT generic intrinsics for the SSE signed saturated math intrinsics. LLVM counterpart: https://reviews.llvm.org/D55894 Differential Revision: https://reviews.llvm.org/D55890 llvm-svn: 349743
* [Sema] Better static assert diagnostics for expressions involving ↵Clement Courbet2018-12-206-14/+92
| | | | | | | | | | | | | | | | | | temporaries/casts/.... Summary: Handles expressions such as: - `std::is_const<T>()` - `std::is_const<T>()()`; - `std::is_same(decltype(U()), V>::value`; Reviewers: aaron.ballman, Quuxplusone Subscribers: cfe-commits, llvm-commits Differential Revision: https://reviews.llvm.org/D55552 llvm-svn: 349729
* [analyzer] pr38668: Do not attempt to cast loaded values of non-scalar types.Artem Dergachev2018-12-193-10/+34
| | | | | | | | | | | | | | | | | | | | | | | | It is expected to have the same object (memory region) treated as if it has different types in different program points. The correct behavior for RegionStore when an object is stored as an object of type T1 but loaded as an object of type T2 is to store the object as if it has type T1 but cast it to T2 during load. Note that the cast here is some sort of a "reinterpret_cast" (even in C). For instance, if you store a float and load an integer, you won't have your float rounded to an integer; instead, you will have garbage. Admit that we cannot perform the cast as long as types we're dealing with are non-trivial (neither integers, nor pointers). Of course, if the cast is not necessary (eg, T1 == T2), we can still load the value just fine. Differential Revision: https://reviews.llvm.org/D55875 rdar://problem/45062567 llvm-svn: 349701
* [analyzer] GenericTaint: Fix formatting to prepare for incoming improvements.Artem Dergachev2018-12-191-107/+107
| | | | | | | | Patch by Gábor Borsik! Differential Revision: https://reviews.llvm.org/D54918 llvm-svn: 349698
* [analyzer] Improve modeling for returning an object from the top frame with RVO.Artem Dergachev2018-12-192-19/+108
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Static Analyzer processes the program function-by-function, sometimes diving into other functions ("inlining" them). When an object is returned from an inlined function, Return Value Optimization is modeled, and the returned object is constructed at its return location directly. When an object is returned from the function from which the analysis has started (the top stack frame of the analysis), the return location is unknown. Model it with a SymbolicRegion based on a conjured symbol that is specifically tagged for that purpose, because this is generally the correct way to symbolicate unknown locations in Static Analyzer. Fixes leak false positives when an object is returned from top frame in C++17: objects that are put into a SymbolicRegion-based memory region automatically "escape" and no longer get reported as leaks. This only applies to C++17 return values with destructors, because it produces a redundant CXXBindTemporaryExpr in the call site, which confuses our liveness analysis. The actual fix for liveness analysis is still pending, but it is no longer causing problems. Additionally, re-enable temporary destructor tests in C++17. Differential Revision: https://reviews.llvm.org/D55804 rdar://problem/46217550 llvm-svn: 349696
* Disable -faddsig by default for PS4 target.Douglas Yung2018-12-192-0/+2
| | | | llvm-svn: 349691
* [analyzer] CStringChecker: Add the forgotten test file.Artem Dergachev2018-12-191-0/+28
| | | | | | | | Differential Revision: https://reviews.llvm.org/D55873 rdar://problem/45366551 llvm-svn: 349683
* [analyzer] CStringChecker: Fix a crash on C++ overloads of standard functions.Artem Dergachev2018-12-191-34/+56
| | | | | | | | | | | | | | | | | | | | | | It turns out that it's not all that uncommon to have a C++ override of, say, memcpy that receives a structure (or two) by reference (or by value, if it's being copied from) and copies memory from it (or into it, if it's passed by reference). In this case the argument will be of structure type (recall that expressions of reference type do not exist: instead, C++ classifies expressions into prvalues and lvalues and xvalues). In this scenario we crash because we are trying to assume that, say, a memory region is equal to an empty CompoundValue (the non-lazy one; this is what makeZeroVal() return for compound types and it represents prvalue of an object that is initialized with an empty initializer list). Add defensive checks. Differential Revision: https://reviews.llvm.org/D55873 rdar://problem/45366551 llvm-svn: 349682
* PR40096: Forwards-compatible with C++20 rule regarding aggregates not having ↵David Blaikie2018-12-192-5/+0
| | | | | | | | | | user-declared ctors Looks like these were in place to make these types move-only. That's generally not a feature that the type should prescribe (unless it's an inherent limitation) - instead leaving it up to the users of a type. llvm-svn: 349669
* [OPENMP]Mark the loop as started when initialized.Alexey Bataev2018-12-192-1/+13
| | | | | | | | | Need to mark the loop as started when the initialization statement is found. It is required to prevent possible incorrect loop iteraton variable detection during template instantiation and fix the compiler crash during the codegen. llvm-svn: 349657
* [CodeComplete] Properly determine qualifiers of 'this' in a lambdaIlya Biryukov2018-12-192-5/+24
| | | | | | | | | | | | | | | | | Summary: The clang used to pick up the qualifiers of the lamba's call operator (which is always const) and fail to show non-const methods of 'this' in completion results. Reviewers: kadircet Reviewed By: kadircet Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55885 llvm-svn: 349655
* [Driver] [NetBSD] Add -D_REENTRANT when using sanitizersMichal Gorny2018-12-192-0/+12
| | | | | | | | | | | | | | | NetBSD intends to support only reentrant interfaces in interceptors. When -lpthread is used without _REENTRANT defined, things are not guaranteed to work. This is especially important for <stdio.h> and sanitization of interfaces around FILE. Some APIs have alternative modes depending on the _REENTRANT definition, and NetBSD intends to support sanitization of the _REENTRANT ones. Differential Revision: https://reviews.llvm.org/D55654 llvm-svn: 349650
* [Driver] Add .hasAnySanitizer() to SanitizerArgsMichal Gorny2018-12-191-0/+1
| | | | | | | | | | Add a simple method to query whether any sanitizer was enabled, via SanitizerArgs. This will be used in the NetBSD driver to pass additional definitions that are required by all sanitizers. Differential Revision: https://reviews.llvm.org/D55832 llvm-svn: 349649
* [Basic] Correct description of SanitizerSet.empty()Michal Gorny2018-12-191-1/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D55830 llvm-svn: 349648
* [Driver] Disable -faddrsig by default on NetBSDMichal Gorny2018-12-191-1/+2
| | | | | | | | | | Avoid passing -faddrsig by default on NetBSD. This platform is still using old GNU binutils that crashes on executables containing those sections. Differential Revision: https://reviews.llvm.org/D55828 llvm-svn: 349647
* [OpenMP] Fix data sharing analysis in nested clauseJoel E. Denny2018-12-192-7/+13
| | | | | | | | | | | | | | | | | | | | | | Without this patch, clang doesn't complain that X needs explicit data sharing attributes in the following: ``` #pragma omp target teams default(none) { #pragma omp parallel num_threads(X) ; } ``` However, clang does produce that complaint after the braces are removed. With this patch, clang complains in both cases. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D55861 llvm-svn: 349635
OpenPOWER on IntegriCloud