1. Oct 09, 2015
    • Duncan P. N. Exon Smith's avatar
      Support: Stop relying on iterator auto-conversion, NFC · 6eeaff16
      Duncan P. N. Exon Smith authored
      Stop relying on ilist implicit conversions from `value_type&` to
      `iterator` in YAMLParser.cpp.
      
      I eventually want to outlaw this entirely.  It encourages
      `getNextNode()` and `getPrevNode()` in iterator logic, which is
      extremely fragile (and relies on them never returning `nullptr`).
      
      FTR, there's nothing nefarious going on in this case, it was just easy
      to clean up since the callers really wanted iterators to begin with.
      
      llvm-svn: 249767
      6eeaff16
    • Reid Kleckner's avatar
      Enable gtest SEH when building with clang-cl · 066c8db3
      Reid Kleckner authored
      Clang supports SEH well enough that this should work out of the box.  If
      it doesn't, we'll hear about it.
      
      llvm-svn: 249766
      066c8db3
    • Rui Ueyama's avatar
      00851fdf
    • Duncan P. N. Exon Smith's avatar
      AArch64: Stop using MachineInstr::getNextNode() · d389165c
      Duncan P. N. Exon Smith authored
      Stop using `getNextNode()` to get an insertion point (at least, in this
      one place).  Instead, use iterator logic directly.
      
      The `getNextNode()` interface isn't actually supposed to work for
      creating iterators; it's supposed to return `nullptr` (not a real
      iterator) if this is the last node.  It's currently broken and will
      "happen" to work, but if we ever fix the function, we'll get some
      strange failures in places like this.
      
      llvm-svn: 249764
      d389165c
    • Duncan P. N. Exon Smith's avatar
      MC: Stop using Fragment::getNextNode() · ece61624
      Duncan P. N. Exon Smith authored
      Stop using `getNextNode()` to get an iterator to a fragment (at least,
      in this one place).  Instead, use iterator logic directly.
      
      The `getNextNode()` interface isn't actually supposed to work for
      creating iterators; it's supposed to return `nullptr` (not a real
      iterator) if this is the last node.  It's currently broken and will
      "happen" to work, but if we ever fix the function, we'll get some
      strange failures in places like this.
      
      llvm-svn: 249763
      ece61624
    • Frederic Riss's avatar
      [dsymutil] Try to find lipo first besides dsymutil before looking up the PATH. · 02cccde9
      Frederic Riss authored
      Even if we don't have it in PATH, lipo should usually exist in the same directory
      as dsymutil. Keep the fallback looking up the PATH, it's very useful when
      testing a non-installed executable.
      
      llvm-svn: 249762
      02cccde9
    • Richard Smith's avatar
      Split <stddef.h> out of <cstddef>. · d6cffc4f
      Richard Smith authored
      There are a bunch of macros (__need_size_t etc) that request just one piece of
      <stddef.h>; if any one of these is defined, we just directly include the
      underlying header.
      
      Note that <stddef.h> provides a ::nullptr_t. We don't want that available to
      includers of <cstddef>, so instead of following the usual pattern where <cfoo>
      includes <foo.h> then pulls things from :: into std:: with using-declarations,
      we implement <stddef.h> and <cstddef> separately; both include <__nullptr> for
      the definition of std::nullptr_t.
      
      llvm-svn: 249761
      d6cffc4f
    • Hal Finkel's avatar
      [ELF2] Make the system page size a target-dependent property · e3c2626a
      Hal Finkel authored
      The required page alignment is different on different targets. On PowerPC, for
      example, we need 64K pages (the loader won't set different permissions on a
      finer granularity than that). I've set the existing targets to what I believe
      to be the correct values, and have updated the regression tests accordingly.
      
      llvm-svn: 249760
      e3c2626a
    • Evgeniy Stepanov's avatar
      Fix msan tests build. · 6870dc73
      Evgeniy Stepanov authored
      CMake build rules listed -I flags for two different libc++ header
      locations which broke when libc++ headers started using include_next.
      
      Also change -I to -isystem to avoid compiler warning about
      include_next.
      
      llvm-svn: 249759
      6870dc73
    • Duncan P. N. Exon Smith's avatar
      PowerPC: Don't use getNextNode() for insertion point · a3da4488
      Duncan P. N. Exon Smith authored
      Stop using `getNextNode()` to create an insertion point for machine
      instructions (at least, in this one place).  Instead, use an iterator.
      As a drive-by, clean up dump statements to use iterator logic.
      
      The `getNextNode()` interface isn't actually supposed to work for
      insertion points; it's supposed to return `nullptr` if this is the last
      node.  It's currently broken and will "happen" to work, but if we ever
      fix the function, we'll get some strange failures.
      
      llvm-svn: 249758
      a3da4488
    • Hal Finkel's avatar
      [ELF2] Make the .plt entry size target dependent · 6c2a3b83
      Hal Finkel authored
      The size of a .plt entry is different on different targets (it is,
      specifically, much larger than 8 on all PPC ABIs). There is no functional
      change here (later patches to create .plt entries for PPC64 will depend on this
      change).
      
      llvm-svn: 249756
      6c2a3b83
    • Jason Molenda's avatar
      Re-commit the (fixed) changes from r248985 which were reverted by Pavel · 8825c5c9
      Jason Molenda authored
      when they introduced android testsuite regressions.  Pavel has run the
      testsuite against the updated patch and it completes cleanly now.
      
      The original commit message:
      
      
      Fixing a subtle issue on Mac OS X systems with dSYMs (possibly
      introduced by r235737 but I didn't look into it too closely).
      
      A dSYM can have a per-UUID plist in it which tells lldb where
      to find an executable binary for the dSYM (DBGSymbolRichExecutable)
      - other information can be included in this plist, like how to
      remap the source file paths from their build pathnames to their
      long-term storage pathnames.
      
      This per-UUID plist is a unusual; it is used probably exclusively
      inside apple with our build system.  It is not created by default
      in normal dSYMs.
      
      The problem was like this:
      
        1. lldb wants to find an executable, given only a UUID
           (this happens when lldb is doing cross-host debugging
            and doesn't have a copy of the target system's binaries)
      
        2. It eventually calls LocateMacOSXFilesUsingDebugSymbols
           which does a spotlight search for the dSYM on the local
           system, and failing that, tries the DBGShellCommands
           command to find the dSYM.
      
        3. It gets a dSYM.  It reads the per-UUID plist in the dSYM.
           The dSYM has a DBGSymbolRichExecutable kv pair pointing to
           the binary on a network filesystem.
      
        4. Using the binary on the network filesystem, lldb now goes
           to find the dSYM.
      
        5. It starts by looking for a dSYM next to the binary it found.
      
        6. lldb is now reading the dSYM over a network filesystem,
           ignoring the one it found on its local filesystem earlier.
      
      Everything still *works* but it's much slower.
      
      This would be a tricky one to write up in a testsuite case;
      you really need the binary to not exist on the local system.
      And LocateMacOSXFilesUsingDebugSymbols will only compile on
      Mac OS X - even if I found a way to write up a test case, it
      would not run anywhere but on a mac.
      
      One change Greg wanted while I was touching this code was to
      have LocateMacOSXFilesUsingDebugSymbols (which could be asked
      to find a binary OR find a dSYM) to instead return a ModuleSpec
      with the sum total of everything it could find.  This
      change of passing around a ModuleSpec instead of a FileSpec
      was percolated up into ModuleList::GetSharedModule.
      
      The changes to LocateMacOSXFilesUsingDebugSymbols look larger
      than they really are - there's a lot of simple whitespace changes
      in there.
      
      I ran the testsuites on mac, no new regressions introduced
      
      <rdar://problem/21993813> 
      
      llvm-svn: 249755
      8825c5c9
    • Evgeniy Stepanov's avatar
      New MSan mapping layout (compiler-rt part). · b688a479
      Evgeniy Stepanov authored
      This is an implementation of
      https://github.com/google/sanitizers/issues/579
      
      It has a number of advantages over the current mapping:
      * Works for non-PIE executables.
      * Does not require ASLR; as a consequence, debugging MSan programs in
        gdb no longer requires "set disable-randomization off".
      * Supports linux kernels >=4.1.2.
      * The code is marginally faster and smaller.
      
      This is an ABI break. We never really promised ABI stability, but
      this patch includes a courtesy escape hatch: a compile-time macro
      that reverts back to the old mapping layout.
      
      llvm-svn: 249754
      b688a479
    • Evgeniy Stepanov's avatar
      New MSan mapping layout (llvm part). · d12212bc
      Evgeniy Stepanov authored
      This is an implementation of
      https://github.com/google/sanitizers/issues/579
      
      It has a number of advantages over the current mapping:
      * Works for non-PIE executables.
      * Does not require ASLR; as a consequence, debugging MSan programs in
        gdb no longer requires "set disable-randomization off".
      * Supports linux kernels >=4.1.2.
      * The code is marginally faster and smaller.
      
      This is an ABI break. We never really promised ABI stability, but
      this patch includes a courtesy escape hatch: a compile-time macro
      that reverts back to the old mapping layout.
      
      llvm-svn: 249753
      d12212bc
    • Hal Finkel's avatar
      Revert: r249728 - Roll back r249726 and r249723 because they broke buildbots. · 4729064a
      Hal Finkel authored
      Reapply r249726 (and r249723), hopefully with the correct test fixups this time.
      
      Original commit message:
      
      Address a FIXME in ELF/Writer.cpp: Make VAStart a target-dependent property.
      I've set the values for the existing targets to what I believe to be the
      correct values, and updated the regression tests accordingly.
      
      llvm-svn: 249752
      4729064a
    • Evgeniy Stepanov's avatar
      Use Triple.isAndroid() where possible. · 14deb7b6
      Evgeniy Stepanov authored
      llvm-svn: 249751
      14deb7b6
    • Evgeniy Stepanov's avatar
      Add Triple::isAndroid(). · 5fe279e7
      Evgeniy Stepanov authored
      This is a simple refactoring that replaces Triple.getEnvironment()
      checks for Android with Triple.isAndroid().
      
      llvm-svn: 249750
      5fe279e7
    • Richard Smith's avatar
      Fix incorrect file header. This is <cfenv> not <cctype>. · 239ab3c0
      Richard Smith authored
      llvm-svn: 249749
      239ab3c0
    • Reid Kleckner's avatar
      [WinEH] Push cleanupendpad scopes around exceptional cleanups · 55391524
      Reid Kleckner authored
      We were only doing this for SEH as a special case. Generalize it to all
      cleanups.
      
      llvm-svn: 249748
      55391524
    • Greg Clayton's avatar
      Moved the target specific ClangASTContext initialization over into ClangASTContext::CreateInstance. · 5beec213
      Greg Clayton authored
      This involved changing the TypeSystem::CreateInstance to take a module or a target. This allows type systems to create an AST for modules (no expression support needed) or targets (expression support is needed) and return the correct class instance for both cases.
      
      llvm-svn: 249747
      5beec213
    • Rui Ueyama's avatar
      Re-apply r249630: ELF2: Use `-flavor gnu2` after `not` to fix Windows buildbot. · 1890799f
      Rui Ueyama authored
      Thanks to George Rimar's r249696, `not` is now able to find ld.lld2
      executable correctly.
      
      llvm-svn: 249746
      1890799f
    • Teresa Johnson's avatar
      Fix another UBSan test error from r248897 and follow on fix r249689 · 881e8860
      Teresa Johnson authored
      While here fix a few more issues with potential overflow and add
      new tests for these cases. Ensured that test now passes with UBSan.
      
      llvm-svn: 249745
      881e8860
    • Rafael Espindola's avatar
      Don't silently ignore an error. · 6390d16f
      Rafael Espindola authored
      Found by inspection.
      
      llvm-svn: 249744
      6390d16f
    • Richard Smith's avatar
      Split <setjmp.h> out of <csetjmp>. · 38a2a28f
      Richard Smith authored
      llvm-svn: 249743
      38a2a28f
    • Richard Smith's avatar
      Split <math.h> out of <cmath>. · 524956bb
      Richard Smith authored
      llvm-svn: 249742
      524956bb
    • Richard Smith's avatar
      Split <inttypes.h> out of <cinttypes>. · 37df7a05
      Richard Smith authored
      llvm-svn: 249741
      37df7a05
    • Richard Smith's avatar
      Split <float.h> out of <cfloat>. · 33700e64
      Richard Smith authored
      llvm-svn: 249740
      33700e64
    • Richard Smith's avatar
      Split <errno.h> out of <cerrno>. · 3cb38811
      Richard Smith authored
      llvm-svn: 249739
      3cb38811
    • Richard Smith's avatar
      Split <ctype.h> out of <cctype>. · f80c1b73
      Richard Smith authored
      llvm-svn: 249738
      f80c1b73
    • Richard Smith's avatar
      Factor definition of std::nullptr_t out of <cstddef> into a header that can... · c467d9b4
      Richard Smith authored
      Factor definition of std::nullptr_t out of <cstddef> into a header that can also be used by <stddef.h>.
      
      llvm-svn: 249737
      c467d9b4
    • Rafael Espindola's avatar
      Make this test a bit stricter. · 98af66f9
      Rafael Espindola authored
      The only way for SecIndex to be zero in here is for an extended section
      number to be zero, which would be an error.
      
      llvm-svn: 249736
      98af66f9
    • Akira Hatanaka's avatar
      [CodeGen] [CodeGen] Attach function attributes to functions created in · aec6b2c2
      Akira Hatanaka authored
      CGBlocks.cpp.
      
      This commit fixes a bug in clang's code-gen where it creates the
      following functions but doesn't attach function attributes to them:
      
      __copy_helper_block_
      __destroy_helper_block_
      __Block_byref_object_copy_
      __Block_byref_object_dispose_
      
      rdar://problem/20828324
      
      Differential Revision: http://reviews.llvm.org/D13525
      
      llvm-svn: 249735
      aec6b2c2
    • Eric Christopher's avatar
      ab2241f1
    • Eric Christopher's avatar
      Handle sse turning on mmx, but no -mmx not turning off SSE. · a7260af7
      Eric Christopher authored
      Rationale :
      
      // sse3
      __m128d test_mm_addsub_pd(__m128d A, __m128d B) {
        return _mm_addsub_pd(A, B);
      }
      
      // mmx
      void shift(__m64 a, __m64 b, int c) {
        _mm_slli_pi16(a, c);
        _mm_slli_pi32(a, c);
        _mm_slli_si64(a, c);
        _mm_srli_pi16(a, c);
        _mm_srli_pi32(a, c);
        _mm_srli_si64(a, c);
        _mm_srai_pi16(a, c);
        _mm_srai_pi32(a, c);
      }
      
      clang -msse3 -mno-mmx file.c -c
      
      For this code we should be able to explicitly turn off MMX
      without affecting the compilation of the SSE3 function and then
      diagnose and error on compiling the MMX function.
      
      This is a preparatory patch to the actual diagnosis code which is
      coming in a future patch. This sets us up to have the correct information
      where we need it and verifies that it's being emitted for the backend
      to handle.
      
      llvm-svn: 249733
      a7260af7
    • Eric Christopher's avatar
      Migrate most feature map inclusion to initFeatureMap for the x86 target so · bbd746db
      Eric Christopher authored
      that we can build up an accurate set of features rather than relying on
      TargetInfo initialization via handleTargetFeatures to munge the list
      of features.
      
      llvm-svn: 249732
      bbd746db
    • Eric Christopher's avatar
      Move the MMX subtarget feature out of the SSE set of features and into · 11e59836
      Eric Christopher authored
      its own variable.
      
      This is needed so that we can explicitly turn off MMX without turning
      off SSE and also so that we can diagnose feature set incompatibilities
      that involve MMX without SSE.
      
      Rationale:
      
      // sse3
      __m128d test_mm_addsub_pd(__m128d A, __m128d B) {
        return _mm_addsub_pd(A, B);
      }
      
      // mmx
      void shift(__m64 a, __m64 b, int c) {
        _mm_slli_pi16(a, c);
        _mm_slli_pi32(a, c);
        _mm_slli_si64(a, c);
        _mm_srli_pi16(a, c);
        _mm_srli_pi32(a, c);
        _mm_srli_si64(a, c);
        _mm_srai_pi16(a, c);
        _mm_srai_pi32(a, c);
      }
      
      clang -msse3 -mno-mmx file.c -c
      
      For this code we should be able to explicitly turn off MMX
      without affecting the compilation of the SSE3 function and then
      diagnose and error on compiling the MMX function.
      
      This matches the existing gcc behavior and follows the spirit of
      the SSE/MMX separation in llvm where we can (and do) turn off
      MMX code generation except in the presence of intrinsics.
      
      Updated a couple of tests, but primarily tested with a couple of tests
      for turning on only mmx and only sse.
      
      This is paired with a patch to clang to take advantage of this behavior.
      
      llvm-svn: 249731
      11e59836
    • Evgeniy Stepanov's avatar
      Revert "[lsan] [aarch64] Add support for AArch64" · 43761563
      Evgeniy Stepanov authored
      This reverts commit ea02fa45225c35613bfecab383fb526e24b74497 (r249337).
      
      Reason: broken "ninja AsanUnitTests" on Android/AArch64.
      http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux/builds/20675/steps/build%20compiler-rt%20android%2Faarch64/logs/stdio
      
      llvm-svn: 249730
      43761563
    • Rui Ueyama's avatar
      af21d923
    • Rui Ueyama's avatar
      Roll back r249726 and r249723 because they broke buildbots. · 7114f059
      Rui Ueyama authored
      llvm-svn: 249728
      7114f059
    • Aaron Ballman's avatar
      Adding a checker (cert-err52-cpp) that detects use of setjmp or longjmp in C++... · e4b1765a
      Aaron Ballman authored
      Adding a checker (cert-err52-cpp) that detects use of setjmp or longjmp in C++ code. Corresponds to the CERT C++ secure coding rule: https://www.securecoding.cert.org/confluence/pages/viewpage.action?pageId=1834
      
      llvm-svn: 249727
      e4b1765a