summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [OpenMP] Correct generation of offloading entriesJonas Hahnfeld2018-01-182-29/+28
| | | | | | | | | | | Firstly, each offloading entry must have a unique name or the linker will complain if there are multiple files with target regions. Secondly, the compiler must not introduce padding so mark the struct with a PackedAttr. Differential Revision: https://reviews.llvm.org/D42168 llvm-svn: 322858
* [Frontend] Allow to use PrecompiledPreamble without calling CanReuseIlya Biryukov2018-01-182-17/+47
| | | | | | | | | | | | | | | | | | | Summary: The new method 'OverridePreamble' allows to override the preamble of any source file without checking if preamble bounds or dependencies were changed. This is used for completion in clangd. Reviewers: bkramer, sammccall Reviewed By: sammccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41990 llvm-svn: 322853
* Fix MSVC "uninitialized variable" warning.Simon Pilgrim2018-01-181-1/+4
| | | | llvm-svn: 322845
* [ASTMatcher] Add isScoped matcher for enumDecl.Haojian Wu2018-01-184-0/+26
| | | | | | | | | | | | Summary: Reviewers: bkramer, aaron.ballman Subscribers: aaron.ballman, cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D42185 llvm-svn: 322826
* Revert rC322769: [RISCV] Propagate -mabi and -march values to GNU assembler.Hiroshi Inoue2018-01-183-27/+0
| | | | | | Temporarily revert rC322769 due to buildbot failurs. llvm-svn: 322816
* Fix Scope::dump()Richard Trieu2018-01-181-64/+35
| | | | | | | | | The dump function for Scope only has 20 out of the 24 flags. Since it looped until no flags were left, having an unknown flag lead to an infinite loop. That loop has been changed to a single pass for each flag, plus an assert to alert if new flags are added. llvm-svn: 322813
* [analyzer] a few helper methods for getting and comparing symbolic valuesGeorge Karpenkov2018-01-185-2/+42
| | | | | | | | API calls should express intent, and that's a motivation behind this patch. Differential Revision: https://reviews.llvm.org/D42218 llvm-svn: 322809
* Update for llvm change.Rafael Espindola2018-01-189-9/+9
| | | | llvm-svn: 322808
* [analyzer] NFC: Remove unused method - BugReporter::RemoveUnneededCalls().Artem Dergachev2018-01-181-2/+0
| | | | | | | | Patch by Henry Wong! Differential Revision: https://reviews.llvm.org/D42106 llvm-svn: 322804
* [analyzer] NFC: RetainCount: Protect from dumping raw region to path notes.Artem Dergachev2018-01-181-2/+8
| | | | | | | | | | | | | | | | | | MemRegion::getString() is a wrapper around MemRegion::dump(), which is not user-friendly and should never be used for diagnostic messages. Actual cases where raw dumps were reaching the user were unintentionally fixed in r315736; these were noticed accidentally and shouldn't be reproducible anymore. For now RetainCountChecker only tracks pointers through variable regions, and for those dumps are "fine". However, we should still use a less dangerous method for producing our path notes. This patch replaces the dump with printing a variable name, asserting that this is indeed a variable. Differential Revision: https://reviews.llvm.org/D42015 llvm-svn: 322799
* [analyzer] NFC: Use "= default" for default ProgramPoint constructors.Artem Dergachev2018-01-181-26/+26
| | | | | | Differential Revision: https://reviews.llvm.org/D41935 llvm-svn: 322798
* [analyzer] operator new: Fix callback order for CXXNewExpr.Artem Dergachev2018-01-185-2/+114
| | | | | | | | | | | | | | | | PreStmt<CXXNewExpr> was never called. Additionally, under c++-allocator-inlining=true, PostStmt<CXXNewExpr> was called twice when the allocator was inlined: once after evaluating the new-expression itself, once after evaluating the allocator call which, for the lack of better options, uses the new-expression as the call site. This patch fixes both problems. Differential Revision: https://reviews.llvm.org/D41934 rdar://problem/12180598 llvm-svn: 322797
* [analyzer] operator new: Add a new ProgramPoint for check::NewAllocator.Artem Dergachev2018-01-185-56/+70
| | | | | | | | | | | | | | Add PostAllocatorCall program point to represent the moment in the analysis between the operator new() call and the constructor call. Pointer cast from "void *" to the correct object pointer type has already happened by this point. The new program point, unlike the previously used PostImplicitCall, contains a reference to the new-expression, which allows adding path diagnostics over it. Differential Revision: https://reviews.llvm.org/D41800 rdar://problem/12180598 llvm-svn: 322796
* [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
* 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
* [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
* [ASTMatchers] Support generating docs for single-line matchersBenjamin Kramer2018-01-172-4/+2
| | | | | | clang-format likes this format. PR35989. llvm-svn: 322783
* [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
* [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
* [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
* [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
* [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
* [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
* [DeclPrinter] Fix two cases that crash clang -ast-print.Artem Belevich2018-01-173-4/+21
| | | | | | | | | | | | | Both are related to handling anonymous structures. * clang didn't handle () around an anonymous struct variable. * clang also crashed on syntax errors that could lead to other syntactic constructs following the declaration of an anonymous struct. While the code is invalid, that's not a good reason to panic compiler. Differential Revision: https://reviews.llvm.org/D41788 llvm-svn: 322742
* [Parse] Forward brace locations to TypeConstructExprVedant Kumar2018-01-1712-90/+260
| | | | | | | | | | | | | | | | | | | | | | | | When parsing C++ type construction expressions with list initialization, forward the locations of the braces to Sema. Without these locations, the code coverage pass crashes on the given test case, because the pass relies on getLocEnd() returning a valid location. Here is what this patch does in more detail: - Forwards init-list brace locations to Sema (ParseExprCXX), - Builds an InitializationKind with these locations (SemaExprCXX), and - Uses these locations for constructor initialization (SemaInit). The remaining changes fall out of introducing a new overload for creating direct-list InitializationKinds. Testing: check-clang, and a stage2 coverage-enabled build of clang with asserts enabled. Differential Revision: https://reviews.llvm.org/D41921 llvm-svn: 322729
* [Index] Fix GCC warning again :-(Sam McCall2018-01-171-2/+2
| | | | llvm-svn: 322720
* [Tooling] Don't deduplicate tool results in the All-TUs executor.Eric Liu2018-01-172-12/+7
| | | | | | | | | | | | | | Summary: As result deduplication or reduction is not supported in the framework, we should leave the deplication to tools (if needed) until the framework supports it. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42111 llvm-svn: 322691
* [Format] Improve ObjC header guessing heuristicBen Hamilton2018-01-172-8/+176
| | | | | | | | | | | | | | | | | | | | | Summary: This improves upon the previous Objective-C header guessing heuristic from rC320479. Now, we run the lexer on C++ header files and look for Objective-C keywords and syntax. We also look for Foundation types. Test Plan: make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: jolesiak, krasimir Reviewed By: jolesiak Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42135 llvm-svn: 322690
* Update dump_ast_matchers for many recent changes.Benjamin Kramer2018-01-173-93/+258
| | | | | | | The html file hasn't been updated in a long time so there are quite a few changes in there. No matchers were removed though. llvm-svn: 322687
* [clang-format] adds enclosing function detection to raw string formattingKrasimir Georgiev2018-01-177-53/+170
| | | | | | | | | | | | | | Summary: This patch adds enclosing function detection to raw string formatting. Reviewers: bkramer Reviewed By: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D42167 llvm-svn: 322678
* Attempt to fix test/Driver/masm.c on the ARM bots.Nico Weber2018-01-171-1/+1
| | | | llvm-svn: 322674
* [Index] Fix GCC warning. This is silly, but no llvm_unreachable and no C99.Sam McCall2018-01-171-1/+3
| | | | llvm-svn: 322672
* [Sema] Add visited contexts to CodeCompleteContextHaojian Wu2018-01-176-1/+169
| | | | | | | | | | | | | | | | | | | Summary: This would allow code completion clients to know which context is visited during Sema code completion. Also some changes: * add `EnteredContext` callback in VisibleDeclConsumer. * add a simple unittest for sema code completion (only for visited contexts at the moment). Reviewers: ilya-biryukov Reviewed By: ilya-biryukov Subscribers: mgorny, bkramer, cfe-commits Differential Revision: https://reviews.llvm.org/D42071 llvm-svn: 322661
* [clang-cl] Let /FA output use intel assembly.Nico Weber2018-01-172-0/+5
| | | | | | | cl's assembly output is in intel syntax, so clang-cl's should be too, PR35031. https://reviews.llvm.org/D42157 llvm-svn: 322652
* [clang-format] Reorganize RawStringFormat based on languageKrasimir Georgiev2018-01-175-58/+81
| | | | | | | | | | | | | | | | | | Summary: This patch changes the structure for raw string formatting options by making it language based (enumerate delimiters per language) as opposed to delimiter-based (specify the language for a delimiter). The raw string formatting now uses an appropriate style from the .clang-format file, if exists. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D42098 llvm-svn: 322634
* [CodeGen] Fix a crash on mangling multiversioned functionsGeorge Burgess IV2018-01-172-2/+18
| | | | | | | `multiVersionSortPriority` expects features to have no prefix. We currently carry them around in the format "+${feature}". llvm-svn: 322618
* [analyzer] support a mode to only show relevant lines in HTML diagnosticsGeorge Karpenkov2018-01-1712-22/+305
| | | | | | | | | | | | | | HTML diagnostics can be an overwhelming blob of pages of code. This patch adds a checkbox which filters this list down to only the lines *relevant* to the counterexample by e.g. skipping branches which analyzer has assumed to be infeasible at a time. The resulting amount of output is much smaller, and often fits on one screen, and also provides a much more readable diagnostics. Differential Revision: https://reviews.llvm.org/D41378 llvm-svn: 322612
* Make DiagnosticsEngine() take DiagOpts as DiagnosticsEngine.Nico Weber2018-01-172-6/+6
| | | | | | | No behavior change, but makes it a bit clearer that DiagnosticsEngine adds a ref to DiagOpts. llvm-svn: 322611
* Add context to why test was disabled on WindowsRichard Trieu2018-01-161-0/+1
| | | | | | | test/Modules/odr_hash-Friend.cpp triggers an assertion in MicrosoftMangle.cpp This has been reported in PR35939 llvm-svn: 322593
* Move target MV resolver to COMDATErich Keane2018-01-167-15/+18
| | | | | | | | | | As reported here: https://bugs.llvm.org/show_bug.cgi?id=35921 The resolver functions should be in their own COMDAT regions. This patch sets that up. Differential Revision: https://reviews.llvm.org/D42110 llvm-svn: 322592
* [DOCS] Updated current status of OpenMP support, NFC.Alexey Bataev2018-01-161-6/+6
| | | | llvm-svn: 322589
OpenPOWER on IntegriCloud