1. Dec 14, 2018
    • Philipp Stephani's avatar
      clang-include-fixer.el: support remote files · 113e2cd9
      Philipp Stephani authored
      Summary: Support remote files (e.g., Tramp) in the Emacs integration for clang-include-fixer
      
      Reviewers: klimek
      
      Reviewed By: klimek
      
      Subscribers: cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D54672
      
      llvm-svn: 349150
      113e2cd9
    • Pavel Labath's avatar
      Mark Permissions as a bitmask enum · b3ce98ac
      Pavel Labath authored
      this allows one to use bitwise operators on the variables of this type
      without complicated casting.
      
      The gotcha here is that the combinations of these enums were being used
      in some constexpr contexts such as case labels (case
      ePermissionsWritable | ePermissionsExecutable:), which is not possible
      if the user-defined operator| is not constexpr.
      
      So, this commit also marks these operators as constexpr. I am committing
      this as a small standalone patch so it can be easily reverted if some
      compiler has an issue with this.
      
      llvm-svn: 349149
      b3ce98ac
    • Haojian Wu's avatar
      [clangd] Use buildCompilerInvocation to simplify the HeadersTests, NFC. · 941ce02d
      Haojian Wu authored
      llvm-svn: 349148
      941ce02d
    • Diana Picus's avatar
      [ARM GlobalISel] Thumb2: casts between int and ptr · 02c8343c
      Diana Picus authored
      Mark as legal and add tests. Nothing special to do.
      
      llvm-svn: 349147
      02c8343c
    • Diana Picus's avatar
      [ARM GlobalISel] Remove duplicate test. NFCI · acca60b4
      Diana Picus authored
      Fixup for r349026. I forgot to delete these test functions from the
      original file when I moved them to arm-legalize-exts.mir.
      
      llvm-svn: 349146
      acca60b4
    • Haojian Wu's avatar
      [clangd] Fix memory leak in ClangdTests. · 23ae22b6
      Haojian Wu authored
      Summary:
      createInvocationFromCommandLine sets DisableFree to true by default,
      which leads memory leak in clangd. The fix is to  use the `BuildCompilationInvocation`
      to create CI with the correct options (DisableFree is false).
      
      Fix https://bugs.llvm.org/show_bug.cgi?id=39991.
      
      Reviewers: kadircet
      
      Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55702
      
      llvm-svn: 349145
      23ae22b6
    • Haojian Wu's avatar
      [clangd] Fix an assertion failure in background index. · d5a78e6e
      Haojian Wu authored
      Summary:
      When indexing a file which contains an uncompilable error, we will
      trigger an assertion failure -- the IndexFileIn data is not set, but we
      access them in the backgound index.
      
      Reviewers: kadircet
      
      Subscribers: ilya-biryukov, ioeric, MaskRay, jkorous, arphaman, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55650
      
      llvm-svn: 349144
      d5a78e6e
    • Diana Picus's avatar
      [ARM GlobalISel] Minor refactoring. NFCI · 813af0d2
      Diana Picus authored
      Refactor the ARMInstructionSelector to cache some opcodes in the
      constructor instead of checking all the time if we're in ARM or Thumb
      mode.
      
      llvm-svn: 349143
      813af0d2
    • Diana Picus's avatar
      [ARM GlobalISel] Allow simple binary ops in Thumb2 · 14dc3b29
      Diana Picus authored
      Mark G_ADD, G_SUB, G_MUL, G_AND, G_OR and G_XOR as legal for both ARM
      and Thumb2.
      
      Extract the legalizer tests for these opcodes into another file.
      
      Add tests for the instruction selector.
      
      llvm-svn: 349142
      14dc3b29
    • Simon Tatham's avatar
      [TableGen:AsmWriter] Cope with consecutive tied operands. · 80391d63
      Simon Tatham authored
      When you define an instruction alias as a subclass of InstAlias, you
      specify all the MC operands for the instruction it expands to, except
      for operands that are tied to a previous one, which you leave out in
      the expectation that the Tablegen output code will fill them in
      automatically.
      
      But the code in Tablegen's AsmWriter backend that skips over a tied
      operand was doing it using 'if' instead of 'while', because it wasn't
      expecting to find two tied operands in sequence.
      
      So if an instruction updates a pair of registers in place, so that its
      MC representation has two input operands tied to the output ones (for
      example, Arm's UMLAL instruction), then any alias which wants to
      expand to a special case of that instruction is likely to fail to
      match, because the indices of subsequent operands will be off by one
      in the generated printAliasInstr function.
      
      This patch re-indents some existing code, so it's clearest when
      viewed as a diff with whitespace changes ignored.
      
      Reviewers: fhahn, rengolin, sdesmalen, atanasyan, asb, jholewinski, t.p.northover, kparzysz, craig.topper, stoklund
      
      Reviewed By: rengolin
      
      Subscribers: javed.absar, kristof.beyls, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D53816
      
      llvm-svn: 349141
      80391d63
    • Luke Cheeseman's avatar
      [AArch64][libunwind] Unwinding support for return address signing · e1a819e8
      Luke Cheeseman authored
      - Follow up to revision r342895
      - gcc would not build libunwind with the earlier patch as the autia1716
        instruction wasn't allowed to be assembled for pre armv8.3a targets
      - The autia1716 instruction lives in the hint space encodings so is a valid
        instruction for all armv8a targets
      - To work around this I have swapped out the autia1716 instruction for the hint
        instruction
      
      Differential Revision: https://reviews.llvm.org/D55700
      
      llvm-svn: 349140
      e1a819e8
    • Simon Pilgrim's avatar
      Revert rL349136: [llvm-exegesis] Optimize ToProcess in dbScan · 96408bb0
      Simon Pilgrim authored
      Summary:
      Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`
      
      We also check `Added[P]` to enqueueing a point more than once, which
      also saves us a `ClusterIdForPoint_[Q].isUndef()` check.
      
      Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri
      
      Subscribers: tschuett, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D54442
      ........
      Patch wasn't approved and breaks buildbots
      
      llvm-svn: 349139
      96408bb0
    • Dan Liew's avatar
      Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`,... · 41fec1bf
      Dan Liew authored
      Introduce `AddressSpaceView` template parameter to `SizeClassAllocator32`, `FlatByteMap`, and `TwoLevelByteMap`.
      
      Summary:
      This is a follow up patch to r346956 for the `SizeClassAllocator32`
      allocator.
      
      This patch makes `AddressSpaceView` a template parameter both to the
      `ByteMap` implementations (but makes `LocalAddressSpaceView` the
      default), some `AP32` implementations and is used in `SizeClassAllocator32`.
      The actual changes to `ByteMap` implementations and
      `SizeClassAllocator32` are very simple. However the patch is large
      because it requires changing all the `AP32` definitions, and users of
      those definitions.
      
      For ASan and LSan we make `AP32` and `ByteMap` templateds type that take
      a single `AddressSpaceView` argument. This has been done because we will
      instantiate the allocator with a type that isn't `LocalAddressSpaceView`
      in the future patches. For the allocators used in the other sanitizers
      (i.e. HWAsan, MSan, Scudo, and TSan) use of `LocalAddressSpaceView` is
      hard coded because we do not intend to instantiate the allocators with
      any other type.
      
      In the cases where untemplated types have become templated on a single
      `AddressSpaceView` parameter (e.g. `PrimaryAllocator`) their name has
      been changed to have a `ASVT` suffix (Address Space View Type) to
      indicate they are templated.  The only exception to this are the `AP32`
      types due to the desire to keep the type name as short as possible.
      
      In order to check that template is instantiated in the correct a way a
      `static_assert(...)` has been added that checks that the
      `AddressSpaceView` type used by `Params::ByteMap::AddressSpaceView` matches
      the `Params::AddressSpaceView`. This uses the new `sanitizer_type_traits.h`
      header.
      
      rdar://problem/45284065
      
      Reviewers: kcc, dvyukov, vitalybuka, cryptoad, eugenis, kubamracek, george.karpenkov
      
      Subscribers: mgorny, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D54904
      
      llvm-svn: 349138
      41fec1bf
    • Craig Topper's avatar
      [DAGCombiner][X86] Prevent visitSIGN_EXTEND from returning N when (sext... · 257ce387
      Craig Topper authored
      [DAGCombiner][X86] Prevent visitSIGN_EXTEND from returning N when (sext (setcc)) already has the target desired type for the setcc
      
      Summary:
      If the setcc already has the target desired type we can reach the getSetCC/getSExtOrTrunc after the MatchingVecType check with the exact same types as the nodes we started with. This causes those causes VsetCC to be CSEd to N0 and the getSExtOrTrunc will CSE to N. When we return N, the caller will think that meant we called CombineTo and did our own worklist management. But that's not what happened. This prevents target hooks from being called for the node.
      
      To fix this, I've now returned SDValue if the setcc is already the desired type. But to avoid some regressions in X86 I've had to disable one of the target combines that wasn't being reached before in the case of a (sext (setcc)). If we get vector widening legalization enabled that entire function will be deleted anyway so hopefully this is only for the short term.
      
      Reviewers: RKSimon, spatel
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D55459
      
      llvm-svn: 349137
      257ce387
    • Fangrui Song's avatar
      [llvm-exegesis] Optimize ToProcess in dbScan · 92537ccc
      Fangrui Song authored
      Summary:
      Use `vector<char> Added + vector<size_t> ToProcess` to replace `SetVector ToProcess`
      
      We also check `Added[P]` to enqueueing a point more than once, which
      also saves us a `ClusterIdForPoint_[Q].isUndef()` check.
      
      Reviewers: courbet, RKSimon, gchatelet, john.brawn, lebedev.ri
      
      Subscribers: tschuett, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D54442
      
      llvm-svn: 349136
      92537ccc
    • Fangrui Song's avatar
      [ThinLTO] Fix test added in rL349076 · 54a18bb0
      Fangrui Song authored
      llvm-svn: 349135
      54a18bb0
    • Fangrui Song's avatar
      [sanitizer] Fix nolibc internal_sleep · c4e6de2e
      Fangrui Song authored
      Reviewers: kubamracek, vitalybuka
      
      Reviewed By: vitalybuka
      
      Subscribers: delcypher, llvm-commits, #sanitizers
      
      Differential Revision: https://reviews.llvm.org/D55692
      
      llvm-svn: 349134
      c4e6de2e
    • Fangrui Song's avatar
      [Object] Rename getRelrRelocationType to getRelativeRelocationType · d2ed5be8
      Fangrui Song authored
      Summary:
      The two utility functions were added in D47919 to support SHT_RELR.
      However, these are just relative relocations types and are't
      necessarily be named Relr.
      
      Reviewers: phosek, dberris
      
      Reviewed By: dberris
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D55691
      
      llvm-svn: 349133
      d2ed5be8
    • Ivan Donchevskii's avatar
      [clang-tidy] Remove extra config.h includes · 13c9c054
      Ivan Donchevskii authored
      It's included in a new header ClangTidyForceLinker.h and should not
      be included the second time.
      
      Follow up for the https://reviews.llvm.org/D55595
      
      llvm-svn: 349132
      13c9c054
    • Ivan Donchevskii's avatar
      [clang-tidy] Share the forced linking code between clang-tidy tool and plugin · 37512e58
      Ivan Donchevskii authored
      Extract code that forces linking to the separate header and include it in both plugin and standalone tool.
      Try 2: missing header guard and "clang/Config/config.h" are added to the new header.
      
      Differential Revision: https://reviews.llvm.org/D55595
      
      llvm-svn: 349131
      37512e58
    • Petr Hosek's avatar
      [llvm-xray] Use correct variable name · 0c02306d
      Petr Hosek authored
      This fixes the compiler error introduced in r349129.
      
      llvm-svn: 349130
      0c02306d
    • Petr Hosek's avatar
      [llvm-xray] Store offset pointers in temporaries · 27e2f201
      Petr Hosek authored
      DataExtractor::getU64 modifies the OffsetPtr which also pass to
      RelocateOrElse which breaks on Windows. This addresses the issue
      introduced in r349120.
      
      Differential Revision: https://reviews.llvm.org/D55689
      
      llvm-svn: 349129
      27e2f201
    • Richard Trieu's avatar
      Remove unused variable. · f03e8023
      Richard Trieu authored
      llvm-svn: 349128
      f03e8023
    • Eric Fiselier's avatar
      Update google benchmark again · 814715f9
      Eric Fiselier authored
      llvm-svn: 349127
      814715f9
    • Eric Fiselier's avatar
      Update google benchmark version · 7a91ac47
      Eric Fiselier authored
      llvm-svn: 349126
      7a91ac47
    • Richard Trieu's avatar
      Fix up diagnostics. · 0f25c747
      Richard Trieu authored
      Move some diagnostics around between Diagnostic*Kinds.td files.  Diagnostics
      used in multiple places were moved to DiagnosticCommonKinds.td.  Diagnostics
      listed in the wrong place (ie, Sema diagnostics listed in
      DiagnosticsParseKinds.td) were moved to the correct places.  One diagnostic
      split into two so that the diagnostic string is in the .td file instead of in
      code.  Cleaned up the diagnostic includes after all the changes.
      
      llvm-svn: 349125
      0f25c747
    • Nico Weber's avatar
      [gn build] Merge r348963 and r349076 · f464a476
      Nico Weber authored
      llvm-svn: 349124
      f464a476
    • Stephane Moore's avatar
      [clang-tidy] Improve google-objc-function-naming diagnostics 📙 · b69ece89
      Stephane Moore authored
      Summary:
      The diagnostics from google-objc-function-naming check will be more
      actionable if they provide a brief description of the requirements from
      the Google Objective-C style guide. The more descriptive diagnostics may
      help clarify that functions in the global namespace must have an
      appropriate prefix followed by Pascal case (engineers working previously
      with static functions might not immediately understand the different
      requirements of static and non-static functions).
      
      Test Notes:
      Verified against the clang-tidy tests.
      
      Reviewers: benhamilton, aaron.ballman
      
      Reviewed By: benhamilton
      
      Subscribers: MyDeveloperDay, xazax.hun, cfe-commits
      
      Differential Revision: https://reviews.llvm.org/D55482
      
      llvm-svn: 349123
      b69ece89
    • Greg Clayton's avatar
      Fix test failures that depended on module order · 918adb56
      Greg Clayton authored
      llvm-svn: 349122
      918adb56
    • Douglas Yung's avatar
    • Petr Hosek's avatar
      [llvm-xray] Support for PIE · 493a0824
      Petr Hosek authored
      When the instrumented binary is linked as PIE, we need to apply the
      relative relocations to sleds. This is handled by the dynamic linker
      at runtime, but when processing the file we have to do it ourselves.
      
      Differential Revision: https://reviews.llvm.org/D55542
      
      llvm-svn: 349120
      493a0824
    • Alex Lorenz's avatar
      [macho] save the SDK version stored in module metadata into the version min and · afa75d78
      Alex Lorenz authored
      build version load commands in the object file
      
      This commit introduces a new metadata node called "SDK Version". It will be set
      by the frontend to mark the platform SDK (macOS/iOS/etc) version which was used
      during that particular compilation.
      This node is used when machine code is emitted, by either saving the SDK version
      into the appropriate macho load command (version min/build version), or by
      emitting the assembly for these load commands with the SDK version specified as
      well.
      The assembly for both load commands is extended by allowing it to contain the
      sdk_version X, Y [, Z] trailing directive to represent the SDK version
      respectively.
      
      rdar://45774000
      
      Differential Revision: https://reviews.llvm.org/D55612
      
      llvm-svn: 349119
      afa75d78
    • Adam Nemet's avatar
      Revert "Try to update the test to fix the breakage With the new warning, we... · 4065da29
      Adam Nemet authored
      Revert "Try to update the test to fix the breakage With the new warning, we are showing one more output in the test."
      
      This reverts commit r349064.
      
      This wasn't updating the right test.  Causing (not the different line number
      from the previous revert):
      
      ======================================================================
      FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py", line 18, in test_diagnostic_warning
          self.assertEqual(len(tu.diagnostics), 2)
      AssertionError: 1 != 2
      
      llvm-svn: 349118
      4065da29
    • Adam Nemet's avatar
      Revert "Make -Wstring-plus-int warns even if when the result is not out of bounds" · cbb8aa19
      Adam Nemet authored
      This reverts commit r349054.
      
      It's causing:
      
      FAILED: tools/clang/bindings/python/tests/CMakeFiles/check-clang-python
      FAIL: test_diagnostic_range (tests.cindex.test_diagnostics.TestDiagnostics)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File
        "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
        line 55, in test_diagnostic_range
            self.assertEqual(len(tu.diagnostics), 1)
            AssertionError: 2 != 1
      
      ======================================================================
      FAIL: test_diagnostic_warning (tests.cindex.test_diagnostics.TestDiagnostics)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File
        "/Users/buildslave/jenkins/workspace/clang-stage1-configure-RA/llvm/tools/clang/bindings/python/tests/cindex/test_diagnostics.py",
        line 18, in test_diagnostic_warning
            self.assertEqual(len(tu.diagnostics), 2)
            AssertionError: 1 != 2
      
      llvm-svn: 349117
      cbb8aa19
    • Vlad Tsyrklevich's avatar
      Windows ASan: Instrument _msize_base() · 137e23d5
      Vlad Tsyrklevich authored
      Summary:
      A recent update to the VS toolchain in chromium [1] broke the windows
      ASan bot because the new toolchain calls _msize_base() instead of
      _msize() in a number of _aligned_* UCRT routines. Instrument
      _msize_base() as well.
      
      [1] https://crbug.com/914947
      
      Reviewers: rnk, #sanitizers, vitalybuka
      
      Reviewed By: rnk, #sanitizers, vitalybuka
      
      Subscribers: vitalybuka, kubamracek, llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D55684
      
      llvm-svn: 349115
      137e23d5
    • Craig Topper's avatar
      [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for... · 1f2b1816
      Craig Topper authored
      [Builltins][X86] Provide implementations of __lzcnt16, __lzcnt, __lzcnt64 for MS compatibility. Remove declarations from intrin.h and implementations from lzcntintrin.h
      
      intrin.h had forward declarations for these and lzcntintrin.h had implementations that were only available with -mlzcnt or a -march that supported the lzcnt feature.
      
      For MS compatibility we should always have these builtins available regardless of X86 being the target or the CPU support the lzcnt instruction. The backends should be able to gracefully fallback to something support even if its just shifts and bit ops.
      
      Unfortunately, gcc also implements 2 of the 3 function names here on X86 when lzcnt feature is enabled.
      
      This patch adds builtins for these for MSVC compatibility and drops the forward declarations from intrin.h. To keep the gcc compatibility the two intrinsics that collided have been turned into macros that use the X86 specific builtins with the lzcnt feature check. These macros are only defined when _MSC_VER is not defined. Without them being macros we can get a redefinition error because -ms-extensions doesn't seem to set _MSC_VER but does make the MS builtins available.
      
      Should fix PR40014
      
      Differential Revision: https://reviews.llvm.org/D55677
      
      llvm-svn: 349098
      1f2b1816
    • Reid Kleckner's avatar
      Silence CMP0048 warning in the benchmark utility library · 37b891ed
      Reid Kleckner authored
      I'm testing this in LLVM before sending it upstream.
      
      Part of PR38874
      
      llvm-svn: 349097
      37b891ed
    • Nico Weber's avatar
      [gn build] Add infrastructure to create symlinks and use it to create lld's symlinks · 6399234b
      Nico Weber authored
      This is slightly involved, see the comments in the code.
      
      The GN build now builds a functional lld!
      
      Differential Revision: https://reviews.llvm.org/D55606
      
      llvm-svn: 349096
      6399234b
    • Sanjay Patel's avatar
      [DAGCombiner] clean up visitEXTRACT_VECTOR_ELT · 093ab45d
      Sanjay Patel authored
      This isn't quite NFC, but I don't know how to expose
      any outward diffs from these changes. Mostly, this
      was confusing because it used 'VT' to refer to the
      operand type rather the usual type of the input node.
      
      There's also a large block at the end that is dedicated 
      solely to matching loads, but that wasn't obvious. This
      could probably be split up into separate functions to
      make it easier to see. 
      
      It's still not clear to me when we make certain transforms 
      because the legality and constant conditions are 
      intertwined in a way that might be improved.
      
      llvm-svn: 349095
      093ab45d
    • Craig Topper's avatar
      [X86] Demote EmitTest to a helper function of EmitCmp. Route all callers... · 178abc59
      Craig Topper authored
      [X86] Demote EmitTest to a helper function of EmitCmp. Route all callers except EmitCmp through EmitCmp.
      
      This requires the two callers to manifest a 0 to make EmitCmp call EmitTest.
      
      I'm looking into changing how we combine TEST and flag setting instructions to not be part of lowering. And instead be part of DAG combine or isel. Which will mean EmitTest will probably become gutted and maybe disappear entirely.
      
      llvm-svn: 349094
      178abc59