summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer][UninitializedObjectChecker] Added a NotesAsWarnings flagKristof Umann2018-06-291-21/+53
| | | | | | | | | | In order to better support consumers of the plist output that don't parse note entries just yet, a 'NotesAsWarnings' flag was added. If it's set to true, all notes will be converted to warnings. Differential Revision: https://reviews.llvm.org/D48285 llvm-svn: 335964
* [X86] Remove masking from the avx512 packed sqrt builtins. Use select ↵Craig Topper2018-06-293-67/+52
| | | | | | builtins instead. llvm-svn: 335945
* [frontend] Don't include the C++ stdlib for -x assembler-with-cppAlex Lorenz2018-06-281-2/+2
| | | | | | | | | | | | | | The new C++ stdlib warning added in r335081 gets triggered when compiling an assembly file with -x assembler-with-cpp. This commit ensures that the C++ stdlib is not included when compiling assembly. In general, it's not really useful to include the C++ stdlib search path when compiling assembly source. rdar://41359632 Differential Revision: https://reviews.llvm.org/D48736 llvm-svn: 335940
* DebugInfo: Add -gno-gnu-pubnames to allow disabling gnu-pubnames later in ↵David Blaikie2018-06-281-1/+2
| | | | | | the command line llvm-svn: 335938
* [Parse] Make -Wgcc-compat complain about for loop inits in C89George Burgess IV2018-06-281-1/+3
| | | | | | | | | | While clang allows declarations in for loop init statements in c89 and gnu89, gcc does not. So, we should probably warn if users care about gcc compatibility. Differential Revision: https://reviews.llvm.org/D47840 llvm-svn: 335927
* [analyzer] Fix wrong comparison generation of the ranges generated by the ↵Mikhail R. Gadelha2018-06-281-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | refutation manager The refutation manager is removing a true bug from the test in this patch. The problem is that the following constraint: ``` (conj_$1{struct o *}) - (reg_$3<int * r>): [-9223372036854775808, 0] ``` is encoded as: ``` (and (bvuge (bvsub $1 $3) #x8000000000000000) (bvule (bvsub $1 $3) #x0000000000000000)) ``` The issue is that unsigned comparisons (bvuge and bvule) are being generated instead of signed comparisons (bvsge and bvsle). When generating the expressions: ``` (conj_$1{p *}) - (reg_$3<int * r>) >= -9223372036854775808 ``` and ``` (conj_$1{p *}) - (reg_$3<int * r>) <= 0 ``` both -9223372036854775808 and 0 are casted to pointer type and `LTy->isSignedIntegerOrEnumerationType()` in `Z3ConstraintManager::getZ3BinExpr` only checks if the type is signed, not if it's a pointer. Reviewers: NoQ, george.karpenkov, ddcc Subscribers: rnkovacs, NoQ, george.karpenkov, ddcc, xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48324 llvm-svn: 335926
* PR37979: integral promotions in C++ treat enum bit-fields like enums,Richard Smith2018-06-282-1/+22
| | | | | | | | | | | | | | | | | not like bit-fields. We used to get this right "by accident", because conversions for the selected built-in overloaded operator would convert the enum bit-field to its corresponding underlying type early. But after DR1687 that no longer happens. Technically this change should also apply to C, where bit-fields only have special promotion rules if the bit-field's declared type is _Bool, int, signed int, or unsigned int, but for GCC compatibility we only look at the bit-width and not the underlying type when performing bit-field integral promotions in C. llvm-svn: 335925
* [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | | | | | | A reduction for an incomplete array type used to produce an assert fail during codegen. Now it produces a diagnostic. Reviewed By: ABataev Differential Revision: https://reviews.llvm.org/D48735 llvm-svn: 335911
* Revert r335907: [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | Sorry, forgot to add commit log attributes again. llvm-svn: 335910
* [OPENMP] Fix incomplete type check for array reductionsJoel E. Denny2018-06-281-1/+1
| | | | | | | A reduction for an incomplete array type used to produce an assert fail during codegen. Now it produces a diagnostic. llvm-svn: 335907
* [Darwin] Remove _VPMergeHook from the auto-export listVedant Kumar2018-06-281-1/+0
| | | | | | | | | | | Remove _VPMergeHook from Darwin's automatically-exported symbol list for PGO. As of r328987 this symbol is no longer weak. An integration test in compiler-rt will follow. rdar://41470205 llvm-svn: 335890
* [CUDA] Place all CUDA sections in __NV_CUDA segment on Mac.Artem Belevich2018-06-281-4/+6
| | | | | | | | That's where CUDA binaries appear to put them. Differential Revision: https://reviews.llvm.org/D48615 llvm-svn: 335880
* [clang-format] Do not format raw string literals inside a recognized ↵Krasimir Georgiev2018-06-281-1/+1
| | | | | | | | | | | | | | function with a non-recognized delimiter Summary: This stops clang-format from touching raw string contents with unrecognized delimiters inside recognized functions. Unrecognized delimiters signal that the string might be special. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D48728 llvm-svn: 335876
* OpenBSD driver needs ld.lld in sanitizer contextDavid Carlier2018-06-281-1/+3
| | | | | | | | | | | | | Base GNU ld is pretty ancient and does not support --dynamic-list flag. For conveniency, we can it automatically when compile with ubsan sanitizer flag. Reviewers: dberris Reviewed by: dberris Differential Revision: https://reviews.llvm.org/D48574 llvm-svn: 335856
* [ODRHash] Do not rely on Type* when computing the hash.Vassil Vassilev2018-06-281-9/+0
| | | | | | | | | | | | | | | | | ODRHash aims to provide Cross-TU stable hashing. Making clang::Type pointer part of the hash connects (remotely) the ODRHash with the TU-specific ::Profile hasher. r332281 exposed the issue by changing the way the ASTContext different elaborated types if there is an owning tag. In that case, ODRHash stores two different types in its TypeMap which yields false ODR violation in modules. The current state of implementation shouldn't need the TypeMap concept anymore. Rip it out. Differential Revision: https://reviews.llvm.org/D48524 llvm-svn: 335853
* [Analyzer] Iterator Checker - Part 2: Increment, decrement operators and ↵Adam Balogh2018-06-281-31/+448
| | | | | | | | | | | | | ahead-of-begin checks Add handling of the begin() funcion of containers to the iterator checkers, together with the pre- and postfix ++ and -- operators of the iterators. This makes possible the checking of iterators dereferenced ahead of the begin of the container. Differential Revision: https://reviews.llvm.org/D32642 llvm-svn: 335835
* [DebugInfo] Follow-up commit to improve consistency. NFCJonas Devlieghere2018-06-282-127/+117
| | | | | | Follow-up commit for r335757 to address some inconsistencies. llvm-svn: 335834
* [Analyzer] Constraint Manager Negates DifferenceAdam Balogh2018-06-281-1/+68
| | | | | | | | If range [m .. n] is stored for symbolic expression A - B, then we can deduce the range for B - A which is [-n .. -m]. This is only true for signed types, unless the range is [0 .. 0]. Differential Revision: https://reviews.llvm.org/D35110 llvm-svn: 335814
* Support for multiarch runtimes layoutPetr Hosek2018-06-283-24/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | This change adds a support for multiarch style runtimes layout, so in addition to the existing layout where runtimes get installed to: lib/clang/$version/lib/$os Clang now allows runtimes to be installed to: lib/clang/$version/$target/lib This also includes libc++, libc++abi and libunwind; today those are assumed to be in Clang library directory built for host, with the new layout it is possible to install libc++, libc++abi and libunwind into the runtime directory built for different targets. The use of new layout is enabled by setting the LLVM_ENABLE_RUNTIME_TARGET_DIR CMake variable and is supported by both projects and runtimes layouts. The runtimes CMake build has been further modified to use the new layout when building runtimes for multiple targets. Differential Revision: https://reviews.llvm.org/D45604 llvm-svn: 335809
* [analyzer] Remove redundant ';'.Artem Dergachev2018-06-281-1/+1
| | | | | | Fixes a compiler warning. No functionan change intended. llvm-svn: 335808
* [modules] Do not serialize / deserialize pending new/delete mismatchRichard Smith2018-06-282-17/+16
| | | | | | | | | | checks across module boundaries. This was causing us to load constructor definitions for all consumers of a module with a pending check. (In one case we saw ~7% of total frontend time spent loading constructors for this check.) llvm-svn: 335807
* [modules] Ensure that an in-class function definition is attached to theRichard Smith2018-06-281-0/+13
| | | | | | | | | | | declaration of the function that ends up in the primary definition of the class. ... at least for class templates. This is necessary for us to be able to track when an inline friend function has a definition that needs to be (lazily) instantiated. llvm-svn: 335805
* [analyzer] Use sufficiently large types for index bounds calculation.Artem Dergachev2018-06-282-3/+3
| | | | | | | | | | | | | | | | | The ProgramState::assumeInBound() API is used by checkers to make an assumption that a certain array index is within the array's bounds (i.e. is greater than or equal to 0 and is less than the length of the array). When the type of the index was unspecified by the caller, it assumed that the type is 'int', which caused some indices and sizes to truncate during calculations. Use ArrayIndexTy by default instead, which is used by the analyzer to represent index types and is currently hardcoded to long long. Patch by Bevin Hansson! Differential Revision: https://reviews.llvm.org/D46944 llvm-svn: 335803
* [analyzer] Add support for pre-C++17 copy elision.Artem Dergachev2018-06-282-43/+150
| | | | | | | | | | | | | | | | r335795 adds copy elision information to CFG. This commit allows static analyzer to elide elidable copy constructors by constructing the objects that were previously subject to elidable copy directly in the target region of the copy. The chain of elided constructors may potentially be indefinitely long. This only happens when the object is being returned from a function which in turn is returned from another function, etc. NRVO is not supported yet. Differential Revision: https://reviews.llvm.org/D47671 llvm-svn: 335800
* [CFG] [analyzer] Simplify lifetime-extended temporary construction contexts.Artem Dergachev2018-06-282-8/+8
| | | | | | | | | | | | | | When a temporary object is materialized and through that obtain lifetime that is longer than the duration of the full-expression, it does not require a temporary object destructor; it will be destroyed in a different manner. Therefore it's not necessary to include CXXBindTemporaryExpr into the construction context for such temporary in the CFG only to make clients throw it away. Differential Revision: https://reviews.llvm.org/D47667 llvm-svn: 335798
* [analyzer] Re-enable lifetime extension for temporaries without destructors.Artem Dergachev2018-06-281-9/+7
| | | | | | | | | | | | | | | | When an object's class provides no destructor, it's less important to materialize that object properly because we don't have to model the destructor correctly, so previously we skipped the support for these syntax patterns. Additionally, fix support for construction contexts of "static temporaries" (temporaries that are lifetime-extended by static references) because it turned out that we only had tests for them without destructors, which caused us to regress when we re-introduced the construction context for such temporaries. Differential Revision: https://reviews.llvm.org/D47658 llvm-svn: 335796
* [CFG] [analyzer] Add construction contexts that explain pre-C++17 copy elision.Artem Dergachev2018-06-286-31/+119
| | | | | | | | | | | | | | | | Before C++17 copy elision was optional, even if the elidable copy/move constructor had arbitrary side effects. The elidable constructor is present in the AST, but marked as elidable. In these cases CFG now contains additional information that allows its clients to figure out if a temporary object is only being constructed so that to pass it to an elidable constructor. If so, it includes a reference to the elidable constructor's construction context, so that the client could elide the elidable constructor and construct the object directly at its final destination. Differential Revision: https://reviews.llvm.org/D47616 llvm-svn: 335795
* DR1687: When overload resolution selects a built-in operator, implicitRichard Smith2018-06-275-35/+104
| | | | | | | | | | | conversions are only applied to operands of class type, and the second standard conversion sequence is not applied. When diagnosing an invalid builtin binary operator, talk about the original types rather than the converted types. If these differ by a user-defined conversion, tell the user what happened. llvm-svn: 335781
* [Modules][ObjC] Warn on the use of '@import' in framework headersBruno Cardoso Lopes2018-06-271-0/+12
| | | | | | | | | | | Using @import in framework headers inhibit the use of such headers when not using modules, this is specially bad for headers that end up in the SDK (or any other system framework). Add a warning to give users some indication that this is discouraged. rdar://problem/39192894 llvm-svn: 335780
* DR1213: Ignore implicit conversions when determining if an operand of anRichard Smith2018-06-271-4/+14
| | | | | | | | array subscript expression is an array prvalue. Also apply DR1213 to vector prvalues for consistency. llvm-svn: 335779
* [HIP] Fix ordering of device-libs linkingAaron Enye Shi2018-06-271-1/+1
| | | | | | | | | | | | | | | Summary: HIP should link the bitcodes with caller functions before callee functions. Also added lit test to check the ordering of the linked bitcodes is matches. Reviewers: yaxunl, b-sumner Reviewed By: yaxunl, b-sumner Subscribers: cfe-commits, yaxunl, b-sumner, scchan Differential Revision: https://reviews.llvm.org/D48667 llvm-svn: 335774
* [HIP] Support flush denormals bitcodeAaron Enye Shi2018-06-271-1/+7
| | | | | | | | | | | | | | | Summary: Use oclc_daz_opt_on.amdgcn.bc bitcode when option fcuda-flush-denormal-to-zero is enabled, otherwise use oclc_daz_opt_off.amdgcn.bc bitcode. Added lit tests to verify that the correct bitcode is linked when -fcuda-flush-denormal-to-zero option is enabled or disabled. Reviewers: yaxunl, scchan, b-sumner Reviewed By: yaxunl, scchan, b-sumner Subscribers: cfe-commits, yaxunl Differential Revision: https://reviews.llvm.org/D48493 llvm-svn: 335765
* [CUDA] Use atexit() to call module destructor.Artem Belevich2018-06-272-3/+15
| | | | | | | | | | This matches the way NVCC does it. Doing module cleanup at global destructor phase used to work, but is, apparently, too late for the CUDA runtime in CUDA-9.2, which ends up crashing with double-free. Differential Revision: https://reviews.llvm.org/D48613 llvm-svn: 335763
* [DebugInfo] Emit ObjC methods as part of interfaceJonas Devlieghere2018-06-272-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As brought up during the discussion of the DWARF5 accelerator tables, there is currently no way to associate Objective-C methods with the interface they belong to, other than the .apple_objc accelerator table. After due consideration we came to the conclusion that it makes more sense to follow Pavel's suggestion of just emitting this information in the .debug_info section. One concern was that categories were emitted in the .apple_names as well, but it turns out that LLDB doesn't rely on the accelerator tables for this information. This patch changes the codegen behavior to emit subprograms for structure types, like we do for C++. This will result in the DW_TAG_subprogram being nested as a child under its DW_TAG_structure_type. This behavior is only enabled for DWARF5 and later, so we can have a unique code path in LLDB with regards to obtaining the class methods. This was tested on the LLDB side and doesn't lead to a regression. There's already code in place to deal with member functions in C++, which deals with this transparently. For more background please refer to the discussion on the mailing list: http://lists.llvm.org/pipermail/llvm-dev/2018-June/123986.html Differential revision: https://reviews.llvm.org/D48241 llvm-svn: 335757
* Revert "[Analyzer] Moved RangeConstraintManager to header. NFC."Mikhail R. Gadelha2018-06-271-0/+83
| | | | | | | | This broke a number of bots. This reverts commit 5e1a89912d37a21c3b49ccf30600d7f498dffa9c. llvm-svn: 335752
* [X86] Rename llvm.x86.avx512.mask.fpclass.p* to exclude 'mask.' from the ↵Craig Topper2018-06-271-6/+6
| | | | | | name to match llvm. llvm-svn: 335745
* [analyzer] Allow registering custom statically-linked analyzer checkersAlexander Kornienko2018-06-272-6/+18
| | | | | | | | | | | | | | | | | | Summary: Add an extension point to allow registration of statically-linked Clang Static Analyzer checkers that are not a part of the Clang tree. This extension point employs the mechanism used when checkers are registered from dynamically loaded plugins. Reviewers: george.karpenkov, NoQ, xazax.hun, dcoughlin Reviewed By: george.karpenkov Subscribers: mgorny, mikhail.ramalho, rnkovacs, xazax.hun, szepet, a.sidorin, cfe-commits Differential Revision: https://reviews.llvm.org/D45718 llvm-svn: 335740
* [NEON] Support vldNq intrinsics in AArch32 (Clang part)Ivan A. Kosarev2018-06-271-63/+16
| | | | | | | | | This patch reworks the support for dup NEON intrinsics as described in D48439. Differential Revision: https://reviews.llvm.org/D48440 llvm-svn: 335734
* Re-apply: [ASTImporter] Import the whole redecl chain of functionsGabor Marton2018-06-272-37/+134
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: With this patch when any `FunctionDecl` of a redeclaration chain is imported then we bring in the whole declaration chain. This involves functions and function template specializations. Also friend functions are affected. The chain is imported as it is in the "from" tu, the order of the redeclarations are kept. I also changed the lookup logic in order to find friends, but first making them visible in their declaration context. We may have long redeclaration chains if all TU contains the same prototype, but our measurements shows no degradation in time of CTU analysis (Tmux, Xerces, Bitcoin, Protobuf). Also, as further work we could squash redundant prototypes, but first ensure that functionality is working properly; then should we optimize. This may seem like a huge patch, sorry about that. But, most of the changes are new tests, changes in the production code is not that much. I also tried to create a smaller patch which does not affect specializations, but that patch failed to pass some of the `clang-import-test`s because there we import function specializations. Also very importantly, we can't just change the import of `FunctionDecl`s without changing the import of function template specializations because they are handled as `FunctionDecl`s. Reviewers: a.sidorin, r.stahl, xazax.hun, balazske, a_sidorin Reviewed By: a_sidorin Subscribers: labath, aprantl, a_sidorin, rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47532 Re-apply commit rC335480 llvm-svn: 335731
* [Analyzer] Moved RangeConstraintManager to header. NFC.Mikhail R. Gadelha2018-06-271-83/+0
| | | | | | | | | | | | | | Summary: While at it, added a dump method to RangeSet. Reviewers: george.karpenkov, NoQ Reviewed By: george.karpenkov Subscribers: xazax.hun, szepet, a.sidorin Differential Revision: https://reviews.llvm.org/D48561 llvm-svn: 335726
* Fix warning about unhandled enumeration in switch.Zachary Turner2018-06-271-0/+2
| | | | llvm-svn: 335702
* [analyzer] [NFC] A convenient getter for getting a current stack frameGeorge Karpenkov2018-06-2720-68/+63
| | | | | | Differential Revision: https://reviews.llvm.org/D44756 llvm-svn: 335701
* Diagnose missing 'template' keywords in contexts where a comma is not aRichard Smith2018-06-273-78/+132
| | | | | | | | | | binary operator. Factor out the checking for a comma within potential angle brackets and also call it from contexts where we parse a comma-separated list of arguments or initializers. llvm-svn: 335699
* [mips] Explicitly specify the linker emulation for MIPS on FreeBSD.John Baldwin2018-06-271-6/+29
| | | | | | | | | | | | | | FreeBSD's mips64 builds O32 binaries for /usr/lib32 by default and thus needs to be able to link O32 binaries which requires an explicit linker emulation. Go ahead and list all the linker emulation variants for MIPS so that any supported MIPS ABI binary can be linked by any linker supporting MIPS. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48507 llvm-svn: 335691
* Diagnose missing 'template' keywords in more cases.Richard Smith2018-06-267-17/+95
| | | | | | | | | | | | | | | | | | | | We track when we see a name-shaped expression followed by a '<' token and parse the '<' as a comparison. Then: * if we see a token sequence that cannot possibly be an expression but can be a template argument (in particular, a type-id) that follows either a ',' or the '<', diagnose that the '<' was supposed to start a template argument list, and * if we see '>()', diagnose that the '<' was supposed to start a template argument list. This only changes the diagnostic for error cases, and in practice appears to catch the most common cases where a missing 'template' keyword leads to parse errors within a template. Differential Revision: https://reviews.llvm.org/D48571 llvm-svn: 335687
* Revert "[MS] Use mangled names and comdats for string merging with ASan"Evgeniy Stepanov2018-06-261-5/+7
| | | | | | Depends on r334313, which has been reverted in r335681. llvm-svn: 335684
* [analyzer] Minor cleanups for BugReporter, expose a getter for AnalyzerOptions.George Karpenkov2018-06-261-10/+4
| | | | llvm-svn: 335683
* [MachineOutliner] Emit a warning when using -moutline on unsupported targetsJessica Paquette2018-06-261-13/+20
| | | | | | | | | | | | | | | | Instead of just saying "flag unused", we should tell the user that the outliner isn't (at least officially) supported for some given architecture. This adds a warning that will state something like The 'blah' architecture does not support -moutline; flag ignored when we call -moutline with the 'blah' architecture. Since the outliner is still mostly an AArch64 thing, any architecture other than AArch64 will emit this warning. llvm-svn: 335672
* [analyzer] Do not run visitors until the fixpoint, run only once.George Karpenkov2018-06-2616-336/+354
| | | | | | | | | | | | | | | | | | | | | | | | | | | | In the current implementation, we run visitors until the fixed point is reached. That is, if a visitor adds another visitor, the currently processed path is destroyed, all diagnostics is discarded, and it is regenerated again, until it's no longer modified. This pattern has a few negative implications: - This loop does not even guarantee to terminate. E.g. just imagine two visitors bouncing a diagnostics around. - Performance-wise, e.g. for sqlite3 all visitors are being re-run at least 10 times for some bugs. We have already seen a few reports where it leads to timeouts. - If we want to add more computationally intense visitors, this will become worse. - From architectural standpoint, the current layout requires copying visitors, which is conceptually wrong, and can be annoying (e.g. no unique_ptr on visitors allowed). The proposed change is a much simpler architecture: the outer loop processes nodes upwards, and whenever the visitor is added it only processes current nodes and above, thus guaranteeing termination. Differential Revision: https://reviews.llvm.org/D47856 llvm-svn: 335666
* [mips] Use more conservative default CPUs for MIPS on FreeBSD.John Baldwin2018-06-261-0/+7
| | | | | | | | | | | | FreeBSD defaults to mips3 for all MIPS ABIs with GCC as that is the minimum MIPS architecture FreeBSD supports. Use mips3 for MIPS64 and mips2 for MIPS32 to match. Reviewed By: atanasyan Differential Revision: https://reviews.llvm.org/D48499 llvm-svn: 335653
OpenPOWER on IntegriCloud