summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* CodeGen: use non-zero memset when possible for automatic variablesJF Bastien2018-07-251-26/+141
| | | | | | | | | | | | | | | | | Summary: Right now automatic variables are either initialized with bzero followed by a few stores, or memcpy'd from a synthesized global. We end up encountering a fair amount of code where memcpy of non-zero byte patterns would be better than memcpy from a global because it touches less memory and generates a smaller binary. The optimizer could reason about this, but it's not really worth it when clang already knows. This code could definitely be more clever but I'm not sure it's worth it. In particular we could track a histogram of bytes seen and figure out (as we do with bzero) if a memset could be followed by a handful of stores. Similarly, we could tune the heuristics for GlobalSize, but using the same as for bzero seems conservatively OK for now. <rdar://problem/42563091> Reviewers: dexonsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49771 llvm-svn: 337887
* [profile] Support profiling runtime on FuchsiaPetr Hosek2018-07-251-0/+1
| | | | | | | | | | | | | This ports the profiling runtime on Fuchsia and enables the instrumentation. Unlike on other platforms, Fuchsia doesn't use files to dump the instrumentation data since on Fuchsia, filesystem may not be accessible to the instrumented process. We instead use the data sink to pass the profiling data to the system the same sanitizer runtimes do. Differential Revision: https://reviews.llvm.org/D47208 llvm-svn: 337881
* [analyzer] Syntactic matcher for leaks associated with run loop and ↵George Karpenkov2018-07-252-0/+218
| | | | | | | | | | | | | | | | | | | | | | | autoreleasepool A checker for detecting leaks resulting from allocating temporary autoreleasing objects before starting the main run loop. Checks for two antipatterns: 1. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in the same autorelease pool. 2. ObjCMessageExpr followed by [[NARunLoop mainRunLoop] run] in no autorelease pool. Happens-before relationship is modeled purely syntactically. rdar://39299145 Differential Revision: https://reviews.llvm.org/D49528 llvm-svn: 337876
* Revert "[analyzer] Extend NoStoreFuncVisitor to insert a note on IVars"George Karpenkov2018-07-241-50/+13
| | | | | | | This reverts commit a9e21bd727112cd69eabc1af648c5da6b773d06e. Reverted because the dependency has not landed yet. llvm-svn: 337866
* [analyzer] Extend NoStoreFuncVisitor to insert a note on IVarsGeorge Karpenkov2018-07-241-13/+50
| | | | | | | | | | | | | | The note is added in the following situation: - We are throwing a nullability-related warning on an IVar - The path goes through a method which *could have* (syntactically determined) written into that IVar, but did not rdar://42444460 Differential Revision: https://reviews.llvm.org/D49689 llvm-svn: 337864
* Don't lifetime-extend or track lifetime problems through the LHS of '->*'.Richard Smith2018-07-241-1/+1
| | | | | | Fixes a false-positive warning found by selfhost. llvm-svn: 337857
* Revert "[VFS] Cleanups to VFS interfaces."Jordan Rupprecht2018-07-242-20/+19
| | | | | | This reverts commit r337834 due to test failures. llvm-svn: 337850
* [VFS] Cleanups to VFS interfaces.Sam McCall2018-07-242-19/+20
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: - add comments clarifying semantics - Status::copyWithNewName(Status, Name) --> instance method - Status::copyWithNewName(fs::file_status, Name) --> constructor (it's not a copy) - File::getName() -> getRealPath(), reflecting its actual behavior/function and stop returning status().getName() in the base class (callers can do this fallback if they want to, it complicates the contracts). This is mostly NFC, but the behavior of File::getName() affects FileManager's FileEntry::tryGetRealPathName(), which now fails in more cases: - non-real file cases - real-file cases where the underlying vfs::File was opened in a way that doesn't call realpath(). (In these cases we don't know a distinct real name, so in principle it seems OK) Reviewers: klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D49724 llvm-svn: 337834
* [Sema] Mark implicitly-inserted ICE's as being part of explicit cast (PR38166)Roman Lebedev2018-07-245-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: As discussed in [[ https://bugs.llvm.org/show_bug.cgi?id=38166 | PR38166 ]], we need to be able to distinqush whether the cast we are visiting is actually a cast, or part of an `ExplicitCast`. There are at least four ways to get there: 1. Introduce a new `CastKind`, and use it instead of `IntegralCast` if we are in `ExplicitCast`. Would work, but does not scale - what if we will need more of these cast kinds? 2. Introduce a flag in `CastExprBits`, whether this cast is part of `ExplicitCast` or not. Would work, but it isn't immediately clear where it needs to be set. 2. Fix `ScalarExprEmitter::VisitCastExpr()` to visit these `NoOp` casts. As pointed out by @rsmith, CodeGenFunction::EmitMaterializeTemporaryExpr calls skipRValueSubobjectAdjustments, which steps over the CK_NoOp cast`, which explains why we currently don't visit those. This is probably impossible, as @efriedma points out, that is intentional as per `[class.temporary]` in the standard 3. And the simplest one, just record which NoOp casts we skip. It just kinda works as-is afterwards. But, the approach with a flag is the least intrusive one, and is probably the best one overall. Reviewers: rsmith, rjmccall, majnemer, efriedma Reviewed By: rsmith Subscribers: cfe-commits, aaron.ballman, vsk, llvm-commits, rsmith Differential Revision: https://reviews.llvm.org/D49508 llvm-svn: 337815
* For x86_64, gcc 7.2 under Amazon Linux AMI sets its path to x86_64-amazon-linux.Jiading Gai2018-07-241-1/+2
| | | | | | | | | | | | | | | gcc 7.2 under Amazon Linux AMI sets its paths to x86_64-amazon-linux. Adding this triple to the list of search, plus a test case to cover this. The patch fixes the following bug reported in bugzilla: https://bugs.llvm.org/show_bug.cgi?id=35992 Reviewers: echristo Differential Revision: https://reviews.llvm.org/D46230 llvm-svn: 337811
* Revert "[DebugInfo] Generate debug information for labels. (Fix PR37395)"Shiva Chen2018-07-243-39/+0
| | | | | | This reverts commit 4288dd3bf082482e02c8a044c611c18168cb0180. llvm-svn: 337803
* [DebugInfo] Generate debug information for labels. (Fix PR37395)Shiva Chen2018-07-243-0/+39
| | | | | | | | | | | | | Generate DILabel metadata and call llvm.dbg.label after label statement to associate the metadata with the label. After fixing PR37395. Differential Revision: https://reviews.llvm.org/D45045 Patch by Hsiangkai Wang. llvm-svn: 337800
* Fix unused variable warnings; NFCGeorge Burgess IV2018-07-241-2/+2
| | | | | | | Looks like MTE was previously used for its SourceLoc, but we're now using a seperate SourceLocation here. llvm-svn: 337796
* [HIP] pass -target-cpu when running the device-mode compilerYaxun Liu2018-07-241-0/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D49643 llvm-svn: 337793
* Enable .hip files for test/DriverYaxun Liu2018-07-241-2/+2
| | | | | | Partially revert r334128 due to regressions. llvm-svn: 337791
* Warn if a local variable's initializer retains a pointer/reference to aRichard Smith2018-07-241-73/+37
| | | | | | non-lifetime-extended temporary object. llvm-svn: 337790
* Borrow visibility from __fundamental_type_info for generated fundamental ↵Thomas Anderson2018-07-241-60/+67
| | | | | | | | | | | | type infos This is necessary so the clang gives hidden visibility to fundamental types when -fvisibility=hidden is passed. Fixes https://bugs.llvm.org/show_bug.cgi?id=35066 Differential Revision: https://reviews.llvm.org/D49109 llvm-svn: 337788
* [WebAssembly] Change size_t to `unsigned long`.Dan Gohman2018-07-241-3/+5
| | | | | | | | | | | | Changing it to unsigned long (which is 32-bit on wasm32) makes it the same type as wasm64 (where unsigned long is 64-bit), which would eliminate the most common cause for mangled names being different between wasm32 and wasm64. For example, export lists containing symbol names could now often be the same between wasm32 and wasm64. Differential Revision: https://reviews.llvm.org/D40526 llvm-svn: 337783
* NFC: Add the emacs c++ mode hint "-*- C++ -*-" to the headers that don't have itErik Pilkington2018-07-244-4/+4
| | | | | | https://llvm.org/docs/CodingStandards.html#file-headers llvm-svn: 337780
* [analyzer] pr38273: Legalize Loc<>NonLoc comparison symbols.Artem Dergachev2018-07-231-2/+4
| | | | | | | | | Remove an assertion in RangeConstraintManager that expects such symbols to never appear, while admitting that the constraint manager doesn't yet handle them. Differential Revision: https://reviews.llvm.org/D49703 llvm-svn: 337769
* Support lifetime-extension of conditional temporaries.Richard Smith2018-07-234-117/+149
| | | | llvm-svn: 337767
* [Sema] Fix crash on BlockExprs in a default member initializersErik Pilkington2018-07-231-0/+5
| | | | | | | | | | | | Clang would crash when instantiating a BlockDecl that appeared in a default-member-initializer of a class template. Fix this by deferring the instantiation until we instantate the BlockExpr. rdar://41200624 Differential revision: https://reviews.llvm.org/D49688 llvm-svn: 337766
* [ASTMatchers] Add an isMain() matcherGeorge Karpenkov2018-07-231-0/+1
| | | | | | Differential Revision: https://reviews.llvm.org/D49615 llvm-svn: 337761
* Do not try to perform lifetime-extension through conditionalRichard Smith2018-07-231-20/+39
| | | | | | | | | expressions. CodeGen can't cope with that yet. Instead, produce a "not supported" warning for now and don't extend lifetime. llvm-svn: 337744
* Fold -Wreturn-stack-address into general initialization lifetimeRichard Smith2018-07-232-527/+318
| | | | | | checking. llvm-svn: 337743
* Update to -r337585, allow scoped enum inits in -pedanticErich Keane2018-07-232-0/+9
| | | | llvm-svn: 337738
* [CodeGen] Record if a C++ record is a trivial typeAaron Smith2018-07-231-0/+4
| | | | | | | | | | | | | | Summary: This has a dependence on D45122 Reviewers: rnk, zturner, llvm-commits, aleksandr.urakov Reviewed By: rnk Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45124 llvm-svn: 337736
* [ms] Fix mangling of vector types in QMM_Result contexts.Nico Weber2018-07-231-1/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | If QMM_Result is set (which it is for return types, RTTI descriptors, and exception type descriptors), tag types (structs, enums, classes, unions) get their qualifiers mangled in. __m64 and friends is a struct/union thingy in MSVC, but not in clang's headers. To make mangling work, we call mangleArtificalTagType(TTK_Union/TTK_Struct for the vector types to mangle them as tag types -- but the isa<TagType> check when mangling in QMM_Result mode isn't true for these vector types. Add an isArtificialTagType() function and check for that too. Fixes PR37276 and some other issues. I tried to audit all references to TagDecl and TagType in MicrosoftMangle.cpp to find other places where we need to call mangleArtificalTagType(), but couldn't find any. I tried to audit all calls to mangleArtificalTagType() to see if isArtificialTagType() needs to handle more than just the vector types, but as far as I can tell all other types we use it for are types that MSVC can't handle at all (Objective-C types etc). https://reviews.llvm.org/D49597 llvm-svn: 337732
* Separate out the initialization kind for a statement expression resultRichard Smith2018-07-232-6/+25
| | | | | | | | | | from that for a return value. No functionality change intended: I don't believe any of the diagnostics affected by this patch are reachable when initializing the result of statement expression. llvm-svn: 337728
* Fold dangling-field warning into general initialization lifetime checks.Richard Smith2018-07-232-134/+177
| | | | | | | This reinstates r337627, reverted in r337671, with a fix to correctly handle the lvalueness of array subscript expressions on pointers. llvm-svn: 337726
* Revert "[OPENMP] Fix PR38026: Link -latomic when -fopenmp is used."Jonas Hahnfeld2018-07-231-5/+1
| | | | | | | | | | | | This reverts commit r336467: libatomic is not available on all Linux systems and this commit completely breaks OpenMP on them, even if there are no atomic operations or all of them can be lowered to hardware instructions. See http://lists.llvm.org/pipermail/cfe-commits/Week-of-Mon-20180716/234816.html for post-commit discussion. llvm-svn: 337722
* [CStringSyntaxChecker] Improvements of strlcpy checkDavid Carlier2018-07-231-2/+18
| | | | | | | | | | | | Adding an additional check whenwe offset fro the buffer base address. Reviewers: george.karpenkov,NoQ Reviewed By: george.karpenkov Differential Revision: https://reviews.llvm.org/D49633 llvm-svn: 337721
* [DebugInfo] Error out when enabling -fdebug-types-section on non-ELF target.Jonas Devlieghere2018-07-231-0/+5
| | | | | | | | | | | Currently, support for debug_types is only present for ELF and trying to pass -fdebug-types-section for other targets results in a crash in the backend. Until this is fixed, we should emit a diagnostic in the front end when the option is passed for non-linux targets. Differential revision: https://reviews.llvm.org/D49594 llvm-svn: 337717
* [MS] Update _MSVC_LANG values for C++17 and C++2aReid Kleckner2018-07-231-2/+4
| | | | | | Fixes PR38262 llvm-svn: 337715
* [Sema] Don't emit -Wmemset-transposed-args for memset(p,0,0)Erik Pilkington2018-07-231-3/+6
| | | | | | Thanks to Arthur O'Dwyer for the suggestion! llvm-svn: 337706
* [ASTMatchers] add matcher for decltypeType and its underlyingTypeJonas Toth2018-07-232-0/+2
| | | | | | | | | | | | | | | | Summary: This patch introduces a new matcher for `DecltypeType` and its underlying type in order to fix a bug in clang-tidy, see https://reviews.llvm.org/D48717 for more. Reviewers: aaron.ballman, alexfh, NoQ, dcoughlin Reviewed By: aaron.ballman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48759 llvm-svn: 337703
* [NEON] Fix support for vrndi_f32(), vrndiq_f32() and vrndns_f32() intrinsicsIvan A. Kosarev2018-07-231-6/+13
| | | | | | | | | | This patch adds support for vrndi_f32() and vrndiq_f32() intrinsics in AArch32 mode and for vrndns_f32() intrinsic in AArch64 mode. Differential Revision: https://reviews.llvm.org/D48829 llvm-svn: 337690
* [AST] Use llvm::TrailingObjects in CXXTryStmtBenjamin Kramer2018-07-231-7/+3
| | | | | | | | | | | | | | 1. Use llvm::TrailingObjects in CXXTryStmt instead of manually doing the reinterpret_casts + pointer arithmetic. This is more consistent with other classes using this idiom and this make it clearer that this class has trailing objects. 2. Make the class CXXTryStmt final since it has trailing objects. 3. Move the friend declarations together. No functional changes. Patch by Bruno Ricci! Differential Revision: https://reviews.llvm.org/D48873 llvm-svn: 337688
* [Tooling] Use UniqueStringSaver. NFCSam McCall2018-07-231-10/+1
| | | | llvm-svn: 337682
* [Analyzer] Quick Fix for exponential execution time when simpilifying ↵Adam Balogh2018-07-232-9/+12
| | | | | | | | | | | | | | | | | | complex additive expressions Patch https://reviews.llvm.org/rC329780 not only rearranges comparisons but also binary expressions. This latter behavior is not protected by the analyzer option. Hower, since no complexity threshold is enforced to the symbols this may result in exponential execution time if the expressions are too complex: https://bugs.llvm.org/show_bug.cgi?id=38208. For a quick fix we extended the analyzer option to also cover the additive cases. This is only a temporary fix, the final solution should be enforcing the complexity threshold to the symbols. Differential Revision: https://reviews.llvm.org/D49536 llvm-svn: 337678
* Revert "Fold dangling-field warning into general initialization lifetime ↵Ilya Biryukov2018-07-232-170/+131
| | | | | | | | | | | | | | | | checks." This reverts commit r337627. After the change, clang started producing invalid warning on the following code: struct foo { foo(char *x) : x_(&x[10]) {} private: char *x_; }; 1.cpp:2:21: warning: initializing pointer member 'x_' with the stack address of parameter 'x' [-Wdangling-field] llvm-svn: 337671
* OpenBSD/arm has switched to float ABI SoftFP.Brad Smith2018-07-221-1/+1
| | | | llvm-svn: 337660
* PR38257: don't perform ADL when instantiating a unary & operator that turns outRichard Smith2018-07-222-4/+6
| | | | | | to be forming a pointer-to-member. llvm-svn: 337653
* [HIP] Support -fcuda-flush-denormals-to-zero for amdgcnYaxun Liu2018-07-213-6/+5
| | | | | | Differential Revision: https://reviews.llvm.org/D48287 llvm-svn: 337639
* [NFC] CodeGen: rename memset to bzeroJF Bastien2018-07-201-30/+27
| | | | | | The optimization looks for opportunities to emit bzero, not memset. Rename the functions accordingly (and clang-format the diff) because I want to add a fallback optimization which actually tries to generate memset. bzero is still better and it would confuse the code to merge both. llvm-svn: 337636
* [Driver] Sanitizer support based on runtime library presenceGeorge Karpenkov2018-07-202-23/+65
| | | | | | | | | | | | | | | The runtime libraries of sanitizers are built in compiler-rt, and Clang can be built without compiler-rt, or compiler-rt can be configured to only build certain sanitizers. The driver should provide reasonable diagnostics and not a link-time error when a runtime library is missing. This patch changes the driver for OS X to only support sanitizers of which we can find the runtime libraries. The discussion for this patch explains the rationale Differential Revision: https://reviews.llvm.org/D15225 llvm-svn: 337635
* [HIP] Register/unregister device fat binary only onceYaxun Liu2018-07-201-17/+105
| | | | | | | | | | | | | | | | | | | | | | | | | | HIP generates one fat binary for all devices after linking. However, for each compilation unit a ctor function is emitted which register the same fat binary. Measures need to be taken to make sure the fat binary is only registered once. Currently each ctor function calls __hipRegisterFatBinary and stores the returned value to __hip_gpubin_handle. This patch changes the linkage of __hip_gpubin_handle to be linkonce so that they are shared between LLVM modules. Then this patch adds check of value of __hip_gpubin_handle to make sure __hipRegisterFatBinary is only called once. The code is equivalent to void *_gpubin_handle; void ctor() { if (__hip_gpubin_handle == 0) { __hip_gpubin_handle = __hipRegisterFatBinary(...); } // register kernels and variables. } The patch also does similar change to dtors so that __hipUnregisterFatBinary is called once. Differential Revision: https://reviews.llvm.org/D49083 llvm-svn: 337631
* Fold dangling-field warning into general initialization lifetime checks.Richard Smith2018-07-202-131/+170
| | | | llvm-svn: 337627
* [ms] Add __shiftleft128 / __shiftright128 intrinsicsNico Weber2018-07-201-0/+14
| | | | | | | | | | | | Carefully match the pattern matched by ISel so that this produces shld / shrd (unless Subtarget->isSHLDSlow() is true). Thanks to Craig Topper for providing the LLVM IR pattern that gets successfully matched. Fixes PR37755. llvm-svn: 337619
* [codeview] Don't emit variable templates as class membersReid Kleckner2018-07-201-5/+10
| | | | | | | | | | | | | MSVC doesn't, so neither should we. Fixes PR38004, which is a crash that happens when we try to emit debug info for a still-dependent partial variable template specialization. As a follow-up, we should review what we're doing for function and class member templates. It looks like we don't filter those out, but I can't seem to get clang to emit any. llvm-svn: 337616
OpenPOWER on IntegriCloud