summaryrefslogtreecommitdiffstats
path: root/clang/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* [OPENMP][BLOCKS]Fix PR38923: reference to a global variable is capturedAlexey Bataev2018-08-201-1/+2
| | | | | | | | | | | by a block. Added checks for capturing of the variable in the block when trying to emit correct address for the variable with the reference type. This extra check allows correctly identify the variables that are not captured in the block context. llvm-svn: 340181
* [NFC] Don't define static function in header (UninitializedObject.h)Andrei Elovikov2018-08-202-5/+3
| | | | | | | | | | | | | | | | Summary: See also http://lists.llvm.org/pipermail/cfe-users/2016-January/000854.html for the reasons why it's bad. Reviewers: Szelethus, erichkeane Reviewed By: Szelethus Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50963 llvm-svn: 340174
* [CodeGen] add rotate builtins that map to LLVM funnel shift Sanjay Patel2018-08-192-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a partial retry of rL340137 (reverted at rL340138 because of gcc host compiler crashing) with 1 change: Remove the changes to make microsoft builtins also use the LLVM intrinsics. This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang (when both halves of a funnel shift are the same value, it's a rotate). We're free to name these as we want because we're not copying gcc, but if there's some other existing art (eg, the microsoft ops) that we want to replicate, we can change the names. The funnel shift intrinsics were added here: https://reviews.llvm.org/D49242 With improved codegen in: https://reviews.llvm.org/rL337966 https://reviews.llvm.org/rL339359 And basic IR optimization added in: https://reviews.llvm.org/rL338218 https://reviews.llvm.org/rL340022 ...so these are expected to produce asm output that's equal or better to the multi-instruction alternatives using primitive C/IR ops. In the motivating loop example from PR37387: https://bugs.llvm.org/show_bug.cgi?id=37387#c7 ...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source. Differential Revision: https://reviews.llvm.org/D50924 llvm-svn: 340141
* revert r340137: [CodeGen] add rotate builtinsSanjay Patel2018-08-192-39/+40
| | | | | | At least a couple of bots (gcc host compiler on PPC only?) are showing the compiler dying while trying to compile. llvm-svn: 340138
* [CodeGen] add/fix rotate builtins that map to LLVM funnel shift (retry)Sanjay Patel2018-08-192-40/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a retry of rL340135 (reverted at rL340136 because of gcc host compiler crashing) with 2 changes: 1. Move the code into a helper to reduce code duplication (and hopefully work-around the crash). 2. The original commit had a formatting bug in the docs (missing an underscore). Original commit message: This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang (when both halves of a funnel shift are the same value, it's a rotate). We're free to name these as we want because we're not copying gcc, but if there's some other existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate, we can change the names. The funnel shift intrinsics were added here: https://reviews.llvm.org/D49242 With improved codegen in: https://reviews.llvm.org/rL337966 https://reviews.llvm.org/rL339359 And basic IR optimization added in: https://reviews.llvm.org/rL338218 https://reviews.llvm.org/rL340022 ...so these are expected to produce asm output that's equal or better to the multi-instruction alternatives using primitive C/IR ops. In the motivating loop example from PR37387: https://bugs.llvm.org/show_bug.cgi?id=37387#c7 ...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source. Differential Revision: https://reviews.llvm.org/D50924 llvm-svn: 340137
* revert r340135: [CodeGen] add rotate builtinsSanjay Patel2018-08-191-37/+40
| | | | | | | | At least a couple of bots (PPC only?) are showing the compiler dying while trying to compile: http://lab.llvm.org:8011/builders/clang-ppc64be-linux-multistage/builds/11065/steps/build%20stage%201/logs/stdio http://lab.llvm.org:8011/builders/clang-ppc64be-linux-lnt/builds/18267/steps/build%20stage%201/logs/stdio llvm-svn: 340136
* [CodeGen] add rotate builtinsSanjay Patel2018-08-191-40/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This exposes the LLVM funnel shift intrinsics as more familiar bit rotation functions in clang (when both halves of a funnel shift are the same value, it's a rotate). We're free to name these as we want because we're not copying gcc, but if there's some other existing art (eg, the microsoft ops that are modified in this patch) that we want to replicate, we can change the names. The funnel shift intrinsics were added here: D49242 With improved codegen in: rL337966 rL339359 And basic IR optimization added in: rL338218 rL340022 ...so these are expected to produce asm output that's equal or better to the multi-instruction alternatives using primitive C/IR ops. In the motivating loop example from PR37387: https://bugs.llvm.org/show_bug.cgi?id=37387#c7 ...we get the expected 'rolq' x86 instructions if we substitute the rotate builtin into the source. Differential Revision: https://reviews.llvm.org/D50924 llvm-svn: 340135
* Revert "[analyzer] [NFC] Split up RetainSummaryManager from RetainCountChecker"Bruno Cardoso Lopes2018-08-1813-59/+638
| | | | | | | | | | | | | | This reverts commit a786521fa66c72edd308baff0c08961b6d964fb1. Bots haven't caught up yet, but broke modules build with: ../tools/clang/include/clang/StaticAnalyzer/Checkers/MPIFunctionClassifier.h:18:10: fatal error: cyclic dependency in module 'Clang_StaticAnalyzer_Core': Clang_StaticAnalyzer_Core -> Clang_Analysis -> Clang_StaticAnalyzer_Checkers -> Clang_StaticAnalyzer_Core ^ llvm-svn: 340117
* [analyzer] [NFC] Split up RetainSummaryManager from RetainCountCheckerGeorge Karpenkov2018-08-1813-638/+59
| | | | | | | | | | | | | ARCMigrator is using code from RetainCountChecker, which is a layering violation (and it also does it badly, by using a different header, and then relying on implementation being present in a header file). This change splits up RetainSummaryManager into a separate library in lib/Analysis, which can be used independently of a checker. Differential Revision: https://reviews.llvm.org/D50934 llvm-svn: 340114
* [index] For an ObjC message call, also record as receivers the protocols if ↵Argyrios Kyrtzidis2018-08-171-2/+18
| | | | | | they are present in the ObjC type llvm-svn: 340109
* [ObjC] Error out when using forward-declared protocol in a @protocolAlex Lorenz2018-08-173-13/+8
| | | | | | | | | | | | | | | | | | | | | | expression Clang emits invalid protocol metadata when a @protocol expression is used with a forward-declared protocol. The protocol metadata is missing protocol conformance list of the protocol since we don't have access to the definition of it in the compiled translation unit. The linker then might end up picking the invalid metadata when linking which will lead to incorrect runtime protocol conformance checks. This commit makes sure that Clang fails to compile code that uses a @protocol expression with a forward-declared protocol. This ensures that Clang does not emit invalid protocol metadata. I added an extra assert in CodeGen to ensure that this kind of issue won't happen in other places. rdar://32787811 Differential Revision: https://reviews.llvm.org/D49462 llvm-svn: 340102
* Don't warn on returning the address of a label from a statement expressionReid Kleckner2018-08-171-0/+4
| | | | | | | | | | | | | | | | | Summary: There isn't anything inherently wrong with returning a label from a statement expression. In practice, the Linux kernel uses this pattern to materialize PCs. Fixes PR38569 Reviewers: niravd, rsmith, nickdesaulniers Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50805 llvm-svn: 340101
* [analyzer] [NFC] Minor refactoring of ISL-specific code in RetainCountCheckerGeorge Karpenkov2018-08-172-14/+9
| | | | | | Differential Revision: https://reviews.llvm.org/D50879 llvm-svn: 340098
* [analyzer] Re-instate support for MakeCollectable is RetainCountCheckerGeorge Karpenkov2018-08-173-5/+24
| | | | | | Differential Revision: https://reviews.llvm.org/D50872 llvm-svn: 340097
* [analyzer] [NFC] Move ObjCRetainCount to include/AnalysisGeorge Karpenkov2018-08-173-3/+3
| | | | | | Differential Revision: https://reviews.llvm.org/D50869 llvm-svn: 340096
* [analyzer] [NFC] Move canEval function from RetainCountChecker to ↵George Karpenkov2018-08-173-72/+85
| | | | | | | | RetainCountSummaries Differential Revision: https://reviews.llvm.org/D50863 llvm-svn: 340094
* [analyzer] [NFC] Split up summary generation in RetainCountChecker in two ↵George Karpenkov2018-08-172-204/+195
| | | | | | | | methods Differential Revision: https://reviews.llvm.org/D50830 llvm-svn: 340093
* [analyzer] [NFC] Split up RetainCountCheckerGeorge Karpenkov2018-08-178-3894/+4036
| | | | | | | | At some point, staring at 4k+ LOC file becomes a bit hard. Differential Revision: https://reviews.llvm.org/D50821 llvm-svn: 340092
* [analyzer] Drop support for GC mode in RetainCountCheckerGeorge Karpenkov2018-08-171-324/+61
| | | | | | | | | | | | A lot of code in RetainCountChecker deals with GC mode. Given that GC mode is deprecated, Apple does not ship runtime for it, and modern compiler toolchain does not support it, it makes sense to remove the code dealing with it in order to aid understanding of RetainCountChecker. Differential Revision: https://reviews.llvm.org/D50747 llvm-svn: 340091
* Update comments in CGDebugInfo to reflect changes in the MS mangler, NFCReid Kleckner2018-08-171-12/+26
| | | | | | | I've tried to elaborate on the purpose of these type identifiers and why and when clang uses them. llvm-svn: 340080
* [MS] Mangle a hash of the main file path into anonymous namespacesReid Kleckner2018-08-171-3/+38
| | | | | | | | | | | | | | | | | | | | | | | Summary: This is needed to avoid conflicts in mangled names for codeview types in anonymous namespaces. In CodeView, types refer to each other typically through forward declarations, which contain mangled names. These names have to be unique, otherwise the debugger will look up the mangled name and find the wrong definition. Furthermore, ThinLTO will deduplicate the types, and debug info verification can fail when the types have the wrong sizes. This is PR38608. Fixes PR38609. Reviewers: majnemer, inglorion, hans Subscribers: mehdi_amini, aprantl, JDevlieghere, dexonsmith, cfe-commits Differential Revision: https://reviews.llvm.org/D50877 llvm-svn: 340079
* Improve diagnostic for missing comma in template parameter list.Richard Smith2018-08-171-15/+23
| | | | | | | | | | Given 'typename T typename U', we would correctly diagnose the missing comma, but incorrectly disambiguate the first parameter as being a non-type parameter and complain that the 'T' is not a qualified-id. See also gcc.gnu.org/PR86998. llvm-svn: 340074
* [HIP] Make __hip_gpubin_handle hidden to avoid being merged across different ↵Yaxun Liu2018-08-171-0/+2
| | | | | | | | | | | | | | | | shared libraries Different shared libraries contain different fat binary, which is stored in a global variable __hip_gpubin_handle. Since different compilation units share the same fat binary, this variable has linkonce linkage. However, it should not be merged across different shared libraries. This patch set the visibility of the global variable to be hidden, which will make it invisible in the shared library, therefore preventing it from being merged. Differential Revision: https://reviews.llvm.org/D50596 llvm-svn: 340056
* Make __shiftleft128 / __shiftright128 real compiler built-ins.Nico Weber2018-08-172-14/+21
| | | | | | | | | | | | r337619 added __shiftleft128 / __shiftright128 as functions in intrin.h. Microsoft's STL plans on using these functions, and they're using intrin0.h which just has declarations of built-ins to not pull in the huge intrin.h header in the standard library headers. That requires that these functions are real built-ins. https://reviews.llvm.org/D50907 llvm-svn: 340048
* [CodeGen] Merge identical block descriptor global variables.Akira Hatanaka2018-08-174-132/+337
| | | | | | | | | | | | | | | | | | Currently, clang generates a new block descriptor global variable for each new block literal. This commit merges block descriptors that are identical inside and across translation units using the same approach taken in r339438. To enable merging identical block descriptors, the size and signature of the block and information about the captures are encoded into the name of the block descriptor variable. Also, the block descriptor variable is marked as linkonce_odr and unnamed_addr. rdar://problem/42640703 Differential Revision: https://reviews.llvm.org/D50783 llvm-svn: 340041
* [Preamble] Empty preamble is not an error.Haojian Wu2018-08-172-9/+0
| | | | | | | | | | | | | | | | | | | | Summary: Empty preamble is valid for source file which doesn't have any preprocessor and #includes. This patch makes clang treat an empty preamble as a normal preamble. Check: ninja check-clang A testcase is added in https://reviews.llvm.org/D50627. Reviewers: ilya-biryukov Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50628 llvm-svn: 340029
* Fix for bug 38508 - Don't do PCH processing when only generating ↵Erich Keane2018-08-171-3/+4
| | | | | | | | | | | | preprocessor output This clang-cl driver change removes the PCH options when we are only generating preprocessed output. This is similar to the behavior of Y-. Patch by: mikerice Differential Revision: https://reviews.llvm.org/D50640 llvm-svn: 340025
* [AArch64] - return address signingLuke Cheeseman2018-08-173-0/+36
| | | | | | | | | | | | | | - Add a command line options -msign-return-address to enable return address signing - Armv8.3a added instructions to sign the return address to help mitigate against ROP attacks - This patch adds command line options to generate function attributes that signal to the back whether return address signing instructions should be added Differential revision: https://reviews.llvm.org/D49793 llvm-svn: 340019
* [hexagon] restore -fuse-cxa-atexit by defaultBrian Cain2018-08-171-1/+0
| | | | | | | | | | | | | "-fno-use-cxa-atexit" was a default provided by the initial commit offering hexagon support. This is no longer required. Reviewers: bcahoon, sidneym Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D50816 llvm-svn: 339979
* Disable pubnames in NVPTX debug info using metadataDavid Blaikie2018-08-161-2/+5
| | | | llvm-svn: 339968
* [InstrProf] Use atomic profile counter updates for TSanVedant Kumar2018-08-161-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | Thread sanitizer instrumentation fails to skip all loads and stores to profile counters. This can happen if profile counter updates are merged: %.sink = phi i64* ... %pgocount5 = load i64, i64* %.sink %27 = add i64 %pgocount5, 1 %28 = bitcast i64* %.sink to i8* call void @__tsan_write8(i8* %28) store i64 %27, i64* %.sink To suppress TSan diagnostics about racy counter updates, make the counter updates atomic when TSan is enabled. If there's general interest in this mode it can be surfaced as a clang/swift driver option. Testing: check-{llvm,clang,profile} rdar://40477803 Differential Revision: https://reviews.llvm.org/D50867 llvm-svn: 339955
* Update for LLVM API changeDavid Blaikie2018-08-161-1/+2
| | | | llvm-svn: 339941
* AMDGPU: Correct errors in device tableMatt Arsenault2018-08-161-2/+2
| | | | llvm-svn: 339934
* [AST] Store the OwnedTagDecl as a trailing object in ElaboratedType.Bruno Ricci2018-08-161-2/+4
| | | | | | | | | | | | | | The TagDecl *OwnedTagDecl in ElaboratedType is quite commonly null (at least when parsing all of Boost, it is non-null for only about 600 of the 66k ElaboratedType). Therefore we can save a pointer in the common case by storing it as a trailing object, and storing a bit in the bit-fields of Type indicating when the pointer is null. Reviewed By: rjmccall Differential Revision: https://reviews.llvm.org/D50715 llvm-svn: 339862
* [AST] Pack the unsigned of SubstTemplateTypeParmPackType into TypeBruno Ricci2018-08-161-3/+4
| | | | | | | | | | | The bit-fields of Type have enough space for the member unsigned NumArgs of SubstTemplateTypeParmPackType. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D50713 llvm-svn: 339861
* [AST] Pack the unsigned of DependentTemplateSpecializationType into TypeBruno Ricci2018-08-161-1/+2
| | | | | | | | | | | The bit-fields of `Type` have enough space for the member `unsigned NumArgs` of `DependentTemplateSpecializationType`. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D50712 llvm-svn: 339860
* [X86] Remove masking from the 512-bit paddus/psubus builtins. Use a select ↵Craig Topper2018-08-162-66/+36
| | | | | | builtin instead. llvm-svn: 339845
* [X86] Remove masking from the 512-bit padds and psubs builtins. Use select ↵Craig Topper2018-08-161-56/+32
| | | | | | builtin instead. llvm-svn: 339843
* [Driver] -print-target-triple and -print-effective-triple optionsPetr Hosek2018-08-161-0/+12
| | | | | | | | These can be used to print Clang target and effective triple. Differential Revision: https://reviews.llvm.org/D50755 llvm-svn: 339834
* [Darwin Driver] Fix Simulator builtins and test casesChris Bieneman2018-08-152-9/+16
| | | | | | | | In r339807, I broke linking the builtins libraries for simulator targets, which itself was bad, but turns out it was all completely untested and marked with FIXME in the test suite. This fixes all the test cases so they actually work, and fixes the bug I introduced in r339807. llvm-svn: 339829
* Add a newline to SourceLocation dump outputStephen Kelly2018-08-156-7/+8
| | | | | | | | | | | | | | Summary: Migrate callers to print(). dump() should be useful to downstreams and third parties as a debugging aid. Everyone trips up on this and creates confusing output. Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50661 llvm-svn: 339810
* [CStringSyntaxChecker] Reduces space around error message for strlcat.David Carlier2018-08-151-1/+1
| | | | llvm-svn: 339808
* Refactor Darwin driver to refer to runtimes by componentChris Bieneman2018-08-152-64/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: In r335809, Petr Hosek lays out support for what he calls the multiarch runtimes layout. This new way of laying out the directories for runtime libraries is workable for all platforms. Petr did some of the common infrastructure and made it work for Linux and Fuscia. This patch is a cleanup to the Darwin and MachO drivers to serve as a step toward supporting it in Darwin. This patch does primarily two things: (1) Changes the APIs for how the Darwin driver refers to compiler-rt libraries to use the component names, similar to how Linux and Fuscia do (2) Removes some legacy functionality for supporting macOS versions before 10.6. This functionality is effectively dead code because in r339277, the support was removed from compiler-rt for generating the 10.4 runtime support library, and Xcode 10 (currently in beta) removes libgcc_s.10.4 and libgcc_s.10.5 from the macOS SDK. With this patch landed a subsequent patch can modify MachO::AddLinkRuntimeLib to support the multiarch runtimes layout. Worth noting: None of the removed functionality was actually covered in the test suite. So no test case updates are required. Reviewers: phosek, bruno, arphaman Reviewed By: phosek, arphaman Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50618 llvm-svn: 339807
* [OPENMP] FIx processing of declare target variables.Alexey Bataev2018-08-157-27/+49
| | | | | | | | The compiler may produce unexpected error messages/crashes when declare target variables were used. Patch fixes problems with the declarations marked as declare target to or link. llvm-svn: 339805
* clang-format: Change Google style wrt. the formatting of empty messages.Daniel Jasper2018-08-151-1/+1
| | | | | | | | | | | Before: message Empty { } After: message Empty {} llvm-svn: 339803
* [AST] Pack the bits of TemplateSpecializationType into TypeBruno Ricci2018-08-151-3/+5
| | | | | | | | | | | Type has enough space for two members of TemplateSpecializationType. Mechanical patch. Reviewed By: erichkeane Differential Revision: https://reviews.llvm.org/D50643 llvm-svn: 339787
* Silence "unused variable" warning.Richard Smith2018-08-151-0/+1
| | | | llvm-svn: 339747
* [analyzer] Add support for constructors of arguments.Artem Dergachev2018-08-156-29/+221
| | | | | | | | | | | | | | | | | | | | | Once CFG-side support for argument construction contexts landed in r338436, the analyzer could make use of them to evaluate argument constructors properly. When evaluated as calls, constructors of arguments now use the variable region of the parameter as their target. The corresponding stack frame does not yet exist when the parameter is constructed, and this stack frame is created eagerly. Construction of functions whose body is unavailable and of virtual functions is not yet supported. Part of the reason is the analyzer doesn't consistently use canonical declarations o identify the function in these cases, and every re-declaration or potential override comes with its own set of parameter declarations. Also it is less important because if the function is not inlined, there's usually no benefit in inlining the argument constructor. Differential Revision: https://reviews.llvm.org/D49443 llvm-svn: 339745
* Fix Stmt::ignoreImplicitStephen Kelly2018-08-141-8/+14
| | | | | | | | | | | | | | | | Summary: A CXXBindTemporaryExpr can appear inside an ImplicitCastExpr, and was not ignored previously. Fixes the case reported in PR37327. Reviewers: rsmith, dblaikie, klimek Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D50666 llvm-svn: 339730
* [CFG] [analyzer] Find argument constructors in CXXTemporaryObjectExprs.Artem Dergachev2018-08-141-0/+5
| | | | | | | | | | | CXXTemporaryObjectExpr is a sub-class of CXXConstructExpr. If it has arguments that are structures passed by value, their respective constructors need to be handled by providing a ConstructionContext, like for regular function calls and for regular constructors. Differential Revision: https://reviews.llvm.org/D50487 llvm-svn: 339727
OpenPOWER on IntegriCloud