summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [X86] Remove mask from 512 bit pmulhrsw/pmulhw/pmulhuw builtins.Craig Topper2018-02-201-46/+29
| | | | | | We now use a vselect node in IR around an unmasked builtin. This makes it consistent with the 128 and 256 bit versions. llvm-svn: 325560
* [Sema] Fix -Wunused-variableSam McCall2018-02-201-1/+0
| | | | llvm-svn: 325553
* Fix some -Wexceptions false positives.Richard Smith2018-02-201-71/+48
| | | | | | | | | Reimplement the "noexcept function actually throws" warning to properly handle nested try-blocks. In passing, change 'throw;' handling to treat any enclosing try block as being sufficient to suppress the warning rather than requiring a 'catch (...)'; the warning is intended to be conservatively-correct. llvm-svn: 325545
* [Sema] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-02-202-39/+43
| | | | | | other minor fixes (NFC). llvm-svn: 325544
* [clang-format] Fix text proto extension scope opening detectionKrasimir Georgiev2018-02-191-0/+1
| | | | | | | | | | | | | | | | | | | | Summary: This fixes the detection of scope openers in text proto extensions; previously they were not detected correctly leading to instances like: ``` msg { [aa.bb ] { key: value } } ``` Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43469 llvm-svn: 325513
* [clang-format] Fixup a case of text proto message attributesKrasimir Georgiev2018-02-191-0/+6
| | | | | | | | | | Summary: This patch fixes a case where a proto message attribute is wrongly identified as an text proto extension. Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43465 llvm-svn: 325509
* [CodeComplete] Avoid name clashes of 'Kind' inside CodeCompletionContext. NFCIlya Biryukov2018-02-191-3/+3
| | | | | | | | | | CodeCompletionContext had declarations of field and enum inside, both named 'Kind'. It caused gcc 4.8 to give an incorrent warning when refering to enum as `enum CodeCompletionContext::Kind`. Avoid that warning by renaming the private field to CCKind. llvm-svn: 325496
* [ARM] disable FPU features when using soft floating point.Keith Walker2018-02-191-5/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | To be compatible with GCC if soft floating point is in effect any FPU specified is effectively ignored, eg, -mfloat-abi=soft -fpu=neon If any floating point features which require FPU hardware are enabled they must be disable. There was some support for doing this for NEON, but it did not handle VFP, nor did it prevent the backend from emitting the build attribute Tag_FP_arch describing the generated code as using the floating point hardware if a FPU was specified (even though soft float does not use the FPU). Disabling the hardware floating point features for targets which are compiling for soft float has meant that some tests which were incorrectly checking for hardware support also needed to be updated. In such cases, where appropriate the tests have been updated to check compiling for soft float and a non-soft float variant (usually softfp). This was usually because the target specified in the test defaulted to soft float. Differential Revision: https://reviews.llvm.org/D42569 llvm-svn: 325492
* [CodeComplete] Add a helper to print CodeCompletionContext::KindIlya Biryukov2018-02-191-0/+75
| | | | | | | | | | | | | | Summary: Will be used in clangd. See D43377. Reviewers: sammccall Reviewed By: sammccall Subscribers: ioeric, cfe-commits Differential Revision: https://reviews.llvm.org/D43379 llvm-svn: 325490
* clang-format: [JS] fix `of` detection.Martin Probst2018-02-191-1/+1
| | | | | | | | | | | | | | | | | | | Summary: `of` is only a keyword when after an identifier, but not when after an actual keyword. Before: return of (a, b, c); After: return of(a, b, c); Reviewers: djasper Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D43440 llvm-svn: 325489
* [AVR] Set the program address space in the data layoutDylan McKay2018-02-191-1/+1
| | | | | | This is accompanied by r325481 in LLVM. llvm-svn: 325483
* [CodeGen] Initialize large arrays by copying from a globalIvan A. Kosarev2018-02-191-6/+30
| | | | | | | | | | | | | | Currently, clang compiles explicit initializers for array elements into series of store instructions. For large arrays of built-in types this results in bloated output code and significant amount of time spent on the instruction selection phase. This patch fixes the issue by initializing such arrays with global constants that store the binary image of the initializer. Differential Revision: https://reviews.llvm.org/D43181 llvm-svn: 325478
* [Analyzer] Move UnexploredFirstStack into an anonymous namespace.Benjamin Kramer2018-02-181-0/+2
| | | | | | No functionality change intended. llvm-svn: 325468
* [X86] Add 'sahf' CPU feature to frontendDimitry Andric2018-02-172-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the `+sahf` feature for the backend, for bug 36028 (Incorrect use of pushf/popf enables/disables interrupts on amd64 kernels). This was originally submitted in bug 36037 by Jonathan Looney <jonlooney@gmail.com>. As described there, GCC also uses `-msahf` for this feature, and the backend already recognizes the `+sahf` feature. All that is needed is to teach clang to pass this on to the backend. The mapping of feature support onto CPUs may not be complete; rather, it was chosen to match LLVM's idea of which CPUs support this feature (see lib/Target/X86/X86.td). I also updated the affected test case (CodeGen/attr-target-x86.c) to match the emitted output. Reviewers: craig.topper, coby, efriedma, rsmith Reviewed By: craig.topper Subscribers: emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D43394 llvm-svn: 325446
* [Basic] Fix some Clang-tidy modernize and Include What You Use warnings; ↵Eugene Zelenko2018-02-164-46/+49
| | | | | | other minor fixes (NFC). llvm-svn: 325412
* [ThinLTO] Allow indexing to request backend to ignore the moduleVitaly Buka2018-02-161-5/+17
| | | | | | | | | | | | | | | | | | Summary: Gold plugin does not add pass to ThinLTO modules without useful symbols. In this case ThinLTO can't create corresponding index file and some features, like CFI, cannot be processes by backed correctly without index. Given that we don't need the backed output we can request it to avoid processing the module. This is implemented by this patch using new "SkipModuleByDistributedBackend" flag. Reviewers: pcc, tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42995 llvm-svn: 325411
* [ThinLTO] Ignore object files with no ThinLTO modules if -fthinlto-index= is setVitaly Buka2018-02-162-10/+25
| | | | | | | | | | | | | | | | | Summary: ThinLTO compilation may decide not to split module and keep at as regular LTO. In this can this module already processed during indexing and already a part of merged object file. So here we can just skip it. Reviewers: pcc, tejohnson Reviewed By: tejohnson Subscribers: mehdi_amini, inglorion, eraman, cfe-commits Differential Revision: https://reviews.llvm.org/D42680 llvm-svn: 325410
* [OPENMP] Do not emit messages for templates in declare targetAlexey Bataev2018-02-161-19/+38
| | | | | | | | | constructs. The compiler may emit some extra warnings for functions, that are implicit specialization of the templates, declared in the target region. llvm-svn: 325391
* [MS] Make constexpr static data members implicitly inlineReid Kleckner2018-02-161-1/+1
| | | | | | | | | | | | | | This handles them exactly the same way that we handle const integral static data members with inline definitions, which is what MSVC does. As a follow-up, now that we have a way to mark variables inline in the AST, we should consider marking them implicitly inline there instead of only treating them as inline in CodeGen. Unfortunately, this breaks a lot of dllimport test cases, so that is future work for now. Fixes PR36125. llvm-svn: 325375
* [OPENMP] Fix PR35873: Fix data-sharing attributes for const variables.Alexey Bataev2018-02-161-1/+1
| | | | | | | Compiler erroneously returned wrong data-sharing attributes for the constant variables if they have explictly specified attributes. llvm-svn: 325373
* [OPENMP] Fix parsing of the directives with inner directives.Alexey Bataev2018-02-162-3/+15
| | | | | | | The parsing may lead to compiler hanging because of the incorrect processing of inner OpenMP pragmas. llvm-svn: 325369
* Clean up 'target' attribute diagnosticsErich Keane2018-02-161-2/+3
| | | | | | | | | | | | | | There were a few issues previously with the target attribute diagnostics implementation that lead to the attribute being added to the AST despite having an error in it. This patch changes that, and adds a test to ensure it does not get added to the AST. Differential Revision: https://reviews.llvm.org/D43359 llvm-svn: 325364
* [clang-format] Enable google text proto formatting in R"proto('sKrasimir Georgiev2018-02-161-0/+2
| | | | llvm-svn: 325336
* Revert r325321 "[Sema] Take into account the current context when checking the"Hans Wennborg2018-02-161-5/+0
| | | | | | | | | | | | | | This broke the Chromium build, see https://crbug.com/813017 > accessibility of a class member. > > This fixes PR32898. > > rdar://problem/33737747 > > Differential revision: https://reviews.llvm.org/D36918 llvm-svn: 325335
* [Sema] Take into account the current context when checking theAkira Hatanaka2018-02-161-0/+5
| | | | | | | | | | | | accessibility of a class member. This fixes PR32898. rdar://problem/33737747 Differential revision: https://reviews.llvm.org/D36918 llvm-svn: 325321
* [Coverage] Handle break/continue outside of loop bodiesVedant Kumar2018-02-161-8/+16
| | | | | | | | | Teach the coverage mapping logic to handle break or continue statements within for loop increments. Fixes llvm.org/PR36406. llvm-svn: 325319
* [DOXYGEN] There was a request in the review D41507 to change the notation ↵Ekaterina Romanova2018-02-162-65/+67
| | | | | | | | for hex numbers in doxygen documentation from <...>h to 0x<...>. Both of these notations were used in x86 intrinsics documentation. I promised to change them to 0x<...> for consistency. Differential Revision: https://reviews.llvm.org/D41888 llvm-svn: 325312
* [Modules] Extend -fmodule-name semantic for frameworks with private modulesBruno Cardoso Lopes2018-02-161-4/+22
| | | | | | | | | | | | | Assume Foo.framework with two module maps and two modules Foo and Foo_Private. Framework authors need to skip building both Foo and Foo_Private when using -fmodule-name=Foo, since both are part of the framework and used interchangeably during compilation. rdar://problem/37500098 llvm-svn: 325305
* [OPENMP] Fix PR36399: Crash on C code with ordered doacross construct.Alexey Bataev2018-02-151-0/+2
| | | | | | | | | Codegen for ordered with doacross construct might produce incorrect code because of missing cleanup scope for the construct. Without this scope the final runtime function call could be emitted in the wrong order that leads to incorrect codegen. llvm-svn: 325304
* [OPENMP] Fix PR38398: compiler crash on standalone pragma ordered with ↵Alexey Bataev2018-02-151-119/+116
| | | | | | | | | depend sink|source clause. Patch fixes compiler crash on standalone #pragmas ordered with depend(sink|source) clauses. llvm-svn: 325302
* Silence a -Wparentheses warning; NFC.Aaron Ballman2018-02-151-1/+1
| | | | llvm-svn: 325293
* Silence some -Wunused-variable warnings; NFC.Aaron Ballman2018-02-151-2/+2
| | | | llvm-svn: 325292
* [Coroutines] Use allocator overload when availableBrian Gesiak2018-02-151-36/+89
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Depends on https://reviews.llvm.org/D42605. An implementation of the behavior described in `[dcl.fct.def.coroutine]/7`: when a promise type overloads `operator new` using a "placement new" that takes the same argument types as the coroutine function, that overload is used when allocating the coroutine frame. Simply passing references to the coroutine function parameters directly to `operator new` results in invariant violations in LLVM's coroutine splitting pass, so this implementation modifies Clang codegen to produce allocator-specific alloc/store/loads for each parameter being forwarded to the allocator. Test Plan: `check-clang` Reviewers: rsmith, GorNishanov, eric_niebler Reviewed By: GorNishanov Subscribers: lewissbaker, EricWF, cfe-commits Differential Revision: https://reviews.llvm.org/D42606 llvm-svn: 325291
* [Sema] Toggle diags when finding allocators (NFCI)Brian Gesiak2018-02-151-42/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Many methods in Sema take a `bool Diagnose` parameter. Examples of such methods include `Sema::FindDeallocationFunction` and `Sema::SpecialMemberIsTrivial`. Calling these methods with `Diagnose = false` allows callers to, for instance, check for the existence of a deallocation function, without that check resulting in error diagnostics being emitted if no matching deallocation function exists. Add a similar `bool Diagnose` to the `Sema::FindAllocationFunctions` method, so that checks for the existence of allocation functions can be made without triggering error diagnostics. This allows `SemaCoroutine.cpp`, in its implementation of the Coroutines TS, to check for the existence of a particular `operator new` overload, but then without error fall back to a default `operator new` if no matching overload exists. Test Plan: `check-clang` Reviewers: rsmith, GorNishanov, eric_niebler Reviewed By: GorNishanov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D42605 llvm-svn: 325288
* [analyzer] Suppress temporary destructors for temporary arrays.Artem Dergachev2018-02-151-3/+16
| | | | | | | | | | | | | | | Array destructors, like constructors, need to be called for each element of the array separately. We do not have any mechanisms to do this in the analyzer, so for now all we do is evaluate a single constructor or destructor conservatively and give up. It automatically causes the necessary invalidation and pointer escape for the whole array, because this is how RegionStore works. Implement this conservative behavior for temporary destructors. This fixes the crash on the provided test. Differential Revision: https://reviews.llvm.org/D43149 llvm-svn: 325286
* [analyzer] Implement path notes for temporary destructors.Artem Dergachev2018-02-151-2/+8
| | | | | | | | | | | | | | Temporary destructors fire at the end of the full-expression. It is reasonable to attach the path note for entering/leaving the temporary destructor to its CXXBindTemporaryExpr. This would not affect lifetime-extended temporaries with their automatic destructors which aren't temporary destructors. The path note may be confusing in the case of destructors after elidable copy constructors. Differential Revision: https://reviews.llvm.org/D43144 llvm-svn: 325284
* [analyzer] Compute the correct this-region for temporary destructors.Artem Dergachev2018-02-155-88/+147
| | | | | | | | | | | | | | | | | | | Inline them if possible - a separate flag is added to control this. The whole thing is under the cfg-temporary-dtors flag, off by default so far. Temporary destructors are called at the end of full-expression. If the temporary is lifetime-extended, automatic destructors kick in instead, which are not addressed in this patch, and normally already work well modulo the overally broken support for lifetime extension. The patch operates by attaching the this-region to the CXXBindTemporaryExpr in the program state, and then recalling it during destruction that was triggered by that CXXBindTemporaryExpr. It has become possible because CXXBindTemporaryExpr is part of the construction context since r325210. Differential revision: https://reviews.llvm.org/D43104 llvm-svn: 325282
* [analyzer] NFC: Eliminate ParentMap lookup in mayInlineCallKind().Artem Dergachev2018-02-152-9/+3
| | | | | | | | Don't look at the parent statement to figure out if the cxx-allocator-inlining flag should kick in and prevent us from inlining the constructor within a new-expression. We now have construction contexts for that purpose. llvm-svn: 325278
* [OpenCL] Fix __enqueue_block for block with capturesYaxun Liu2018-02-154-39/+56
| | | | | | | | | | | | | | | | | | | | | | | | | The following test case causes issue with codegen of __enqueue_block void (^block)(void) = ^{ callee(id, out); }; enqueue_kernel(queue, 0, ndrange, block); Clang first does codegen for block expression in the first line and deletes its block info. Clang then tries to do codegen for the same block expression again for the second line, and fails because the block info is gone. The fix is to do normal codegen for both lines. Introduce an API to OpenCL runtime to record llvm block invoke function and llvm block literal emitted for each AST block expression, and use the recorded information for generating the wrapper kernel. The EmitBlockLiteral APIs are cleaned up to minimize changes to the normal codegen of blocks. Another minor issue is that some clean up AST expression is generated for block with captures, which can be stripped by IgnoreImplicit. Differential Revision: https://reviews.llvm.org/D43240 llvm-svn: 325264
* Amend r325256. This change was not properly merged locally before the commit ↵Aaron Ballman2018-02-151-1/+1
| | | | | | happened. llvm-svn: 325261
* NFC; clean up this file based on our coding standards. The impetus was ↵Aaron Ballman2018-02-151-1500/+1467
| | | | | | | | | | considerable use of a type name as an identifier for an object. Changed identifier names (especially function parameters) to not clash with type names and to follow the proper naming conventions. Use of explicit type names changed to use auto where appropriate. Removed unused parameters that should have never been added in the first place. Minor formatting cleanups. The changes were mostly mechanical and should have no functional impact. llvm-svn: 325256
* [clang-format] Support repeated field lists in protosKrasimir Georgiev2018-02-151-7/+24
| | | | | | | | | | | | | | | | | | Summary: This patch adds support for list initialization of proto repeated fields: ``` keys: [1, 2, 3] ``` Reviewers: djasper Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43298 llvm-svn: 325252
* Adding msan support for FreeBSDKamil Rytarowski2018-02-151-0/+2
| | | | | | | | | | | | | | | | Summary: Enabling memory sanitiser for X86_64 arch only. To match the sanitiser counterpart. Patch by: David CARLIER Reviewers: krytarowski Reviewed By: krytarowski Subscribers: dim, emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D43148 llvm-svn: 325241
* Add Xray instrumentation compile-time/link-time support to FreeBSDKamil Rytarowski2018-02-151-0/+27
| | | | | | | | | | | | | | | | Summary: Similarly to the GNU driver version, adding proper compile and linker flags. Patch by: David CARLIER Reviewers: vitalybuka, krytarowski, dberris Reviewed By: krytarowski, dberris Subscribers: emaste, dberris, cfe-commits Differential Revision: https://reviews.llvm.org/D43279 llvm-svn: 325238
* [clang-format] Improve ObjC headers detectionJacek Olesiak2018-02-151-2/+7
| | | | | | | | | | | | | | Summary: Detect ObjC characteristic types when they start a line and add additional keywords. Reviewers: benhamilton Reviewed By: benhamilton Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D43124 llvm-svn: 325221
* [analyzer] Inline constructors for destroyable temporaries.Artem Dergachev2018-02-151-0/+3
| | | | | | | | | | | | | | | | | | | | | Since r325210, in cfg-temporary-dtors mode, we can rely on the CFG to tell us that we're indeed constructing a temporary, so we can trivially construct a temporary region and inline the constructor. Much like r325202, this is only done under the off-by-default cfg-temporary-dtors flag because the temporary destructor, even if available, will not be inlined and won't have the correct object value (target region). Unless this is fixed, it is quite unsafe to inline the constructor. If the temporary is lifetime-extended, the destructor would be an automatic destructor, which would be evaluated with a "correct" target region - modulo the series of incorrect relocations performed during the lifetime extension. It means that at least, values within the object are guaranteed to be properly escaped or invalidated. Differential Revision: https://reviews.llvm.org/D43062 llvm-svn: 325211
* [CFG] Provide construction contexts for temproary objects.Artem Dergachev2018-02-151-1/+3
| | | | | | | | | | | | | | | Constructors of C++ temporary objects that have destructors now can be queried to discover that they're indeed constructing temporary objects. The respective CXXBindTemporaryExpr, which is also repsonsible for destroying the temporary at the end of full-expression, is now available at the construction site in the CFG. This is all the context we need to provide for temporary objects that are not lifetime extended. For lifetime-extended temporaries, more context is necessary. Differential Revision: https://reviews.llvm.org/D43056 llvm-svn: 325210
* [analyzer] Decide on inlining destructors via EvalCallOptions.Artem Dergachev2018-02-153-55/+59
| | | | | | | | | | | | | | | | | | | | EvalCallOptions were introduced in r324018 for allowing various parts of ExprEngine to notify the inlining mechanism, while preparing for evaluating a function call, of possible difficulties with evaluating the call that they foresee. Then mayInlineCall() would still be a single place for making the decision. Use that mechanism for destructors as well - pass the necessary flags from the CFG-element-specific destructor handlers. Part of this patch accidentally leaked into r324018, which led into a change in tests; this change is reverted now, because even though the change looked correct, the underlying behavior wasn't. Both of these commits were not intended to introduce any function changes otherwise. Differential Revision: https://reviews.llvm.org/D42991 llvm-svn: 325209
* Reapply r325193Konstantin Zhuravlyov2018-02-152-91/+101
| | | | llvm-svn: 325203
* [analyzer] Allow inlining constructors into return values.Artem Dergachev2018-02-152-4/+23
| | | | | | | | | | | | | | | | | This only affects the cfg-temporary-dtors mode - in this mode we begin inlining constructors that are constructing function return values. These constructors have a correct construction context since r324952. Because temporary destructors are not only never inlined, but also don't have the correct target region yet, this change is not entirely safe. But this will be fixed in the subsequent commits, while this stays off behind the cfg-temporary-dtors flag. Lifetime extension for return values is still not modeled correctly. Differential Revision: https://reviews.llvm.org/D42875 llvm-svn: 325202
OpenPOWER on IntegriCloud