summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* Revert r332028; see PR37545 for details.Richard Smith2018-05-212-97/+80
| | | | llvm-svn: 332879
* [Clang Tablegen] Add llvm_unreachable() to getModifierName()Mark Searles2018-05-211-0/+2
| | | | | | | | | | | | | | | | | Fix internal build failure: ../../../ClangDiagnosticsEmitter.cpp -o ClangDiagnosticsEmitter.o ../../../ClangDiagnosticsEmitter.cpp: In function 'llvm::StringRef {anonymous}::getModifierName({anonymous}::ModifierType)': ../../../ClangDiagnosticsEmitter.cpp:495:1: error: control reaches end of non-void function [-Werror=return-type] } ^ Build failure triggered by git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@332799 91177308-0d34-0410-b5e6-96231b3b80d8 Differential Revision: https://reviews.llvm.org/D47150 llvm-svn: 332854
* [OPENMP-SIMD] Fix PR37536: Fix definition of _OPENMP macro.Alexey Bataev2018-05-215-29/+34
| | | | | | | | if `-fopenmp-simd` is specified alone, `_OPENMP` macro should not be defined. If `-fopenmp-simd` is specified along with the `-fopenmp`, `_OPENMP` macro should be defined with the value `201511`. llvm-svn: 332852
* [AMDGPU] fixes for lds f32 builtinsDaniil Fukalov2018-05-214-9/+69
| | | | | | | | | | | | 1. added restrictions to memory scope, order and volatile parameters 2. added custom processing for these builtins - currently is not used code, needed to switch off GCCBuiltin link to the builtins (ongoing change to llvm tree) 3. builtins renamed as requested Differential Revision: https://reviews.llvm.org/D43281 llvm-svn: 332848
* [CodeGen] Recognize more cases of zero initializationSerge Pavlov2018-05-219-41/+77
| | | | | | | | | | | | | | | | | | | | | If a variable has an initializer, codegen tries to build its value. If the variable is large in size, building its value requires substantial resources. It causes strange behavior from user viewpoint: compilation of huge zero initialized arrays like: char data_1[2147483648u] = { 0 }; consumes enormous amount of time and memory. With this change codegen tries to determine if variable initializer is equivalent to zero initializer. In this case variable value is not constructed. This change fixes PR18978. Differential Revision: https://reviews.llvm.org/D46241 llvm-svn: 332847
* [Sema] Fix incorrect packed aligned structure layoutMomchil Velikov2018-05-212-3/+30
| | | | | | | | | | Handle attributes before checking the record layout (e.g. underalignment check during `alignas` processing), as layout may be cached without taking into account attributes that may affect it. Differential Revision: https://reviews.llvm.org/D46439 llvm-svn: 332843
* [CodeGen] Disable aggressive structor optimizations at -O0, take 2Pavel Labath2018-05-213-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | The first version of the patch (r332228) was flawed because it was putting structors into C5/D5 comdats very eagerly. This is correct only if we can ensure the comdat contains all required versions of the structor (which wasn't the case). This version uses a more nuanced approach: - for local structor symbols we use an alias because we don't have to worry about comdats or other compilation units. - linkonce symbols are emitted separately, as we cannot guarantee we will have all symbols we need to form a comdat (they are emitted lazily, only when referenced). - available_externally symbols are also emitted separately, as the code seemed to be worried about emitting an alias in this case. - other linkage types are not affected by the optimization level. They either get put into a comdat (weak) or get aliased (external). Reviewers: rjmccall, aprantl Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46685 llvm-svn: 332839
* [X86] Remove some preprocessor feature checks from intrinsic headersCraig Topper2018-05-212-4/+0
| | | | | | | | | | | | | | | | | | | Summary: These look to be a couple things that weren't removed when we switched to target attribute. The popcnt makes including just smmintrin.h also include popcntintrin.h. The popcnt file itself already contains target attrributes. The prefetch ones are just wrappers around __builtin_prefetch which we have graceful fallbacks for in the backend if the exact instruction isn't available. So there's no reason to hide them. And it makes them available in functions that have the write target attribute but not a -march command line flag. Reviewers: echristo, RKSimon, spatel, DavidKreitzer Reviewed By: echristo Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47029 llvm-svn: 332830
* [X86] Remove some unused builtins.Craig Topper2018-05-212-16/+0
| | | | | | These were upgraded to native shufflevectors months ago. llvm-svn: 332829
* [X86] Remove mask arguments from permvar builtins/intrinsics. Use a select ↵Craig Topper2018-05-2013-199/+163
| | | | | | | | in IR instead. Someday maybe we'll use selects for all the builtins. llvm-svn: 332825
* Revert 332750, clang part (see comment on D46910).Nico Weber2018-05-201-2/+1
| | | | llvm-svn: 332822
* Sema: diagnose invalid catch parameter in ObjCSaleem Abdulrasool2018-05-202-3/+17
| | | | | | | | | Ensure that the type being used has an associated interface when declaring the parameter for `@catch`. Resolves PR37384! llvm-svn: 332821
* Print the qualified name when dumping deserialized decls.Vassil Vassilev2018-05-201-2/+4
| | | | | | | | | This is useful to understand and debug the lazy template specializations used in the pch and modules. Differential Revision: https://reviews.llvm.org/D41785 llvm-svn: 332817
* [Driver] Temporarily remove test for LLVM findNearestBrian Gesiak2018-05-191-1/+0
| | | | | | | Summary: This fixes a failure caused by the revert of https://reviews.llvm.org/rL332805. llvm-svn: 332806
* [Driver] Loosen test for LLVM findNearestBrian Gesiak2018-05-191-1/+1
| | | | | | | | | | | | | | | | | Summary: When https://reviews.llvm.org/D46776 landed to improve the behavior of `llvm::OptTable::findNearest`, a PS4 buildbot began failing due to an assertion that a suggestion "-debug-info-macro" should be provided for the unrecognized option `clang -cc1as -debug-info-macros`. All other buildbots succeeded in this check, and the PS4 buildbot succeeded in the other `findNearest` tests. Temporarily loosen this check in order to reland the `findNearest` change. Test Plan: check-clang llvm-svn: 332804
* CodeGen: block capture shouldn't ICEJF Bastien2018-05-192-13/+39
| | | | | | | | | | When a lambda capture captures a __block in the same statement, the compiler asserts out because isCapturedBy assumes that an Expr can only be a BlockExpr, StmtExpr, or if it's a Stmt then all the statement's children are expressions. That's wrong, we need to visit all sub-statements even if they're not expressions to see if they also capture. Fix this issue by pulling out the isCapturedBy logic to use RecursiveASTVisitor. <rdar://problem/39926584> llvm-svn: 332801
* Adjust and fix failing CXX tests after r332799Eric Fiselier2018-05-192-9/+9
| | | | llvm-svn: 332800
* [Clang Tablegen][RFC] Allow Early Textual Substitutions in `Diagnostic` ↵Eric Fiselier2018-05-1911-319/+1106
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | messages. Summary: There are cases where the same string or select is repeated verbatim in a lot of diagnostics. This can be a pain to maintain and update. Tablegen provides no way stash the common text somewhere and reuse it in the diagnostics, until now! This patch allows diagnostic texts to contain `%sub{<definition-name>}`, where `<definition-name>` names a Tablegen record of type `TextSubstitution`. These substitutions are done early, before the diagnostic string is otherwise processed. All `%sub` modifiers will be replaced before the diagnostic definitions are emitted. The substitution must specify all arguments used by the substitution, and modifier indexes in the substitution are re-numbered accordingly. For example: ``` def select_ovl_candidate : TextSubstitution<"%select{function|constructor}0%select{| template| %2}1">; ``` when used as ``` "candidate `%sub{select_ovl_candidate}3,2,1 not viable" ``` will act as if we wrote: ``` "candidate %select{function|constructor}3%select{| template| %1}2 not viable" ``` Reviewers: rsmith, rjmccall, aaron.ballman, a.sidorin Reviewed By: rjmccall Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46740 llvm-svn: 332799
* Do not enable RTTI with -fexceptions, for PS4Sunil Srivastava2018-05-186-70/+19
| | | | | | | | | | | | | | | | | | | NFC for targets other than PS4. This patch is a change in behavior for PS4, in that PS4 will no longer enable RTTI when -fexceptions is specified (RTTI and Exceptions are disabled by default on PS4). RTTI will remain disabled except for types being thrown or caught. Also, '-fexceptions -fno-rtti' (previously prohibited on PS4) is now accepted, as it is for other targets. This patch removes some PS4 specific code, making the code cleaner. Also, in the test file rtti-options.cpp, PS4 tests where the behavior is the same as the generic x86_64-linux are removed, making the test cleaner. Differential Revision: https://reviews.llvm.org/D46982 llvm-svn: 332784
* [test] Fix run line to use correct tripleShoaib Meenai2018-05-181-1/+1
| | | | | | | | | | objc_begin_catch/objc_end_catch are specific to the Itanium ABI, so we should be using an Itanium triple for this test. Additionally, while I'm here, convert the run line to invoke the compiler directly rather than going through the driver. llvm-svn: 332777
* Maintain PS4 ABI compatibility by making the fix made in r331136 not apply ↵Douglas Yung2018-05-182-4/+7
| | | | | | | | | | | | when the target is the PS4. Reviewers: rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47084 llvm-svn: 332773
* Revert r332470 (and corresponding tests in r332492).Richard Smith2018-05-1815-768/+57
| | | | | | | This regressed our support for __attribute__((section)). See added test file for example of code broken by this. llvm-svn: 332760
* Support: Simplify endian stream interface. NFCI.Peter Collingbourne2018-05-184-33/+31
| | | | | | | | | | | | Provide some free functions to reduce verbosity of endian-writing a single value, and replace the endianness template parameter with a field. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47032 llvm-svn: 332757
* Revert "Move #include manipulation code to new lib/Tooling/Inclusions."Eric Liu2018-05-1811-26/+15
| | | | | | | This reverts commit r332720. This break build bot with modules. Need to investigate. Revert the change to unbreak bots. llvm-svn: 332751
* [Support] Avoid normalization in sys::getDefaultTargetTriplePetr Hosek2018-05-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | The return value of sys::getDefaultTargetTriple, which is derived from -DLLVM_DEFAULT_TRIPLE, is used to construct tool names, default target, and in the future also to control the search path directly; as such it should be used textually, without interpretation by LLVM. Normalization of this value may lead to unexpected results, for example if we configure LLVM with -DLLVM_DEFAULT_TARGET_TRIPLE=x86_64-linux-gnu, normalization will transform that value to x86_64--linux-gnu. Driver will use that value to search for tools prefixed with x86_64--linux-gnu- which may be confusing. This is also inconsistent with the behavior of the --target flag which is taken as-is without any normalization and overrides the value of LLVM_DEFAULT_TARGET_TRIPLE. Users of sys::getDefaultTargetTriple already perform their own normalization as needed, so this change shouldn't impact existing logic. Differential Revision: https://reviews.llvm.org/D46910 llvm-svn: 332750
* MC: Change the streamer ctors to take an object writer instead of a stream. ↵Peter Collingbourne2018-05-181-2/+4
| | | | | | | | | | | | | | NFCI. The idea is that a client that wants split dwarf would create a specific kind of object writer that creates two files, and use it to create the streamer. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47050 llvm-svn: 332749
* [X86] Fix a bad cast from mask16 to mask8 in _mm256_mask_cvtepi16_epi8 ↵Craig Topper2018-05-181-2/+2
| | | | | | introduced in r332266. llvm-svn: 332738
* Fix unused variable warning in r332724Eric Liu2018-05-181-0/+1
| | | | llvm-svn: 332734
* [Tooling] Add an overload of runToolOnCodeWithArgs that takes VFSEric Liu2018-05-182-10/+30
| | | | | | | | | | | | Summary: ... to support purely VFS-based tools. Reviewers: bkramer Subscribers: klimek, cfe-commits Differential Revision: https://reviews.llvm.org/D47074 llvm-svn: 332731
* [ASTImporter] Enable disabled but passing testGabor Marton2018-05-181-1/+1
| | | | | | | | | | | | | | Summary: There is a test which passes since D32947, but it was forgotten to be enabled. This patch enables that disabled test. Reviewers: a.sidorin, r.stahl, xazax.hun Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D47069 llvm-svn: 332728
* [clang-format/ObjC] Correctly annotate single-component ObjC method invocationsBen Hamilton2018-05-182-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Previously, clang-format's parser would fail to annotate the selector in a single-component Objective-C method invocation with `TT_SelectorName`. For example, the following: [foo bar]; would parse `bar` as `TT_Unknown`: M=0 C=1 T=Unknown S=0 B=0 BK=0 P=140 Name=identifier L=34 PPK=2 FakeLParens= FakeRParens=0 II=0x559d5db51770 Text='bar' This caused us to fail to insert a space after a closing cast rparen, so the following: [((Foo *)foo) bar]; would format as: [((Foo *)foo)bar]; This diff fixes the issue by ensuring we annotate the selector in a single-component Objective-C method invocation as `TT_SelectorName`. Test Plan: New tests added. Ran tests with: % make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests Reviewers: djasper, jolesiak Reviewed By: jolesiak Subscribers: Wizard, klimek, hokein, cfe-commits Differential Revision: https://reviews.llvm.org/D47028 llvm-svn: 332727
* [HIP] Support offloading by linker scriptYaxun Liu2018-05-186-60/+237
| | | | | | | | | | | | To support linking device code in different source files, it is necessary to embed fat binary at host linking stage. This patch emits an external symbol for fat binary in host codegen, then embed the fat binary by lld through a linker script. Differential Revision: https://reviews.llvm.org/D46472 llvm-svn: 332724
* Move #include manipulation code to new lib/Tooling/Inclusions.Eric Liu2018-05-1811-15/+26
| | | | | | | | | | | | | | | Summary: clangToolingCore is linked into almost everything (incl. clang), but not few tools need #include manipulation at this point. So pull this into a separate library in Tooling. Reviewers: ilya-biryukov Subscribers: klimek, mgorny, cfe-commits, thakis Differential Revision: https://reviews.llvm.org/D47068 llvm-svn: 332720
* [VFS] Implement getRealPath for OverlayFileSystem.Eric Liu2018-05-183-1/+59
| | | | | | | | | | Reviewers: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D47060 llvm-svn: 332717
* This patch aims to match the changes introducedAlexander Ivchenko2018-05-1815-56/+46
| | | | | | | | | | | | | | | | | in gcc by https://gcc.gnu.org/ml/gcc-cvs/2018-04/msg00534.html. The -mibt feature flag is being removed, and the -fcf-protection option now also defines a CET macro and causes errors when used on non-X86 targets, while X86 targets no longer check for -mibt and -mshstk to determine if -fcf-protection is supported. -mshstk is now used only to determine availability of shadow stack intrinsics. Comes with an LLVM patch (D46882). Patch by mike.dvoretsky Differential Revision: https://reviews.llvm.org/D46881 llvm-svn: 332704
* Do not try to remove invisible Decls from DeclContextGabor Marton2018-05-182-28/+67
| | | | llvm-svn: 332699
* Support: Add a raw_ostream::write_zeros() function. NFCI.Peter Collingbourne2018-05-171-2/+1
| | | | | | | | | | This will eventually replace MCObjectWriter::WriteZeros. Part of PR37466. Differential Revision: https://reviews.llvm.org/D47033 llvm-svn: 332675
* Add missing test case for r332639Reid Kleckner2018-05-171-0/+17
| | | | llvm-svn: 332646
* Fix a mangling failure on clang-cl C++17Reid Kleckner2018-05-174-14/+10
| | | | | | | | | | | | | | MethodVFTableLocations in MigrosoftVTableContext contains canonicalized decl. But, it's sometimes asked to lookup for non-canonicalized decl, and that causes assertion failure, and compilation failure. Fixes PR37481. Patch by Taiju Tsuiki! Differential Revision: https://reviews.llvm.org/D46929 llvm-svn: 332639
* [sanitizer] Don't add --export-dynamic for MyriadWalter Lee2018-05-171-0/+5
| | | | | | | | | | | This is to work around a bug in some versions of gnu ld, where --export-dynamic implies -shared even if -static is explicitly given. Myriad supports static linking only, so --export-dynamic is never needed. Differential Revision: https://reviews.llvm.org/D46452 llvm-svn: 332635
* [CUDA] Allow "extern __shared__ Foo foo[]" within anon. namespaces.Justin Lebar2018-05-174-6/+48
| | | | | | | | | | | | | | | Summary: Previously this triggered a -Wundefined-internal warning. But it's not an undefined variable -- any variable of this form is a pointer to the base of GPU core's shared memory. Reviewers: tra Subscribers: sanjoy, rsmith Differential Revision: https://reviews.llvm.org/D46782 llvm-svn: 332621
* [CUDA] Make std::min/max work when compiling in C++14 mode with a C++11 stdlib.Justin Lebar2018-05-171-18/+29
| | | | | | | | | | Reviewers: rsmith Subscribers: sanjoy, cfe-commits, tra Differential Revision: https://reviews.llvm.org/D46993 llvm-svn: 332619
* Fix __uuidof handling on non-type template parameter in C++17Nico Weber2018-05-172-1/+14
| | | | | | | | | | | | | | | Clang used to pass the base lvalue of a non-type template parameter to the template instantiation phase when the base part is __uuidof and it's running in C++17 mode. However, that drops its LValuePath, and unintentionally transforms &__uuidof(...) to __uuidof(...). This CL fixes that by passing whole expr. Fixes PR24986. https://reviews.llvm.org/D46820?id=146557 Patch from Taiju Tsuiki <tzik@chromium.org>! llvm-svn: 332614
* [AArch64] Correct inline assembly test case for S modifier [NFC]Peter Smith2018-05-171-3/+3
| | | | | | | | | | | | | | | The existing test for the AArch64 inline assembly constraint S uses the A and L modifiers. These modifiers were implemented in the original AArch64 backend but were not carried forward to the merged backend. The A is associated with ADRP and does nothing, the L is associated with :lo12: . Given that A and L are not supported by GCC and not supported by the new implementation of constraint S in LLVM (see D46745) I've altered the test to put :lo12: directly in the string so that A and L are not needed. Differential Revision: https://reviews.llvm.org/D46932 llvm-svn: 332606
* Use dotted format of version tuple for availability diagnosticsJan Korous2018-05-177-42/+41
| | | | | | | | | | | | E. g. use "10.11" instead of "10_11". We are maintaining backward compatibility by parsing underscore-delimited version tuples but no longer keep track of the separator and using dot format for output. Differential Revision: https://reviews.llvm.org/D46747 rdar://problem/39845032 llvm-svn: 332598
* CodeGen: Fix invalid bitcast for lifetime.start/endYaxun Liu2018-05-176-34/+103
| | | | | | | | | | | | | | lifetime.start/end expects pointer argument in alloca address space. However in C++ a temporary variable is in default address space. This patch changes API CreateMemTemp and CreateTempAlloca to get the original alloca instruction and pass it lifetime.start/end. It only affects targets with non-zero alloca address space. Differential Revision: https://reviews.llvm.org/D45900 llvm-svn: 332593
* Add vfs::FileSystem::getRealPathEric Liu2018-05-173-16/+21
| | | | | | | | | | | | | | Summary: And change `FileManager::getCanonicalName` to use getRealPath. Reviewers: bkramer Reviewed By: bkramer Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D46942 llvm-svn: 332590
* [ASTImporter] Fix missing implict CXXRecordDeclGabor Marton2018-05-172-2/+2
| | | | | | | | | | | | | | Summary: Implicit CXXRecordDecl is not added to its DeclContext during import, but in the original AST it is. This patch fixes this. Reviewers: xazax.hun, a.sidorin, szepet Subscribers: rnkovacs, dkrupp, cfe-commits Differential Revision: https://reviews.llvm.org/D46958 llvm-svn: 332588
* [libclang] Allow skipping function bodies in preamble onlyIvan Donchevskii2018-05-177-10/+59
| | | | | | | | | | | | | | | | | | | Second attempt. Fix line endings and warning. As an addition to CXTranslationUnit_SkipFunctionBodies, provide the new option CXTranslationUnit_LimitSkipFunctionBodiesToPreamble, which constraints the skipping of functions bodies to the preamble only. Function bodies in the main file are not affected if this option is set. Skipping function bodies only in the preamble is what clangd already does and the introduced flag implements it for libclang clients. Patch by Nikolai Kosjar. Differential Revision: https://reviews.llvm.org/D45815 llvm-svn: 332587
* [Frontend] Avoid running plugins during code completion parseIvan Donchevskii2018-05-172-0/+10
| | | | | | | | | | | | | | | | | Second attempt. Proper line endings. The parsing that is done for code completion is a special case that will discard any generated diagnostics, so avoid running plugins for this case in the first place to avoid performance penalties due to the plugins. A scenario for this is for example libclang with extra plugins like tidy. Patch by Nikolai Kosjar Differential Revision: https://reviews.llvm.org/D46050 llvm-svn: 332586
OpenPOWER on IntegriCloud