summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* Workaround for EvalInfo ctor for MSVC 2017Yaxun (Sam) Liu2019-11-261-3/+3
| | | | | | | | | | | | Current EvalInfo ctor causes EnableNewConstInterp to be true even though it is supposed to be false on MSVC 2017. This is because a virtual function getLangOpts() is called in member initializer lists, whereas on MSVC member ctors are called before function virtual function pointers are initialized. This patch fixes that. Differential Revision: https://reviews.llvm.org/D70729
* Fix tests on Windows after D49466Fangrui Song2019-11-262-8/+6
| | | | | | It is tricky to use replace_path_prefix correctly on Windows which uses backslashes as native path separators. Switch back to the old approach (startswith is not ideal) to appease build bots for now.
* Initial implementation of -fmacro-prefix-map and -ffile-prefix-mapDan McGregor2019-11-267-7/+73
| | | | | | | | | GCC 8 implements -fmacro-prefix-map. Like -fdebug-prefix-map, it replaces a string prefix for the __FILE__ macro. -ffile-prefix-map is the union of -fdebug-prefix-map and -fmacro-prefix-map Reviewed By: rnk, Lekensteyn, maskray Differential Revision: https://reviews.llvm.org/D49466
* [OPENMP]Fix PR44133: crash on lambda reductions in templates.Alexey Bataev2019-11-261-32/+51
| | | | | | Need to perform the instantiation of the combiner/initializer even if the resulting type is not dependent, if the construct is defined in templates in some cases.
* Partially reland "[Diagnostics] Put "deprecated copy" warnings into ↵Dávid Bolvanský2019-11-261-5/+5
| | | | | | -Wdeprecated-copy"" But do not enable it under -Wextra until libcxx issue is solved.
* [OpenCL] Add work-group and miscellaneous vector builtin functionsSven van Haastregt2019-11-261-1/+56
| | | | | | | Add the work-group and miscellaneous vector builtin functions from the OpenCL C specification. Patch by Pierre Gondois and Sven van Haastregt.
* [clang][CodeGen] Fix wrong memcpy size of no_unique_address in FieldMemcpyizerSenran Zhang2019-11-251-0/+2
| | | | | | | | | | When generating ctor, FieldMemcpyizer wrongly treated zero-sized class members as what should be copied, and generated wrong memcpy size under some special circumstances. This patch tries to fix it. Reviewed By: MaskRay, rjmccall Differential Revision: https://reviews.llvm.org/D70671
* [X86] Remove forward declaration of _invpcid from intrin.h. Rely on inline ↵Craig Topper2019-11-251-1/+0
| | | | | | | | | | | version from immintrin.h The forward declaration had a cdecl calling convention, but the inline version did not. This leads to a conflict if the default calling convention is not cdecl. Fix this by just removing the forward declaration. Fixes PR41503
* IRGen: Call SetLLVMFunctionAttributes{,ForDefinition} on __cfi_check_fail.Peter Collingbourne2019-11-251-0/+3
| | | | | | | | | | | | | | This has the main effect of causing target-cpu and target-features to be set on __cfi_check_fail, causing the function to become ABI-compatible with other functions in the case where these attributes affect ABI (e.g. reserve-x18). Technically we only need to call SetLLVMFunctionAttributes to get the target-* attributes set, but since we're creating a definition we probably ought to call the ForDefinition function as well. Fixes PR44094. Differential Revision: https://reviews.llvm.org/D70692
* Disallow use of __has_c_attribute in C++ mode.Aaron Ballman2019-11-251-1/+5
| | | | | | | __has_cpp_attribute is not available in C mode, and __has_c_attribute should not be available in C++ mode. This also adds a test to demonstrate that we properly handle scoped attribute tokens even in C mode.
* Revert "[Diagnostic] add a warning which warns about misleading indentation"Tom Stellard2019-11-251-35/+0
| | | | | | This reverts commit 7b86188b50bf6e537fe98b326f258fbd23108b83. This commit introduced bot falures for multi-stage bots with -Werror.
* Revert "[Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copy"Tom Stellard2019-11-251-4/+3
| | | | | | This reverts commit 9353c5dd0664ea444236e527bf93566e11dc34df. This commit introduced bot falures for multi-stage bots with -Werror.
* [OPENMP]Fix PR41826: symbols visibility in device code.Alexey Bataev2019-11-252-1/+5
| | | | | | | | | | | | | | | | | | Summary: Currently, we ignore all locality attributes/info when building for the device and thus all symblos are externally visible and can be preemted at the runtime. It may lead to incorrect results. We need to follow the same logic, compiler uses for static/pie builds. But in some cases changing of dso locality may lead to problems with codegen, so instead mark external symbols as hidden instead in the device code. Reviewers: jdoerfert Subscribers: guansong, caomhin, kkwli0, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70549
* [Diagnostic] add a warning which warns about misleading indentationTyker2019-11-251-0/+35
| | | | | | | | | | | | Summary: Add a warning for misleading indentation similar to GCC's -Wmisleading-indentation Reviewers: aaron.ballman, xbolva00 Reviewed By: aaron.ballman, xbolva00 Subscribers: arphaman, Ka-Ka, thakis Differential Revision: https://reviews.llvm.org/D70638
* [WebAssembly] Change the llvm-lto dir to use the LLVM VersionDan Gohman2019-11-251-11/+17
| | | | | | | | | Using the version instead of the VCS revision, which isn't available when LLVM_APPEND_VC_REV is set. The bitcode format should be backwards-compatible at least within a minor version, so the version string should be sufficient. Differential Revision: https://reviews.llvm.org/D70677
* [Diagnostics] Warn for comparison with string literals expanded from macro ↵Dávid Bolvanský2019-11-241-40/+45
| | | | | | | | | | | | | | | | | | (PR44064) Summary: As noted in PR, we have a poor test coverage for this warning. I think macro support was just overlooked. GCC warns in these cases. Clang missed a real bug in the code I am working with, GCC caught it. Reviewers: aaron.ballman Reviewed By: aaron.ballman Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70624
* [Diagnostics] Make behaviour of Clang's -Wdeprecated-copy same as in GCCDávid Bolvanský2019-11-231-2/+3
| | | | Do not warn for functions that are explicitly marked delete or default, which follows the behavior of the GCC warning.
* [analyzer] Add custom filter functions for GenericTaintCheckerBorsik Gabor2019-11-233-56/+112
| | | | | | | | | | | This patch is the last of the series of patches which allow the user to annotate their functions with taint propagation rules. I implemented the use of the configured filtering functions. These functions can remove taintedness from the symbols which are passed at the specified arguments to the filters. Differential Revision: https://reviews.llvm.org/D59516
* [Driver] Fix incorrect GNU triplet for PowerPC on SUSE LinuxAaron Puchert2019-11-231-1/+3
| | | | | | | | | | | | | | | Summary: On SUSE distributions for 32-bit PowerPC, gcc is configured as a 64-bit compiler using the GNU triplet "powerpc64-suse-linux", but invoked with "-m32" by default. Thus, the correct GNU triplet for 32-bit PowerPC SUSE distributions is "powerpc64-suse-linux" and not "powerpc-suse-linux". Reviewers: jrtc27, nemanjai, glaubitz Reviewed By: nemanjai Differential Revision: https://reviews.llvm.org/D55326
* [WebAssembly] Use wasm-opt and LTO libraries when available.Dan Gohman2019-11-221-0/+36
| | | | | | | | | | When there's a wasm-opt in the PATH, run the it to optimize LLVM's output. This fixes PR43796. And, add an "llvm-lto" directory to the sysroot library search paths, so that sysroots can provide LTO-enabled system libraries. Differential Revision: https://reviews.llvm.org/D70500
* [ASTMatchers] work around a miscompile; "NFC"George Burgess IV2019-11-221-1/+2
| | | | | | | | I chatted with Reid offline, and we agreed that having a workaround here would be appropriate until PR43879 is resolved. The given transformation Works On My Machine(TM), and should hopefully hold more broadly, but my fingers are crossed nonetheless. :)
* clang/Modules: Rename CompilerInstance::ModuleManager, NFCDuncan P. N. Exon Smith2019-11-225-60/+58
| | | | | | | | | | | | | | | | | | | Fix the confusing naming of `CompilerInstance::ModuleManager`. This is actually an instance of `ASTReader`, which contains an instance of `ModuleManager`. I have to assume there was a point in the past where they were just one class, but it's been pretty confusing for a while. I think it's time to fix it. The new name is `TheASTReader`; the annoying `The` prefix is so that we don't shadow the `ASTReader` class. I tried out `ASTRdr` but that seemed less clear, and this choice matches `ThePCHContainerOperations` just a couple of declarations below. Also rename `CompilerInstance::getModuleManager` and `CompilerInstance::createModuleManager` to `*ASTReader`, making some cases of `getModuleManager().getModuleManager()` a little more clear. https://reviews.llvm.org/D70583
* clang/Modules: Refactor CompilerInstance::loadModule, NFCDuncan P. N. Exon Smith2019-11-222-205/+250
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the logic on CompilerInstance::loadModule and a couple of surrounding methods in order to clarify what's going on. - Rename ModuleLoader::loadModuleFromSource to compileModuleFromSource and fix its documentation, since it never loads a module. It just creates/compiles one. - Rename one of the overloads of compileModuleImpl to compileModule, making it more obvious which one calls the other. - Rename compileAndLoadModule to compileModuleAndReadAST. This clarifies the relationship between this helper and its caller, CompilerInstance::loadModule (the old name implied the opposite relationship). It also (correctly) indicates that more needs to be done to load the module than this function is responsible for. - Split findOrCompileModuleAndReadAST out of loadModule. Besides reducing nesting for this code thanks to early returns and the like, this refactor clarifies the logic in loadModule, particularly around calls to ModuleMap::cacheModuleLoad and ModuleMap::getCachedModuleLoad. findOrCompileModuleAndReadAST also breaks early if the initial ReadAST call returns Missing or OutOfDate, allowing the last ditch call to compileModuleAndReadAST to come at the end of the function body. - Additionally split out selectModuleSource, clarifying the logic due to early returns. - Add ModuleLoadResult::isNormal and OtherUncachedFailure, so that loadModule knows whether to cache the result. OtherUncachedFailure was added to keep this patch NFC, but there's a chance that these cases were uncached by accident, through copy/paste/modify failures. These should be audited as a follow-up (maybe we can eliminate this case). - Do *not* lift the setting of `ModuleLoadFailed = true` to loadModule because there isn't a clear pattern for when it's set. This should be reconsidered in a follow-up, in case it would be correct to set `ModuleLoadFailed` whenever no module is returned and the result is either Normal or OtherUncachedFailure. - Add some header documentation where it was missing, and fix it where it was wrong. This should have no functionality change. https://reviews.llvm.org/D70556
* DebugInfo: Flag Dwarf Version metadata for merging during LTODavid Blaikie2019-11-221-3/+1
| | | | | | | | | | | | | | | | | | | | | | | When the Dwarf Version metadata was initially added (r184276) there was no support for Module::Max - though the comment suggested that was the desired behavior. The original behavior was Module::Warn which would warn and then pick whichever version came first - which is pretty arbitrary/luck-based if the consumer has some need for one version or the other. Now that the functionality's been added (r303590) this change updates the implementation to match the desired goal. The general logic here is - if you compile /some/ of your program with a more recent DWARF version, you must have a consumer that can handle it, so might as well use it for /everything/. The only place where this might fall down is if you have a need to use an old tool (supporting only the older DWARF version) for some subset of your program. In which case now it'll all be the higher version. That seems pretty narrow (& the inverse could happen too - you specifically /need/ the higher DWARF version for some extra expressivity, etc, in some part of the program)
* Separate the MS inheritance model enum from the attribute, NFCReid Kleckner2019-11-227-107/+105
| | | | | | This avoids the need to include Attr.h in DeclCXX.h for a four-value enum. Removing the include will be done separately, since it is large and risky change.
* Move vtordisp mode from Attr class to LangOptions.h, NFCReid Kleckner2019-11-226-12/+13
| | | | | This removes one of the two uses of Attr.h in DeclCXX.h, reducing the need to include Attr.h as widely. LangOptions is already very popular.
* [Driver] Make -static-libgcc imply static libunwindJosh Kunz2019-11-221-1/+4
| | | | | | | | | | | | | | | | | | In the GNU toolchain, `-static-libgcc` implies that the unwindlib will be linked statically. However, when `--unwindlib=libunwind`, this flag is ignored, and a bare `-lunwind` is added to the linker args. Unfortunately, this means that if both `libunwind.so`, and `libunwind.a` are present in the library path, `libunwind.so` will be chosen in all cases where `-static` is not set. This change makes `-static-libgcc` affect the `-l` flag produced by `--unwindlib=libunwind`. After this patch, providing `-static-libgcc --unwindlib=libunwind` will cause the driver to explicitly emit `-l:libunwind.a` to statically link libunwind. For all other cases it will emit `-l:libunwind.so` matching current behavior with a more explicit link line. https://reviews.llvm.org/D70416
* Revert "[Sema] Use the canonical type in function isVector"Akira Hatanaka2019-11-221-1/+1
| | | | | This reverts commit a6150b48cea00ab31e9335cc73770327acc4cb3a. The commit broke a few neon CodeGen tests.
* [Diagnostics] Put "deprecated copy" warnings into -Wdeprecated-copyDávid Bolvanský2019-11-221-3/+4
| | | | | | | | | | | | | | | | | Summary: GCC 9 added -Wdeprecated-copy (as part of -Wextra). This diagnostic is already implemented in Clang too, just hidden under -Wdeprecated (not on by default). This patch adds -Wdeprecated-copy and makes it compatible with GCC 9+. This diagnostic is heavily tested in deprecated.cpp, so I added simple tests just to check we warn when new flag/-Wextra is enabled. Reviewers: rsmith, dblaikie Reviewed By: dblaikie Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70342
* [Sema] Use the canonical type in function isVectorAkira Hatanaka2019-11-221-1/+1
| | | | | | | This fixes an assertion in Sema::CreateBuiltinBinOp that fails when one of the vector operand's element type is a typedef of __fp16. rdar://problem/55983556
* Don't report "main" as missing a prototype in freestanding modeBill Wendling2019-11-221-2/+4
| | | | | | | | | | | | | | | | | Summary: A user may want to use freestanding mode with the standard "main" entry point. It's not useful to warn about a missing prototype as it's not typical to have a prototype for "main". Reviewers: efriedma, aaron.ballman Reviewed By: aaron.ballman Subscribers: aaron.ballman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70588
* [RISCV] Use compiler-rt if no GCC installation detectedEdward Jones2019-11-222-3/+29
| | | | | | | | If a GCC installation is not detected, then this attempts to use compiler-rt and the compiler-rt crtbegin/crtend implementations as a fallback. Differential Revision: https://reviews.llvm.org/D68407
* [libTooling] Add stencil combinators for nodes that may be pointers or values.Yitzhak Mandelbaum2019-11-221-4/+36
| | | | | | | | | | | | | | | | Summary: Adds combinators `maybeDeref` and `maybeAddressOf` to provide a uniform way to handle nodes which may be bound to either a pointer or a value (most often in the context of member expressions). Such polymorphism is already supported by `access`; these combinators extend it to more general uses. Reviewers: gribozavr Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70554
* [OPENMP]Simplify processing of context selectors, NFC.Alexey Bataev2019-11-222-70/+38
|
* [coroutines] Remove assert on CoroutineParameterMoves in ↵Brian Gesiak2019-11-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | Sema::buildCoroutineParameterMoves Summary: The assertion of CoroutineParameterMoves happens when build coroutine function with arguments multiple time while fails to build promise type. Fix: use return false instead. Test Plan: check-clang Reviewers: modocache, GorNishanov, rjmccall Reviewed By: modocache Subscribers: rjmccall, EricWF, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69022 Patch by junparser (JunMa)!
* [OPENMP]Fix behaviour of defaultmap for OpenMP 4.5.Alexey Bataev2019-11-221-6/+12
| | | | | | In OpenMP 4.5 pointers also must be considered as scalar types and defaultmap(tofrom:scalar) clause must affect mapping of the pointers too.
* [clangd] Show lambda signature for lambda autocompletionsKirill Bobyrev2019-11-221-3/+27
| | | | | | | | | | | | | | | | | | | | | | | | The original bug report can be found [here](https://github.com/clangd/clangd/issues/85) Given the following code: ```c++ void function() { auto Lambda = [](int a, double &b) {return 1.f;}; La^ } ``` Triggering the completion at `^` would show `(lambda)` before this patch and would show signature `(int a, double &b) const`, build a snippet etc with this patch. Reviewers: sammccall Reviewed by: sammccall Differential revision: https://reviews.llvm.org/D70445
* [CFG] Fix a flaky crash in CFGBlock::getLastCondition().Artem Dergachev2019-11-211-0/+4
| | | | | | | Using an end iterator of an empty CFG block was causing a garbage pointer dereference. Differential Revision: https://reviews.llvm.org/D69962
* [RISCV] Support mutilib in baremetal environmentZakk Chen2019-11-212-3/+87
| | | | | | | | | | | | 1. Currently only support the set of multilibs same to riscv-gnu-toolchain. 2. Fix testcase typo causes fail on Windows. 3. Fix testcases to set empty sysroot. Reviewers: espindola, asb, kito-cheng, lenary Reviewed By: lenary Differential Revision: https://reviews.llvm.org/D67508
* clang/Modules: Move Serialization/Module.{h,cpp} to ModuleFile, NFCDuncan P. N. Exon Smith2019-11-219-13/+13
| | | | | | | | | Remove some cognitive load by renaming clang/Serialization/Module.h to clang/Serialization/ModuleFile.h, since it declares the ModuleFile class. This also makes editing a bit easier, since the basename of the file no long conflicts with clang/Basic/Module.h, which declares the Module class. Also move lib/Serialization/Module.cpp to lib/Serialization/ModuleFile.cpp.
* [analyzer] Fix Objective-C accessor body farms after 2073dd2d.Artem Dergachev2019-11-212-40/+53
| | | | | | | | | | Fix a canonicalization problem for the newly added property accessor stubs that was causing a wrong decl to be used for 'self' in the accessor's body farm. Fix a crash when constructing a body farm for accessors of a property that is declared and @synthesize'd in different (but related) interfaces. Differential Revision: https://reviews.llvm.org/D70158
* [analyzer] NFC: Don't clean up range constraints twice.Artem Dergachev2019-11-212-7/+6
| | | | | | Slightly improves static analysis speed. Differential Revision: https://reviews.llvm.org/D70150
* [Clang] Enable RISC-V support for FuchsiaPetr Hosek2019-11-212-3/+13
| | | | | | | | We don't have a full sysroot yet, so for now we only include compiler support and compiler-rt builtins, the rest of the runtimes will get enabled later. Differential Revision: https://reviews.llvm.org/D70477
* [OPENMP]Remove unused template parameter, NFC.Alexey Bataev2019-11-211-1/+1
|
* [PowerPC] Add new Future CPU for PowerPCStefan Pintilie2019-11-213-3/+28
| | | | | | | | | | | This patch will add -mcpu=future into clang for PowerPC. A CPU type is required for work that may possibly be enabled for some future Power CPU. The CPU type future will serve that purpose. This patch introduces no new functionality. It is an incremental patch on top of which Power PC work for some future CPU can be done. Differential Revision: https://reviews.llvm.org/D70262
* Debug info: Emit objc_direct methods as members of their containing classAdrian Prantl2019-11-212-24/+29
| | | | | | | | | even in DWARF 4 and earlier. This allows the debugger to recognize them as direct functions as opposed to Objective-C methods. <rdar://problem/57327663> Differential Revision: https://reviews.llvm.org/D70544
* [OPENMP50]Add device/kind context selector support.Alexey Bataev2019-11-214-26/+297
| | | | | | | | | | | | Summary: Added basic parsing/sema support for device/kind context selector. Reviewers: jdoerfert Subscribers: rampitec, aheejin, fedor.sergeev, simoncook, guansong, s.egerton, hfinkel, kkwli0, caomhin, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D70245
* Fix compilation warning. NFC.Michael Liao2019-11-211-1/+1
|
* [OPENMP]Fix datasharing checks for if clause in parallel taskloopAlexey Bataev2019-11-211-3/+7
| | | | | | | | directives. If the default datasharing is set to none, the datasharing attributes for variables in the condition of the if clause for the inner taskloop directive must be verified.
* [OPENMP50]Add if clause in for simd directive.Alexey Bataev2019-11-213-98/+126
| | | | | | According to OpenMP 5.0, if clause can be used in for simd directive. If condition in the if clause if false, the non-vectorized version of the loop must be executed.
OpenPOWER on IntegriCloud