summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
...
* [RISCV] Add missing REQUIRES to clang testsDavid Zarzycki2019-11-232-2/+2
| | | | Fixes: e0f22fe04a5c9eb244ff0533549743b7deb03b99
* [WebAssembly] Use wasm-opt and LTO libraries when available.Dan Gohman2019-11-222-0/+42
| | | | | | | | | | 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-226-63/+61
| | | | | | | | | | | | | | | | | | | 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-224-219/+290
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-222-7/+5
| | | | | | | | | | | | | | | | | | | | | | | 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)
* Remove needless Attr.h include from DeclCXX.h, NFCReid Kleckner2019-11-221-1/+0
| | | | | | This actually has no impact on the build, because TypeLoc.h includes Attr.h. However, DeclCXX.h has no need of it, so go ahead and remove it. The final step in this patch series is to split Attr.h and Attrs.h.
* Separate the MS inheritance model enum from the attribute, NFCReid Kleckner2019-11-2212-137/+149
| | | | | | 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-2211-23/+25
| | | | | 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-222-2/+13
| | | | | | | | | | | | | | | | | | 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-222-8/+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-224-6/+39
| | | | | | | | | | | | | | | | | 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-222-1/+8
| | | | | | | 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
* Fix typo to separate "-x" from warning flag.Bill Wendling2019-11-221-1/+1
|
* Don't report "main" as missing a prototype in freestanding modeBill Wendling2019-11-222-2/+10
| | | | | | | | | | | | | | | | | 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
* [OPENMP] [DOCS] correct status for use_device_addr clauseKelvin Li2019-11-221-1/+1
| | | | | | The status of the use_device_addr clause feature is changed from 'done' to 'worked on`. Differential Revision: https://reviews.llvm.org/D70608
* [RISCV] Use compiler-rt if no GCC installation detectedEdward Jones2019-11-226-40/+112
| | | | | | | | 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-223-4/+89
| | | | | | | | | | | | | | | | 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-222-2/+7
| | | | | | | | | | | | | | | | | | | | | | | 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-222-13/+19
| | | | | | In OpenMP 4.5 pointers also must be considered as scalar types and defaultmap(tofrom:scalar) clause must affect mapping of the pointers too.
* Add support to find out resource dir and add it as compilation argsKousik Kumar2019-11-221-1/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: If -resource-dir is not specified as part of the compilation command, then by default clang-scan-deps picks up a directory relative to its own path as resource-directory. This is probably not the right behavior - since resource directory should be picked relative to the path of the clang-compiler in the compilation command. This patch adds support for it along with a cache to store the resource-dir paths based on compiler paths. Notes: 1. "-resource-dir" is a behavior that's specific to clang, gcc does not have that flag. That's why if I'm not able to find a resource-dir, I quietly ignore it. 2. Should I also use the mtime of the compiler in the cache? I think its not strictly necessary since we assume the filesystem is immutable. 3. From my testing, this does not regress performance. 4. Will try to get this tested on Windows. But basically the problem that this patch is trying to solve is, clients might not always want to specify "-resource-dir" in their compile commands, so scan-deps must auto-infer it correctly. Reviewers: arphaman, Bigcheese, jkorous, dexonsmith, klimek Reviewed By: Bigcheese Subscribers: MaskRay, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D69122
* [clangd] Show lambda signature for lambda autocompletionsKirill Bobyrev2019-11-223-8/+48
| | | | | | | | | | | | | | | | | | | | | | | | 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-212-1/+267
| | | | | | | 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-2129-11/+201
| | | | | | | | | | | | 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-2112-19/+19
| | | | | | | | | 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-215-66/+181
| | | | | | | | | | 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-213-10/+10
| | | | | | Slightly improves static analysis speed. Differential Revision: https://reviews.llvm.org/D70150
* [CFG] Add a test for a flaky crash in CFGBlock::getLastCondition().Artem Dergachev2019-11-211-0/+15
| | | | | | | | | | | | Push the test separately ahead of time in order to find out whether our Memory Sanitizer bots will be able to find the problem. If not, I'll add a much more expensive test that repeats the current test multiple times in order to show up on normal buildbots. I really apologize for the potential temporary inconvenience! I'll commit the fix as soon as I get the signal. Differential Revision: https://reviews.llvm.org/D69962
* [Clang] Enable RISC-V support for FuchsiaPetr Hosek2019-11-217-10/+46
| | | | | | | | 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-213-5/+3
|
* [PowerPC] Add new Future CPU for PowerPCStefan Pintilie2019-11-215-4/+45
| | | | | | | | | | | 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-213-24/+50
| | | | | | | | | 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-2114-74/+905
| | | | | | | | | | | | 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-213-3/+27
| | | | | | | | 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-217-107/+319
| | | | | | 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.
* [DeclCXX] Remove unknown external linkage specificationsEhud Katz2019-11-217-42/+7
| | | | | | | | | | | | | | | | Partial revert of r372681 "Support for DWARF-5 C++ language tags". The change introduced new external linkage languages ("C++11" and "C++14") which not supported in C++. It also changed the definition of the existing enum to use the DWARF constants. The problem is that "LinkageSpecDeclBits.Language" (the field that reserves this enum) is actually defined as 3 bits length (bitfield), which cannot contain the new DWARF constants. Defining the enum as integer literals is more appropriate for maintaining valid values. Differential Revision: https://reviews.llvm.org/D69935
* Revert "[RISCV] Support mutilib in baremetal environment"Zakk Chen2019-11-2129-201/+11
| | | | | This reverts commit df876a026981b7a125b31bbb85ba4b1144edb0f9. Clang::riscv32-toolchain.c Clang::riscv64-toolchain.c fails on Windows.
* Fix Wshadow warning against global None variable. NFC.Simon Pilgrim2019-11-211-2/+2
|
* [Driver] Fix a shadowing warning. NFCIlya Biryukov2019-11-211-7/+7
| | | | | Found by the following buildbot: http://lab.llvm.org:8011/builders/clang-cmake-x86_64-sde-avx512-linux/builds/30084
* Reland 9f3fdb0d7fab: [Driver] Use VFS to check if sanitizer blacklists existIlya Biryukov2019-11-216-13/+159
| | | | | | | With updates to various LLVM tools that use SpecialCastList. It was tempting to use RealFileSystem as the default, but that makes it too easy to accidentally forget passing VFS in clang code.
* [OpenCL] Fix address space for base method call (PR43145)Sven van Haastregt2019-11-212-2/+35
| | | | | | | | Clang was creating an UncheckedDerivedToBase ImplicitCastExpr that was also casting between address spaces. Insert an ImplicitCastExpr node for doing the address space conversion. Differential Revision: https://reviews.llvm.org/D69810
* Atomics: support min/max orthogonallyTim Northover2019-11-219-31/+193
| | | | | | | | | | | | We seem to have been gradually growing support for atomic min/max operations (exposing longstanding IR atomicrmw instructions). But until now there have been gaps in the expected intrinsics. This adds support for the C11-style intrinsics (i.e. taking _Atomic, rather than individually blessed by C11 standard), and the variants that return the new value instead of the original one. That way, people won't be misled by trying one form and it not working, and the front-end is more friendly to people using _Atomic types, as we recommend.
* Revert "[Driver] Use VFS to check if sanitizer blacklists exist"Ilya Biryukov2019-11-216-159/+13
| | | | | This reverts commit ba6f906854263375cff3257d22d241a8a259cf77. Commit caused compilation errors on llvm tests. Will fix and re-land.
* [Driver] Use VFS to check if sanitizer blacklists existIlya Biryukov2019-11-216-13/+159
| | | | | | | | | | | | | | | | | | | Summary: This is a follow-up to 590f279c456bbde632eca8ef89a85c478f15a249, which moved some of the callers to use VFS. It turned out more code in Driver calls into real filesystem APIs and also needs an update. Reviewers: gribozavr2, kadircet Reviewed By: kadircet Subscribers: ormris, mgorny, hiraditya, llvm-commits, jkorous, cfe-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D70440
* [RISCV] Support mutilib in baremetal environmentZakk Chen2019-11-2129-11/+201
| | | | | | | | | | | 1. Currently only support the set of multilibs same to riscv-gnu-toolchain. 2. Fix testcase typo causes fail on Windows Reviewers: espindola, asb, kito-cheng, lenary Reviewed By: lenary Differential Revision: https://reviews.llvm.org/D67508
* [clang][IFS][test] GreenDragon and Fuchsia Darwin bot fix: BindArchClass Nest.Puyan Lotfi2019-11-201-1/+3
| | | | | | | | | | | | | | | | | | | | | | On Darwin the clang driver does not invoke Driver::BuildActions directly due to the need to handle Universal apps. Because of this there is a difference in code path where Driver::BuildUniversalActions is called instead of Driver::BuildActions. BuildUniversalActions ends up calling Driver::BuildAction but what it does differently is it takes the driver actions returned and wraps them each into a BindArchAction. In Driver::BuildJobs there is a check for '-o' to determine that multiple files are not specified when passing -o, except for Clang Interface Stub this need to be an exception as we actually want to write out multiple files: for every libfoo.so we have a libfoo.ifso sidecar ifso file, etc. To allow this to happen there is a check for IfsMergeAction, which is permitted to write out a secondary file. Except on Darwin, the IfsMergeAction gets wrapped in the BindArchAction by Driver::BuildUniversalActions so the check fails. This patch is to look inside a BindArchAction in Driver::BuildJobs to determine if there is in fact an IfsMergeAction, and if-so (pun intended) allow the secondary sidecard ifs/ifso file to be written out.
* [Sema] Add a 'Semantic' parameter to Expr::isKnownToHaveBooleanValueErik Pilkington2019-11-204-16/+30
| | | | | | | | | Some clients of this function want to know about any expression that is known to produce a 0/1 value, and others care about expressions that are semantically boolean. This fixes a -Wswitch-bool regression I introduced in 8bfb353bb33c, pointed out by Chris Hamilton!
* [clang][IFS] Driver Pipeline: generate stubs after standard pipeline (3)Puyan Lotfi2019-11-207-33/+135
| | | | | | | | | | | | | | | | | | | | | | | | | | Third Landing Attempt (dropping any linker invocation from clang driver): Up until now, clang interface stubs has replaced the standard PP -> C -> BE -> ASM -> LNK pipeline. With this change, it will happen in conjunction with it. So what when you build your code you will get an a.out or lib.so as well as an interface stub file. Example: clang -shared -o libfoo.so -emit-interface-stubs ... will generate both a libfoo.so and a libfoo.ifso. The .so file will contain the code from the standard compilation pipeline and the .ifso file will contain the ELF stub library. Note: For driver-test.c I've added -S in order to prevent any bot failures on bots that don't have the proper linker for their native triple. You could always specify a triple like x86_64-unknown-linux-gnu and on bots like x86_64-scei-ps4 the clang driver would invoke regular ld instead of getting the error 'Executable "orbis-ld" doesn't exist!' but on bots like ppc64be and s390x you'd get an error "/usr/bin/ld: unrecognised emulation mode: elf_x86_64" Differential Revision: https://reviews.llvm.org/D70274
OpenPOWER on IntegriCloud