1. Jul 07, 2017
    • Alexander Kornienko's avatar
      [clang-tidy] Fix modernize-use-override incorrect replacement · 91dafe09
      Alexander Kornienko authored
      Summary:
      For the following code: `modernize-use-override` generates a replacement with incorrect location.
      ```
      struct IntPair
      {
        int first, second;
      };
      
      struct A
      {
        virtual void il(IntPair);
      };
      
      struct B : A
      {
        void il(IntPair p = {1, (2 + 3)}) {};
        // Generated Fixit: void il(IntPair p = override {1, (2 + 3)}) {};
        // Should be: void il(IntPair p = {1, (2 + 3)}) override {};
      };
      ```
      This fixes that and adds a unit test.
      
      Reviewers: alexfh, aaron.ballman, hokein
      
      Reviewed By: alexfh
      
      Subscribers: JDevlieghere, xazax.hun, cfe-commits
      
      Tags: #clang-tools-extra
      
      Patch by Victor Gao!
      
      Differential Revision: https://reviews.llvm.org/D35078
      
      llvm-svn: 307379
      91dafe09
    • Simon Pilgrim's avatar
      [Sparc] Fix -Wimplicit-fallthrough warning. NFCI. · ecedd8d8
      Simon Pilgrim authored
      llvm-svn: 307378
      ecedd8d8
    • Alex Lorenz's avatar
      Update the Windows version of updateTripleOSVersion to account for · 215be39c
      Alex Lorenz authored
      changes in r307372
      
      llvm-svn: 307377
      215be39c
    • Simon Pilgrim's avatar
      [SystemZ] Fix -Wimplicit-fallthrough warnings. NFCI. · 8c4069e8
      Simon Pilgrim authored
      llvm-svn: 307376
      8c4069e8
    • Simon Pilgrim's avatar
      [Arm] Fix -Wimplicit-fallthrough warnings. NFCI. · ce1fb22c
      Simon Pilgrim authored
      llvm-svn: 307375
      ce1fb22c
    • Simon Pilgrim's avatar
      [Hexagon] Fix -Wimplicit-fallthrough warnings. NFCI. · adb80fba
      Simon Pilgrim authored
      llvm-svn: 307374
      adb80fba
    • Peter Smith's avatar
      [ELF] Add call to assignAddresses() before createThunks() [NFC] · 96f813d1
      Peter Smith authored
      In preparation for the addition of rangeThunks() calculate the addresses
      of all the inputSections so that ThunkSections can be inserted at the right
      place.
      
      Differential Revision: https://reviews.llvm.org/D34688
      
      llvm-svn: 307373
      96f813d1
    • Alex Lorenz's avatar
      [Support] sys::getProcessTriple should return a macOS triple using · 3803df3d
      Alex Lorenz authored
      the system's version of macOS
      
      sys::getProcessTriple returns LLVM_HOST_TRIPLE, whose system version might not
      be the actual version of the system on which the compiler running. This commit
      ensures that, for macOS, sys::getProcessTriple returns a triple with the
      system's macOS version.
      
      rdar://33177551
      
      Differential Revision: https://reviews.llvm.org/D34446
      
      llvm-svn: 307372
      3803df3d
    • Olivier Goffart's avatar
      Fix crash parsing invalid code · 67049f03
      Olivier Goffart authored
      The code in the test caused a crash with this backtrace:
      
       RecordLayoutBuilder.cpp:2934: const clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const clang::RecordDecl *) const: Assertion `!D->isInvalidDecl() && "Cannot get layout of invalid decl!"' failed.
       [...]
       #7 0x00007f63963d845a __assert_fail_base (/usr/lib/libc.so.6+0x2c45a)
       #8 0x00007f63963d84d2 (/usr/lib/libc.so.6+0x2c4d2)
       #9 0x00007f63937a0631 clang::ASTContext::getASTRecordLayout(clang::RecordDecl const*) const /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2935:3
       #10 0x00007f63937a1ad5 getFieldOffset(clang::ASTContext const&, clang::FieldDecl const*) /home/olivier/prog/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:3057:37
       #11 0x00007f6391869f14 clang::Sema::RefersToMemberWithReducedAlignment(clang::Expr*, llvm::function_ref<void (clang::Expr*, clang::RecordDecl*, clang::FieldDecl*, clang::CharUnits)>) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12139:23
       #12 0x00007f639186a2f8 clang::Sema::CheckAddressOfPackedMember(clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaChecking.cpp:12190:1
       #13 0x00007f6391a7a81c clang::Sema::CheckAddressOfOperand(clang::ActionResult<clang::Expr*, true>&, clang::SourceLocation) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11111:10
       #14 0x00007f6391a7f5d2 clang::Sema::CreateBuiltinUnaryOp(clang::SourceLocation, clang::UnaryOperatorKind, clang::Expr*) /home/olivier/prog/llvm/tools/clang/lib/Sema/SemaExpr.cpp:11932:18
      
      Fixing by bailing out for invalid classes.
      
      Differential Revision: https://reviews.llvm.org/D35108
      
      llvm-svn: 307371
      67049f03
    • George Rimar's avatar
      [ELF] - Fail the link if something happens on DWARF parsing stage of -gdb-index building · 1b51b7fc
      George Rimar authored
      This is relative to PR33173,
      
      Previously if something wrong happened on DWARF parsers side during parsing
      object for building gdb index (like was in PR: unsupported relocation) 
      then LLD continued and finished the link. DWARF parsers sure showed error
      message on their side, but that is all.
      
      Patch changes behavior to fail the link in this case and show more
      detailed message.
      
      Differential revision: https://reviews.llvm.org/D34814
      
      llvm-svn: 307370
      1b51b7fc
    • Florian Hahn's avatar
      [AArch64] Add test case for preferred function alignment (NFC). · 9872a6aa
      Florian Hahn authored
      Reviewers: evandro, joelkevinjones, mcrosier
      
      Reviewed By: joelkevinjones, mcrosier
      
      Subscribers: mcrosier, aemerson, llvm-commits, rengolin, evandro, javed.absar, joelkevinjones, kristof.beyls
      
      Differential Revision: https://reviews.llvm.org/D34951
      
      llvm-svn: 307369
      9872a6aa
    • Alex Lorenz's avatar
      [ObjC] Avoid the -Wunguarded-availability warnings for protocol · cdd596fc
      Alex Lorenz authored
      requirements in protocol/class/category declarations
      
      The unguarded availability warnings in the protocol requirements of a protocol
      /class/category declaration can be avoided. This matches the behaviour of
      Swift's diagnostics. The warnings for deprecated/unavailable protocols are
      preserved.
      
      rdar://33156429
      
      Differential Revision: https://reviews.llvm.org/D35061
      
      llvm-svn: 307368
      cdd596fc
    • Peter Smith's avatar
      [ELF] Extract temporary state used in assignAddresses() · 906e9a18
      Peter Smith authored
      The assignAddresses() function accumulates state in the LinkerScript that
      prevents it from being called multiple times. This change moves the state
      into a separate structure AddressState that is created at the start of the
      function and disposed of at the end.
      
      CurAddressState is used rather than passing a reference to the state as a
      parameter to the functions used by assignAddresses(). This is because the
      getSymbolValue function needs to be executed in the context of AddressState
      but it is stored in ScriptParser when AddressState is not available.
      
      The AddressState is also used in a limited context by processCommands()
      
      Differential Revision: https://reviews.llvm.org/D34345
      
      llvm-svn: 307367
      906e9a18
    • Diana Picus's avatar
      [ARM] GlobalISel: Fixup r307365 · 77367378
      Diana Picus authored
      Rename member DebugLoc -> DbgLoc (so it doesn't conflict with the class
      name).
      
      llvm-svn: 307366
      77367378
    • Diana Picus's avatar
      [ARM] GlobalISel: Select hard G_FCMP for s32 · 5b916538
      Diana Picus authored
      We lower to a sequence consisting of:
      - MOVi 0 into a register
      - VCMPS to do the actual comparison and set the VFP flags
      - FMSTAT to move the flags out of the VFP unit
      - MOVCCi to either use the "zero register" that we have previously set
        with the MOVi, or move 1 into the result register, based on the values
        of the flags
      
      As was the case with soft-float, for some predicates (one, ueq) we
      actually need two comparisons instead of just one. When that happens, we
      generate two VCMPS-FMSTAT-MOVCCi sequences and chain them by means of
      using the result of the first MOVCCi as the "zero register" for the
      second one. This is a bit overkill, since one comparison followed by
      two non-flag-setting conditional moves should be enough. In any case,
      the backend manages to CSE one of the comparisons away so it doesn't
      matter much.
      
      Note that unlike SelectionDAG and FastISel, we always use VCMPS, and not
      VCMPES. This makes the code a lot simpler, and it also seems correct
      since the LLVM Lang Ref defines simple true/false returns if the
      operands are QNaN's. For SNaN's, even VCMPS throws an Invalid Operand
      exception, so they won't be slipping through unnoticed.
      
      Implementation-wise, this introduces a template so we can share the same
      code that we use for handling integer comparisons, since the only
      differences are in the details (exact opcodes to be used etc). Hopefully
      this will be easy to extend to s64 G_FCMP.
      
      llvm-svn: 307365
      5b916538
    • George Rimar's avatar
      [ELF] - Handle symbols with default version early. · 85e9216e
      George Rimar authored
      This fixes last testcase provided in PR28414.
      In short issue is next: when we had X@@Version symbol in object A,
      we did not resolve it to X early. Then when in another object B
      we had reference to undefined X, symbol X from archive was fetched.
      Since both archive and object A contains another symbol Z, duplicate
      symbol definition was triggered as a result.
      
      Correct behavior is to use X@@Version from object A instead and do not fetch
      any symbols from archive.
      
      Differential revision: https://reviews.llvm.org/D35059
      
      llvm-svn: 307364
      85e9216e
    • Craig Topper's avatar
      [TableGen] Cleanup capturing of instruction namespace for the fast isel... · 15e3de1c
      Craig Topper authored
      [TableGen] Cleanup capturing of instruction namespace for the fast isel emitter to remove a std::string and duplicated code. NFC
      
      llvm-svn: 307363
      15e3de1c
    • Craig Topper's avatar
    • Craig Topper's avatar
      [TableGen] Add a proper namespace to an Instruction in an AsmMatcher test.... · 3d0463ff
      Craig Topper authored
      [TableGen] Add a proper namespace to an Instruction in an AsmMatcher test. This is required after r307358.
      
      llvm-svn: 307361
      3d0463ff
    • Zachary Turner's avatar
      Fix lld tests after r307356. · cea99709
      Zachary Turner authored
      llvm-svn: 307360
      cea99709
    • Rafael Espindola's avatar
      Reduce code duplication. · 77e87b34
      Rafael Espindola authored
      By addding a mapNameToDWARFSection we only need to check section names
      in one place.
      
      llvm-svn: 307359
      77e87b34
    • Craig Topper's avatar
      [TableGen] Fix some mismatches in the use of Namespace fields versus Target... · 2b347eb1
      Craig Topper authored
      [TableGen] Fix some mismatches in the use of Namespace fields versus Target name in some of our emitters.
      
      Some of our emitters were using the name of the Target to reference things that were created by others emitters using Namespace.
      
      Apparently all targets have the same Target name as their instruction and register Namespace field?
      
      Someone on IRC had a target that didn't do this and was getting build errors. This patch is a necessary, but maybe not sufficient fix.
      
      llvm-svn: 307358
      2b347eb1
    • Duncan P. N. Exon Smith's avatar
      cmath: Support clang's -fdelayed-template-parsing · 66631a12
      Duncan P. N. Exon Smith authored
      r283051 added some functions to cmath (in namespace std) that have the
      same name as functions in math.h (in the global namespace).  Clang's
      limited support for `-fdelayed-template-parsing` chokes on this.  Rename
      the ones in `cmath` and their uses in `complex` and the test.
      
      rdar://problem/32848355
      
      llvm-svn: 307357
      66631a12
    • Zachary Turner's avatar
      [PDB] Teach libpdb to write DBI Stream ECNames. · 6c4bfba8
      Zachary Turner authored
      Based strictly on the name, this seems to have something to do
      width edit & continue.  The goal of this patch has nothing to do
      with supporting edit and continue though.  msvc link.exe writes
      very basic information into this area even when *not* compiling
      with support for E&C, and so the goal here is to bring lld-link
      to parity.  Since we cannot know what assumptions standard tools
      make about the content of PDB files, we need to be as close as
      possible.
      
      This ECNames data structure is a standard PDB string hash table.
      link.exe puts a single string into this hash table, which is the
      full path to the PDB file on disk.  It then references this string
      from the module descriptor for the compiler generated `* Linker *`
      module.
      
      With this patch, lld-link will generate the exact same sequence of
      bytes as MSVC link for this subsection for a given object file
      input (as reported by `llvm-pdbutil bytes -ec`).
      
      llvm-svn: 307356
      6c4bfba8
    • Tobias Grosser's avatar
      Make create_ll work with latest LLVM [NFC] · 41f02a99
      Tobias Grosser authored
      - Instead of running with -O0, we enable the highest optimization level, but
        then disable optimizations. This ensures that possibly important metadata
        is still emitted.
      
      - Update the code for attribute removal to work with latest LLVM
      
      - Do not cut an arbitrary number of lines from the LL file. It is undocumented
        why this was needed at the first place, and such a feature is likely to
        break with trivial IR changes that may come in the future.
      
      llvm-svn: 307355
      41f02a99
    • Lang Hames's avatar
      [Orc] Add missing return value (left out in r307350). · b76aa4ac
      Lang Hames authored
      llvm-svn: 307354
      b76aa4ac
    • Tony Tye's avatar
      Correct GFX9 processor names. · d5b1cbf0
      Tony Tye authored
      Differential Revision: https://reviews.llvm.org/D33736
      
      llvm-svn: 307353
      d5b1cbf0
    • Matthias Braun's avatar
      RegisterScavenging: Fix PR33687 · eeb15168
      Matthias Braun authored
      When scavenging for a use in instruction MI, we will reload after
      that instruction and hence cannot spill uses/defs of this instruction.
      
      This fixes http://llvm.org/PR33687
      
      llvm-svn: 307352
      eeb15168
    • Matthias Braun's avatar
      LiveRegUnits: Rename accumulateBackward()->accumulate() · 1b54aa58
      Matthias Braun authored
      Contrary to the stepForward()/stepBackward() method accumulate() doesn't
      have a direction as defs, uses and clobbers all have the same effect.
      
      Also improve the documentation comment.
      
      llvm-svn: 307351
      1b54aa58
    • Lang Hames's avatar
      [ORC] Errorize the ORC APIs. · 4ce98662
      Lang Hames authored
      This patch updates the ORC layers and utilities to return and propagate
      llvm::Errors where appropriate. This is necessary to allow ORC to safely handle
      error cases in cross-process and remote JITing.
      
      llvm-svn: 307350
      4ce98662
    • Yaxun Liu's avatar
      [InferAddressSpaces] Fix assertion about null pointer · b909f11a
      Yaxun Liu authored
      InferAddressSpaces does not check address space in collectFlatAddressExpressions,
      which causes values with non flat address space put into Postorder and causes
      assertion in cloneValueWithNewAddressSpace.
      
      This patch fixes assertion in OpenCL 2.0 conformance test generic_address_space
      subtest for amdgcn target.
      
      Differential Revision: https://reviews.llvm.org/D34991
      
      llvm-svn: 307349
      b909f11a
    • Sam Clegg's avatar
      [WebAssembly] Support weak defined symbols · 5e3d33a7
      Sam Clegg authored
      Model weakly defined symbols as symbols that are both
      exports and imported and marked as weak. Local references
      to the symbols refer to the import but the linker can
      resolve this to the weak export if not strong symbol
      is found at link time.
      
      Differential Revision: https://reviews.llvm.org/D35029
      
      llvm-svn: 307348
      5e3d33a7
    • Sean Fertile's avatar
      Extend memcpy expansion in Transform/Utils to handle wider operand types. · 9cd1cdf8
      Sean Fertile authored
      Adds loop expansions for known-size and unknown-sized memcpy calls, allowing the
      target to provide the operand types through TTI callbacks. The default values
      for the TTI callbacks use int8 operand types and matches the existing behaviour
      if they aren't overridden by the target.
      
      Differential revision: https://reviews.llvm.org/D32536
      
      llvm-svn: 307346
      9cd1cdf8
    • Evgeniy Stepanov's avatar
      Revert r307342, r307343. · 7d3eeaaa
      Evgeniy Stepanov authored
      Revert "Copy arguments passed by value into explicit allocas for ASan."
      Revert "[asan] Add end-to-end tests for overflows of byval arguments."
      
      Build failure on lldb-x86_64-ubuntu-14.04-buildserver.
      Test failure on clang-cmake-aarch64-42vma and sanitizer-x86_64-linux-android.
      
      llvm-svn: 307345
      7d3eeaaa
    • Kuba Mracek's avatar
      [cmake] Cache results of find_darwin_sdk_dir · 7a493393
      Kuba Mracek authored
      This improves find_darwin_sdk_dir to cache the results of executing xcodebuild to find the SDK. Should significantly reduce the CMake re-configure time.
      
      Differential Revision: https://reviews.llvm.org/D34736
      
      llvm-svn: 307344
      7a493393
    • Evgeniy Stepanov's avatar
      [asan] Add end-to-end tests for overflows of byval arguments. · 03542db8
      Evgeniy Stepanov authored
      Included is one test for passing structs by value and one test for passing C++
      objects by value.
      
      Patch by Matt Morehouse.
      
      Differential revision: https://reviews.llvm.org/D34827
      
      llvm-svn: 307343
      03542db8
    • Evgeniy Stepanov's avatar
      Copy arguments passed by value into explicit allocas for ASan. · 2a7a4bc1
      Evgeniy Stepanov authored
      ASan determines the stack layout from alloca instructions. Since
      arguments marked as "byval" do not have an explicit alloca instruction, ASan
      does not produce red zones for them. This commit produces an explicit alloca
      instruction and copies the byval argument into the allocated memory so that red
      zones are produced.
      
      Patch by Matt Morehouse.
      
      Differential revision: https://reviews.llvm.org/D34789
      
      llvm-svn: 307342
      2a7a4bc1
    • Evgeniy Stepanov's avatar
      Update Cross-DSO CFI documentation. · 760a261e
      Evgeniy Stepanov authored
      Reviewers: pcc
      
      Subscribers: llvm-commits
      
      Differential Revision: https://reviews.llvm.org/D35094
      
      llvm-svn: 307341
      760a261e
    • Anna Thomas's avatar
      [SafepointIRVerifier] NFC: Refactor code for identifying exclusive base type · ccce8538
      Anna Thomas authored
      Added a new Enum to identify if the base pointer is exclusively null or
      exlusively some constant or not exclusively any constant.
      Converted the base pointer identification method from recursive to
      iterative form.
      
      llvm-svn: 307340
      ccce8538
    • George Karpenkov's avatar
      [lit] Modify LIT to accept environment variable LIT_FILTER to select tests. · 22a402fb
      George Karpenkov authored
      This is especially useful when lit is invoked indirectly by the build
      system, and additional arguments can not be easily specified.
      
      Differential Revision: https://reviews.llvm.org/D35091
      
      llvm-svn: 307339
      22a402fb