summaryrefslogtreecommitdiffstats
path: root/clang
Commit message (Collapse)AuthorAgeFilesLines
* Fix default-function-attr.c so that it works on Windows.Peter Collingbourne2019-01-041-1/+1
| | | | llvm-svn: 350433
* hwasan: Implement lazy thread initialization for the interceptor ABI.Peter Collingbourne2019-01-049-0/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The problem is similar to D55986 but for threads: a process with the interceptor hwasan library loaded might have some threads started by instrumented libraries and some by uninstrumented libraries, and we need to be able to run instrumented code on the latter. The solution is to perform per-thread initialization lazily. If a function needs to access shadow memory or add itself to the per-thread ring buffer its prologue checks to see whether the value in the sanitizer TLS slot is null, and if so it calls __hwasan_thread_enter and reloads from the TLS slot. The runtime does the same thing if it needs to access this data structure. This change means that the code generator needs to know whether we are targeting the interceptor runtime, since we don't want to pay the cost of lazy initialization when targeting a platform with native hwasan support. A flag -fsanitize-hwaddress-abi={interceptor,platform} has been introduced for selecting the runtime ABI to target. The default ABI is set to interceptor since it's assumed that it will be more common that users will be compiling application code than platform code. Because we can no longer assume that the TLS slot is initialized, the pthread_create interceptor is no longer necessary, so it has been removed. Ideally, lazy initialization should only cost one instruction in the hot path, but at present the call may cause us to spill arguments to the stack, which means more instructions in the hot path (or theoretically in the cold path if the spills are moved with shrink wrapping). With an appropriately chosen calling convention for the per-thread initialization function (TODO) the hot path should always need just one instruction and the cold path should need two instructions with no spilling required. Differential Revision: https://reviews.llvm.org/D56038 llvm-svn: 350429
* [HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file typesAaron Enye Shi2019-01-041-0/+1
| | | | | | | | | | The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files. Reviewers: yaxunl Differential Revision: https://reviews.llvm.org/D56321 llvm-svn: 350426
* [HIP][DRIVER][OFFLOAD] Do not unbundle unsupported file typesAaron Enye Shi2019-01-042-0/+23
| | | | | | The offload bundler action should not unbundle the input file types that does not match the action type. This fixes an issue where .so files are unbundled when the action type is object files. llvm-svn: 350425
* [ThinLTO] Clang changes to utilize new pass to handle chains of aliasesTeresa Johnson2019-01-042-2/+10
| | | | | | | | | | | | | | | | Summary: As with NameAnonGlobals, invoke the new CanonicalizeAliases via clang when using the new PM. Depends on D54507. Reviewers: pcc, davidxl Subscribers: mehdi_amini, inglorion, steven_wu, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D55620 llvm-svn: 350424
* [ObjCARC] Add an new attribute, objc_externally_retainedErik Pilkington2019-01-0416-57/+500
| | | | | | | | | | | | | | | | | | | | This attribute, called "objc_externally_retained", exposes clang's notion of pseudo-__strong variables in ARC. Pseudo-strong variables "borrow" their initializer, meaning that they don't retain/release it, instead assuming that someone else is keeping their value alive. If a function is annotated with this attribute, implicitly strong parameters of that function aren't implicitly retained/released in the function body, and are implicitly const. This is useful to expose for performance reasons, most functions don't need the extra safety of the retain/release, so programmers can opt out as needed. This attribute can also apply to declarations of local variables, with similar effect. Differential revision: https://reviews.llvm.org/D55865 llvm-svn: 350422
* [OPENMP][NVPTX]Use new functions from the runtime library.Alexey Bataev2019-01-0412-54/+67
| | | | | | Updated codegen to use the new functions from the runtime library. llvm-svn: 350415
* Add two new pragmas for controlling software pipelining optimizations.Aaron Ballman2019-01-0412-35/+280
| | | | | | | | This patch adds #pragma clang loop pipeline and #pragma clang loop pipeline_initiation_interval for debugging or reducing compile time purposes. It is possible to disable SWP for concrete loops to save compilation time or to find bugs by not doing SWP to certain loops. It is possible to set value of initiation interval to concrete number to save compilation time by not doing extra pipeliner passes or to check created schedule for specific initiation interval. Patch by Alexey Lapshin. llvm-svn: 350414
* Refactor the way we handle diagnosing unused expression results.Aaron Ballman2019-01-0421-122/+196
| | | | | | | | Rather than sprinkle calls to DiagnoseUnusedExprResult() around in places where we want diagnostics, we now diagnose unused expression statements and full expressions in a more generic way when acting on the final expression statement. This results in more appropriate diagnostics for [[nodiscard]] where we were previously lacking them, such as when the body of a for loop is not a compound statement. This patch fixes PR39837. llvm-svn: 350404
* Prevent unreachable when checking invalid multiversion decls.Erich Keane2019-01-042-0/+17
| | | | | | | | | | | CPUSpecifc/CPUDispatch call resolution assumed that all declarations that would be passed are valid, however this was an invalid assumption. This patch deals with those situations by making the valid version take priority. Note that the checked ordering is arbitrary, since both are replaced by calls to the resolver later. Change-Id: I7ff2ec88c55a721d51bc1f39ea1a1fe242b4e45f llvm-svn: 350398
* [Basic] Extend DiagnosticEngine to store and format Qualifiers.Anastasia Stulova2019-01-048-33/+51
| | | | | | | | | | | Qualifiers can now be streamed into the DiagnosticEngine using regular << operator. If Qualifiers are empty 'unqualified' will be printed in the diagnostic otherwise regular qual syntax is used. Differential Revision: https://reviews.llvm.org/D56198 llvm-svn: 350386
* Adopt SwiftABIInfo for WebAssembly.Daniel Dunbar2019-01-031-6/+17
| | | | | | | | | | | | | | | | | Summary: - This adopts SwiftABIInfo as the base class for WebAssemblyABIInfo, which is in keeping with what is done for other targets for which Swift is supported. - This is a minimal patch to unblock exploration of WASM support for Swift (https://bugs.swift.org/browse/SR-9307) Reviewers: rjmccall, sunfish Reviewed By: rjmccall Subscribers: ahti, dschuff, sbc100, jgravelle-google, aheejin, cfe-commits Differential Revision: https://reviews.llvm.org/D56188 llvm-svn: 350372
* Fix MSVC visualizations for ActionResult and OpaquePtrMike Spertus2019-01-031-32/+8
| | | | | | | Mainly just fixing buggy code. Also removed unnecessary visualizers for specializations of OpaquePtr llvm-svn: 350371
* Fix check-hwasan with LLVM_BUILD_EXTERNAL_COMPILER_RT=ONEvgeniy Stepanov2019-01-031-1/+1
| | | | | | Add a forwarding target for check-hwasan in clang. llvm-svn: 350363
* [cmake] Fix monorepo + LLVM_BUILD_EXTERNAL_COMPILER_RT=ON.Evgeniy Stepanov2019-01-031-1/+1
| | | | | | | | | In cmake 3.10.2, if (${VARIABLE_NAME}) seems to always be false no matter what documentation says (or maybe I just failed at reading). Anyway, if (VARIABLE_NAME) seems to do what this code intended. llvm-svn: 350361
* Validate -add-plugin arguments.Nico Weber2019-01-032-1/+20
| | | | | | | | | -plugin already prints an error if the name of an unknown plugin is passed. -add-plugin used to silently ignore that, now it errors too. Differential Revision: https://reviews.llvm.org/D56273 llvm-svn: 350340
* Make -Wstring-plus-int warns even if when the result is not out of boundsArnaud Bienner2019-01-033-24/+13
| | | | | | | | | | | | | | Summary: Patch by Arnaud Bienner Reviewers: sylvestre.ledru, thakis, serge-sans-paille Reviewed By: thakis Subscribers: arphaman, dyung, anemet, llvm-commits, cfe-commits Differential Revision: https://reviews.llvm.org/D55382 llvm-svn: 350335
* [OPENMP][NVPTX]Use __kmpc_barrier_simple_spmd(nullptr, 0) instead ofAlexey Bataev2019-01-038-63/+83
| | | | | | | | | | nvvm_barrier0. Use runtime functions instead of the direct call to the nvvm intrinsics. It allows to prevent some dangerous LLVM optimizations, that breaks the code for the NVPTX target. llvm-svn: 350328
* Portable Python script across Python versionSerge Guelton2019-01-033-3/+3
| | | | | | | | Get rid of Python version specific shebang. Differential Revision: https://reviews.llvm.org/D55207 llvm-svn: 350319
* Portable Python script across Python versionSerge Guelton2019-01-033-12/+20
| | | | | | | | StringIO is obsoleted in Python3, replaced by io.BytesIO or io.StringIO depending on the use. Differential Revision: https://reviews.llvm.org/D55196 llvm-svn: 350318
* Diagnose an unused result from a call through a function pointer whose ↵Aaron Ballman2019-01-036-33/+57
| | | | | | | | | | return type is marked [[nodiscard]]. When a function returns a type and that type was declared [[nodiscard]], we diagnose any unused results from that call as though the function were marked nodiscard. The same behavior should apply to calls through a function pointer. This addresses PR31526. llvm-svn: 350317
* [NewPM] Port MsanPhilip Pfaffe2019-01-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Keeping msan a function pass requires replacing the module level initialization: That means, don't define a ctor function which calls __msan_init, instead just declare the init function at the first access, and add that to the global ctors list. Changes: - Pull the actual sanitizer and the wrapper pass apart. - Add a newpm msan pass. The function pass inserts calls to runtime library functions, for which it inserts declarations as necessary. - Update tests. Caveats: - There is one test that I dropped, because it specifically tested the definition of the ctor. Reviewers: chandlerc, fedor.sergeev, leonardchan, vitalybuka Subscribers: sdardis, nemanjai, javed.absar, hiraditya, kbarton, bollu, atanasyan, jsji Differential Revision: https://reviews.llvm.org/D55647 llvm-svn: 350305
* Fix incorrect column numbers in test from r350282.Alex Lorenz2019-01-031-2/+2
| | | | | | After the test was reformatted using clang-format the numbers became invalid. llvm-svn: 350283
* [libclang] CoroutineBody/Coreturn statements are UnexposedStmts and not ExprsAlex Lorenz2019-01-032-3/+30
| | | | | | | | | | | | | This change ensures that the libclang CXCursor represents the CoroutineBody and the Coreturn statement using the appropriate CXCursor_UnexposedStmt kind instead of CXCursor_UnexposedExpr. The problem with CXCursor_UnexposedExpr is that the consumer functions assumed that CoroutineBody/Coreturn statements were valid expressions and performed an invalid downcast to Expr causing assertion failures or other crashes. rdar://40204290 llvm-svn: 350282
* Make test/Driver/darwin-sdk-version.c pass if the host triple is 32-bitNico Weber2019-01-031-2/+2
| | | | | | | | | | | For some reason, the cmake build on my macbook has LLVM_HOST_TRIPLE:STRING=i386-apple-darwin16.7.0 . test/Driver/darwin-sdk-version.c assumed that the host triple is 64-bit, so make it resilient against 32-bit host triples. Differential Revision: https://reviews.llvm.org/D56067 llvm-svn: 350278
* [OpenMP] Added support for explicit mapping of classes using 'this' pointer. ↵Patrick Lyster2019-01-026-5/+183
| | | | | | Differential revision: https://reviews.llvm.org/D55982 llvm-svn: 350252
* Only convert objc messages to alloc to objc_alloc if the receiver is a class.Pete Cooper2019-01-022-4/+22
| | | | | | | | | | r348687 converted [Foo alloc] to objc_alloc(Foo). However the objc runtime method only takes a Class, not an arbitrary pointer. This makes sure we are messaging a class before we convert these messages. rdar://problem/46943703 llvm-svn: 350224
* [CMake][Fuchsia] Include check-lld in the list of bootstrap targetsPetr Hosek2019-01-021-0/+3
| | | | | | | | This allows running lld tests when doing 2-stage toolchain build. Differential Revision: https://reviews.llvm.org/D56181 llvm-svn: 350202
* Fix some typos in the clang doc.Sylvestre Ledru2019-01-014-6/+6
| | | | | | | Fixed with: $ codespell -w ClangFormatStyleOptions.rst Toolchain.rst LanguageExtensions.rst ClangCommandLineReference.rst llvm-svn: 350192
* clang-format-diff: add an example with hgSylvestre Ledru2019-01-011-0/+6
| | | | llvm-svn: 350191
* Make clearer which clang::type subclasses have visualizersMike Spertus2018-12-311-1/+1
| | | | llvm-svn: 350182
* DeclAccessPair visualizer should be expandableMike Spertus2018-12-301-0/+4
| | | | llvm-svn: 350167
* [CodeGen] Replace '@' characters in block descriptors' symbol names withAkira Hatanaka2018-12-293-2/+19
| | | | | | | | | | | | | | '\1'. '@' can't be used in block descriptors' symbol names since it is reserved on ELF platforms as a separator between symbol names and symbol versions. See the discussion here: https://reviews.llvm.org/D50783. Differential Revision: https://reviews.llvm.org/D54539 llvm-svn: 350157
* Add vtable anchor to classes.Richard Trieu2018-12-296-0/+10
| | | | llvm-svn: 350143
* [objc-gnustep2] Fix a bug in category generation.David Chisnall2018-12-282-6/+45
| | | | | | | | | We were not emitting a protocol definition while generating the category method list. This was fine in most cases, because something else in the library typically referenced any given protocol, but it caused linker failures if the category was the only reference to a given protocol. llvm-svn: 350130
* [OPENMP]Fix processing of the clauses on target combined directives.Alexey Bataev2018-12-282-4/+28
| | | | | | | | For constants with the predefined data-sharing clauses we may had troubles with the target combined directives. It may cause compiler crash in some corner cases. llvm-svn: 350127
* [objc-gnustep] Fix a copy-and-paste error.David Chisnall2018-12-271-1/+1
| | | | | | | We were emitting the null class symbol in the wrong section, which meant that programs that contained no Objective-C classes would fail to link. llvm-svn: 350092
* [clang-cl] Treat inputs as C++ with /E, like MSVCReid Kleckner2018-12-262-1/+22
| | | | | | | | | | | | | | | | | midl invokes the compiler on .idl files with /E. Before this change, we would treat unrecognized inputs as object files. Now we pre-process to stdout as expected. I checked that MSVC defines __cplusplus when invoked this way, so treating the input as C++ seems like the right thing to do. After this change, I was able to run midl like this with clang-cl: $ midl -cpp_cmd clang-cl.exe foo.idl Things worked for the example IDL file in the Microsoft documentation, but beyond that, I don't know if this will work well. Fixes PR40140 llvm-svn: 350072
* [MS] Mangle return adjusting thunks with the public access specifierReid Kleckner2018-12-262-6/+41
| | | | | | | | MSVC does this, so we should too. Fixes PR40138 llvm-svn: 350071
* Ignore ConstantExpr in IgnoreParensReid Kleckner2018-12-262-4/+6
| | | | | | | | | | | | | | | | | | Summary: This moves it up from IgnoreParenImpCasts to IgnoreParens, so that more helpers ignore it. For most clients, this ensures that these helpers behave the same with and without C++17 enabled, which is what appears to introduce these new expression nodes. Fixes PR39881 Reviewers: void, rsmith Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D55853 llvm-svn: 350068
* Pass a concrete triple for two OpenMP tests that depend on TLSNico Weber2018-12-262-26/+26
| | | | | | | | | | | | | | | Not all %itanium_abi_triple values support TLS. Makes OpenMP/declare_reduction_codegen.cpp, OpenMP/parallel_copyin_codegen.cpp for %itanium_abi_triples without TLS support. Alternatively we could pass -fnoopenmp-use-tls and tweak some of the CHECK lines, but this seems a bit simpler. Fixes PR40156. Differential Revision: https://reviews.llvm.org/D56086 llvm-svn: 350067
* [analyzer] [NFC] Clean up the mess of constructing argument effects in ↵George Karpenkov2018-12-242-71/+91
| | | | | | | | | | | | | | RetainCountChecker Previously, argument effects were stored in a method variable, which was effectively global. The global state was reset at each (hopefully) entrance point to the summary construction, and every function could modify it. Differential Revision: https://reviews.llvm.org/D56036 llvm-svn: 350057
* [Driver] Disable -faddrsig on Gentoo by defaultMichal Gorny2018-12-233-0/+8
| | | | | | | | | | | | | | Gentoo supports combining clang toolchain with GNU binutils, and many users actually do that. As -faddrsig is not supported by GNU strip, this results in a lot of warnings. Disable it by default and let users enable it explicitly if they want it; with the intent of reevaluating when the underlying feature becomes standarized. See also: https://bugs.gentoo.org/667854 Differential Revision: https://reviews.llvm.org/D56047 llvm-svn: 350028
* [Distro] Support detecting GentooMichal Gorny2018-12-233-0/+44
| | | | | | | | | | | Add support for distinguishing plain Gentoo distribution, and a unit test for it. This is going to be used to introduce distro-specific customizations in the driver code; most notably, it is going to be used to disable -faddrsig. Differential Revision: https://reviews.llvm.org/D56024 llvm-svn: 350027
* Improving this fatal diagnostic to help checker developers figure out what's ↵Aaron Ballman2018-12-221-3/+4
| | | | | | actually gone wrong when they hit it. llvm-svn: 350004
* [AST] Store the arguments of CXXConstructExpr in a trailing arrayBruno Ricci2018-12-227-179/+274
| | | | | | | | | | | | | | | Store the arguments of CXXConstructExpr in a trailing array. This is very similar to the CallExpr case in D55771, with the exception that there is only one derived class (CXXTemporaryObjectExpr) and that we compute the offset to the trailing array instead of storing it. This saves one pointer per CXXConstructExpr and CXXTemporaryObjectExpr. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D56022 llvm-svn: 350003
* [analyzer] pr38668: Do not attempt to cast loaded integers to floats.Artem Dergachev2018-12-226-11/+97
| | | | | | | | | | | | | | | | | | | | | | This patch is a different approach to landing the reverted r349701. It is expected to have the same object (memory region) treated as if it has different types in different program points. The correct behavior for RegionStore when an object is stored as an object of type T1 but loaded as an object of type T2 is to store the object as if it has type T1 but cast it to T2 during load. Note that the cast here is some sort of a "reinterpret_cast" (even in C). For instance, if you store an integer and load a float, you won't get your integer represented as a float; instead, you will get garbage. Admit that we cannot perform the cast and return an unknown value. Differential Revision: https://reviews.llvm.org/D55875 rdar://problem/45062567 llvm-svn: 349984
* [CUDA] Treat extern global variable shadows same as regular extern vars.Artem Belevich2018-12-222-16/+18
| | | | | | | | | | | This fixes compiler crash when we attempted to compile this code: extern __device__ int data; __device__ int data = 1; Differential Revision: https://reviews.llvm.org/D56033 llvm-svn: 349981
* Switch from static_cast<> to cast<>, update identifier for coding ↵Aaron Ballman2018-12-211-4/+2
| | | | | | conventions; NFC. llvm-svn: 349955
* Convert some ObjC retain/release msgSends to runtime calls.Pete Cooper2018-12-215-0/+200
| | | | | | | | | | It is faster to directly call the ObjC runtime for methods such as retain/release instead of sending a message to those functions. Differential Revision: https://reviews.llvm.org/D55869 Reviewed By: rjmccall llvm-svn: 349952
OpenPOWER on IntegriCloud