summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* DR126: partially implement the const-correct rules for exception handler ↵Richard Smith2018-01-132-104/+109
| | | | | | | | | matching. While here, fix up the myriad other ways in which Sema's two "can this handler catch that exception?" implementations get things wrong and unify them. llvm-svn: 322431
* Remove unused addIfPresent function.Eric Christopher2018-01-131-4/+0
| | | | llvm-svn: 322427
* When rebuilding an InitListExpr, don't give it a type.Richard Smith2018-01-121-16/+5
| | | | | | | | InitListExprs without types (well, with type 'void') represent not-yet-analyzed initializer lists; InitListExpr with types fool Sema into thinking they don't need further analysis in some cases (particularly C++17 copy omission). llvm-svn: 322414
* [DWARFv5] Have -gdwarf-5 generate MD5 checksumsPaul Robinson2018-01-121-1/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D42011 llvm-svn: 322413
* [analyzer] Don't flag strcpy of string literals into sufficiently large buffers.Artem Dergachev2018-01-121-0/+11
| | | | | | | | | | | | | | | In the security package, we have a simple syntactic check that warns about strcpy() being insecure, due to potential buffer overflows. Suppress that check's warning in the trivial situation when the source is an immediate null-terminated string literal and the target is an immediate sufficiently large buffer. Patch by András Leitereg! Differential Revision: https://reviews.llvm.org/D41384 llvm-svn: 322410
* Allocate and access NormalCleanupDest with the natural alignment of i32.John McCall2018-01-123-10/+11
| | | | | | | | | This alignment can be less than 4 on certain embedded targets, which may not even be able to deal with 4-byte alignment on the stack. Patch by Jacob Young! llvm-svn: 322406
* Refactor handling of signext/zeroext in ABIArgInfoAlex Bradbury2018-01-123-62/+52
| | | | | | | | | | | | | | | | | | | | As @rjmccall suggested in D40023, we can get rid of ABIInfo::shouldSignExtUnsignedType (used to handle cases like the Mips calling convention where 32-bit integers are always sign extended regardless of the sign of the type) by adding a SignExt field to ABIArgInfo. In the common case, this new field is set automatically by ABIArgInfo::getExtend based on the sign of the type. For targets that want greater control, they can use ABIArgInfo::getSignExtend or ABIArgInfo::getZeroExtend when necessary. This change also cleans up logic in CGCall.cpp. There is no functional change intended in this patch, and all tests pass unchanged. As noted in D40023, Mips might want to sign-extend unsigned 32-bit integer return types. A future patch might modify MipsABIInfo::classifyReturnType to use MipsABIInfo::extendType. Differential Revision: https://reviews.llvm.org/D41999 llvm-svn: 322396
* [OPENMP] Replace calls of getAssociatedStmt().Alexey Bataev2018-01-126-113/+107
| | | | | | | | | | | | | getAssociatedStmt() returns the outermost captured statement for the OpenMP directive. It may return incorrect region in case of combined constructs. Reworked the code to reduce the number of calls of getAssociatedStmt() and used getInnermostCapturedStmt() and getCapturedStmt() functions instead. In case of firstprivate variables it may lead to an extra allocas generation for private copies even if the variable is passed by value into outlined function and could be used directly as private copy. llvm-svn: 322393
* [Lex] Avoid out-of-bounds dereference in LexAngledStringLiteral.Volodymyr Sapsai2018-01-121-8/+11
| | | | | | | | | | | | | | | | | | | | | | Fix makes the loop in LexAngledStringLiteral more like the loops in LexStringLiteral, LexCharConstant. When we skip a character after backslash, we need to check if we reached the end of the file instead of reading the next character unconditionally. Discovered by OSS-Fuzz: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=3832 rdar://problem/35572754 Reviewers: arphaman, kcc, rsmith, dexonsmith Reviewed By: rsmith, dexonsmith Subscribers: cfe-commits, rsmith, dexonsmith Differential Revision: https://reviews.llvm.org/D41423 llvm-svn: 322390
* [WebAssembly] Support -stdlib=libc++ switchSam Clegg2018-01-122-0/+22
| | | | | | | | | | | | | | Referenced implementation from Fuchsia and Darwin Toolchain. Still only support CST_Libcxx. Now checks that the argument is really '-stdlib=libc++', and display error. Also, now will pass -lc++ and -lc++abi to the linker. Patch by Patrick Cheng! Differential Revision: https://reviews.llvm.org/D41937 llvm-svn: 322382
* [CodeComplete] Add an option to omit results from the preamble.Sam McCall2018-01-123-50/+80
| | | | | | | | | | | | | | | | | | | | | | | Summary: Enumerating the contents of a namespace or global scope will omit any decls that aren't already loaded, instead of deserializing them from the PCH. This allows a fast hybrid code completion where symbols from headers are provided by an external index. (Sema already exposes the information needed to do a reasonabl job of filtering them). Clangd plans to implement this hybrid. This option is just a hint - callers still need to postfilter results if they want to *avoid* completing decls outside the main file. Reviewers: bkramer, ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41989 llvm-svn: 322371
* [ODRHash] Don't hash friend functions.Richard Trieu2018-01-121-0/+2
| | | | | | | | In certain combinations of templated classes and friend functions, the body of friend functions does not get propagated along with function signature. Exclude friend functions for hashing to avoid this case. llvm-svn: 322350
* Add `__reference_binds_to_temporary` trait for checking safe reference ↵Eric Fiselier2018-01-121-1/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | initialization. Summary: The STL types `std::pair` and `std::tuple` can both store reference types. However their constructors cannot adequately check if the initialization of reference types is safe. For example: ``` std::tuple<std::tuple<int> const&> t = 42; // The stored reference is already dangling. ``` Libc++ has a best effort attempts in tuple to diagnose this, but they're not able to handle all valid cases (If I'm not mistaken). For example initialization of a reference from the result of a class's conversion operator. Libc++ would benefit from having a builtin traits which can provide a much better implementation. This patch introduce the `__reference_binds_to_temporary(T, U)` trait that determines whether a reference of type `T` bound to an expression of type `U` would bind to a materialized temporary object. Note that the trait simply returns false if `T` is not a reference type instead of reporting it as an error. ``` static_assert(__is_constructible(int const&, long)); static_assert(__reference_binds_to_temporary(int const&, long)); ``` Reviewers: majnemer, rsmith Reviewed By: rsmith Subscribers: compnerd, cfe-commits Differential Revision: https://reviews.llvm.org/D29930 llvm-svn: 322334
* [WebAssembly] Remove `-allow-undefined-file wasm.syms` from linker argsSam Clegg2018-01-111-2/+0
| | | | | | | | See: https://github.com/WebAssembly/tool-conventions/issues/35 Differential Revision: https://reviews.llvm.org/D41923 llvm-svn: 322321
* Make internal/private GVs implicitly dso_local.Rafael Espindola2018-01-111-0/+1
| | | | | | | | | | | | | | | | While updating clang tests for having clang set dso_local I noticed that: - There are *a lot* of tests to update. - Many of the updates are redundant. They are redundant because a GV is "obviously dso_local". This patch starts formalizing that a bit by requiring that internal and private GVs be dso_local too. Since they all are, we don't have to print dso_local to the textual representation, making it a bit more compact and easier to read. llvm-svn: 322318
* Handle scoped_lockable objects being returned by value in C++17.Richard Smith2018-01-111-5/+51
| | | | | | | | | | | In C++17, guaranteed copy elision means that there isn't necessarily a constructor call when a local variable is initialized by a function call that returns a scoped_lockable by value. In order to model the effects of initializing a local variable with a function call returning a scoped_lockable, pretend that the move constructor was invoked within the caller at the point of return. llvm-svn: 322316
* [OpenCL] Reorder the CLK_sRGBx/sRGBA defines, NFCSven van Haastregt2018-01-111-1/+1
| | | | | | | Swap them so that all channel order defines are ordered according to their values. llvm-svn: 322278
* [RISCV] Add the RISCV target and compiler driverAlex Bradbury2018-01-1111-1/+379
| | | | | | | | | As RV64 codegen has not yet been upstreamed into LLVM, we focus on RV32 driver support (RV64 to follow). Differential Revision: https://reviews.llvm.org/D39963 llvm-svn: 322276
* [Lex] Use WritableMemoryBuffer in ScratchBuffer.cppPavel Labath2018-01-111-4/+4
| | | | | | | | This avoids the need to const_cast the buffer contents to write to it. NFCI. llvm-svn: 322268
* Revert "[Driver] Update default sanitizer blacklist location"Petr Hosek2018-01-111-1/+1
| | | | | | This reverts commit r322258: broke the dfsan build. llvm-svn: 322260
* Reland "[Driver] Update default sanitizer blacklist location"Petr Hosek2018-01-111-1/+1
| | | | | | | | | This is related to moving the sanitizer blacklists to share/ subdirectory. Differential Revision: https://reviews.llvm.org/D41706 llvm-svn: 322258
* [X86][Sema] Range check the constant argument for the vpshld/vpshrd builtins ↵Craig Topper2018-01-111-0/+18
| | | | | | to ensure it fits in 8-bits. llvm-svn: 322247
* [X86] Make -mavx512f imply -mfma and -mf16c in the frontend like it does in ↵Craig Topper2018-01-111-1/+5
| | | | | | | | | | the backend. Similarly, make -mno-fma and -mno-f16c imply -mno-avx512f. Withou this "-mno-sse -mavx512f" ends up with avx512f being enabled in the frontend but disabled in the backend. llvm-svn: 322245
* [X86][Sema] Remove constant range checks on on builtins that take a char.Craig Topper2018-01-111-37/+0
| | | | | | The constant is already reduced to 8-bits by the time we get here and the checks were just ensuring that it was 8 bits. Thus I don't think there's anyway for them to fail. llvm-svn: 322244
* Revert "[Driver] Update default sanitizer blacklist location"Petr Hosek2018-01-111-1/+1
| | | | | | This reverts commit r322233: this is breaking dfsan tests. llvm-svn: 322242
* In C++17, when instantiating an out-of-line definition of an inline static dataRichard Smith2018-01-101-1/+2
| | | | | | member, don't forget to instantiate the initializer too. llvm-svn: 322236
* Reland "[Driver] Update default sanitizer blacklist location"Petr Hosek2018-01-101-1/+1
| | | | | | | | | This is related to moving the sanitizer blacklists to share/ subdirectory. Differential Revision: https://reviews.llvm.org/D41706 llvm-svn: 322233
* Revert "[Driver] Update default sanitizer blacklist location"Petr Hosek2018-01-101-1/+1
| | | | | | This reverts commit r322154 because it broke sanitizer bots. llvm-svn: 322155
* [Driver] Update default sanitizer blacklist locationPetr Hosek2018-01-101-1/+1
| | | | | | | | | This is related to moving the sanitizer blacklists to share/ subdirectory. Differential Revision: https://reviews.llvm.org/D41706 llvm-svn: 322154
* [analyzer] [NFC] Minor refactoring of trackNullOrUndefValueGeorge Karpenkov2018-01-101-80/+97
| | | | | | | | | Simple refactoring attempt: factor out some code, remove some repetition, use auto where appropriate. Differential Revision: https://reviews.llvm.org/D41751 llvm-svn: 322151
* [analyzer] [NFC] minor FindLastStoreBRVisitor refactoringGeorge Karpenkov2018-01-101-112/+127
| | | | | | Differential Revision: https://reviews.llvm.org/D41790 llvm-svn: 322150
* [analyzer] suppress nullability inference from a macro when result is used ↵George Karpenkov2018-01-101-4/+14
| | | | | | | | | | | | | | | | | | in another macro The current code used to not suppress the report, if the dereference was performed in a macro, assuming it is that same macro. However, the assumption might not be correct, and XNU has quite a bit of code where dereference is actually performed in a different macro. As the code uses macro name and not a unique identifier it might be fragile, but in a worst-case scenario we would simply emit an extra diagnostic. rdar://36160245 Differential Revision: https://reviews.llvm.org/D41749 llvm-svn: 322149
* Reland "Emit Function IDs table for Control Flow Guard"Adrian McCarthy2018-01-093-0/+10
| | | | | | | | | | | | | | | | | Adds option /guard:cf to clang-cl and -cfguard to cc1 to emit function IDs of functions that have their address taken into a section named .gfids$y for compatibility with Microsoft's Control Flow Guard feature. The original patch didn't have the lit.local.cfg file that restricts the new test to x86, thus the new test was failing on the non-x86 bots. Differential Revision: https://reviews.llvm.org/D40531 The reverts r322008, which was a revert of r322005. This reverts commit a05b89f9aca70597dc79fe97bc49b50b51f525ba. llvm-svn: 322136
* Wire up GCOV to the new pass managerDavid Blaikie2018-01-091-15/+24
| | | | | | | | | | GCOV in the old pass manager also strips debug info (if debug info is disabled/only produced for profiling anyway) after the GCOV pass runs. I think the strip pass hasn't been ported to the new pass manager, so it might take me a little while to wire that up. llvm-svn: 322126
* [Frontend] Remove unused FileMgr in pp arg parseBrian Gesiak2018-01-091-7/+1
| | | | | | | | | | | | | | | | | | | | | Summary: A FIXME added 8 years ago (2010) in https://reviews.llvm.org/rL118203 mentioned that a FileManager should not need to be used when parsing preprocessor arguments. In fact, its only use was removed 6 years ago (2012), in https://reviews.llvm.org/rL166452. Remove the unused variable and the obsolete FIXME. Test Plan: `check-clang` Reviewers: v.g.vassilev Reviewed By: v.g.vassilev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41867 llvm-svn: 322118
* [OPENMP] Fix directive kind on stand-alone target data directives, NFC.Alexey Bataev2018-01-091-1/+1
| | | | llvm-svn: 322112
* [OpenMP] Fix handling of clause on wrong directive, by Joel. E. DennyAlexey Bataev2018-01-091-13/+30
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: First, this patch fixes an assert failure when, for example, "omp for" has num_teams. Second, this patch prevents duplicate diagnostics when, for example, "omp for" has uniform. This patch makes the general assumption (even where it doesn't necessarily fix an existing bug) that it is worthless to perform sema for a clause that appears on a directive on which OpenMP does not permit that clause. However, due to this assumption, this patch suppresses some diagnostics that were expected in the test suite. I assert that those diagnostics were likely just distracting to the user. Reviewers: ABataev Reviewed By: ABataev Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41841 llvm-svn: 322107
* [ASTImporter] Support importing CXXUnresolvedConstructExpr and ↵Aleksei Sidorin2018-01-091-0/+61
| | | | | | | | | | | | | UnresolvedLookupExpr * Note: This solution is based on https://github.com/haoNoQ/clang/blob/summary-ipa-draft/lib/AST/ASTImporter.cpp#L7605. Patch by Peter Szecsi! Differential Revision: https://reviews.llvm.org/D38694 llvm-svn: 322091
* [ASTImporter] Fix missing SourceLoc import for ObjCMethodDecl selectorsAleksei Sidorin2018-01-091-1/+5
| | | | | | | | Patch by Nico Rieck, test case by Sean Callanan! Differential Revision: https://reviews.llvm.org/D6550 llvm-svn: 322079
* Track in the AST whether the operand to a UnaryOperator can overflow and ↵Aaron Ballman2018-01-0916-167/+191
| | | | | | then use that logic when evaluating constant expressions and emitting codegen. llvm-svn: 322074
* ananas: Add shared library supportEd Schouten2018-01-091-5/+25
| | | | | | | | | | | | | The Ananas Operating System (https://github.com/zhmu/ananas) has shared library support as of commit 57739c0b6ece56dd4872aedf30264ed4b9412c77. This change adds the necessary settings to clang so that shared executables and libraries can be build correctly. Submitted by: Rink Springer Differential Revision: https://reviews.llvm.org/D41500 llvm-svn: 322064
* Added Control Flow Protection FlagOren Ben Simhon2018-01-096-1/+62
| | | | | | | | | | Cf-protection is a target independent flag that instructs the back-end to instrument control flow mechanisms like: Branch, Return, etc. For example in X86 this flag will be used to instrument Indirect Branch Tracking instructions. Differential Revision: https://reviews.llvm.org/D40478 Change-Id: I5126e766c0e6b84118cae0ee8a20fe78cc373dea llvm-svn: 322063
* Fix use-after-free found by address-san on -r322028.Erich Keane2018-01-091-1/+5
| | | | | | | | | | | r322028 attempted to remove something from the "Manglings" list when it was no longer valid, and did so with 'erase'. However, StringRefs to these were stored, so these became dangling references. This patch changes to using 'remove' instead of 'erase' to keep the strings valid. llvm-svn: 322052
* [X86] Replace cvt*2mask intrinsics with native IR using 'icmp slt X, ↵Craig Topper2018-01-081-4/+27
| | | | | | zeroinitializer. llvm-svn: 322038
* PR35862: Suppress -Wmissing-variable-declarations warning on inline variables,Richard Smith2018-01-081-0/+2
| | | | | | variable templates, and instantiations thereof. llvm-svn: 322030
* Implement Attribute Target MultiVersioningErich Keane2018-01-0812-24/+758
| | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC's attribute 'target', in addition to being an optimization hint, also allows function multiversioning. We currently have the former implemented, this is the latter's implementation. This works by enabling functions with the same name/signature to coexist, so that they can all be emitted. Multiversion state is stored in the FunctionDecl itself, and SemaDecl manages the definitions. Note that it ends up having to permit redefinition of functions so that they can all be emitted. Additionally, all versions of the function must be emitted, so this also manages that. Note that this includes some additional rules that GCC does not, since defining something as a MultiVersion function after a usage has been made illegal. The only 'history rewriting' that happens is if a function is emitted before it has been converted to a multiversion'ed function, at which point its name needs to be changed. Function templates and virtual functions are NOT yet supported (not supported in GCC either). Additionally, constructors/destructors are disallowed, but the former is planned. llvm-svn: 322028
* [DOXYGEN] Fix doxygen and content issues in avxintrin.hDouglas Yung2018-01-081-201/+200
| | | | | | | | | | - Fix incorrect wording in various intrinsic descriptions. Previously the descriptions used "low-order" and "high-order" when the intended meaning was "even-indexed" and "odd-indexed". - Fix a few typos and errors found during review. - Restore new line endings. This patch was made by Craig Flores llvm-svn: 322027
* Factor out comparison handling for arithmetic types.Richard Smith2018-01-081-35/+50
| | | | | | | | | | This is not quite NFC: we don't perform the usual arithmetic conversions unless we have an operand of arithmetic or enumeration type any more. This matches the standard rule, but actually has no effect other than to marginally improve our diagnostics for the non-arithmetic, non-enumeration cases (by not performing integral promotions on one operand if the other is a pointer). llvm-svn: 322024
* [Myriad] Remove invalidated -elf flag for MoviAsmWalter Lee2018-01-081-1/+0
| | | | | | | | | | | | | | Summary: The flag has been deprecated, and is becoming invalid in the latest MDK. Reviewers: jyknight Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D41713 llvm-svn: 322023
* [OPENMP] Fix debug info for outlined functions in NVPTX + add more tests.Alexey Bataev2018-01-081-4/+4
| | | | | | | Fixed name of emitted outlined functions in NVPTX target + extra tests for the debug info. llvm-svn: 322022
OpenPOWER on IntegriCloud