summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* [analyzer] Suppress "this" pointer escape during construction.Artem Dergachev2018-01-182-2/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | Pointer escape event notifies checkers that a pointer can no longer be reliably tracked by the analyzer. For example, if a pointer is passed into a function that has no body available, or written into a global, MallocChecker would no longer report memory leaks for such pointer. In case of operator new() under -analyzer-config c++-allocator-inlining=true, MallocChecker would start tracking the pointer allocated by operator new() only to immediately meet a pointer escape event notifying the checker that the pointer has escaped into a constructor (assuming that the body of the constructor is not available) and immediately stop tracking it. Even though it is theoretically possible for such constructor to put "this" into a global container that would later be freed, we prefer to preserve the old behavior of MallocChecker, i.e. a memory leak warning, in order to be able to find any memory leaks in C++ at all. In fact, c++-allocator-inlining *reduces* the amount of false positives coming from this-pointers escaping in constructors, because it'd be able to inline constructors in some cases. With other checkers working similarly, we simply suppress the escape event for this-value of the constructor, regardless of analyzer options. Differential Revision: https://reviews.llvm.org/D41797 rdar://problem/12180598 llvm-svn: 322795
* libcxx: Define set_unexpected, _get_unexpected and __uncaught_exceptions ↵Peter Collingbourne2018-01-181-3/+3
| | | | | | | | | | | | without dllimport. It turns out that the MSVC headers define these functions without dllimport even when compiling with /MD. This change fixes the resulting compile-time error. Differential Revision: https://reviews.llvm.org/D42207 llvm-svn: 322794
* [Sanitizers] Changes in Hwasan allocator missed in D42198.Alex Shlyapnikov2018-01-181-5/+5
| | | | | | Converting a few failure handler calls missed in D42198. llvm-svn: 322793
* Use an enum value instead of a string.Rafael Espindola2018-01-184-24/+18
| | | | | | | | The old StringSwitch use was also broken. It assumed that a StringSwitch returns Optional<T> instead of T and was missing a .Default. llvm-svn: 322792
* [analyzer] operator new: Fix path diagnostics around the operator call.Artem Dergachev2018-01-182-5/+11
| | | | | | | | | | | | Implements finding appropriate source locations for intermediate diagnostic pieces in path-sensitive bug reports that need to descend into an inlined operator new() call that was called via new-expression. The diagnostics have worked correctly when operator new() was called "directly". Differential Revision: https://reviews.llvm.org/D41409 rdar://problem/12180598 llvm-svn: 322791
* [analyzer] NFC: operator new: Fix new(nothrow) definition in tests.Artem Dergachev2018-01-181-7/+4
| | | | | | | | | Fix the const qualifier so that the operator defined in the tests indeed does override the default global nothrow version of new. Differential Revision: https://reviews.llvm.org/D41408 llvm-svn: 322790
* [MachineOutliner] Add DISubprograms to outlined functions.Jessica Paquette2018-01-182-2/+266
| | | | | | | | | | Before, it wasn't possible to get backtraces inside outlined functions. This commit adds DISubprograms to the IR functions created by the outliner which makes this possible. Also attached a test that ensures that the produced debug information is correct. This is useful to users that want to debug outlined code. llvm-svn: 322789
* [CodeGen] Hoist common AsmPrinter code out of X86, ARM, and AArch64Reid Kleckner2018-01-178-191/+138
| | | | | | | | | | | Every known PE COFF target emits /EXPORT: linker flags into a .drective section. The AsmPrinter should handle this. While we're at it, use global_values() and emit each export flag with its own .ascii directive. This should make the .s file output more readable. llvm-svn: 322788
* [analyzer] operator new: Add a new checker callback, check::NewAllocator.Artem Dergachev2018-01-179-39/+198
| | | | | | | | | | | | | | | The callback runs after operator new() and before the construction and allows the checker to access the casted return value of operator new() (in the sense of r322780) which is not available in the PostCall callback for the allocator call. Update MallocChecker to use the new callback instead of PostStmt<CXXNewExpr>, which gets called after the constructor. Differential Revision: https://reviews.llvm.org/D41406 rdar://problem/12180598 llvm-svn: 322787
* [LangRef] Clarify Varargs forwarding for musttail calls.Florian Hahn2018-01-171-3/+5
| | | | | | | | | | | | | This clarification was suggested by @efriedma in D41335, which uses this behavior to inline musttail calls with varargs. Reviewers: hfinkel, efriedma, rnk Reviewed By: rnk Differential Revision: https://reviews.llvm.org/D41861 llvm-svn: 322786
* [hwasan] LLVM-level flags for linux kernel-compatible hwasan instrumentation.Evgeniy Stepanov2018-01-172-7/+50
| | | | | | | | | | | | | | | | Summary: -hwasan-mapping-offset defines the non-zero shadow base address. -hwasan-kernel disables calls to __hwasan_init in module constructors. Unlike ASan, -hwasan-kernel does not force callback instrumentation. This is controlled separately with -hwasan-instrument-with-calls. Reviewers: kcc Subscribers: srhines, hiraditya, llvm-commits Differential Revision: https://reviews.llvm.org/D42141 llvm-svn: 322785
* [Sanitizers] Make common allocator agnostic to failure handling modes.Alex Shlyapnikov2018-01-1710-57/+60
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Make common allocator agnostic to failure handling modes and move the decision up to the particular sanitizer's allocator, where the context is available (call stack, parameters, return nullptr/crash mode etc.) It simplifies the common allocator and allows the particular sanitizer's allocator to generate more specific and detailed error reports (which will be implemented later). The behavior is largely the same, except one case, the violation of the common allocator's check for "size + alignment" overflow is now reportied as OOM instead of "bad request". It feels like a worthy tradeoff and "size + alignment" is huge in this case anyway (thus, can be interpreted as not enough memory to satisfy the request). There's also a Report() statement added there. Reviewers: eugenis Subscribers: kubamracek, llvm-commits, #sanitizers Differential Revision: https://reviews.llvm.org/D42198 llvm-svn: 322784
* [ASTMatchers] Support generating docs for single-line matchersBenjamin Kramer2018-01-172-4/+2
| | | | | | clang-format likes this format. PR35989. llvm-svn: 322783
* [scudo] Fix for the Scudo interface function scopeKostya Kortchinsky2018-01-171-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: A forgotten include in `scudo_allocator.cpp` made the symbol only local :/ Before: ``` nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rss 00024730 t __scudo_set_rss_limit ``` After: ``` nm ./lib/clang/7.0.0/lib/linux/libclang_rt.scudo-i686-android.so | grep rs 00024760 T __scudo_set_rss_limit ``` And we want `T`! This include also means that we can get rid of the `extern "C"` in the C++ file, the compiler does fine without it (note that this was already the case for all the `__sanitizer_*` interface functions. Reviewers: alekseyshl, eugenis Reviewed By: eugenis Subscribers: #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42199 llvm-svn: 322782
* [analyzer] operator new: Fix ambigious type name.Artem Dergachev2018-01-171-2/+3
| | | | | | Hopefully fixes an MSVC buildbot failure. llvm-svn: 322781
* [analyzer] operator new: Fix memory space for the returned region.Artem Dergachev2018-01-174-18/+45
| | | | | | | | | | | | | | | Make sure that with c++-allocator-inlining=true we have the return value of conservatively evaluated operator new() in the correct memory space (heap). This is a regression/omission that worked well in c++-allocator-inlining=false. Heap regions are superior to regular symbolic regions because they have stricter aliasing constraints: heap regions do not alias each other or global variables. Differential Revision: https://reviews.llvm.org/D41266 rdar://problem/12180598 llvm-svn: 322780
* [Sema] Allow conversion between long double and __float128.Benjamin Kramer2018-01-173-8/+10
| | | | | | | We should only ban this if long double is a double double. x86's 80 bit long double is fine and supported by the backend. llvm-svn: 322779
* [DOXYGEN] Fix doxygen and content issues in xmmintrin.hDouglas Yung2018-01-171-28/+67
| | | | | | | | | | | | | | | | | - Fix inaccurate instruction listings. - Fix small issues in _mm_getcsr and _mm_setcsr. - Fix description of NaN handling in comparison intrinsics. - Fix inaccurate description of _mm_movemask_pi8. - Fix inaccurate instruction mappings. - Fix typos. - Clarify wording on some descriptions. - Fix bit ranges in return value. - Fix typo in _mm_move_ms intrinsic instruction since it operates on singe-precision values, not double. - This patch was made by Craig Flores Differential Revision: https://reviews.llvm.org/D41523 llvm-svn: 322778
* [analyzer] operator new: Model the cast of returned pointer into object type.Artem Dergachev2018-01-174-13/+71
| | | | | | | | | | | | | | | | | | | | | | | According to [basic.stc.dynamic.allocation], the return type of any C++ overloaded operator new() is "void *". However, type of the new-expression "new T()" and the type of "this" during construction of "T" are both "T *". Hence an implicit cast, which is not present in the AST, needs to be performed before the construction. This patch adds such cast in the case when the allocator was indeed inlined. For now, in the case where the allocator was *not* inlined we still use the same symbolic value (which is a pure SymbolicRegion of type "T *") because it is consistent with how we represent the casts and causes less surprise in the checkers after switching to the new behavior. The better approach would be to represent that value as a cast over a SymbolicRegion of type "void *", however we have technical difficulties conjuring such region without any actual expression of type "void *" present in the AST. Differential Revision: https://reviews.llvm.org/D41250 rdar://problem/12180598 llvm-svn: 322777
* Fix nodiscard failure tests on compilers w/o -verify.Eric Fiselier2018-01-172-2/+13
| | | | | | | | | | | | | Previously .fail.cpp tests for nodiscard were run with -Wunused-result being a warning, not an error, when the compiler didn't support -verify. When -verify isn't enabled this change judiciously adds -Werror=unused-result when to only the failure tests containing the // expected-error string for nodiscard. As a drive-by change, this patch also adds a missing // UNSUPPORTED: c++2a to a test which was only supposed to run in C++ <= 11. llvm-svn: 322776
* [analyzer] NFC: Forbid array elements of void type.Artem Dergachev2018-01-173-4/+23
| | | | | | | | | | | | | | | Represent the symbolic value for results of pointer arithmetic on void pointers in a different way: instead of making void-typed element regions, make char-typed element regions. Add an assertion that ensures that no void-typed regions are ever constructed. This is a refactoring of internals that should not immediately affect the analyzer's (default) behavior. Differential Revision: https://reviews.llvm.org/D40939 llvm-svn: 322775
* [analyzer] operator new: Use the correct region for the constructor.Artem Dergachev2018-01-179-49/+395
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The -analyzer-config c++-allocator-inlining experimental option allows the analyzer to reason about C++ operator new() similarly to how it reasons about regular functions. In this mode, operator new() is correctly called before the construction of an object, with the help of a special CFG element. However, the subsequent construction of the object was still not performed into the region of memory returned by operator new(). The patch fixes it. Passing the value from operator new() to the constructor and then to the new-expression itself was tricky because operator new() has no call site of its own in the AST. The new expression itself is not a good call site because it has an incorrect type (operator new() returns 'void *', while the new expression is a pointer to the allocated object type). Additionally, lifetime of the new expression in the environment makes it unsuitable for passing the value. For that reason, an additional program state trait is introduced to keep track of the return value. Finally this patch relaxes restrictions on the memory region class that are required for inlining the constructor. This change affects the old mode as well (c++-allocator-inlining=false) and seems safe because these restrictions were an overkill compared to the actual problems observed. Differential Revision: https://reviews.llvm.org/D40560 rdar://problem/12180598 llvm-svn: 322774
* Add a TargetOption to enable/disable GlobalISelVolkan Keles2018-01-175-26/+23
| | | | | | | | | | | | | | | | | | | | | Summary: This patch adds a new target option in order to control GlobalISel. This will allow the users to enable/disable GlobalISel prior to the backend by calling `TargetMachine::setGlobalISel(bool Enable)`. No test case as there is already a test to check GlobalISel command line options. See: CodeGen/AArch64/GlobalISel/gisel-commandline-option.ll. Reviewers: qcolombet, aemerson, ab, dsanders Reviewed By: qcolombet Subscribers: rovka, javed.absar, kristof.beyls, llvm-commits Differential Revision: https://reviews.llvm.org/D42137 llvm-svn: 322773
* Add support for emitting libcalls for x86_fp80 -> fp128 and vice-versaBenjamin Kramer2018-01-174-0/+39
| | | | | | compiler_rt doesn't provide them (yet), but libgcc does. PR34076. llvm-svn: 322772
* Add a ProfileCount class to represent entry counts.Easwaran Raman2018-01-1711-44/+114
| | | | | | | | | | | | | | Summary: The class wraps a uint64_t and an enum to represent the type of profile count (real and synthetic) with some helper methods. Reviewers: davidxl Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D41883 llvm-svn: 322771
* [X86][MMX] Add PR35982 test casesSimon Pilgrim2018-01-171-0/+123
| | | | | | FEMMS has the same problem as EMMS llvm-svn: 322770
* [RISCV] Propagate -mabi and -march values to GNU assembler.Ana Pazos2018-01-173-0/+27
| | | | | | | | | | | | | | | When using -fno-integrated-as flag, the gnu assembler produces code with some default march/mabi which later causes linker failure due to incompatible mabi/march. In this patch we explicitly propagate -mabi and -march flags to the GNU assembler. In this patch we explicitly propagate -mabi and -march flags to the GNU assembler. Differential Revision: https://reviews.llvm.org/D41271 llvm-svn: 322769
* Fix standalone test-suite run.Eric Fiselier2018-01-172-11/+20
| | | | | | | | | This patch updates libc++abi's HandleOutOfTreeLLVM.cmake to match libc++'s -- and more importantly, to fix a bug where llvm-lit wasn't found/created when libc++abi was built out-of-tree. This prevented the test suite from running. llvm-svn: 322768
* [LegalizeDAG] Fix ATOMIC_CMP_SWAP_WITH_SUCCESS legalization.Eli Friedman2018-01-175-17/+47
| | | | | | | | | | | | | The code wasn't zero-extending correctly, so the comparison could spuriously fail. Adds some AArch64 tests to cover this case. Inspired by D41791. Differential Revision: https://reviews.llvm.org/D41798 llvm-svn: 322767
* [polly] [ScopInfo] Don't use isl_val_get_num_si.Eli Friedman2018-01-172-8/+42
| | | | | | | | | | | | | | | | | isl_val_get_num_si crashes on overflow, so don't use it on arbitrary integers. Testcase only crashes on platforms where long is 32 bits because of the signature of isl_val_get_num_si; not sure if it's possible to write a testcase which crashes if long is 64 bits. There are a few other places in polly which use isl_val_get_num_si; they probably need to be fixed as well. I don't think polly uses any of the other "long" isl APIs in an unsafe manner. Differential Revision: https://reviews.llvm.org/D42129 llvm-svn: 322766
* [SCEV] Fix typo. NFC.Javed Absar2018-01-171-1/+1
| | | | | | Fix confusing typo in comment. llvm-svn: 322765
* [scudo] Limit by default the TSD pool to 2 on AndroidKostya Kortchinsky2018-01-171-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: jemalloc on Android currently uses 2 arenas (https://android.googlesource.com/platform/external/jemalloc/+/master/Android.bp#64). Since the Android toolchain absorbs compiler-rt and compiles it as is, we have to enforce the same limit to somehow stay competitive in terms of memory usage. The changes could either go in: - `scudo_platform.h` with a default for Android of 2 (this is the solution implemented here); - in `CMakeLists.txt` adding -DSCUDO_SHARED_TSD_POOL_SIZE=2 for Android. - something else? I don't have a strong opinion on how to do it, but it has to be done upstream anyway. Reviewers: alekseyshl, eugenis Reviewed By: alekseyshl, eugenis Subscribers: srhines, #sanitizers, llvm-commits Differential Revision: https://reviews.llvm.org/D42194 llvm-svn: 322764
* rootn: Port from amd_builtinsJan Vesely2018-01-179-0/+399
| | | | | | | | | | | | Passes piglit on turks and carrizo fp64 passes ctx on carrizo v2: fix formatting check fp32 denormal support at runtime Reviewer: Jeroen Ketema <j.ketema@xs4all.nl> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 322763
* powr: Port from amd_builtinsJan Vesely2018-01-176-0/+411
| | | | | | | | | | | | Passes piglit on turks and carrizo fp64 passes cts on carrizo v2: fix formatting check fp32 denormal support at runtime Reviewer: Jeroen Ketema <j.ketema@xs4all.nl> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 322762
* pown: Port from amd_builtinsJan Vesely2018-01-178-31/+395
| | | | | | | | | | | | Passes piglit on turks and carrizo fp64 passes CTS on carrizo v2: fix formatting check fp32 denormal support at runtime Reviewer: Jeroen Ketema <j.ketema@xs4all.nl> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 322761
* pow: Port from amd_builtinsJan Vesely2018-01-178-6/+1096
| | | | | | | | | | | | Passes piglit on turks and carrizo fp64 passes CTS on carrizo v2: fix formatting check fp32 denormal support at runtime Reviewer: Jeroen Ketema <j.ketema@xs4all.nl> Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> llvm-svn: 322760
* [clang-tidy] Adding Fuchsia checker for trailing returnsJulie Hockett2018-01-178-1/+164
| | | | | | | | | | | | Adds a check to the Fuchsia module to warn if a function has a trailing return. See https://fuchsia.googlesource.com/zircon/+/master/docs/cxx.md for reference. Differential Revision: https://reviews.llvm.org/D42116 llvm-svn: 322759
* A third attempt to mark TestRdar12408181.py as skippedVedant Kumar2018-01-171-1/+3
| | | | | | | | | | | | | Due to an unfortunate difference between the open source test harness and our internal harness, applying two @skip... decorators to this test works in the internal build but not in the open source build. I've tried another approach to skipping this test and tested it out with the open source harness. Hopefully this sticks! rdar://36417163 llvm-svn: 322756
* Reland "[libFuzzer] Support using libc++"Petr Hosek2018-01-178-36/+126
| | | | | | | | | | | | This is needed in case the users of libFuzzer use libc++ in their code, which the fuzz target (libFuzzer) will be linked against. When libc++ source is available, we build a private version of it and link it against libFuzzer which allows using the same static library against codebases which use both libc++ and libstdc++. Differential Revision: https://reviews.llvm.org/D37631 llvm-svn: 322755
* [globalisel][tablegen] Honour priority order within nested instructions.Daniel Sanders2018-01-172-0/+53
| | | | | | | | | | | It appears that we haven't been prioritizing rules that contain nested instructions properly. InstructionOperandMatcher didn't override isHigherPriorityThan so it never compared the instructions/operands/predicates inside nested instructions. Fixes PR35926. Thanks to Diana Picus for the bug report. llvm-svn: 322754
* [analyzer] introduce getSVal(Stmt *) helper on ExplodedNode, make sure the ↵George Karpenkov2018-01-1739-164/+115
| | | | | | | | | | | | | | | | | | helper is used consistently In most cases using `N->getState()->getSVal(E, N->getLocationContext())` is ugly, verbose, and also opens up more surface area for bugs if an inconsistent location context is used. This patch introduces a helper on an exploded node, and ensures consistent usage of either `ExplodedNode::getSVal` or `CheckContext::getSVal` across the codebase. As a result, a large number of redundant lines is removed. Differential Revision: https://reviews.llvm.org/D42155 llvm-svn: 322753
* [analyzer] Make isSubRegionOf reflexiveGeorge Karpenkov2018-01-176-10/+8
| | | | | | | | | All usages of isSubRegionOf separately check for reflexive case, and in any case, set theory tells us that each set is a subset of itself. Differential Revision: https://reviews.llvm.org/D42140 llvm-svn: 322752
* [WebAssembly] Simplify generation of "names" sectionSam Clegg2018-01-176-57/+37
| | | | | | | | | | | | | | | | Simplify generation of "names" section by simply iterating over the DefinedFunctions array. This even fixes some bugs, judging by the test changes required. Some tests are asserting that functions are named multiple times, other tests are asserting that the "names" section contains the function's alias rather than its original name Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42076 llvm-svn: 322751
* [analyzer] Better UI in html reports for displaying shortcuts helpGeorge Karpenkov2018-01-172-3/+48
| | | | | | | Make the help window accessible, but don't show by default. Use a different CSS class from macro. llvm-svn: 322750
* [clang-format] Replace unordered_set with an arrayKrasimir Georgiev2018-01-171-14/+5
| | | | | | | | | | | | | | Summary: This replaces an unordered_set from r322690 with an array and binary search. Reviewers: bkramer, benhamilton Reviewed By: bkramer, benhamilton Subscribers: jolesiak, benhamilton, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42189 llvm-svn: 322749
* Revert [PowerPC] This reverts commit rL322721Zaara Syeda2018-01-1717-507/+13
| | | | | | Failing build bots. Revert the commit now. llvm-svn: 322748
* [MDA] Use common code instead of reimplementing same. [NFC]Philip Reames2018-01-171-10/+2
| | | | llvm-svn: 322747
* [ASTMatchers] Add isNoReturn() match narrower for FunctionDeclarationsRoman Lebedev2018-01-174-0/+111
| | | | | | | | | | | | | | Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: dblaikie, klimek, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D41455 llvm-svn: 322746
* [WebAssembly] Remove DEBUG_FUNCTION_NAME after llvm changeSam Clegg2018-01-172-6/+0
| | | | | | | | Patch by Nicholas Wilson! Differential Revision: https://reviews.llvm.org/D42193 llvm-svn: 322745
* libcxx: Disable CFI in function std::get_temporary_buffer.Peter Collingbourne2018-01-171-0/+1
| | | | | | | | | The specification of this function mandates a cast to uninitialized T*, which is forbidden under CFI. Differential Revision: https://reviews.llvm.org/D42146 llvm-svn: 322744
OpenPOWER on IntegriCloud