1. Mar 24, 2016
    • Reid Kleckner's avatar
      [asan] Export new and delete operators on Windows · 03d703bb
      Reid Kleckner authored
      This is necessary to support the dynamic CRT (/MD) with VS2015. In
      VS2015, these symbols are no longer imported from a DLL, they provided
      statically by msvcrt.lib. This means our approach of hotpatching the DLL
      no longer works.
      
      By exporting the symbols, we end up relying on the same mechanism that
      we use to intercept symbols in the static CRT (/MT) case. The ASan
      runtime always needs to appear first on the link line, and the linker
      searches for symbol definitions from left to right. This means we can
      stop hotpatching operator new and delete in the CRT, which is nice.
      
      I think that the only reason we weren't exporting the symbols already is
      because MSVC doesn't allow you to do it directly with
      __declspec(dllexport). Instead, we can use
      `#pragma comment(linker, "/export:foo")`, which is most of what the
      attribute does under the hood. It does mean we have to write down the
      mangled names of the operators, but that's not too bad.
      
      llvm-svn: 264190
      03d703bb
    • Richard Smith's avatar
      Make SemaAccess smarter about determining when a dependent class might · fd55fc86
      Richard Smith authored
      instantiate to match a friend class declaration. It's still pretty dumb,
      though.
      
      llvm-svn: 264189
      fd55fc86
    • Kevin Enderby's avatar
      Add the needed lld change for r264187 in llvm. · 2112b2c0
      Kevin Enderby authored
      Sorry had this fixed in my check out but failed mention it in my
      commit message for r264187.
      
      llvm-svn: 264188
      2112b2c0
    • Kevin Enderby's avatar
      Fix a crash in running llvm-objdump -t with an invalid Mach-O file already · 5afbc1cd
      Kevin Enderby authored
      in the test suite. While this is not really an interesting tool and option to run
      on a Mach-O file to show the symbol table in a generic libObject format
      it shouldn’t crash.
      
      The reason for the crash was in MachOObjectFile::getSymbolType() when it was
      calling MachOObjectFile::getSymbolSection() without checking its return value
      for the error case.
      
      What makes this fix require a fair bit of diffs is that the method getSymbolType() is
      in the class ObjectFile defined without an ErrorOr<> so I needed to add that all
      the sub classes.  And all of the uses needed to be updated and the return value
      needed to be checked for the error case.
      
      The MachOObjectFile version of getSymbolType() “can” get an error in trying to
      come up with the libObject’s internal SymbolRef::Type when the Mach-O symbol
      symbol type is an N_SECT type because the code is trying to select from the
      SymbolRef::ST_Data or SymbolRef::ST_Function values for the SymbolRef::Type.
      And it needs the Mach-O section to use isData() and isBSS to determine if
      it will return SymbolRef::ST_Data.
      
      One other possible fix I considered is to simply return SymbolRef::ST_Other
      when MachOObjectFile::getSymbolSection() returned an error.  But since in
      the past when I did such changes that “ate an error in the libObject code” I
      was asked instead to push the error out of the libObject code I chose not
      to implement the fix this way.
      
      As currently written both the COFF and ELF versions of getSymbolType()
      can’t get an error.  But if isReservedSectionNumber() wanted to check for
      the two known negative values rather than allowing all negative values or
      the code wanted to add the same check as in getSymbolAddress() to use
      getSection() and check for the error then these versions of getSymbolType()
      could return errors.
      
      At the end of the day the error printed now is the generic “Invalid data was
      encountered while parsing the file” for object_error::parse_failed.  In the
      future when we thread Lang’s new TypedError for recoverable error handling
      though libObject this will improve.  And where the added // Diagnostic(…
      comment is, it would be changed to produce and error message
      like “bad section index (42) for symbol at index 8” for this case.
      
      llvm-svn: 264187
      5afbc1cd
    • Sanjay Patel's avatar
      [x86] make peekThroughBitcasts() a helper function · 7876f180
      Sanjay Patel authored
      This should be hoisted further up so it can be used in DAGCombiner and other backends,
      but I'm limiting the scope in the interest of patch minimalism.
      
      It's not quite NFC because some of the replaced code was using an 'if' check rather
      than a 'while' loop, so those cases would only look through a single bitcast.
      
      llvm-svn: 264186
      7876f180
    • Chad Rosier's avatar
      [AArch64] Replace return 0 with return false. NFC. · 85c85940
      Chad Rosier authored
      llvm-svn: 264185
      85c85940
    • Richard Smith's avatar
      Make sure to perform dependent access checks when instantiating a · c7649dc7
      Richard Smith authored
      lambda-expression. We don't actually instantiate the closure type / operator()
      in the template in order to produce the closure type / operator() in the
      instantiation, so this isn't caught by the normal path.
      
      llvm-svn: 264184
      c7649dc7
    • Kyle Butt's avatar
      Codegen: [PPC] Word Rotates are Zero Extending. · 61311282
      Kyle Butt authored
      Add Word rotates to the list of instructions that are zero extending.
      This allows them to be used in dot form to compare with zero.
      
      llvm-svn: 264183
      61311282
    • Nico Weber's avatar
      clang-cl: Fix remaining bugs in interaction of /Yc and /FI /showIncludes. · f54146c1
      Nico Weber authored
      Instead of putting the /Yc header into ExtraDeps, give DependencyOutputOptions
      a dedicated field for /Yc mode, and let HeaderIncludesCallback hang on to the
      full DependencyOutputOptions object, not just ExtraDeps.
      
      Reverts parts of r263352 that are now no longer needed.
      
      llvm-svn: 264182
      f54146c1
    • Davide Italiano's avatar
      [LTO] Keep linkonce symbols when required. · bcd660a9
      Davide Italiano authored
      Similarly to how we do with linkonce_odr symbols already, but
      change their linkage to weak.
      
      llvm-svn: 264181
      bcd660a9
    • George Burgess IV's avatar
      Fix bugs in the MemorySSA walker. · 0e489868
      George Burgess IV authored
      There are a few bugs in the walker that this patch addresses.
      Primarily:
      - Caching can break when we have multiple BBs without phis
      - We weren't optimizing some phis properly
      - Because of how the DFS iterator works, there were times where we
        wouldn't cache any results of our DFS
      
      I left the test cases with FIXMEs in, because I'm not sure how much
      effort it will take to get those to work (read: We'll probably
      ultimately have to end up redoing the walker, or we'll have to come up
      with some creative caching tricks), and more test coverage = better.
      
      Differential Revision: http://reviews.llvm.org/D18065
      
      llvm-svn: 264180
      0e489868
    • Easwaran Raman's avatar
      Add getBlockProfileCount method to BlockFrequencyInfo · 12b79aa0
      Easwaran Raman authored
      Differential Revision: http://reviews.llvm.org/D18233
      
      llvm-svn: 264179
      12b79aa0
    • Nico Weber's avatar
      clang-cl: Add more tests for the interaction of /FI and /Yc /Yu. · d1728f0e
      Nico Weber authored
      Most things even work; see the included FIXMEs for things that need polishing.
      
      Also don't warn about unused flags for the `/Yuh2.h /FIh1.h /FIh2.h`.  The
      common case is that the pch was built with `/Ych2.h /FIh1.h /FIh2.h`, so h1.h
      is in the PCH, and we shouldn't warn about /FIh1.h not having an effect.
      (If we wanted to get fancy, we could store the list of -include flags in the
      pch and then check that it matches later on.)
      
      llvm-svn: 264178
      d1728f0e
    • Justin Bogner's avatar
      SelectionDAG: Remove a tautological dyn_cast. NFC · c35c1059
      Justin Bogner authored
      Index is already a StoreSDNode, so this dyn_cast doesn't do anything.
      
      llvm-svn: 264177
      c35c1059
    • Davide Italiano's avatar
      [LTO/Tests] Fix typo. Visibility -> Linkage. Pointy-hat to me. · 6af61dec
      Davide Italiano authored
      llvm-svn: 264176
      6af61dec
    • Davide Italiano's avatar
      [LTO/tests] Check optimized bitcode instead of produced shared library. · 1de78202
      Davide Italiano authored
      As requested by Rafael.
      
      llvm-svn: 264175
      1de78202
    • Nico Weber's avatar
      clang-cl: Include /FI headers in /showIncludes output. · 149d9522
      Nico Weber authored
      -H in gcc mode doesn't print -include headers, but they are included in
      depfiles written by MMD and friends. Since /showIncludes is what's used instead
      of depfiles, printing /FI there seems important (and matches cl.exe).
      
      Instead of giving HeaderIncludeGen more options, just switch on ShowAllHeaders
      in clang-cl mode and let clang::InitializePreprocessor() not put -include flags
      in the <command line> block. This changes the behavior of -E slightly, and it
      removes the <command line> flag from the output triggered by setting the
      obscure CC_PRINT_HEADERS=1 env var to true while running clang. Both of these
      seem ok to change.
      
      http://reviews.llvm.org/D18401
      
      llvm-svn: 264174
      149d9522
    • Stephane Sezer's avatar
      Implement ObjectFilePECOFF::GetEntryPointAddress. · 8e38c666
      Stephane Sezer authored
      Reviewers: zturner, clayborg
      
      Subscribers: lldb-commits
      
      Differential Revision: http://reviews.llvm.org/D17970
      
      llvm-svn: 264173
      8e38c666
    • Pete Cooper's avatar
      Copy MachO struct to temporary to avoid unaligned load UB. · e82f3a09
      Pete Cooper authored
      We were already copying this data to a temporary for endian swaps.  Now
      we just always copy it, but still only do the endian swaps when needed.
      
      llvm-svn: 264172
      e82f3a09
    • Davide Italiano's avatar
      [LTO] Only change linkage if we keep the symbol. · f20a55fc
      Davide Italiano authored
      llvm-svn: 264171
      f20a55fc
    • Faisal Vali's avatar
      [NFC] Delete an unused function parameter from a static function · 084c9124
      Faisal Vali authored
      llvm-svn: 264170
      084c9124
    • Mike Spertus's avatar
      85a8abee
    • Kuba Brecka's avatar
      ed0b2f7d
    • Manman Ren's avatar
      ObjC: Handle boolean fixed type for enum. · 6d93ad84
      Manman Ren authored
      Before this commit, we assert failure in ImplicitCastExpr
      "unheralded conversion to bool". This commit fixes the assertion by using
      the correct cast type when the fixed type is boolean.
      
      This commit also fixes the behavior for Microsoft mode as well, since
      Obj-C and Microsoft mode share the same code path.
      
      rdar://24999533
      
      llvm-svn: 264167
      6d93ad84
    • Jonathan Peyton's avatar
      Fix Visual Studio builds · b7d30cbc
      Jonathan Peyton authored
      Have Visual Studio use MemoryBarrier() instead of _mm_mfence() and remove
      __declspec align attribute from function parameters in kmp_atomic.h
      
      llvm-svn: 264166
      b7d30cbc
    • Artyom Skrobov's avatar
      Replace a string comparison in ARMSubtarget.h with a tablegen entry in ARM.td (NFC) · e6f1b7f0
      Artyom Skrobov authored
      Reviewers: rengolin, t.p.northover
      
      Subscribers: aemerson, llvm-commits, rengolin
      
      Differential Revision: http://reviews.llvm.org/D18393
      
      llvm-svn: 264165
      e6f1b7f0
    • Chih-Hung Hsieh's avatar
      [analyzer] Fix typo s/initalize/initialize/ · d0891868
      Chih-Hung Hsieh authored
      Differential Revision: http://reviews.llvm.org/D18363
      
      llvm-svn: 264164
      d0891868
  2. Mar 23, 2016