summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [Driver] Export profiling symbols for -exported_symbols_listVedant Kumar2018-04-131-0/+2
| | | | | | | | | When profiling is enabled and -exported_symbols_list is specified for the Darwin linker, export the requisite set of profiling symbols. rdar://39427167 llvm-svn: 330077
* [ODRHash] Support pointer and reference types.Richard Trieu2018-04-131-0/+18
| | | | | | | Recommit r328404 which was reverted in rL328404. r329869 fixed the issue that caused the revert. llvm-svn: 330074
* [Serialization] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-04-131-317/+265
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 330068
* [Analyzer] Fix for SValBuilder expressions rearrangementAdam Balogh2018-04-131-0/+2
| | | | | | | | Expression rearrangement in SValBuilder (see rL329780) crashes with an assert if the type of the integer is different from the type of the symbol. This fix adds a check that prevents rearrangement in such cases. Differential Revision: https://reviews.llvm.org/D45557 llvm-svn: 330064
* hwasan: add -fsanitize=kernel-hwaddress flagAndrey Konovalov2018-04-138-18/+61
| | | | | | | | | This patch adds -fsanitize=kernel-hwaddress flag, that essentially enables -hwasan-kernel=1 -hwasan-recover=1 -hwasan-match-all-tag=0xff. Differential Revision: https://reviews.llvm.org/D45046 llvm-svn: 330044
* [OPENMP] Replace push_back by emplace_back, NFC.Alexey Bataev2018-04-133-13/+13
| | | | llvm-svn: 330042
* Fix evaluation of `__has_include_next` during -frewrite-includes.Volodymyr Sapsai2018-04-131-14/+18
| | | | | | | | | | | | | | | | | | | | | | | `__has_include_next` requires correct DirectoryLookup for being evaluated correctly. We were using Preprocessor::GetCurDirLookup() but we were calling it after the preprocessor finished its work. And in this case CurDirLookup is always nullptr which makes `__has_include_next` behave as `__has_include`. Fix by storing and using CurDirLookup when preprocessor enters a file, not when we rewrite the includes. rdar://problem/36305026 Reviewers: bkramer Reviewed By: bkramer Subscribers: jkorous-apple, cfe-commits Differential Revision: https://reviews.llvm.org/D45603 llvm-svn: 330041
* [OPENMP] Code cleanup + formatting, NFC.Alexey Bataev2018-04-132-477/+492
| | | | llvm-svn: 330040
* [clang-format] Improve Incomplete detection for (text) protosKrasimir Georgiev2018-04-131-5/+18
| | | | | | | | | | | | | | | | | | Summary: This patch improves detection of incomplete code for protos and text protos. This is especially important for text protos in raw string literals, since they might be partial strings concatenated, and we'd like to disable formatting in these cases. Reviewers: sammccall Reviewed By: sammccall Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D44203 llvm-svn: 330016
* [NEON] Support vrndns_f32 intrinsicIvan A. Kosarev2018-04-131-0/+6
| | | | | | Differential Revision: https://reviews.llvm.org/D45515 llvm-svn: 330012
* [analyzer] Fix null deref in AnyFunctionCall::getRuntimeDefinitionGabor Horvath2018-04-131-16/+17
| | | | | | | | Patch by: Rafael Stahl! Differential Revision: https://reviews.llvm.org/D45564 llvm-svn: 330009
* [X86] Introduce cldemote intrinsicGabor Buella2018-04-136-0/+55
| | | | | | | | | | Reviewers: craig.topper, zvi Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45257 llvm-svn: 329993
* [XRay][clang] Make -fxray-modes= additiveDean Michael Berris2018-04-131-11/+12
| | | | | | | | | | | | | | | | | | | | | Summary: This allows us to do the following: clang -fxray-modes=none ... -fxray-modes=xray-basic It's important to be able to do this in cases where we'd like to specialise the configuration for the invocation of the compiler, in various scripting environments. This is related to llvm.org/PR37066, a follow-up to D45474. Reviewers: eizan, kpw, pelikan Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D45610 llvm-svn: 329989
* [XRay][clang] Add flag to choose instrumentation bundlesDean Michael Berris2018-04-137-8/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This change addresses http://llvm.org/PR36926 by allowing users to pick which instrumentation bundles to use, when instrumenting with XRay. In particular, the flag `-fxray-instrumentation-bundle=` has four valid values: - `all`: the default, emits all instrumentation kinds - `none`: equivalent to -fnoxray-instrument - `function`: emits the entry/exit instrumentation - `custom`: emits the custom event instrumentation These can be combined either as comma-separated values, or as repeated flag values. Reviewers: echristo, kpw, eizan, pelikan Reviewed By: pelikan Subscribers: mgorny, cfe-commits Differential Revision: https://reviews.llvm.org/D44970 llvm-svn: 329985
* Remove -cc1 option "-backend-option".Eli Friedman2018-04-123-12/+9
| | | | | | | | | It means the same thing as -mllvm; there isn't any reason to have two options which do the same thing. Differential Revision: https://reviews.llvm.org/D45109 llvm-svn: 329965
* [NFC] Fix terrible formatting of CGRecordLower constructor.Erich Keane2018-04-121-6/+7
| | | | llvm-svn: 329952
* [MinGW] Look for libc++ headers in a triplet prefixed path as wellMartin Storsjo2018-04-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | This makes it consistent with libstdc++ and the other default include directories. If these headers are found in both locations and one isn't a symlink to the other, this will cause errors due to libc++ headers having wrapper headers for some standard C headers, wrappers that do #include_next the actual one. If the same libc++ standard C wrapper header exists in more than one include directory before the real system one, the header include guard will stop it from doing another #include_next to pick up the real one, breaking things. As this is a rather uncommon situation, this should be acceptable and toolchain maintainers can adapt accordingly if necessary. Also simplify some of the existing code with a local variable. Differential Revision: https://reviews.llvm.org/D45500 llvm-svn: 329946
* [RISCV] Fix logic to check if frame pointer should be usedMandeep Singh Grang2018-04-121-8/+3
| | | | | | | | | | | | | | Summary: The logic was broken for Linux triples as it returns true in the switch for Triple.isOSLinux(). Reviewers: asb, apazos Reviewed By: asb Subscribers: kito-cheng, shiva0217, cfe-commits Differential Revision: https://reviews.llvm.org/D45237 llvm-svn: 329941
* [X86] Introduce wbinvd intrinsicGabor Buella2018-04-121-0/+5
| | | | | | | | | | | | A previously missing intrinsic for an old instruction. Reviewers: craig.topper, echristo Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D45311 llvm-svn: 329937
* Fix the try_acquire_capability attribute to behave like the other try-lock ↵Aaron Ballman2018-04-121-2/+13
| | | | | | functions. Fixes PR32954. llvm-svn: 329930
* Correctly diagnose when a conversion function is declared with a type ↵Aaron Ballman2018-04-121-8/+18
| | | | | | qualifier in the declaration specifiers rather than in the conversion type id. Fixes PR30595. llvm-svn: 329924
* [Hexagon] Enable auto-vectorization only when -fvectorize was givenKrzysztof Parzyszek2018-04-121-0/+7
| | | | llvm-svn: 329923
* [clang-format] Do not break after ObjC category open parenBen Hamilton2018-04-121-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, `clang-format` would break Objective-C category extensions after the opening parenthesis to avoid breaking the protocol list: ``` % echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \ clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \ ColumnLimit: 40}" @interface ccccccccccccc ( ccccccccccc) <ccccccccccccc> { } ``` This looks fairly odd, as we could have kept the category extension on the previous line. Category extensions are a single item, so they are generally very short compared to protocol lists. We should prefer breaking after the opening `<` of the protocol list over breaking after the opening `(` of the category extension. With this diff, we now avoid breaking after the category extension's open paren, which causes us to break after the protocol list's open angle bracket: ``` % echo "@interface ccccccccccccc (ccccccccccc) <ccccccccccccc> { }" | \ ./bin/clang-format -assume-filename=foo.h -style="{BasedOnStyle: llvm, \ ColumnLimit: 40}" @interface ccccccccccccc (ccccccccccc) < ccccccccccccc> { } ``` Test Plan: New test added. Confirmed test failed before diff and passed after diff by running: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45526 llvm-svn: 329919
* [clang-format] Improve ObjC guessing heuristic by supporting all @keywordsBen Hamilton2018-04-121-4/+7
| | | | | | | | | | | | | | | | | | | | | | | Summary: This diff improves the Objective-C guessing heuristic by replacing the hard-coded list of a subset of Objective-C @keywords with a general check which supports all @keywords. I also added a few more Foundation keywords which were missing from the heuristic. Test Plan: Unit tests updated. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45521 llvm-svn: 329918
* [clang-format] Don't insert space between ObjC class and lightweight genericBen Hamilton2018-04-121-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: In D45185, I added clang-format parser support for Objective-C generics. However, I didn't touch the whitespace logic, so they got the same space logic as Objective-C protocol lists. In every example in the Apple SDK and in the documentation, there is no space between the class name and the opening `<` for the lightweight generic specification, so this diff removes the space and updates the tests. Test Plan: Tests updated. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak Reviewed By: djasper Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45498 llvm-svn: 329917
* [clang-format] Always indent wrapped Objective-C selector namesBen Hamilton2018-04-121-8/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently, indentation of Objective-C method names which are wrapped onto the next line due to a long return type is controlled by the style option `IndentWrappedFunctionNames`. This diff changes the behavior so we always indent wrapped Objective-C selector names. NOTE: I partially reverted https://github.com/llvm-mirror/clang/commit/6159c0fbd1876c7f5f984b4830c664cc78f16e2e / rL242484, as it was causing wrapped selectors to be double-indented. Its tests in FormatTestObjC.cpp still pass. Test Plan: Tests updated. Ran tests with: % make -j12 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak, stephanemoore, thakis Reviewed By: djasper Subscribers: stephanemoore, klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45004 llvm-svn: 329916
* Diagnose cases of "return x" that should be "return std::move(x)" for efficiencyMalcolm Parsons2018-04-121-17/+110
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: This patch adds two new diagnostics, which are off by default: **-Wreturn-std-move** This diagnostic is enabled by `-Wreturn-std-move`, `-Wmove`, or `-Wall`. Diagnose cases of `return x` or `throw x`, where `x` is the name of a local variable or parameter, in which a copy operation is performed when a move operation would have been available. The user probably expected a move, but they're not getting a move, perhaps because the type of "x" is different from the return type of the function. A place where this comes up in the wild is `stdext::inplace_function<Sig, N>` which implements conversion via a conversion operator rather than a converting constructor; see https://github.com/WG21-SG14/SG14/issues/125#issue-297201412 Another place where this has come up in the wild, but where the fix ended up being different, was try { ... } catch (ExceptionType ex) { throw ex; } where the appropriate fix in that case was to replace `throw ex;` with `throw;`, and incidentally to catch by reference instead of by value. (But one could contrive a scenario where the slicing was intentional, in which case throw-by-move would have been the appropriate fix after all.) Another example (intentional slicing to a base class) is dissected in https://github.com/accuBayArea/Slides/blob/master/slides/2018-03-07.pdf **-Wreturn-std-move-in-c++11** This diagnostic is enabled only by the exact spelling `-Wreturn-std-move-in-c++11`. Diagnose cases of "return x;" or "throw x;" which in this version of Clang *do* produce moves, but which prior to Clang 3.9 / GCC 5.1 produced copies instead. This is useful in codebases which care about portability to those older compilers. The name "-in-c++11" is not technically correct; what caused the version-to-version change in behavior here was actually CWG 1579, not C++14. I think it's likely that codebases that need portability to GCC 4.9-and-earlier may understand "C++11" as a colloquialism for "older compilers." The wording of this diagnostic is based on feedback from @rsmith. **Discussion** Notice that this patch is kind of a negative-space version of Richard Trieu's `-Wpessimizing-move`. That diagnostic warns about cases of `return std::move(x)` that should be `return x` for speed. These diagnostics warn about cases of `return x` that should be `return std::move(x)` for speed. (The two diagnostics' bailiwicks do not overlap: we don't have to worry about a `return` statement flipping between the two states indefinitely.) I propose to write a paper for San Diego that would relax the implicit-move rules so that in C++2a the user //would// see the moves they expect, and the diagnostic could be re-worded in a later version of Clang to suggest explicit `std::move` only "in C++17 and earlier." But in the meantime (and/or forever if that proposal is not well received), this diagnostic will be useful to detect accidental copy operations. Reviewers: rtrieu, rsmith Reviewed By: rsmith Subscribers: lebedev.ri, Rakete1111, rsmith, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D43322 Patch by Arthur O'Dwyer. llvm-svn: 329914
* [OpenCL] Added -std/-cl-std=c++Anastasia Stulova2018-04-122-32/+43
| | | | | | | | This is std option for OpenCL C++ v1.0. Differential Revision: https://reviews.llvm.org/D45363 llvm-svn: 329911
* Allow [[maybe_unused]] on static data members; these are considered ↵Aaron Ballman2018-04-121-10/+0
| | | | | | | | variables and the attribute should appertain to them. Patch by S. B. Tam. llvm-svn: 329904
* ObjCGNU: Fix empty v3 protocols being emitted two fields shortDavid Chisnall2018-04-121-5/+7
| | | | | | | | | | | | | | | | | | | Summary: Protocols that were being referenced but could not be fully realized were being emitted without `properties`/`optional_properties`. Since all v3 protocols must be 9 processor words wide, the lack of these fields is catastrophic for the runtime. As an example, the runtime cannot know [here](https://github.com/gnustep/libobjc2/blob/master/protocol.c#L73) that `properties` and `optional_properties` are invalid. Reviewers: rjmccall, theraven Reviewed By: rjmccall, theraven Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D45305 llvm-svn: 329882
* [Sema][ObjC] Ensure that the return type of an ObjC method is a completeAkira Hatanaka2018-04-121-0/+7
| | | | | | | | | | | | type. Copy the code in ActOnStartOfFunctionDef that checks a function's return type to ActOnStartOfObjCMethodDef. This fixes an assertion failure in IRGen caused by an uninstantiated return type. rdar://problem/38691818 llvm-svn: 329879
* [ODRHash] Skip more types hashing TypedefTypeRichard Trieu2018-04-121-3/+13
| | | | | | To get the underlying type for TypedefType's, also skip ElaboratedType's. llvm-svn: 329869
* Driver: Add gcc search path for RHEL devtoolset-7Tom Stellard2018-04-111-0/+1
| | | | | | | | | | | | Reviewers: bruno Reviewed By: bruno Subscribers: bruno, cfe-commits Differential Revision: https://reviews.llvm.org/D44130 llvm-svn: 329854
* [Serialization] Fix some Clang-tidy modernize and Include What You Use ↵Eugene Zelenko2018-04-113-228/+355
| | | | | | warnings; other minor fixes (NFC). llvm-svn: 329851
* [x86] wbnoinvd intrinsicGabor Buella2018-04-116-1/+54
| | | | | | | | | | | | | | The WBNOINVD instruction writes back all modified cache lines in the processor’s internal cache to main memory but does not invalidate (flush) the internal caches. Reviewers: craig.topper, zvi, ashlykov Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D43817 llvm-svn: 329848
* [OPENMP] Code cleanup, NFC.Alexey Bataev2018-04-111-29/+31
| | | | llvm-svn: 329843
* [CodeGen] Handle __func__ inside __finallyShoaib Meenai2018-04-111-1/+1
| | | | | | | | | | | When we enter a __finally block, the CGF's CurCodeDecl will be null (because CodeGenFunction::StartFunction is given an empty GlobalDecl for a __finally block), and so the dyn_cast here will result in an assertion failure. Change it to dyn_cast_or_null to handle this case. Differential Revision: https://reviews.llvm.org/D45523 llvm-svn: 329836
* [NVPTX] Removed 'satom' feature which is no longer used.Artem Belevich2018-04-112-2/+0
| | | | | | Differential Revision: https://reviews.llvm.org/D45061 llvm-svn: 329830
* [NVPTX, CUDA] Improved feature constraints on NVPTX target builtins.Artem Belevich2018-04-112-0/+19
| | | | | | | | | | When NVPTX TARGET_BUILTIN specifies sm_XX or ptxYY as required feature, consider those features available if we're compiling for GPU >= sm_XX or have enabled PTX version >= ptxYY. Differential Revision: https://reviews.llvm.org/D45061 llvm-svn: 329829
* bpf: accept all asm register namesYonghong Song2018-04-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Sometimes when people compile bpf programs with "clang ... -target bpf ...", the kernel header files may contain host arch inline assembly codes as in the patch https://patchwork.kernel.org/patch/10119683/ by Arnaldo Carvaldo de Melo. The current workaround in the above patch is to guard the inline assembly with "#ifndef __BPF__" marco. So when __BPF__ is defined, these macros will have no use. Such a method is not extensible. As a matter of fact, most of these inline assembly codes will be thrown away at the end of clang compilation. So for bpf target, this patch accepts all asm register names in clang AST stage. The name will be checked again during llc code generation if the inline assembly code is indeed for bpf programs. With this patch, the above "#ifndef __BPF__" is not needed any more in https://patchwork.kernel.org/patch/10119683/. Signed-off-by: Yonghong Song <yhs@fb.com> llvm-svn: 329823
* Fix bugs around handling C++11 attributes.Manuel Klimek2018-04-111-2/+12
| | | | | | | | | | | | | | | | Previously, we would format: int a() { ... } [[unused]] int b() { ... } as... int a() {} [[unused] int b() {} Now we correctly format each on its own line. Similarly, we would detect: [[unused]] int b() { return 42; } As a lambda and leave it on a single line, even if that was disallowed by the format style. llvm-svn: 329816
* [Driver] Don't forward -m[no-]unaligned-access options to GCC when ↵Chad Rosier2018-04-111-0/+7
| | | | | | | | assembling/linking Differential Revision: https://reviews.llvm.org/D45092 llvm-svn: 329810
* [Sema] Fix built-in decrement operator overload resolutionJan Korous2018-04-111-3/+5
| | | | | | | | | | | | | | | | | C++ [over.built] p4: "For every pair (T, VQ), where T is an arithmetic type other than bool, and VQ is either volatile or empty, there exist candidate operator functions of the form VQ T& operator--(VQ T&); T operator--(VQ T&, int); " The bool type is in position LastPromotedIntegralType in BuiltinOperatorOverloadBuilder::getArithmeticType::ArithmeticTypes, but addPlusPlusMinusMinusArithmeticOverloads() was expecting it at position 0. Differential Revision: https://reviews.llvm.org/D44988 rdar://problem/34255516 llvm-svn: 329804
* [PowerPC] Option for secure plt modeStrahinja Petrovic2018-04-112-0/+17
| | | | | | | | | This patch enables option for secure plt mode in clang (-msecure-plt). Differential Revision: https://reviews.llvm.org/D44921 llvm-svn: 329795
* [Tooling] Correct the "-std" compile command option.Haojian Wu2018-04-111-2/+2
| | | | | | | | | | | | | | | Summary: "-std c++11" is not valid in compiler, we have to use "-std=c++11". Test in vscode with this patch, code completion for header works as expected. Reviewers: sammccall Subscribers: cfe-commits, klimek Differential Revision: https://reviews.llvm.org/D45512 llvm-svn: 329786
* [Tooling] Optimize memory usage in InMemoryToolResults.Haojian Wu2018-04-112-3/+13
| | | | | | | | | | | | | | Avoid storing duplicated "std::string"s. clangd's global-symbol-builder takes 20+GB memory running across LLVM repository. With this patch, the used memory is ~10GB (running on 48 threads, most of meory are AST-related). Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D45479 llvm-svn: 329784
* [Analyzer] SValBuilder Comparison Rearrangement (with Restrictions and ↵Adam Balogh2018-04-112-0/+199
| | | | | | | | | | | | | | | | Analyzer Option) Since the range-based constraint manager (default) is weak in handling comparisons where symbols are on both sides it is wise to rearrange them to have symbols only on the left side. Thus e.g. A + n >= B + m becomes A - B >= m - n which enables the constraint manager to store a range m - n .. MAX_VALUE for the symbolic expression A - B. This can be used later to check whether e.g. A + k == B + l can be true, which is also rearranged to A - B == l - k so the constraint manager can check whether l - k is in the range (thus greater than or equal to m - n). The restriction in this version is the the rearrangement happens only if both the symbols and the concrete integers are within the range [min/4 .. max/4] where min and max are the minimal and maximal values of their type. The rearrangement is not enabled by default. It has to be enabled by using -analyzer-config aggressive-relational-comparison-simplification=true. Co-author of this patch is Artem Dergachev (NoQ). Differential Revision: https://reviews.llvm.org/D41938 llvm-svn: 329780
* Adding fuzzer flags support to OpenBSD driverDean Michael Berris2018-04-111-1/+4
| | | | | | | | | | | | | | Summary: - Following-up the sanitizer's part commit https://reviews.llvm.org/rCRT329631, we enable fuzzer flags. Reviewers: brad, thakis, dberris Reviewed By: dberris Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D44878 llvm-svn: 329779
* [X86] Fix typo in intrinsic header file __mask16->__mmask16 from r329775.Craig Topper2018-04-111-2/+2
| | | | llvm-svn: 329777
* [X86] Replace 512-bit masked pmaddubsw and pmaddwd intrinsic with unmasked ↵Craig Topper2018-04-111-32/+21
| | | | | | | | | | intrinsic and a select. This makes it consistent with the 128/256-bit functions. Someday maybe we'll have all the masking moved to selects. llvm-svn: 329775
OpenPOWER on IntegriCloud