summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [NewPM] Port MsanPhilip Pfaffe2019-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Keeping msan a function pass requires replacing the module level initialization: That means, don't define a ctor function which calls __msan_init, instead just declare the init function at the first access, and add that to the global ctors list. Changes: - Pull the actual sanitizer and the wrapper pass apart. - Add a newpm msan pass. The function pass inserts calls to runtime library functions, for which it inserts declarations as necessary. - Update tests. Caveats: - There is one test that I dropped, because it specifically tested the definition of the ctor. Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji Differential Revision: https://reviews.llvm.org/D55647 llvm-svn: 350305
* [OpenMP] Added support for explicit mapping of classes using 'this' pointer. ↵Patrick Lyster2019-01-022-3/+80
| | | | | | Differential revision: https://reviews.llvm.org/D55982 llvm-svn: 350252
* Only convert objc messages to alloc to objc_alloc if the receiver is a class.Pete Cooper2019-01-021-3/+6
| | | | | | | | | | r348687 converted [Foo alloc] to objc_alloc(Foo). However the objc runtime method only takes a Class, not an arbitrary pointer. This makes sure we are messaging a class before we convert these messages. rdar://problem/46943703 llvm-svn: 350224
* [CodeGen] Replace '@' characters in block descriptors' symbol names withAkira Hatanaka2018-12-291-0/+3
| | | | | | | | | | | | | | '\1'. '@' can't be used in block descriptors' symbol names since it is reserved on ELF platforms as a separator between symbol names and symbol versions. See the discussion here: https://reviews.llvm.org/D50783. Differential Revision: https://reviews.llvm.org/D54539 llvm-svn: 350157
* Add vtable anchor to classes.Richard Trieu2018-12-293-0/+6
| | | | llvm-svn: 350143
* [objc-gnustep2] Fix a bug in category generation.David Chisnall2018-12-281-6/+20
| | | | | | | | | We were not emitting a protocol definition while generating the category method list. This was fine in most cases, because something else in the library typically referenced any given protocol, but it caused linker failures if the category was the only reference to a given protocol. llvm-svn: 350130
* [OPENMP]Fix processing of the clauses on target combined directives.Alexey Bataev2018-12-281-4/+7
| | | | | | | | For constants with the predefined data-sharing clauses we may had troubles with the target combined directives. It may cause compiler crash in some corner cases. llvm-svn: 350127
* [objc-gnustep] Fix a copy-and-paste error.David Chisnall2018-12-271-1/+1
| | | | | | | We were emitting the null class symbol in the wrong section, which meant that programs that contained no Objective-C classes would fail to link. llvm-svn: 350092
* [clang-cl] Treat inputs as C++ with /E, like MSVCReid Kleckner2018-12-261-1/+4
| | | | | | | | | | | | | | | | | midl invokes the compiler on .idl files with /E. Before this change, we would treat unrecognized inputs as object files. Now we pre-process to stdout as expected. I checked that MSVC defines __cplusplus when invoked this way, so treating the input as C++ seems like the right thing to do. After this change, I was able to run midl like this with clang-cl: $ midl -cpp_cmd clang-cl.exe foo.idl Things worked for the example IDL file in the Microsoft documentation, but beyond that, I don't know if this will work well. Fixes PR40140 llvm-svn: 350072
* [MS] Mangle return adjusting thunks with the public access specifierReid Kleckner2018-12-261-6/+12
| | | | | | | | MSVC does this, so we should too. Fixes PR40138 llvm-svn: 350071
* Ignore ConstantExpr in IgnoreParensReid Kleckner2018-12-261-4/+4
| | | | | | | | | | | | | | | | | | Summary: This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more helpers ignore it. For most clients, this ensures that these helpers behave the same with and without C++17 enabled, which is what appears to introduce these new expression nodes. Fixes PR39881 Reviewers: void, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55853 llvm-svn: 350068
* [analyzer] [NFC] Clean up the mess of constructing argument effects in ↵George Karpenkov2018-12-241-60/+83
| | | | | | | | | | | | | | RetainCountChecker Previously, argument effects were stored in a method variable, which was effectively global. The global state was reset at each (hopefully) entrance point to the summary construction, and every function could modify it. Differential Revision: https://reviews.llvm.org/D56036 llvm-svn: 350057
* [Driver] Disable -faddrsig on Gentoo by defaultMichal Gorny2018-12-231-0/+2
| | | | | | | | | | | | | | Gentoo supports combining clang toolchain with GNU binutils, and many users actually do that. As -faddrsig is not supported by GNU strip, this results in a lot of warnings. Disable it by default and let users enable it explicitly if they want it; with the intent of reevaluating when the underlying feature becomes standarized. See also: https://bugs.gentoo.org/667854 Differential Revision: https://reviews.llvm.org/D56047 llvm-svn: 350028
* [Distro] Support detecting GentooMichal Gorny2018-12-231-0/+3
| | | | | | | | | | | Add support for distinguishing plain Gentoo distribution, and a unit test for it. This is going to be used to introduce distro-specific customizations in the driver code; most notably, it is going to be used to disable -faddrsig. Differential Revision: https://reviews.llvm.org/D56024 llvm-svn: 350027
* [AST] Store the arguments of CXXConstructExpr in a trailing arrayBruno Ricci2018-12-225-95/+130
| | | | | | | | | | | | | | | Store the arguments of CXXConstructExpr in a trailing array. This is very similar to the CallExpr case in D55771, with the exception that there is only one derived class (CXXTemporaryObjectExpr) and that we compute the offset to the trailing array instead of storing it. This saves one pointer per CXXConstructExpr and CXXTemporaryObjectExpr. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D56022 llvm-svn: 350003
* [analyzer] pr38668: Do not attempt to cast loaded integers to floats.Artem Dergachev2018-12-222-9/+31
| | | | | | | | | | | | | | | | | | | | | | This patch is a different approach to landing the reverted r349701. 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 an integer and load a float, you won't get your integer represented as a float; instead, you will get garbage. Admit that we cannot perform the cast and return an unknown value. Differential Revision: https://reviews.llvm.org/D55875 rdar://problem/45062567 llvm-svn: 349984
* [CUDA] Treat extern global variable shadows same as regular extern vars.Artem Belevich2018-12-221-10/+5
| | | | | | | | | | | This fixes compiler crash when we attempted to compile this code: extern __device__ int data; __device__ int data = 1; Differential Revision: https://reviews.llvm.org/D56033 llvm-svn: 349981
* Switch from static_cast<> to cast<>, update identifier for coding ↵Aaron Ballman2018-12-211-4/+2
| | | | | | conventions; NFC. llvm-svn: 349955
* Convert some ObjC retain/release msgSends to runtime calls.Pete Cooper2018-12-213-0/+94
| | | | | | | | | | It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions. Differential Revision: https://reviews.llvm.org/D55869 Reviewed By: rjmccall llvm-svn: 349952
* [Sema][NFC] Fix a Wimplicit-fallthrough warning in ↵Bruno Ricci2018-12-211-0/+1
| | | | | | | | CheckSpecializationInstantiationRedecl All cases are covered so add an llvm_unreachable. NFC. llvm-svn: 349949
* [AST][NFC] Remove stale comment in CXXRecordDecl::is(Virtually)DerivedFrom.Bruno Ricci2018-12-211-2/+0
| | | | | | The "this" capture was removed in r291939. llvm-svn: 349948
* Remove stat cache chaining as it's no longer needed after PTH support has beenAlex Lorenz2018-12-213-45/+12
| | | | | | | | | | | | | removed Stat cache chaining was implemented for a StatListener in the PTH writer so that it could write out the stat information to PTH. r348266 removed support for PTH, and it doesn't seem like there are other uses of stat cache chaining. We can remove the chaining support. Differential Revision: https://reviews.llvm.org/D55455 llvm-svn: 349942
* Revert "Revert rL349876 from cfe/trunk: [analyzer] Perform escaping in ↵George Karpenkov2018-12-211-23/+28
| | | | | | | | | | RetainCountChecker on type mismatch even for inlined functions" This reverts commit b44b33f6e020a2c369da2b0c1d53cd52975f2526. Revert the revert with the fix. llvm-svn: 349939
* [analyzer] Correct the summary violation diagnostics for the retain count ↵George Karpenkov2018-12-211-1/+1
| | | | | | | | checker It should be in the past tense. llvm-svn: 349938
* [AST][NFC] Fix Wsign-compare warning introduced in CXXOperatorCallExprBruno Ricci2018-12-211-2/+3
| | | | llvm-svn: 349934
* [Sema][NFC] Fix Wimplicit-fallthrough warning in getCursorKindForDeclBruno Ricci2018-12-211-0/+1
| | | | | | All cases are covered so add an llvm_unreachable. NFC. llvm-svn: 349933
* [AST][NFC] Pack CXXOperatorCallExprBruno Ricci2018-12-213-5/+10
| | | | | | | Use the space available in the bit-fields of Stmt. This saves 8 bytes per CXXOperatorCallExpr. NFC. llvm-svn: 349924
* [AST] Store the callee and argument expressions of CallExpr in a trailing array.Bruno Ricci2018-12-2113-217/+379
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since CallExpr::setNumArgs has been removed, it is now possible to store the callee expression and the argument expressions of CallExpr in a trailing array. This saves one pointer per CallExpr, CXXOperatorCallExpr, CXXMemberCallExpr, CUDAKernelCallExpr and UserDefinedLiteral. Given that CallExpr is used as a base of the above classes we cannot use llvm::TrailingObjects. Instead we store the offset in bytes from the this pointer to the start of the trailing objects and manually do the casts + arithmetic. Some notes: 1.) I did not try to fit the number of arguments in the bit-fields of Stmt. This leaves some space for future additions and avoid the discussion about whether x bits are sufficient to hold the number of arguments. 2.) It would be perfectly possible to recompute the offset to the trailing objects before accessing the trailing objects. However the trailing objects are frequently accessed and benchmarks show that it is slightly faster to just load the offset from the bit-fields. Additionally, because of 1), we have plenty of space in the bit-fields of Stmt. Differential Revision: https://reviews.llvm.org/D55771 Reviewed By: rjmccall llvm-svn: 349910
* [Sema][NFC] Remove some unnecessary calls to getASTContext.Bruno Ricci2018-12-214-13/+12
| | | | | | The AST context is already easily available. NFC. llvm-svn: 349904
* [AST][NFC] Pass the AST context to one of the ctor of DeclRefExpr.Bruno Ricci2018-12-2117-187/+197
| | | | | | | | | 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-211-28/+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-213-20/+34
| | | | | | | | | | | 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-211-23/+28
| | | | | | | | | | | | 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-211-3/+2
| | | | | | | | | | | | 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-211-2/+8
| | | | | | | | | | | | | | | 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-211-2/+13
| | | | | | | | | | | | | | 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-211-3/+7
| | | | | | | | | | 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-211-0/+11
| | | | | | | | | | | | 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 assertion on emitting cleanup for object with inlined ↵Volodymyr Sapsai2018-12-201-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-202-17/+69
| | | | | | | | | | | | | | | | 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-201-10/+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-201-22/+43
| | | | | | | | | | | | | | | | | | | | | | | | 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
* Declares __cpu_model as dso localHaibo Huang2018-12-201-0/+7
| | | | | | | | __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-201-3/+10
| | | | | | | | | | | | | | | | | | | 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-202-16/+29
| | | | | | | | | | | | | | 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
* Allow direct navigation to static analysis checker documentation through ↵Aaron Ballman2018-12-203-10/+27
| | | | | | | | 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-201-2/+10
| | | | | | | | | | | | | | | | | 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-201-20/+6
| | | | | | | | | | | | | | | 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-201-1/+53
| | | | | | | | | | | | 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-201-5/+2
| | | | | | | | 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
OpenPOWER on IntegriCloud