r373078 - [clang] [AST] Treat "inline gnu_inline" the same way as "extern inline gnu_inline" in C++ mode

2019-09-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Sep 27 05:25:19 2019
New Revision: 373078

URL: http://llvm.org/viewvc/llvm-project?rev=373078=rev
Log:
[clang] [AST] Treat "inline gnu_inline" the same way as "extern inline 
gnu_inline" in C++ mode

This matches how GCC handles it, see e.g. https://gcc.godbolt.org/z/HPplnl.
GCC documents the gnu_inline attribute with "In C++, this attribute does
not depend on extern in any way, but it still requires the inline keyword
to enable its special behavior."

The previous behaviour of gnu_inline in C++, without the extern
keyword, can be traced back to the original commit that added
support for gnu_inline, SVN r69045.

Differential Revision: https://reviews.llvm.org/D67414

Added:
cfe/trunk/test/SemaCXX/gnu_inline.cpp
Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/CodeGen/inline.c
cfe/trunk/test/SemaCUDA/gnu-inline.cu
cfe/trunk/test/SemaCXX/undefined-inline.cpp

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=373078=373077=373078=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Fri Sep 27 05:25:19 2019
@@ -128,7 +128,10 @@ C11 Feature Support
 C++ Language Changes in Clang
 -
 
-- ...
+- The behaviour of the `gnu_inline` attribute now matches GCC, for cases
+  where used without the `extern` keyword. As this is a change compared to
+  how it behaved in previous Clang versions, a warning is emitted for this
+  combination.
 
 C++1z Feature Support
 ^

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=373078=373077=373078=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Sep 27 05:25:19 
2019
@@ -3008,6 +3008,10 @@ def warn_gnu_inline_attribute_requires_i
   "'gnu_inline' attribute requires function to be marked 'inline',"
   " attribute ignored">,
   InGroup;
+def warn_gnu_inline_cplusplus_without_extern : Warning<
+  "'gnu_inline' attribute without 'extern' in C++ treated as externally"
+  " available, this changed in Clang 10">,
+  InGroup>;
 def err_attribute_vecreturn_only_vector_member : Error<
   "the vecreturn attribute can only be used on a class or structure with one 
member, which must be a vector">;
 def err_attribute_vecreturn_only_pod_record : Error<

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=373078=373077=373078=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Fri Sep 27 05:25:19 2019
@@ -3261,6 +3261,9 @@ bool FunctionDecl::doesDeclarationForceE
   return true;
   }
 
+  if (Context.getLangOpts().CPlusPlus)
+return false;
+
   if (Context.getLangOpts().GNUInline || hasAttr()) {
 // With GNU inlining, a declaration with 'inline' but not 'extern', forces
 // an externally visible definition.
@@ -3289,9 +3292,6 @@ bool FunctionDecl::doesDeclarationForceE
 return FoundBody;
   }
 
-  if (Context.getLangOpts().CPlusPlus)
-return false;
-
   // C99 6.7.4p6:
   //   [...] If all of the file scope declarations for a function in a
   //   translation unit include the inline function specifier without extern,
@@ -3371,6 +3371,8 @@ bool FunctionDecl::isInlineDefinitionExt
 // If it's not the case that both 'inline' and 'extern' are
 // specified on the definition, then this inline definition is
 // externally visible.
+if (Context.getLangOpts().CPlusPlus)
+  return false;
 if (!(isInlineSpecified() && getStorageClass() == SC_Extern))
   return true;
 

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=373078=373077=373078=diff
==
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Sep 27 05:25:19 2019
@@ -4255,6 +4255,9 @@ static void handleGNUInlineAttr(Sema ,
 return;
   }
 
+  if (S.LangOpts.CPlusPlus && Fn->getStorageClass() != SC_Extern)
+S.Diag(AL.getLoc(), diag::warn_gnu_inline_cplusplus_without_extern);
+
   D->addAttr(::new (S.Context) GNUInlineAttr(S.Context, AL));
 }
 

Modified: cfe/trunk/test/CodeGen/inline.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/inline.c?rev=373078=373077=373078=diff

[libunwind] r360861 - [PPC64][libunwind] Fix r2 not properly restored

2019-05-16 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed May 15 23:49:13 2019
New Revision: 360861

URL: http://llvm.org/viewvc/llvm-project?rev=360861=rev
Log:
[PPC64][libunwind] Fix r2 not properly restored

This change makes each unwind step inspect the instruction at the
return address and, if needed, read r2 from its saved location and
modify the context appropriately.

The unwind logic is able to handle both ELFv1 and ELFv2 stacks.

Reported by Bug 41050

Patch by Leandro Lupori!

Differential Revision: https://reviews.llvm.org/D59694

Modified:
libunwind/trunk/src/DwarfInstructions.hpp
libunwind/trunk/src/assembly.h
libunwind/trunk/test/lit.cfg

Modified: libunwind/trunk/src/DwarfInstructions.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=360861=360860=360861=diff
==
--- libunwind/trunk/src/DwarfInstructions.hpp (original)
+++ libunwind/trunk/src/DwarfInstructions.hpp Wed May 15 23:49:13 2019
@@ -232,6 +232,31 @@ int DwarfInstructions::stepWithDwa
   }
 #endif
 
+#if defined(_LIBUNWIND_TARGET_PPC64)
+#define PPC64_ELFV1_R2_LOAD_INST_ENCODING 0xe8410028u // ld r2,40(r1)
+#define PPC64_ELFV1_R2_OFFSET 40
+#define PPC64_ELFV2_R2_LOAD_INST_ENCODING 0xe8410018u // ld r2,24(r1)
+#define PPC64_ELFV2_R2_OFFSET 24
+  // If the instruction at return address is a TOC (r2) restore,
+  // then r2 was saved and needs to be restored.
+  // ELFv2 ABI specifies that the TOC Pointer must be saved at SP + 24,
+  // while in ELFv1 ABI it is saved at SP + 40.
+  if (R::getArch() == REGISTERS_PPC64 && returnAddress != 0) {
+pint_t sp = newRegisters.getRegister(UNW_REG_SP);
+pint_t r2 = 0;
+switch (addressSpace.get32(returnAddress)) {
+case PPC64_ELFV1_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV1_R2_OFFSET);
+  break;
+case PPC64_ELFV2_R2_LOAD_INST_ENCODING:
+  r2 = addressSpace.get64(sp + PPC64_ELFV2_R2_OFFSET);
+  break;
+}
+if (r2)
+  newRegisters.setRegister(UNW_PPC64_R2, r2);
+  }
+#endif
+
   // Return address is address after call site instruction, so setting IP 
to
   // that does simualates a return.
   newRegisters.setIP(returnAddress);

Modified: libunwind/trunk/src/assembly.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=360861=360860=360861=diff
==
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Wed May 15 23:49:13 2019
@@ -36,6 +36,20 @@
 #define SEPARATOR ;
 #endif
 
+#if defined(__powerpc64__) && (!defined(_CALL_ELF) || _CALL_ELF == 1)
+#define PPC64_OPD1 .section .opd,"aw",@progbits SEPARATOR
+#define PPC64_OPD2 SEPARATOR \
+  .p2align 3 SEPARATOR \
+  .quad .Lfunc_begin0 SEPARATOR \
+  .quad .TOC.@tocbase SEPARATOR \
+  .quad 0 SEPARATOR \
+  .text SEPARATOR \
+.Lfunc_begin0:
+#else
+#define PPC64_OPD1
+#define PPC64_OPD2
+#endif
+
 #define GLUE2(a, b) a ## b
 #define GLUE(a, b) GLUE2(a, b)
 #define SYMBOL_NAME(name) GLUE(__USER_LABEL_PREFIX__, name)
@@ -123,7 +137,9 @@
   .globl SYMBOL_NAME(name) SEPARATOR   
\
   HIDDEN_SYMBOL(SYMBOL_NAME(name)) SEPARATOR   
\
   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR  
\
-  SYMBOL_NAME(name):
+  PPC64_OPD1   
\
+  SYMBOL_NAME(name):   
\
+  PPC64_OPD2
 
 #if defined(__arm__)
 #if !defined(__ARM_ARCH)

Modified: libunwind/trunk/test/lit.cfg
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/test/lit.cfg?rev=360861=360860=360861=diff
==
--- libunwind/trunk/test/lit.cfg (original)
+++ libunwind/trunk/test/lit.cfg Wed May 15 23:49:13 2019
@@ -23,6 +23,9 @@ config.suffixes = ['.cpp', '.s']
 # test_source_root: The root path where tests are located.
 config.test_source_root = os.path.dirname(__file__)
 
+# needed to test libunwind with code that throws exceptions
+config.enable_exceptions = True
+
 # Infer the libcxx_test_source_root for configuration import.
 # If libcxx_source_root isn't specified in the config, assume that the libcxx
 # and libunwind source directories are sibling directories.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r360862 - [PPC] Fix 32-bit build of libunwind

2019-05-16 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed May 15 23:49:20 2019
New Revision: 360862

URL: http://llvm.org/viewvc/llvm-project?rev=360862=rev
Log:
[PPC] Fix 32-bit build of libunwind

Clang integrated assembler was unable to build libunwind PPC32 assembly code,
present in functions used to save/restore register context.

This change consists in replacing the assembly style used in libunwind source,
to one that is compatible with both Clang integrated assembler as well as
GNU assembler.

Patch by Leandro Lupori!

Differential Revision: https://reviews.llvm.org/D61792

Modified:
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=360862=360861=360862=diff
==
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Wed May 15 23:49:20 2019
@@ -395,119 +395,119 @@ Lnovec:
 #elif defined(__ppc__)
 
 DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind13Registers_ppc6jumptoEv)
-;
-; void libunwind::Registers_ppc::jumpto()
-;
-; On entry:
-;  thread_state pointer is in r3
-;
-
-  ; restore integral registerrs
-  ; skip r0 for now
-  ; skip r1 for now
-  lwz r2, 16(r3)
-  ; skip r3 for now
-  ; skip r4 for now
-  ; skip r5 for now
-  lwz r6, 32(r3)
-  lwz r7, 36(r3)
-  lwz r8, 40(r3)
-  lwz r9, 44(r3)
-  lwzr10, 48(r3)
-  lwzr11, 52(r3)
-  lwzr12, 56(r3)
-  lwzr13, 60(r3)
-  lwzr14, 64(r3)
-  lwzr15, 68(r3)
-  lwzr16, 72(r3)
-  lwzr17, 76(r3)
-  lwzr18, 80(r3)
-  lwzr19, 84(r3)
-  lwzr20, 88(r3)
-  lwzr21, 92(r3)
-  lwzr22, 96(r3)
-  lwzr23,100(r3)
-  lwzr24,104(r3)
-  lwzr25,108(r3)
-  lwzr26,112(r3)
-  lwzr27,116(r3)
-  lwzr28,120(r3)
-  lwzr29,124(r3)
-  lwzr30,128(r3)
-  lwzr31,132(r3)
-
-  ; restore float registers
-  lfdf0, 160(r3)
-  lfdf1, 168(r3)
-  lfdf2, 176(r3)
-  lfdf3, 184(r3)
-  lfdf4, 192(r3)
-  lfdf5, 200(r3)
-  lfdf6, 208(r3)
-  lfdf7, 216(r3)
-  lfdf8, 224(r3)
-  lfdf9, 232(r3)
-  lfdf10,240(r3)
-  lfdf11,248(r3)
-  lfdf12,256(r3)
-  lfdf13,264(r3)
-  lfdf14,272(r3)
-  lfdf15,280(r3)
-  lfdf16,288(r3)
-  lfdf17,296(r3)
-  lfdf18,304(r3)
-  lfdf19,312(r3)
-  lfdf20,320(r3)
-  lfdf21,328(r3)
-  lfdf22,336(r3)
-  lfdf23,344(r3)
-  lfdf24,352(r3)
-  lfdf25,360(r3)
-  lfdf26,368(r3)
-  lfdf27,376(r3)
-  lfdf28,384(r3)
-  lfdf29,392(r3)
-  lfdf30,400(r3)
-  lfdf31,408(r3)
-
-  ; restore vector registers if any are in use
-  lwzr5,156(r3)  ; test VRsave
-  cmpwi  r5,0
-  beqLnovec
-
-  subi  r4,r1,16
-  rlwinm  r4,r4,0,0,27  ; mask low 4-bits
-  ; r4 is now a 16-byte aligned pointer into the red zone
-  ; the _vectorRegisters may not be 16-byte aligned so copy via red zone temp 
buffer
-
+//
+// void libunwind::Registers_ppc::jumpto()
+//
+// On entry:
+//  thread_state pointer is in r3
+//
+
+  // restore integral registerrs
+  // skip r0 for now
+  // skip r1 for now
+  lwz %r2,  16(%r3)
+  // skip r3 for now
+  // skip r4 for now
+  // skip r5 for now
+  lwz %r6,  32(%r3)
+  lwz %r7,  36(%r3)
+  lwz %r8,  40(%r3)
+  lwz %r9,  44(%r3)
+  lwz %r10, 48(%r3)
+  lwz %r11, 52(%r3)
+  lwz %r12, 56(%r3)
+  lwz %r13, 60(%r3)
+  lwz %r14, 64(%r3)
+  lwz %r15, 68(%r3)
+  lwz %r16, 72(%r3)
+  lwz %r17, 76(%r3)
+  lwz %r18, 80(%r3)
+  lwz %r19, 84(%r3)
+  lwz %r20, 88(%r3)
+  lwz %r21, 92(%r3)
+  lwz %r22, 96(%r3)
+  lwz %r23,100(%r3)
+  lwz %r24,104(%r3)
+  lwz %r25,108(%r3)
+  lwz %r26,112(%r3)
+  lwz %r27,116(%r3)
+  lwz %r28,120(%r3)
+  lwz %r29,124(%r3)
+  lwz %r30,128(%r3)
+  lwz %r31,132(%r3)
+
+  // restore float registers
+  lfd %f0, 160(%r3)
+  lfd %f1, 168(%r3)
+  lfd %f2, 176(%r3)
+  lfd %f3, 184(%r3)
+  lfd %f4, 192(%r3)
+  lfd %f5, 200(%r3)
+  lfd %f6, 208(%r3)
+  lfd %f7, 216(%r3)
+  lfd %f8, 224(%r3)
+  lfd %f9, 232(%r3)
+  lfd %f10,240(%r3)
+  lfd %f11,248(%r3)
+  lfd %f12,256(%r3)
+  lfd %f13,264(%r3)
+  lfd %f14,272(%r3)
+  lfd %f15,280(%r3)
+  lfd %f16,288(%r3)
+  lfd %f17,296(%r3)
+  lfd %f18,304(%r3)
+  lfd %f19,312(%r3)
+  lfd %f20,320(%r3)
+  lfd %f21,328(%r3)
+  lfd %f22,336(%r3)
+  lfd %f23,344(%r3)
+  lfd %f24,352(%r3)
+  lfd %f25,360(%r3)
+  lfd %f26,368(%r3)
+  lfd %f27,376(%r3)
+  lfd %f28,384(%r3)
+  lfd %f29,392(%r3)
+  lfd %f30,400(%r3)
+  lfd %f31,408(%r3)
+
+  // restore vector registers if any are in use
+  lwz %r5, 156(%r3)   // test VRsave
+  cmpwi   %r5, 0
+  beq Lnovec
+

r360081 - [MinGW] Use SEH by default on AArch64

2019-05-06 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon May  6 14:19:01 2019
New Revision: 360081

URL: http://llvm.org/viewvc/llvm-project?rev=360081=rev
Log:
[MinGW] Use SEH by default on AArch64

The implementation of SEH is pretty mature at this point.

Differential Revision: https://reviews.llvm.org/D61591

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/windows-exceptions.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=360081=360080=360081=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon May  6 14:19:01 2019
@@ -436,7 +436,8 @@ bool toolchains::MinGW::IsUnwindTablesDe
   if (ExceptionArg &&
   ExceptionArg->getOption().matches(options::OPT_fseh_exceptions))
 return true;
-  return getArch() == llvm::Triple::x86_64;
+  return getArch() == llvm::Triple::x86_64 ||
+ getArch() == llvm::Triple::aarch64;
 }
 
 bool toolchains::MinGW::isPICDefault() const {
@@ -451,7 +452,7 @@ bool toolchains::MinGW::isPICDefaultForc
 
 llvm::ExceptionHandling
 toolchains::MinGW::GetExceptionModel(const ArgList ) const {
-  if (getArch() == llvm::Triple::x86_64)
+  if (getArch() == llvm::Triple::x86_64 || getArch() == llvm::Triple::aarch64)
 return llvm::ExceptionHandling::WinEH;
   return llvm::ExceptionHandling::DwarfCFI;
 }

Modified: cfe/trunk/test/Driver/windows-exceptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-exceptions.cpp?rev=360081=360080=360081=diff
==
--- cfe/trunk/test/Driver/windows-exceptions.cpp (original)
+++ cfe/trunk/test/Driver/windows-exceptions.cpp Mon May  6 14:19:01 2019
@@ -2,8 +2,8 @@
 // RUN: %clang -target x86_64-windows-msvc -c %s -### 2>&1 | FileCheck 
-check-prefix=MSVC %s
 // RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-DWARF %s
 // RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-SEH %s
-// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-DWARF %s
-// RUN: %clang -target aarch64-windows-gnu -fseh-exceptions -c %s -### 2>&1 | 
FileCheck -check-prefix=MINGW-SEH %s
+// RUN: %clang -target aarch64-windows-gnu -fdwarf-exceptions -c %s -### 2>&1 
| FileCheck -check-prefix=MINGW-DWARF %s
+// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-SEH %s
 
 MSVC-NOT: -fdwarf-exceptions
 MSVC-NOT: -fseh-exceptions


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r360082 - [AArch64] Add __builtin_sponentry, for calling setjmp in MinGW

2019-05-06 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon May  6 14:19:07 2019
New Revision: 360082

URL: http://llvm.org/viewvc/llvm-project?rev=360082=rev
Log:
[AArch64] Add __builtin_sponentry, for calling setjmp in MinGW

In MinGW, setjmp isn't expanded as a builtin in the compiler (like it
is for MSVC), but manually hooked up as calls to the right underlying
functions in headers. Using the actual CRT's real setjmp/longjmp
functions requires this intrinsic. (Currently this is worked around by
using MinGW specific reimplementations of setjmp/longjmp on aarch64.)

Differential Revision: https://reviews.llvm.org/D61592

Added:
cfe/trunk/test/CodeGen/builtin-sponentry.c
Modified:
cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
cfe/trunk/lib/CodeGen/CGBuiltin.cpp

Modified: cfe/trunk/include/clang/Basic/BuiltinsAArch64.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/BuiltinsAArch64.def?rev=360082=360081=360082=diff
==
--- cfe/trunk/include/clang/Basic/BuiltinsAArch64.def (original)
+++ cfe/trunk/include/clang/Basic/BuiltinsAArch64.def Mon May  6 14:19:07 2019
@@ -86,6 +86,9 @@ LANGBUILTIN(__wfi,   "v", "",   ALL_MS_L
 LANGBUILTIN(__sev,   "v", "",   ALL_MS_LANGUAGES)
 LANGBUILTIN(__sevl,  "v", "",   ALL_MS_LANGUAGES)
 
+// Misc
+BUILTIN(__builtin_sponentry, "v*", "c")
+
 TARGET_HEADER_BUILTIN(_BitScanForward, "UcUNi*UNi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_BitScanReverse, "UcUNi*UNi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")
 TARGET_HEADER_BUILTIN(_BitScanForward64, "UcUNi*ULLi", "nh", "intrin.h", 
ALL_MS_LANGUAGES, "")

Modified: cfe/trunk/lib/CodeGen/CGBuiltin.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuiltin.cpp?rev=360082=360081=360082=diff
==
--- cfe/trunk/lib/CodeGen/CGBuiltin.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGBuiltin.cpp Mon May  6 14:19:07 2019
@@ -7233,6 +7233,11 @@ Value *CodeGenFunction::EmitAArch64Built
 return Builder.CreateCall(F);
   }
 
+  if (BuiltinID == AArch64::BI__builtin_sponentry) {
+llvm::Function *F = CGM.getIntrinsic(Intrinsic::sponentry);
+return Builder.CreateCall(F);
+  }
+
   // Find out if any arguments are required to be integer constant
   // expressions.
   unsigned ICEArguments = 0;

Added: cfe/trunk/test/CodeGen/builtin-sponentry.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/builtin-sponentry.c?rev=360082=auto
==
--- cfe/trunk/test/CodeGen/builtin-sponentry.c (added)
+++ cfe/trunk/test/CodeGen/builtin-sponentry.c Mon May  6 14:19:07 2019
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple aarch64-windows-gnu -Oz -emit-llvm %s -o - | 
FileCheck %s
+
+void *test_sponentry() {
+  return __builtin_sponentry();
+}
+// CHECK-LABEL: define dso_local i8* @test_sponentry()
+// CHECK: = tail call i8* @llvm.sponentry()
+// CHECK: ret i8*


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r359343 - [MinGW] Do dllexport inline methods in template instantiation

2019-04-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Apr 26 12:31:46 2019
New Revision: 359343

URL: http://llvm.org/viewvc/llvm-project?rev=359343=rev
Log:
[MinGW] Do dllexport inline methods in template instantiation

Normally, in MinGW mode, inline methods aren't dllexported.

However, in the case of a dllimported template instantiation,
the inline methods aren't instantiated locally, but referenced
from the instantiation. Therefore, those methods also need to
be dllexported, in the case of an instantiation.

GCC suffers from the same issue, reported at [1], but the issue
is still unresolved there.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89088

Differential Revision: https://reviews.llvm.org/D61176

Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=359343=359342=359343=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Apr 26 12:31:46 2019
@@ -5726,9 +5726,12 @@ void Sema::checkClassLevelDLLAttribute(C
 continue;
 
   if (MD->isInlined()) {
-// MinGW does not import or export inline methods.
+// MinGW does not import or export inline methods. But do it for
+// template instantiations.
 if (!Context.getTargetInfo().getCXXABI().isMicrosoft() &&
-!Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment())
+!Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() 
&&
+TSK != TSK_ExplicitInstantiationDeclaration &&
+TSK != TSK_ExplicitInstantiationDefinition)
   continue;
 
 // MSVC versions before 2015 don't export the move assignment operators

Modified: cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp?rev=359343=359342=359343=diff
==
--- cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Fri Apr 26 12:31:46 
2019
@@ -7,11 +7,9 @@
 
 template 
 class c {
-  void f();
+  void f() {}
 };
 
-template  void c::f() {}
-
 template class __declspec(dllexport) c;
 
 // CHECK: define {{.*}} dllexport {{.*}} @_ZN1cIiE1fEv


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r359345 - [MinGW] Always emit local typeinfo

2019-04-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Apr 26 12:31:51 2019
New Revision: 359345

URL: http://llvm.org/viewvc/llvm-project?rev=359345=rev
Log:
[MinGW] Always emit local typeinfo

This makes sure that code built with headers for a statically linked
libc++ also works when linking to the DLL version, when the DLL
hasn't been built with --export-all-symbols.

This matches what GCC for MinGW does for this test case.

Differential Revision: https://reviews.llvm.org/D61177

Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=359345=359344=359345=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Fri Apr 26 12:31:51 2019
@@ -2959,7 +2959,7 @@ static bool ShouldUseExternalRTTIDescrip
 bool IsDLLImport = RD->hasAttr();
 
 // Don't import the RTTI but emit it locally.
-if (CGM.getTriple().isWindowsGNUEnvironment() && IsDLLImport)
+if (CGM.getTriple().isWindowsGNUEnvironment())
   return false;
 
 if (CGM.getVTables().isVTableExternal(RD))

Modified: cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp?rev=359345=359344=359345=diff
==
--- cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/vtable-key-function-ios.cpp Fri Apr 26 12:31:51 
2019
@@ -1,7 +1,7 @@
-// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck 
-check-prefixes=CHECK,CHECK-UNIX %s
 // RUN: %clang_cc1 %s -triple=armv7-apple-darwin -emit-llvm -o - | FileCheck 
-check-prefix=CHECK-LATE %s
 
-// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | 
FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | 
FileCheck -check-prefixes=CHECK,CHECK-MINGW %s
 // RUN: %clang_cc1 %s -triple=x86_64-pc-windows-gnu -emit-llvm -o - | 
FileCheck -check-prefix=CHECK-LATE %s
 
 // The 'a' variants ask for the vtable first.
@@ -29,7 +29,8 @@ struct Test0a {
 // V-table should be defined externally.
 Test0a::Test0a() { use(typeid(Test0a)); }
 // CHECK: @_ZTV6Test0a = external {{(dso_local )?}}unnamed_addr constant 
-// CHECK: @_ZTI6Test0a = external {{(dso_local )?}}constant
+// CHECK-UNIX: @_ZTI6Test0a = external {{(dso_local )?}}constant
+// CHECK-MINGW: @_ZTI6Test0a = linkonce_odr {{(dso_local )?}}constant
 
 // This is not a key function.
 void Test0a::foo() {}
@@ -48,7 +49,8 @@ void Test0b::foo() {}
 // V-table should be defined externally.
 Test0b::Test0b() { use(typeid(Test0b)); }
 // CHECK: @_ZTV6Test0b = external {{(dso_local )?}}unnamed_addr constant 
-// CHECK: @_ZTI6Test0b = external {{(dso_local )?}}constant
+// CHECK-UNIX: @_ZTI6Test0b = external {{(dso_local )?}}constant
+// CHECK-MINGW: @_ZTI6Test0b = linkonce_odr {{(dso_local )?}}constant
 
 /*** Test1a **/
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r359342 - [MinGW] Don't let template instantiation declarations cover nested classes

2019-04-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Apr 26 12:31:39 2019
New Revision: 359342

URL: http://llvm.org/viewvc/llvm-project?rev=359342=rev
Log:
[MinGW] Don't let template instantiation declarations cover nested classes

An explicit template instantiation declaration used to let
callers assume both outer and nested classes instantiations were
defined in a different translation unit.

If the instantiation is marked dllexport, only the outer class
is exported, but the caller will try to reference the instantiation
of both outer and inner classes.

This makes MinGW mode match both MSVC and Windows Itanium, by
having instantations only cover the outer class, and locally emitting
definitions of the nested classes. Windows Itanium was changed to
use this behavious in SVN r300804.

This deviates from what GCC does, but should be safe (and only
inflate the object file size a bit, but MSVC and Windows Itanium
modes do the same), and fixes cases where inner classes aren't
dllexported.

This fixes missing references in combination with dllexported/imported
template intantiations.

GCC suffers from the same issue, reported at [1], but the issue
is still unresolved there. The issue can probably be solved either
by making dllexport cover all nested classes as well, or this
way (matching MSVC).

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89087

Differential Revision: https://reviews.llvm.org/D61175

Modified:
cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp

Modified: cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp?rev=359342=359341=359342=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Fri Apr 26 12:31:39 2019
@@ -2685,10 +2685,14 @@ Sema::InstantiateClassMembers(SourceLoca
 continue;
 
   if ((Context.getTargetInfo().getCXXABI().isMicrosoft() ||
-   Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment()) 
&&
+   Context.getTargetInfo().getTriple().isWindowsItaniumEnvironment() ||
+   Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) &&
   TSK == TSK_ExplicitInstantiationDeclaration) {
 // In MSVC and Windows Itanium mode, explicit instantiation decl of the
 // outer class doesn't affect the inner class.
+// In GNU mode, inner classes aren't dllexported. Don't let the
+// instantiation cover the inner class, to avoid undefined references
+// to inner classes that weren't exported.
 continue;
   }
 

Modified: cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp?rev=359342=359341=359342=diff
==
--- cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp Fri Apr 26 12:31:39 
2019
@@ -1,5 +1,10 @@
 // RUN: %clang_cc1 -emit-llvm -triple i686-mingw32 %s -o - | FileCheck %s
 
+#define JOIN2(x, y) x##y
+#define JOIN(x, y) JOIN2(x, y)
+#define UNIQ(name) JOIN(name, __LINE__)
+#define USEMEMFUNC(class, func) void (class::*UNIQ(use)())() { return 
::func; }
+
 template 
 class c {
   void f();
@@ -36,3 +41,10 @@ template class __declspec(dllexport) out
 
 // CHECK: define {{.*}} dllexport {{.*}} @_ZN5outerIiE1fEv
 // CHECK-NOT: define {{.*}} dllexport {{.*}} @_ZN5outerIiE5inner1fEv
+
+extern template class __declspec(dllimport) outer;
+USEMEMFUNC(outer, f)
+USEMEMFUNC(outer::inner, f)
+
+// CHECK: declare dllimport {{.*}} @_ZN5outerIcE1fEv
+// CHECK: define {{.*}} @_ZN5outerIcE5inner1fEv


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r359285 - [MinGW] Fix dllexport of explicit template instantiation

2019-04-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Apr 26 01:09:51 2019
New Revision: 359285

URL: http://llvm.org/viewvc/llvm-project?rev=359285=rev
Log:
[MinGW] Fix dllexport of explicit template instantiation

Contrary to MSVC, GCC/MinGW needs to have the dllexport attribute
on the template instantiation declaration, not on the definition.

Previously clang never marked explicit template instantiations as
dllexport in MinGW mode, if the instantiation had a previous
declaration, regardless of where the attribute was placed. This
makes Clang behave like GCC in this regard, and allows using the
same attribute form for both MinGW compilers.

This fixes PR40256.

Differential Revision: https://reviews.llvm.org/D61118

Added:
cfe/trunk/test/CodeGenCXX/mingw-template-dllexport.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaTemplate.cpp
cfe/trunk/test/SemaCXX/dllexport.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=359285=359284=359285=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Fri Apr 26 01:09:51 
2019
@@ -2863,6 +2863,9 @@ def warn_attribute_dllimport_static_fiel
 def warn_attribute_dllexport_explicit_instantiation_decl : Warning<
   "explicit instantiation declaration should not be 'dllexport'">,
   InGroup>;
+def warn_attribute_dllexport_explicit_instantiation_def : Warning<
+  "'dllexport' attribute ignored on explicit instantiation definition">,
+  InGroup;
 def warn_invalid_initializer_from_system_header : Warning<
   "invalid constructor form class in system header, should not be explicit">,
   InGroup>;

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=359285=359284=359285=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Fri Apr 26 01:09:51 2019
@@ -5697,9 +5697,11 @@ void Sema::checkClassLevelDLLAttribute(C
 
   TemplateSpecializationKind TSK = Class->getTemplateSpecializationKind();
 
-  // Ignore explicit dllexport on explicit class template instantiation 
declarations.
+  // Ignore explicit dllexport on explicit class template instantiation
+  // declarations, except in MinGW mode.
   if (ClassExported && !ClassAttr->isInherited() &&
-  TSK == TSK_ExplicitInstantiationDeclaration) {
+  TSK == TSK_ExplicitInstantiationDeclaration &&
+  !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
 Class->dropAttr();
 return;
   }

Modified: cfe/trunk/lib/Sema/SemaTemplate.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplate.cpp?rev=359285=359284=359285=diff
==
--- cfe/trunk/lib/Sema/SemaTemplate.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplate.cpp Fri Apr 26 01:09:51 2019
@@ -8732,8 +8732,10 @@ DeclResult Sema::ActOnExplicitInstantiat
? TSK_ExplicitInstantiationDefinition
: TSK_ExplicitInstantiationDeclaration;
 
-  if (TSK == TSK_ExplicitInstantiationDeclaration) {
-// Check for dllexport class template instantiation declarations.
+  if (TSK == TSK_ExplicitInstantiationDeclaration &&
+  !Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
+// Check for dllexport class template instantiation declarations,
+// except for MinGW mode.
 for (const ParsedAttr  : Attr) {
   if (AL.getKind() == ParsedAttr::AT_DLLExport) {
 Diag(ExternLoc,
@@ -8793,6 +8795,19 @@ DeclResult Sema::ActOnExplicitInstantiat
   TemplateSpecializationKind PrevDecl_TSK
 = PrevDecl ? PrevDecl->getTemplateSpecializationKind() : TSK_Undeclared;
 
+  if (TSK == TSK_ExplicitInstantiationDefinition && PrevDecl != nullptr &&
+  Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) {
+// Check for dllexport class template instantiation definitions in MinGW
+// mode, if a previous declaration of the instantiation was seen.
+for (const ParsedAttr  : Attr) {
+  if (AL.getKind() == ParsedAttr::AT_DLLExport) {
+Diag(AL.getLoc(),
+ diag::warn_attribute_dllexport_explicit_instantiation_def);
+break;
+  }
+}
+  }
+
   if (CheckExplicitInstantiation(*this, ClassTemplate, TemplateNameLoc,
  SS.isSet(), TSK))
 return true;
@@ -8949,6 +8964,14 @@ DeclResult Sema::ActOnExplicitInstantiat
   dllExportImportClassTemplateSpecialization(*this, Def);
 }
 
+// In MinGW mode, export the template instantiation if the declaration
+// was marked 

r359233 - [Windows] Separate elements in -print-search-dirs with semicolons

2019-04-25 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Apr 25 13:03:20 2019
New Revision: 359233

URL: http://llvm.org/viewvc/llvm-project?rev=359233=rev
Log:
[Windows] Separate elements in -print-search-dirs with semicolons

Path lists on windows should always be separated by semicolons, not
colons. Reuse llvm::sys::EnvPathSeparator for this purpose (as that's
also a path list that is separated in the same way).

Alternatively, this could just be a local ifdef _WIN32 in this function,
or generalizing the existing EnvPathSeparator to e.g. a
llvm::sys::path::PathListSeparator?

Differential Revision: https://reviews.llvm.org/D61121

Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=359233=359232=359233=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu Apr 25 13:03:20 2019
@@ -1695,7 +1695,7 @@ bool Driver::HandleImmediateArgs(const C
 bool separator = false;
 for (const std::string  : TC.getProgramPaths()) {
   if (separator)
-llvm::outs() << ':';
+llvm::outs() << llvm::sys::EnvPathSeparator;
   llvm::outs() << Path;
   separator = true;
 }
@@ -1706,7 +1706,7 @@ bool Driver::HandleImmediateArgs(const C
 
 for (const std::string  : TC.getFilePaths()) {
   // Always print a separator. ResourceDir was the first item shown.
-  llvm::outs() << ':';
+  llvm::outs() << llvm::sys::EnvPathSeparator;
   // Interpretation of leading '=' is needed only for NetBSD.
   if (Path[0] == '=')
 llvm::outs() << sysroot << Path.substr(1);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r358778 - [MSVC] If unable to find link.exe from a MSVC installation, look for link.exe next to cl.exe

2019-04-19 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Apr 19 12:04:22 2019
New Revision: 358778

URL: http://llvm.org/viewvc/llvm-project?rev=358778=rev
Log:
[MSVC] If unable to find link.exe from a MSVC installation, look for link.exe 
next to cl.exe

Previously, if the MSVC installation isn't detected properly, clang
will later just fail to execute link.exe.

This improves using clang in msvc mode on linux, where one intentionally
might not want to point clang to the MSVC installation itself (which
isn't executable as such), but where a link.exe named wine wrapper is
available in the path next to a cl.exe named wine wrapper.

Differential Revision: https://reviews.llvm.org/D60094

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=358778=358777=358778=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Fri Apr 19 12:04:22 2019
@@ -488,8 +488,18 @@ void visualstudio::Linker::ConstructJob(
 // their own link.exe which may come first.
 linkPath = FindVisualStudioExecutable(TC, "link.exe");
 
-if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath))
-  C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+if (!TC.FoundMSVCInstall() && !llvm::sys::fs::can_execute(linkPath)) {
+  llvm::SmallString<128> ClPath;
+  ClPath = TC.GetProgramPath("cl.exe");
+  if (llvm::sys::fs::can_execute(ClPath)) {
+linkPath = llvm::sys::path::parent_path(ClPath);
+llvm::sys::path::append(linkPath, "link.exe");
+if (!llvm::sys::fs::can_execute(linkPath))
+  C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+  } else {
+C.getDriver().Diag(clang::diag::warn_drv_msvc_not_found);
+  }
+}
 
 #ifdef _WIN32
 // When cross-compiling with VS2017 or newer, link.exe expects to have


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r358662 - [MSVC] Use the correct casing of HostX64/HostX86

2019-04-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Apr 18 06:27:31 2019
New Revision: 358662

URL: http://llvm.org/viewvc/llvm-project?rev=358662=rev
Log:
[MSVC] Use the correct casing of HostX64/HostX86

If accessing the MSVC installation root directly on a case sensitive
filesystem, these details matter.

Differential Revision: https://reviews.llvm.org/D60627

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=358662=358661=358662=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Apr 18 06:27:31 2019
@@ -496,7 +496,7 @@ void visualstudio::Linker::ConstructJob(
 // its containing bin directory at the top of PATH, followed by the
 // native target bin directory.
 // e.g. when compiling for x86 on an x64 host, PATH should start with:
-// /bin/HostX64/x86;/bin/HostX64/x64
+// /bin/Hostx64/x86;/bin/Hostx64/x64
 // This doesn't attempt to handle ToolsetLayout::DevDivInternal.
 if (TC.getIsVS2017OrNewer() &&
 llvm::Triple(llvm::sys::getProcessTriple()).getArch() != TC.getArch()) 
{
@@ -838,7 +838,7 @@ MSVCToolChain::getSubDirectoryPath(SubDi
 if (VSLayout == ToolsetLayout::VS2017OrNewer) {
   const bool HostIsX64 =
   llvm::Triple(llvm::sys::getProcessTriple()).isArch64Bit();
-  const char *const HostName = HostIsX64 ? "HostX64" : "HostX86";
+  const char *const HostName = HostIsX64 ? "Hostx64" : "Hostx86";
   llvm::sys::path::append(Path, "bin", HostName, SubdirName);
 } else { // OlderVS or DevDivInternal
   llvm::sys::path::append(Path, "bin", SubdirName);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r358642 - Add support for ARMv7-M architecture which uses the Thumb 2 ISA (unified syntax)

2019-04-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Apr 17 23:35:42 2019
New Revision: 358642

URL: http://llvm.org/viewvc/llvm-project?rev=358642=rev
Log:
Add support for ARMv7-M architecture which uses the Thumb 2 ISA (unified syntax)

Patch by Jérémie Faucher-Goulet!

Differential Revision: https://reviews.llvm.org/D60417

Modified:
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=358642=358641=358642=diff
==
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Wed Apr 17 23:35:42 2019
@@ -610,6 +610,9 @@ DEFINE_LIBUNWIND_FUNCTION(_ZN9libunwind1
 #elif defined(__arm__) && !defined(__APPLE__)
 
 #if !defined(__ARM_ARCH_ISA_ARM)
+#if (__ARM_ARCH_ISA_THUMB == 2)
+  .syntax unified
+#endif
   .thumb
 #endif
 

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=358642=358641=358642=diff
==
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Wed Apr 17 23:35:42 2019
@@ -750,6 +750,9 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getconte
 #elif defined(__arm__) && !defined(__APPLE__)
 
 #if !defined(__ARM_ARCH_ISA_ARM)
+#if (__ARM_ARCH_ISA_THUMB == 2)
+  .syntax unified
+#endif
   .thumb
 #endif
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r358393 - [MinGW] Remove some supefluous calls to MakeArgString. NFC.

2019-04-15 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Apr 15 03:57:09 2019
New Revision: 358393

URL: http://llvm.org/viewvc/llvm-project?rev=358393=rev
Log:
[MinGW] Remove some supefluous calls to MakeArgString. NFC.

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=358393=358392=358393=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Apr 15 03:57:09 2019
@@ -252,16 +252,16 @@ void tools::MinGW::Linker::ConstructJob(
 ToolChain::FT_Shared));
 CmdArgs.push_back(
 TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk"));
-CmdArgs.push_back(Args.MakeArgString("--require-defined"));
-CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86
- ? "___asan_seh_interceptor"
- : "__asan_seh_interceptor"));
+CmdArgs.push_back("--require-defined");
+CmdArgs.push_back(TC.getArch() == llvm::Triple::x86
+  ? "___asan_seh_interceptor"
+  : "__asan_seh_interceptor");
 // Make sure the linker consider all object files from the dynamic
 // runtime thunk.
-CmdArgs.push_back(Args.MakeArgString("--whole-archive"));
-CmdArgs.push_back(Args.MakeArgString(
-TC.getCompilerRT(Args, "asan_dynamic_runtime_thunk")));
-CmdArgs.push_back(Args.MakeArgString("--no-whole-archive"));
+CmdArgs.push_back("--whole-archive");
+CmdArgs.push_back(
+TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk"));
+CmdArgs.push_back("--no-whole-archive");
   }
 
   TC.addProfileRTLibs(Args, CmdArgs);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r357711 - Move the alias definition of unw_getcontext to within !defined(__USING_SJLJ_EXCEPTIONS__)

2019-04-04 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Apr  4 10:50:14 2019
New Revision: 357711

URL: http://llvm.org/viewvc/llvm-project?rev=357711=rev
Log:
Move the alias definition of unw_getcontext to within 
!defined(__USING_SJLJ_EXCEPTIONS__)

For builds with SJLJ, there is no __unw_getcontext symbol. On Windows,
the weak alias macro also expands to a dllexport directive, which fails
if the symbol doesn't exist.

Differential Revision: https://reviews.llvm.org/D60251

Modified:
libunwind/trunk/src/UnwindRegistersSave.S

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=357711=357710=357711=diff
==
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Thu Apr  4 10:50:14 2019
@@ -972,8 +972,9 @@ DEFINE_LIBUNWIND_FUNCTION(__unw_getconte
   jmp %o7
clr %o0   // return UNW_ESUCCESS
 #endif
-#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */
 
   WEAK_ALIAS(__unw_getcontext, unw_getcontext)
 
+#endif /* !defined(__USING_SJLJ_EXCEPTIONS__) */
+
 NO_EXEC_STACK_DIRECTIVE


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r353946 - [test] Tweak driver test from r353917 and r353922 to pass with a nondefault CLANG_DEFAULT_LINKER

2019-02-13 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Feb 13 05:13:45 2019
New Revision: 353946

URL: http://llvm.org/viewvc/llvm-project?rev=353946=rev
Log:
[test] Tweak driver test from r353917 and r353922 to pass with a nondefault 
CLANG_DEFAULT_LINKER

Force -fuse-ld=ld, as some other tests in the same file do.

Loosen the regex matching the linker tool name as well, as this
can end up being -ld in case such a named tool exists.

Modified:
cfe/trunk/test/Driver/instrprof-ld.c

Modified: cfe/trunk/test/Driver/instrprof-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353946=353945=353946=diff
==
--- cfe/trunk/test/Driver/instrprof-ld.c (original)
+++ cfe/trunk/test/Driver/instrprof-ld.c Wed Feb 13 05:13:45 2019
@@ -123,9 +123,9 @@
 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
 //
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
-// RUN: -target x86_64-mingw32 -fprofile-instr-generate \
+// RUN: -target x86_64-mingw32 -fprofile-instr-generate -fuse-ld=ld \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN:   | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s
 //
-// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
+// CHECK-MINGW-X86-64: "{{(.*[^.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-MINGW-X86-64: 
"{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r353922 - [test] Fix the test from SVN r353917 when running without lld available

2019-02-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Feb 12 23:50:21 2019
New Revision: 353922

URL: http://llvm.org/viewvc/llvm-project?rev=353922=rev
Log:
[test] Fix the test from SVN r353917 when running without lld available

These tests still relies on the default linker not to be overridden
via e.g. CLANG_DEFAULT_LINKER in cmake.

Modified:
cfe/trunk/test/Driver/instrprof-ld.c

Modified: cfe/trunk/test/Driver/instrprof-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353922=353921=353922=diff
==
--- cfe/trunk/test/Driver/instrprof-ld.c (original)
+++ cfe/trunk/test/Driver/instrprof-ld.c Tue Feb 12 23:50:21 2019
@@ -122,10 +122,10 @@
 // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
 //
-// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fuse-ld=lld \
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
 // RUN: -target x86_64-mingw32 -fprofile-instr-generate \
 // RUN: -resource-dir=%S/Inputs/resource_dir \
 // RUN:   | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s
 //
-// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
+// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld{{(.exe)?}}"
 // CHECK-MINGW-X86-64: 
"{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r353917 - [MinGW] Add the profiling library when necessary

2019-02-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Feb 12 23:26:54 2019
New Revision: 353917

URL: http://llvm.org/viewvc/llvm-project?rev=353917=rev
Log:
[MinGW] Add the profiling library when necessary

Profiling still doesn't seem to work properly, but this at least
hooks up the library and eases completing whatever is missing.

Differential Revision: https://reviews.llvm.org/D58107

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/instrprof-ld.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=353917=353916=353917=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Feb 12 23:26:54 2019
@@ -264,6 +264,8 @@ void tools::MinGW::Linker::ConstructJob(
 CmdArgs.push_back(Args.MakeArgString("--no-whole-archive"));
   }
 
+  TC.addProfileRTLibs(Args, CmdArgs);
+
   if (!HasWindowsApp) {
 // Add system libraries. If linking to libwindowsapp.a, that import
 // library replaces all these and we shouldn't accidentally try to

Modified: cfe/trunk/test/Driver/instrprof-ld.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/instrprof-ld.c?rev=353917=353916=353917=diff
==
--- cfe/trunk/test/Driver/instrprof-ld.c (original)
+++ cfe/trunk/test/Driver/instrprof-ld.c Tue Feb 12 23:26:54 2019
@@ -121,3 +121,11 @@
 //
 // CHECK-WINDOWS-X86-64: "{{.*}}link{{(.exe)?}}"
 // CHECK-WINDOWS-X86-64: "{{.*}}clang_rt.profile-x86_64.lib"
+//
+// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 -fuse-ld=lld \
+// RUN: -target x86_64-mingw32 -fprofile-instr-generate \
+// RUN: -resource-dir=%S/Inputs/resource_dir \
+// RUN:   | FileCheck --check-prefix=CHECK-MINGW-X86-64 %s
+//
+// CHECK-MINGW-X86-64: "{{(.*[^-.0-9A-Z_a-z])?}}ld.lld{{(.exe)?}}"
+// CHECK-MINGW-X86-64: 
"{{.*}}/Inputs/resource_dir{{/|}}lib{{/|}}windows{{/|}}libclang_rt.profile-x86_64.a"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r353402 - [clang-cl] support /Oy- on aarch64

2019-02-07 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Feb  7 04:46:49 2019
New Revision: 353402

URL: http://llvm.org/viewvc/llvm-project?rev=353402=rev
Log:
[clang-cl] support /Oy- on aarch64

MSVC supports /Oy- on aarch64, so clang-cl should too.

Patch by Nathan Froyd!

Differential Revision: https://reviews.llvm.org/D57838

Modified:
cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/ToolChains/MSVC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MSVC.cpp?rev=353402=353401=353402=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MSVC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MSVC.cpp Thu Feb  7 04:46:49 2019
@@ -1407,10 +1407,10 @@ static void TranslateOptArg(Arg *A, llvm
   DAL.AddFlagArg(
   A, Opts.getOption(options::OPT_fno_omit_frame_pointer));
   } else {
-// Don't warn about /Oy- in 64-bit builds (where
+// Don't warn about /Oy- in x86-64 builds (where
 // SupportsForcingFramePointer is false).  The flag having no effect
 // there is a compiler-internal optimization, and people shouldn't have
-// to special-case their build files for 64-bit clang-cl.
+// to special-case their build files for x86-64 clang-cl.
 A->claim();
   }
   break;
@@ -1441,8 +1441,8 @@ MSVCToolChain::TranslateArgs(const llvm:
   DerivedArgList *DAL = new DerivedArgList(Args.getBaseArgs());
   const OptTable  = getDriver().getOpts();
 
-  // /Oy and /Oy- only has an effect under X86-32.
-  bool SupportsForcingFramePointer = getArch() == llvm::Triple::x86;
+  // /Oy and /Oy- don't have an effect on X86-64
+  bool SupportsForcingFramePointer = getArch() != llvm::Triple::x86_64;
 
   // The -O[12xd] flag actually expands to several flags.  We must desugar the
   // flags so that options embedded can be negated.  For example, the '-O2' 
flag

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=353402=353401=353402=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Thu Feb  7 04:46:49 2019
@@ -178,6 +178,10 @@
 // Oy_2: -momit-leaf-frame-pointer
 // Oy_2: -O2
 
+// RUN: %clang_cl --target=aarch64-pc-windows-msvc -Werror /Oy- /O2 -### -- %s 
2>&1 | FileCheck -check-prefix=Oy_aarch64 %s
+// Oy_aarch64: -mdisable-fp-elim
+// Oy_aarch64: -O2
+
 // RUN: %clang_cl --target=i686-pc-win32 -Werror /O2 /O2 -### -- %s 2>&1 | 
FileCheck -check-prefix=O2O2 %s
 // O2O2: "-O2"
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r353010 - Provide a placement new definition for the SEH version of UnwindCursor

2019-02-03 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sun Feb  3 14:16:53 2019
New Revision: 353010

URL: http://llvm.org/viewvc/llvm-project?rev=353010=rev
Log:
Provide a placement new definition for the SEH version of UnwindCursor

This fixes compilation after SVN r352966 in SEH mode.

Modified:
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=353010=353009=353010=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Sun Feb  3 14:16:53 2019
@@ -482,6 +482,10 @@ public:
   DISPATCHER_CONTEXT *getDispatcherContext() { return &_dispContext; }
   void setDispatcherContext(DISPATCHER_CONTEXT *disp) { _dispContext = *disp; }
 
+  // libunwind does not and should not depend on C++ library which means that 
we
+  // need our own defition of inline placement new.
+  static void *operator new(size_t, UnwindCursor *p) { return p; }
+
 private:
 
   pint_t getLastPC() const { return _dispContext.ControlPc; }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r352461 - Don't define unw_fpreg_t to uint64_t for __ARM_DWARF_EH__

2019-01-29 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 29 01:00:32 2019
New Revision: 352461

URL: http://llvm.org/viewvc/llvm-project?rev=352461=rev
Log:
Don't define unw_fpreg_t to uint64_t for __ARM_DWARF_EH__

The existing typedef of unw_fpreg_t to uint64_t might work and be
correct for the ARM_EHABI case, but for dwarf, some cases in e.g.
DwarfInstructions.hpp convert between double and unw_fpreg_t.

When converting implicitly between double and unw_fpreg_t (uint64_t),
the values get interpreted as integers and converted to float and vice
versa, while the correct thing would be to keep the same bit pattern.

Avoid the whole issue by using the same definition of unw_fpreg_t
as all other architectures, when using dwarf unwinding on ARM.

Change assembler functions to take a void pointer instead of
unw_fpreg_t pointer, to avoid having a different mangled symbol name
depending on the actual value of this typedef.

Differential Revision: https://reviews.llvm.org/D57001

Modified:
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=352461=352460=352461=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Tue Jan 29 01:00:32 2019
@@ -75,7 +75,7 @@ typedef struct unw_addr_space *unw_addr_
 
 typedef int unw_regnum_t;
 typedef uintptr_t unw_word_t;
-#if defined(__arm__)
+#if defined(__arm__) && !defined(__ARM_DWARF_EH__)
 typedef uint64_t unw_fpreg_t;
 #else
 typedef double unw_fpreg_t;

Modified: libunwind/trunk/src/Registers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=352461=352460=352461=diff
==
--- libunwind/trunk/src/Registers.hpp (original)
+++ libunwind/trunk/src/Registers.hpp Tue Jan 29 01:00:32 2019
@@ -2103,16 +2103,16 @@ private:
 uint32_t __pc;// Program counter r15
   };
 
-  static void saveVFPWithFSTMD(unw_fpreg_t*);
-  static void saveVFPWithFSTMX(unw_fpreg_t*);
-  static void saveVFPv3(unw_fpreg_t*);
-  static void restoreVFPWithFLDMD(unw_fpreg_t*);
-  static void restoreVFPWithFLDMX(unw_fpreg_t*);
-  static void restoreVFPv3(unw_fpreg_t*);
+  static void saveVFPWithFSTMD(void*);
+  static void saveVFPWithFSTMX(void*);
+  static void saveVFPv3(void*);
+  static void restoreVFPWithFLDMD(void*);
+  static void restoreVFPWithFLDMX(void*);
+  static void restoreVFPv3(void*);
 #if defined(__ARM_WMMX)
-  static void saveiWMMX(unw_fpreg_t*);
+  static void saveiWMMX(void*);
   static void saveiWMMXControl(uint32_t*);
-  static void restoreiWMMX(unw_fpreg_t*);
+  static void restoreiWMMX(void*);
   static void restoreiWMMXControl(uint32_t*);
 #endif
   void restoreCoreAndJumpTo();

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=352461=352460=352461=diff
==
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Tue Jan 29 01:00:32 2019
@@ -658,7 +658,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 #if defined(__ELF__)
   .fpu vfpv3-d16
 #endif
-DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPy)
+DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPv)
   @ VFP and iwMMX instructions are only available when compiling with the flags
   @ that enable them. We do not want to do that in the library (because we do 
not
   @ want the compiler to generate instructions that access those) but this is
@@ -679,7 +679,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 #if defined(__ELF__)
   .fpu vfpv3-d16
 #endif
-DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPy)
+DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPv)
   vldmia r0, {d0-d15} @ fldmiax is deprecated in ARMv7+ and now behaves like 
vldmia
   JMP(lr)
 
@@ -693,7 +693,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 #if defined(__ELF__)
   .fpu vfpv3
 #endif
-DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPy)
+DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPv)
   vldmia r0, {d16-d31}
   JMP(lr)
 
@@ -709,7 +709,7 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 #if defined(__ELF__)
   .arch armv5te
 #endif
-DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPy)
+DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPv)
   ldcl p1, cr0, [r0], #8  @ wldrd wR0, [r0], #8
   ldcl p1, cr1, [r0], #8  @ wldrd wR1, [r0], #8
   ldcl p1, cr2, 

[libunwind] r351888 - Silence warnings about unused parameters

2019-01-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 22 14:12:23 2019
New Revision: 351888

URL: http://llvm.org/viewvc/llvm-project?rev=351888=rev
Log:
Silence warnings about unused parameters

Differential Revision: https://reviews.llvm.org/D56984

Modified:
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/Unwind-seh.cpp
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=351888=351887=351888=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Tue Jan 22 14:12:23 2019
@@ -456,6 +456,8 @@ inline bool LocalAddressSpace::findUnwin
 #elif defined(_LIBUNWIND_SUPPORT_SEH_UNWIND) && defined(_WIN32)
   // Don't even bother, since Windows has functions that do all this stuff
   // for us.
+  (void)targetAddr;
+  (void)info;
   return true;
 #elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) &&  
\
 (__ANDROID_API__ < 21)
@@ -596,6 +598,11 @@ inline bool LocalAddressSpace::findFunct
   return true;
 }
   }
+#else
+  (void)addr;
+  (void)buf;
+  (void)bufLen;
+  (void)offset;
 #endif
   return false;
 }

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351888=351887=351888=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 14:12:23 2019
@@ -52,6 +52,7 @@ static const uint64_t kSEHExceptionClass
 /// Exception cleanup routine used by \c _GCC_specific_handler to
 /// free foreign exceptions.
 static void seh_exc_cleanup(_Unwind_Reason_Code urc, _Unwind_Exception *exc) {
+  (void)urc;
   if (exc->exception_class != kSEHExceptionClass)
 _LIBUNWIND_ABORT("SEH cleanup called on non-SEH exception");
   free(exc);
@@ -210,6 +211,8 @@ extern "C" _Unwind_Reason_Code
 __libunwind_seh_personality(int version, _Unwind_Action state,
 uint64_t klass, _Unwind_Exception *exc,
 struct _Unwind_Context *context) {
+  (void)version;
+  (void)klass;
   EXCEPTION_RECORD ms_exc;
   bool phase2 = (state & (_UA_SEARCH_PHASE|_UA_CLEANUP_PHASE)) == 
_UA_CLEANUP_PHASE;
   ms_exc.ExceptionCode = STATUS_GCC_THROW;

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=351888=351887=351888=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Tue Jan 22 14:12:23 2019
@@ -788,6 +788,8 @@ bool UnwindCursor::validFloatReg(i
   if (regNum >= UNW_ARM_D0 && regNum <= UNW_ARM_D31) return true;
 #elif defined(_LIBUNWIND_TARGET_AARCH64)
   if (regNum >= UNW_ARM64_D0 && regNum <= UNW_ARM64_D31) return true;
+#else
+  (void)regNum;
 #endif
   return false;
 }
@@ -815,6 +817,7 @@ unw_fpreg_t UnwindCursor::getFloat
 #elif defined(_LIBUNWIND_TARGET_AARCH64)
   return _msContext.V[regNum - UNW_ARM64_D0].D[0];
 #else
+  (void)regNum;
   _LIBUNWIND_ABORT("float registers unimplemented");
 #endif
 }
@@ -842,6 +845,8 @@ void UnwindCursor::setFloatReg(int
 #elif defined(_LIBUNWIND_TARGET_AARCH64)
   _msContext.V[regNum - UNW_ARM64_D0].D[0] = value;
 #else
+  (void)regNum;
+  (void)value;
   _LIBUNWIND_ABORT("float registers unimplemented");
 #endif
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r351878 - Remove an unused variable

2019-01-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 22 12:50:45 2019
New Revision: 351878

URL: http://llvm.org/viewvc/llvm-project?rev=351878=rev
Log:
Remove an unused variable

Differential Revision: https://reviews.llvm.org/D56985

Modified:
libunwind/trunk/src/Unwind-seh.cpp

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351878=351877=351878=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 12:50:45 2019
@@ -68,7 +68,6 @@ static void _unw_seh_set_disp_ctx(unw_cu
 _LIBUNWIND_EXPORT EXCEPTION_DISPOSITION
 _GCC_specific_handler(PEXCEPTION_RECORD ms_exc, PVOID frame, PCONTEXT ms_ctx,
   DISPATCHER_CONTEXT *disp, __personality_routine pers) {
-  unw_context_t uc;
   unw_cursor_t cursor;
   _Unwind_Exception *exc;
   _Unwind_Action action;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r351877 - Add casts to avoid warnings about implicit conversions losing precision

2019-01-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 22 12:50:42 2019
New Revision: 351877

URL: http://llvm.org/viewvc/llvm-project?rev=351877=rev
Log:
Add casts to avoid warnings about implicit conversions losing precision

This fixes warnings like these:

DwarfInstructions.hpp:85:25: warning: implicit conversion
  loses integer precision: 'uint64_t' (aka 'unsigned long long') to
  'libunwind::DwarfInstructions::pint_t' (aka 'unsigned int')
  [-Wshorten-64-to-32]

DwarfInstructions.hpp:88:25: warning: implicit conversion
  loses integer precision: 'uint64_t' (aka 'unsigned long long') to
  'libunwind::DwarfInstructions::pint_t' (aka 'unsigned int')
  [-Wshorten-64-to-32]

Differential Revision: https://reviews.llvm.org/D56983

Modified:
libunwind/trunk/src/DwarfInstructions.hpp

Modified: libunwind/trunk/src/DwarfInstructions.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/DwarfInstructions.hpp?rev=351877=351876=351877=diff
==
--- libunwind/trunk/src/DwarfInstructions.hpp (original)
+++ libunwind/trunk/src/DwarfInstructions.hpp Tue Jan 22 12:50:42 2019
@@ -81,12 +81,11 @@ typename A::pint_t DwarfInstructions::kRegisterInCFA:
-return addressSpace.getRegister(cfa + (pint_t)savedReg.value);
+return (pint_t)addressSpace.getRegister(cfa + (pint_t)savedReg.value);
 
   case CFI_Parser::kRegisterAtExpression:
-return addressSpace.getRegister(
-evaluateExpression((pint_t)savedReg.value, addressSpace,
-registers, cfa));
+return (pint_t)addressSpace.getRegister(evaluateExpression(
+(pint_t)savedReg.value, addressSpace, registers, cfa));
 
   case CFI_Parser::kRegisterIsExpression:
 return evaluateExpression((pint_t)savedReg.value, addressSpace,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r351876 - Fix warnings about printf format strings

2019-01-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 22 12:50:39 2019
New Revision: 351876

URL: http://llvm.org/viewvc/llvm-project?rev=351876=rev
Log:
Fix warnings about printf format strings

Either adjust the format string to use a more exact type, or add casts
(for cases when printing pointers to structs/objects with a %p
format specifier).

Differential Revision: https://reviews.llvm.org/D56982

Modified:
libunwind/trunk/src/Unwind-seh.cpp
libunwind/trunk/src/Unwind-sjlj.c

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=351876=351875=351876=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Tue Jan 22 12:50:39 2019
@@ -77,7 +77,9 @@ _GCC_specific_handler(PEXCEPTION_RECORD
   uintptr_t retval, target;
   bool ours = false;
 
-  _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler(%#010x(%x), %p)", 
ms_exc->ExceptionCode, ms_exc->ExceptionFlags, frame);
+  _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler(%#010lx(%lx), %p)",
+ ms_exc->ExceptionCode, ms_exc->ExceptionFlags,
+ (void *)frame);
   if (ms_exc->ExceptionCode == STATUS_GCC_UNWIND) {
 if (IS_TARGET_UNWIND(ms_exc->ExceptionFlags)) {
   // Set up the upper return value (the lower one and the target PC
@@ -129,7 +131,10 @@ _GCC_specific_handler(PEXCEPTION_RECORD
 }
   }
 
-  _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() calling personality 
function %p(1, %d, %llx, %p, %p)", pers, action, exc->exception_class, exc, 
ctx);
+  _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() calling personality "
+ "function %p(1, %d, %llx, %p, %p)",
+ (void *)pers, action, exc->exception_class,
+ (void *)exc, (void *)ctx);
   urc = pers(1, action, exc->exception_class, exc, ctx);
   _LIBUNWIND_TRACE_UNWINDING("_GCC_specific_handler() personality returned 
%d", urc);
   switch (urc) {

Modified: libunwind/trunk/src/Unwind-sjlj.c
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=351876=351875=351876=diff
==
--- libunwind/trunk/src/Unwind-sjlj.c (original)
+++ libunwind/trunk/src/Unwind-sjlj.c Tue Jan 22 12:50:39 2019
@@ -11,6 +11,7 @@
 
 #include 
 
+#include 
 #include 
 #include 
 #include 
@@ -107,7 +108,8 @@ _Unwind_SjLj_Unregister(struct _Unwind_F
 static _Unwind_Reason_Code
 unwind_phase1(struct _Unwind_Exception *exception_object) {
   _Unwind_FunctionContext_t c = __Unwind_SjLj_GetTopOfFunctionStack();
-  _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p", c);
+  _LIBUNWIND_TRACE_UNWINDING("unwind_phase1: initial function-context=%p",
+ (void *)c);
 
   // walk each frame looking for a place to stop
   for (bool handlerNotFound = true; handlerNotFound; c = c->prev) {
@@ -116,17 +118,18 @@ unwind_phase1(struct _Unwind_Exception *
 if (c == NULL) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): reached "
  "bottom => _URC_END_OF_STACK",
-  exception_object);
+ (void *)exception_object);
   return _URC_END_OF_STACK;
 }
 
-_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", c);
+_LIBUNWIND_TRACE_UNWINDING("unwind_phase1: function-context=%p", (void 
*)c);
 // if there is a personality routine, ask it if it will want to stop at 
this
 // frame
 if (c->personality != NULL) {
   _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): calling "
-"personality function %p",
- exception_object, c->personality);
+ "personality function %p",
+ (void *)exception_object,
+ (void *)c->personality);
   _Unwind_Reason_Code personalityResult = (*c->personality)(
   1, _UA_SEARCH_PHASE, exception_object->exception_class,
   exception_object, (struct _Unwind_Context *)c);
@@ -137,12 +140,14 @@ unwind_phase1(struct _Unwind_Exception *
 handlerNotFound = false;
 exception_object->private_2 = (uintptr_t) c;
 _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): "
-   "_URC_HANDLER_FOUND", exception_object);
+   "_URC_HANDLER_FOUND",
+   (void *)exception_object);
 return _URC_NO_REASON;
 
   case _URC_CONTINUE_UNWIND:
 _LIBUNWIND_TRACE_UNWINDING("unwind_phase1(ex_ojb=%p): "
-   "_URC_CONTINUE_UNWIND", exception_object);
+   "_URC_CONTINUE_UNWIND",
+

[libunwind] r351875 - Enable LLVM_ENABLE_WARNINGS when building standalone out of tree

2019-01-22 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 22 12:50:33 2019
New Revision: 351875

URL: http://llvm.org/viewvc/llvm-project?rev=351875=rev
Log:
Enable LLVM_ENABLE_WARNINGS when building standalone out of tree

When built within the llvm runtimes directory, the runtimes
CMakeLists.txt adds the same.

Differential Revision: https://reviews.llvm.org/D56981

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=351875=351874=351875=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Tue Jan 22 12:50:33 2019
@@ -73,6 +73,8 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   endif()
 
   if (EXISTS ${LLVM_CMAKE_PATH})
+# Enable warnings, otherwise -w gets added to the cflags by 
HandleLLVMOptions.
+set(LLVM_ENABLE_WARNINGS ON)
 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
 include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
 include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r351587 - [SjLj] Don't use __declspec(thread) in MinGW mode

2019-01-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Jan 18 12:31:12 2019
New Revision: 351587

URL: http://llvm.org/viewvc/llvm-project?rev=351587=rev
Log:
[SjLj] Don't use __declspec(thread) in MinGW mode

GCC and Clang in MinGW mode don't support __declspec(thread), which
after expanding macros ends up as __attribute__((thread)). Use the
GCC specific attribute __thread instead (the next one in the chain
of alternatives).

Differential Revision: https://reviews.llvm.org/D56905

Modified:
libunwind/trunk/src/Unwind-sjlj.c

Modified: libunwind/trunk/src/Unwind-sjlj.c
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=351587=351586=351587=diff
==
--- libunwind/trunk/src/Unwind-sjlj.c (original)
+++ libunwind/trunk/src/Unwind-sjlj.c Fri Jan 18 12:31:12 2019
@@ -52,7 +52,7 @@ struct _Unwind_FunctionContext {
 #else
 # if __STDC_VERSION__ >= 201112L
 #  define _LIBUNWIND_THREAD_LOCAL _Thread_local
-# elif defined(_WIN32)
+# elif defined(_MSC_VER)
 #  define _LIBUNWIND_THREAD_LOCAL __declspec(thread)
 # elif defined(__GNUC__) || defined(__clang__)
 #  define _LIBUNWIND_THREAD_LOCAL __thread


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r349532 - [SEH] Add initial support for AArch64

2018-12-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Dec 18 12:05:59 2018
New Revision: 349532

URL: http://llvm.org/viewvc/llvm-project?rev=349532=rev
Log:
[SEH] Add initial support for AArch64

This doesn't yet implement inspecting the .pdata/.xdata to find the
LSDA pointer (in UnwindCursor::getInfoFromSEH), but normal C++
exception handling seems to run just fine without it. (The only
place I can see where it's even referenced is in
unwind_phase2_forced, and I can't find a codepath where libcxxabi
would end up calling that.)

Differential Revision: https://reviews.llvm.org/D55674

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/src/Unwind-seh.cpp
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=349532=349531=349532=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Tue Dec 18 12:05:59 2018
@@ -57,7 +57,11 @@
 # elif defined(__aarch64__)
 #  define _LIBUNWIND_TARGET_AARCH64 1
 #  define _LIBUNWIND_CONTEXT_SIZE 66
-#  define _LIBUNWIND_CURSOR_SIZE 78
+#  if defined(__SEH__)
+#define _LIBUNWIND_CURSOR_SIZE 164
+#  else
+#define _LIBUNWIND_CURSOR_SIZE 78
+#  endif
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64
 # elif defined(__arm__)
 #  define _LIBUNWIND_TARGET_ARM 1

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=349532=349531=349532=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Tue Dec 18 12:05:59 2018
@@ -87,6 +87,8 @@ _GCC_specific_handler(PEXCEPTION_RECORD
   disp->ContextRecord->Rdx = ms_exc->ExceptionInformation[3];
 #elif defined(__arm__)
   disp->ContextRecord->R1 = ms_exc->ExceptionInformation[3];
+#elif defined(__aarch64__)
+  disp->ContextRecord->X1 = ms_exc->ExceptionInformation[3];
 #endif
 }
 // This is the collided unwind to the landing pad. Nothing to do.
@@ -172,12 +174,16 @@ _GCC_specific_handler(PEXCEPTION_RECORD
 exc->private_[2] = disp->TargetPc;
 unw_get_reg(, UNW_ARM_R0, );
 unw_get_reg(, UNW_ARM_R1, >private_[3]);
+#elif defined(__aarch64__)
+exc->private_[2] = disp->TargetPc;
+unw_get_reg(, UNW_ARM64_X0, );
+unw_get_reg(, UNW_ARM64_X1, >private_[3]);
 #endif
 unw_get_reg(, UNW_REG_IP, );
 ms_exc->ExceptionCode = STATUS_GCC_UNWIND;
 #ifdef __x86_64__
 ms_exc->ExceptionInformation[2] = disp->TargetIp;
-#elif defined(__arm__)
+#elif defined(__arm__) || defined(__aarch64__)
 ms_exc->ExceptionInformation[2] = disp->TargetPc;
 #endif
 ms_exc->ExceptionInformation[3] = exc->private_[3];
@@ -447,6 +453,12 @@ _unw_init_seh(unw_cursor_t *cursor, CONT
   auto *co = reinterpret_cast(cursor);
   co->setInfoBasedOnIPRegister();
   return UNW_ESUCCESS;
+#elif defined(_LIBUNWIND_TARGET_AARCH64)
+  new ((void *)cursor) UnwindCursor(
+  context, LocalAddressSpace::sThisAddressSpace);
+  auto *co = reinterpret_cast(cursor);
+  co->setInfoBasedOnIPRegister();
+  return UNW_ESUCCESS;
 #else
   return UNW_EINVAL;
 #endif
@@ -458,6 +470,8 @@ _unw_seh_get_disp_ctx(unw_cursor_t *curs
   return reinterpret_cast 
*>(cursor)->getDispatcherContext();
 #elif defined(_LIBUNWIND_TARGET_ARM)
   return reinterpret_cast 
*>(cursor)->getDispatcherContext();
+#elif defined(_LIBUNWIND_TARGET_AARCH64)
+  return reinterpret_cast 
*>(cursor)->getDispatcherContext();
 #else
   return nullptr;
 #endif
@@ -469,6 +483,8 @@ _unw_seh_set_disp_ctx(unw_cursor_t *curs
   reinterpret_cast 
*>(cursor)->setDispatcherContext(disp);
 #elif defined(_LIBUNWIND_TARGET_ARM)
   reinterpret_cast 
*>(cursor)->setDispatcherContext(disp);
+#elif defined(_LIBUNWIND_TARGET_AARCH64)
+  reinterpret_cast 
*>(cursor)->setDispatcherContext(disp);
 #endif
 }
 

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=349532=349531=349532=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Tue Dec 18 12:05:59 2018
@@ -615,6 +615,13 @@ UnwindCursor::UnwindCursor(unw_con
 d.d = r.getFloatRegister(i);
 _msContext.D[i - UNW_ARM_D0] = d.w;
   }
+#elif defined(_LIBUNWIND_TARGET_AARCH64)
+  for (int i = UNW_ARM64_X0; i <= UNW_ARM64_X30; ++i)
+_msContext.X[i - UNW_ARM64_X0] = r.getRegister(i);
+  _msContext.Sp = r.getRegister(UNW_REG_SP);
+  _msContext.Pc = r.getRegister(UNW_REG_IP);
+  for (int i = UNW_ARM64_D0; i <= UNW_ARM64_D31; ++i)
+_msContext.V[i - UNW_ARM64_D0].D[0] = r.getFloatRegister(i);
 #endif
 }
 
@@ -638,6 +645,8 @@ bool 

r349453 - [unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC.

2018-12-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Dec 18 00:36:16 2018
New Revision: 349453

URL: http://llvm.org/viewvc/llvm-project?rev=349453=rev
Log:
[unittests] Remove superfluous semicolon, fixing warnings with GCC. NFC.

Modified:
cfe/trunk/unittests/AST/ASTImporterTest.cpp

Modified: cfe/trunk/unittests/AST/ASTImporterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/ASTImporterTest.cpp?rev=349453=349452=349453=diff
==
--- cfe/trunk/unittests/AST/ASTImporterTest.cpp (original)
+++ cfe/trunk/unittests/AST/ASTImporterTest.cpp Tue Dec 18 00:36:16 2018
@@ -4467,7 +4467,7 @@ static Decl *findInDeclListOfDC(DeclCont
 return ND;
   }
   return nullptr;
-};
+}
 
 TEST_P(ASTImporterLookupTableTest,
 FriendWhichIsnotFoundByNormalLookupShouldBeFoundByImporterSpecificLookup) {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r349452 - [Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled

2018-12-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Dec 18 00:36:10 2018
New Revision: 349452

URL: http://llvm.org/viewvc/llvm-project?rev=349452=rev
Log:
[Driver] Automatically enable -munwind-tables if -fseh-exceptions is enabled

For targets where SEH exceptions are used by default (on MinGW,
only x86_64 so far), -munwind-tables are added automatically. If
-fseh-exeptions is enabled on a target where SEH exeptions are
availble but not enabled by default yet (aarch64), we need to
pass -munwind-tables if -fseh-exceptions was specified.

Differential Revision: https://reviews.llvm.org/D55749

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/windows-exceptions.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=349452=349451=349452=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Dec 18 00:36:10 2018
@@ -429,6 +429,12 @@ bool toolchains::MinGW::HasNativeLLVMSup
 }
 
 bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList ) const {
+  Arg *ExceptionArg = Args.getLastArg(options::OPT_fsjlj_exceptions,
+  options::OPT_fseh_exceptions,
+  options::OPT_fdwarf_exceptions);
+  if (ExceptionArg &&
+  ExceptionArg->getOption().matches(options::OPT_fseh_exceptions))
+return true;
   return getArch() == llvm::Triple::x86_64;
 }
 

Modified: cfe/trunk/test/Driver/windows-exceptions.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/windows-exceptions.cpp?rev=349452=349451=349452=diff
==
--- cfe/trunk/test/Driver/windows-exceptions.cpp (original)
+++ cfe/trunk/test/Driver/windows-exceptions.cpp Tue Dec 18 00:36:10 2018
@@ -2,8 +2,11 @@
 // RUN: %clang -target x86_64-windows-msvc -c %s -### 2>&1 | FileCheck 
-check-prefix=MSVC %s
 // RUN: %clang -target i686-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-DWARF %s
 // RUN: %clang -target x86_64-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-SEH %s
+// RUN: %clang -target aarch64-windows-gnu -c %s -### 2>&1 | FileCheck 
-check-prefix=MINGW-DWARF %s
+// RUN: %clang -target aarch64-windows-gnu -fseh-exceptions -c %s -### 2>&1 | 
FileCheck -check-prefix=MINGW-SEH %s
 
 MSVC-NOT: -fdwarf-exceptions
 MSVC-NOT: -fseh-exceptions
 MINGW-DWARF: -fdwarf-exceptions
+MINGW-SEH: -munwind-tables
 MINGW-SEH: -fseh-exceptions


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r349256 - [MinGW] Produce a vtable and RTTI for dllexported classes without a key function

2018-12-15 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sat Dec 15 00:08:11 2018
New Revision: 349256

URL: http://llvm.org/viewvc/llvm-project?rev=349256=rev
Log:
[MinGW] Produce a vtable and RTTI for dllexported classes without a key function

This matches what GCC does in these situations.

This fixes compiling Qt in debug mode. In release mode, references to
the vtable of this particular class ends up optimized away, but in debug
mode, the compiler creates references to the vtable, which is expected
to be dllexported from a different DLL. Make sure the dllexported
version actually ends up emitted.

Differential Revision: https://reviews.llvm.org/D55698

Added:
cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=349256=349255=349256=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Dec 15 00:08:11 2018
@@ -5528,6 +5528,9 @@ static void ReferenceDllExportedMembers(
 // declaration.
 return;
 
+  if (S.Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
+S.MarkVTableUsed(Class->getLocation(), Class, true);
+
   for (Decl *Member : Class->decls()) {
 // Defined static variables that are members of an exported base
 // class must be marked export too.

Added: cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp?rev=349256=auto
==
--- cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/dllexport-missing-key.cpp Sat Dec 15 00:08:11 2018
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -std=c++11 -o - %s | 
FileCheck --check-prefix=GNU %s
+
+class __declspec(dllexport) QAbstractLayoutStyleInfo {
+public:
+  QAbstractLayoutStyleInfo() : m_isWindow(false) {}
+  virtual ~QAbstractLayoutStyleInfo() {}
+
+  virtual bool hasChangedCore() const { return false; }
+
+  virtual void invalidate() {}
+
+  virtual double windowMargin(bool orientation) const = 0;
+
+  bool isWindow() const { return m_isWindow; }
+
+protected:
+  bool m_isWindow;
+};
+
+// GNU-DAG: @_ZTV24QAbstractLayoutStyleInfo = weak_odr dso_local dllexport
+// GNU-DAG: @_ZTS24QAbstractLayoutStyleInfo = linkonce_odr
+// GNU-DAG: @_ZTI24QAbstractLayoutStyleInfo = linkonce_odr


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r348981 - Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.

2018-12-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Dec 12 14:24:42 2018
New Revision: 348981

URL: http://llvm.org/viewvc/llvm-project?rev=348981=rev
Log:
Avoid code duplication in the SEH version of UnwindCursor::getRegisterName. NFC.

This requires making Registers_*::getRegisterName static.

Differential Revision: https://reviews.llvm.org/D55610

Modified:
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/src/Registers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=348981=348980=348981=diff
==
--- libunwind/trunk/src/Registers.hpp (original)
+++ libunwind/trunk/src/Registers.hpp Wed Dec 12 14:24:42 2018
@@ -42,7 +42,7 @@ public:
   boolvalidVectorRegister(int) const { return false; }
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86; }
 
@@ -248,7 +248,7 @@ public:
   boolvalidVectorRegister(int) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64; }
 
@@ -561,7 +561,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC; }
 
@@ -1126,7 +1126,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64; }
 
@@ -1768,7 +1768,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64; }
 
@@ -2038,7 +2038,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto() {
 restoreSavedFloatRegisters();
 restoreCoreAndJumpTo();
@@ -2518,7 +2518,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K; }
 
@@ -2714,7 +2714,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS; }
 
@@ -3035,7 +3035,7 @@ public:
   boolvalidVectorRegister(int num) const;
   v128getVectorRegister(int num) const;
   voidsetVectorRegister(int num, v128 value);
-  const char *getRegisterName(int num);
+  static const char *getRegisterName(int num);
   voidjumpto();
   static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_MIPS; }
 

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=348981=348980=348981=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Wed Dec 12 14:24:42 2018
@@ -804,113 +804,7 @@ template  void U
 
 template 
 const char *UnwindCursor::getRegisterName(int regNum) {
-  switch (regNum) {
-#if defined(_LIBUNWIND_TARGET_X86_64)
-  case UNW_REG_IP: return "rip";
-  case UNW_X86_64_RAX: return "rax";
-  case UNW_X86_64_RDX: return "rdx";
-  case UNW_X86_64_RCX: return "rcx";
-  case UNW_X86_64_RBX: return "rbx";
-  case UNW_REG_SP:
-  case UNW_X86_64_RSP: return "rsp";
-  case 

[libunwind] r348836 - [SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling RtlUnwindEx

2018-12-11 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Dec 11 01:53:11 2018
New Revision: 348836

URL: http://llvm.org/viewvc/llvm-project?rev=348836=rev
Log:
[SEH] Zero-initialize EXCEPTION_RECORD and UNWIND_HISTORY_TABLE before calling 
RtlUnwindEx

This fixes PR39935.

Modified:
libunwind/trunk/src/Unwind-seh.cpp

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=348836=348835=348836=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Tue Dec 11 01:53:11 2018
@@ -374,6 +374,8 @@ _Unwind_Resume(_Unwind_Exception *except
 CONTEXT ms_ctx;
 UNWIND_HISTORY_TABLE hist;
 
+memset(_exc, 0, sizeof(ms_exc));
+memset(, 0, sizeof(hist));
 ms_exc.ExceptionCode = STATUS_GCC_THROW;
 ms_exc.ExceptionFlags = EXCEPTION_NONCONTINUABLE;
 ms_exc.NumberParameters = 4;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r348832 - Don't export assembly functions when function visibility annotations are disabled

2018-12-10 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Dec 10 23:34:14 2018
New Revision: 348832

URL: http://llvm.org/viewvc/llvm-project?rev=348832=rev
Log:
Don't export assembly functions when function visibility annotations are 
disabled

Patch by Peiyuan Song!

Differential Revision: https://reviews.llvm.org/D55537

Modified:
libunwind/trunk/src/assembly.h

Modified: libunwind/trunk/src/assembly.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/assembly.h?rev=348832=348831=348832=diff
==
--- libunwind/trunk/src/assembly.h (original)
+++ libunwind/trunk/src/assembly.h Mon Dec 10 23:34:14 2018
@@ -76,7 +76,11 @@
   .section .drectve,"yn" SEPARATOR\
   .ascii "-export:", #name, "\0" SEPARATOR\
   .text
+#if defined(_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
+#define EXPORT_SYMBOL(name)
+#else
 #define EXPORT_SYMBOL(name) EXPORT_SYMBOL2(name)
+#endif
 #define HIDDEN_SYMBOL(name)
 
 #define NO_EXEC_STACK_DIRECTIVE


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r345372 - Revert "Reapply: [Driver] Use forward slashes in most linker arguments"

2018-10-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Oct 26 01:33:29 2018
New Revision: 345372

URL: http://llvm.org/viewvc/llvm-project?rev=345372=rev
Log:
Revert "Reapply: [Driver] Use forward slashes in most linker arguments"

This reverts commit r345370, as it uncovered even more issues in
tests with partial/inconsistent path normalization:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/13562
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/886
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-windows10pro-fast/builds/20994

In particular, these tests seem to have failed:
Clang :: CodeGen/thinlto-diagnostic-handler-remarks-with-hotness.ll
Clang :: CodeGen/thinlto-multi-module.ll
Clang :: Driver/cuda-external-tools.cu
Clang :: Driver/cuda-options.cu
Clang :: Driver/hip-toolchain-no-rdc.hip
Clang :: Driver/hip-toolchain-rdc.hip
Clang :: Driver/openmp-offload-gpu.c

At least the Driver tests could potentially be fixed by extending
the path normalization to even more places, but the issues with the
CodeGen tests are still unknown.

In addition, a number of other tests seem to have been broken in
other clang dependent tools such as clang-tidy and clangd.

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=345372=345371=345372=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 26 01:33:29 2018
@@ -21,7 +21,6 @@
 #include "llvm/ADT/Triple.h"
 #include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Option/Option.h"
-#include "llvm/Support/Path.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/Target/TargetOptions.h"
 #include 
@@ -371,12 +370,6 @@ public:
  StringRef Component,
  bool Shared = false) const;
 
-  std::string normalizePath(StringRef Path) const {
-if (!Triple.isOSWindows() || Triple.isOSCygMing())
-  return llvm::sys::path::convert_to_slash(Path);
-return Path;
-  }
-
   // Returns /lib//.  This is used by runtimes (such
   // as OpenMP) to find arch-specific libraries.
   std::string getArchSpecificLibPath() const;

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=345372=345371=345372=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 26 01:33:29 2018
@@ -1011,12 +1011,6 @@ Compilation *Driver::BuildCompilation(Ar
 .Default(SaveTempsCwd);
   }
 
-  llvm::Triple EffectiveTriple = computeTargetTriple(*this, TargetTriple, 
Args);
-  if (!EffectiveTriple.isOSWindows() || EffectiveTriple.isOSCygMing()) {
-for (auto *Str : {, , , })
-  *Str = llvm::sys::path::convert_to_slash(*Str);
-  }
-
   setLTOMode(Args);
 
   // Process -fembed-bitcode= flags.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345372=345371=345372=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 26 01:33:29 2018
@@ -376,10 +376,9 @@ std::string ToolChain::getCompilerRT(con
 
   for (const auto  : getLibraryPaths()) {
 SmallString<128> P(LibPath);
-llvm::sys::path::append(P,
-Prefix + Twine("clang_rt.") + Component + Suffix);
+llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
 if (getVFS().exists(P))
-  return normalizePath(P);
+  return P.str();
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -387,7 +386,7 @@ std::string ToolChain::getCompilerRT(con
   SmallString<128> Path(getCompilerRTPath());
   llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
 Arch + Env + Suffix);
-  return normalizePath(Path);
+  return Path.str();
 }
 
 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList ,
@@ -426,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct
 }
 
 std::string ToolChain::GetFilePath(const char *Name) const {
-  return normalizePath(D.GetFilePath(Name, *this));
+  return D.GetFilePath(Name, *this);
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {
@@ -775,14 +774,12 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const 

r345370 - Reapply: [Driver] Use forward slashes in most linker arguments

2018-10-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Oct 26 00:01:59 2018
New Revision: 345370

URL: http://llvm.org/viewvc/llvm-project?rev=345370=rev
Log:
Reapply: [Driver] Use forward slashes in most linker arguments

libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

Compared to the previous attempt in SVN r345004, this now does
the same transformation on more paths, hopefully on the right set
of paths so that all tests pass (previously some tests failed, where
path fragments that were required to be identical turned out to
use different path separators in different places). This now also
is done only for non-windows, or cygwin/mingw targets, to preserve
all backslashes for MSVC cases (where the paths can end up e.g. embedded
into PDB files. (The transformation function itself,
llvm::sys::path::convert_to_slash only has an effect when run on windows.)

Differential Revision: https://reviews.llvm.org/D53066

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/lib/Driver/ToolChains/CommonArgs.cpp
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=345370=345369=345370=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Fri Oct 26 00:01:59 2018
@@ -21,6 +21,7 @@
 #include "llvm/ADT/Triple.h"
 #include "llvm/MC/MCTargetOptions.h"
 #include "llvm/Option/Option.h"
+#include "llvm/Support/Path.h"
 #include "llvm/Support/VersionTuple.h"
 #include "llvm/Target/TargetOptions.h"
 #include 
@@ -370,6 +371,12 @@ public:
  StringRef Component,
  bool Shared = false) const;
 
+  std::string normalizePath(StringRef Path) const {
+if (!Triple.isOSWindows() || Triple.isOSCygMing())
+  return llvm::sys::path::convert_to_slash(Path);
+return Path;
+  }
+
   // Returns /lib//.  This is used by runtimes (such
   // as OpenMP) to find arch-specific libraries.
   std::string getArchSpecificLibPath() const;

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=345370=345369=345370=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Fri Oct 26 00:01:59 2018
@@ -1011,6 +1011,12 @@ Compilation *Driver::BuildCompilation(Ar
 .Default(SaveTempsCwd);
   }
 
+  llvm::Triple EffectiveTriple = computeTargetTriple(*this, TargetTriple, 
Args);
+  if (!EffectiveTriple.isOSWindows() || EffectiveTriple.isOSCygMing()) {
+for (auto *Str : {, , , })
+  *Str = llvm::sys::path::convert_to_slash(*Str);
+  }
+
   setLTOMode(Args);
 
   // Process -fembed-bitcode= flags.

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345370=345369=345370=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Fri Oct 26 00:01:59 2018
@@ -376,9 +376,10 @@ std::string ToolChain::getCompilerRT(con
 
   for (const auto  : getLibraryPaths()) {
 SmallString<128> P(LibPath);
-llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
+llvm::sys::path::append(P,
+Prefix + Twine("clang_rt.") + Component + Suffix);
 if (getVFS().exists(P))
-  return P.str();
+  return normalizePath(P);
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -386,7 +387,7 @@ std::string ToolChain::getCompilerRT(con
   SmallString<128> 

r345005 - Revert "[Driver] Use forward slashes in most linker arguments"

2018-10-23 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Oct 23 00:01:55 2018
New Revision: 345005

URL: http://llvm.org/viewvc/llvm-project?rev=345005=rev
Log:
Revert "[Driver] Use forward slashes in most linker arguments"

This reverts commit r345004, as it broke tests when actually run
on windows; see e.g.
http://lab.llvm.org:8011/builders/clang-x64-windows-msvc/builds/763.

This broke tests that had captured a variable containing a path
with backslashes, which failed to match cases in the output
where the path separators had been changed into forward slashes.

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345005=345004=345005=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Tue Oct 23 00:01:55 2018
@@ -378,7 +378,7 @@ std::string ToolChain::getCompilerRT(con
 SmallString<128> P(LibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
 if (getVFS().exists(P))
-  return llvm::sys::path::convert_to_slash(P);
+  return P.str();
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -386,7 +386,7 @@ std::string ToolChain::getCompilerRT(con
   SmallString<128> Path(getCompilerRTPath());
   llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
 Arch + Env + Suffix);
-  return llvm::sys::path::convert_to_slash(Path);
+  return Path.str();
 }
 
 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList ,
@@ -425,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct
 }
 
 std::string ToolChain::GetFilePath(const char *Name) const {
-  return llvm::sys::path::convert_to_slash(D.GetFilePath(Name, *this));
+  return D.GetFilePath(Name, *this);
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {
@@ -774,14 +774,12 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getLibraryPaths())
-if (LibPath.length() > 0)
-  CmdArgs.push_back(Args.MakeArgString(
-  StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 
   for (const auto  : getFilePaths())
-if (LibPath.length() > 0)
-  CmdArgs.push_back(Args.MakeArgString(
-  StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
+if(LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r345003 - [MinGW] Link to correct openmp library

2018-10-23 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Oct 22 23:33:22 2018
New Revision: 345003

URL: http://llvm.org/viewvc/llvm-project?rev=345003=rev
Log:
[MinGW] Link to correct openmp library

Patch by Peiyuan Song!

Differential Revision: https://reviews.llvm.org/D53397

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/fopenmp.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=345003=345002=345003=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Oct 22 23:33:22 2018
@@ -220,8 +220,24 @@ void tools::MinGW::Linker::ConstructJob(
 CmdArgs.push_back("-lssp_nonshared");
 CmdArgs.push_back("-lssp");
   }
-  if (Args.hasArg(options::OPT_fopenmp))
-CmdArgs.push_back("-lgomp");
+
+  if (Args.hasFlag(options::OPT_fopenmp, options::OPT_fopenmp_EQ,
+   options::OPT_fno_openmp, false)) {
+switch (TC.getDriver().getOpenMPRuntime(Args)) {
+case Driver::OMPRT_OMP:
+  CmdArgs.push_back("-lomp");
+  break;
+case Driver::OMPRT_IOMP5:
+  CmdArgs.push_back("-liomp5md");
+  break;
+case Driver::OMPRT_GOMP:
+  CmdArgs.push_back("-lgomp");
+  break;
+case Driver::OMPRT_Unknown:
+  // Already diagnosed.
+  break;
+}
+  }
 
   AddLibGCC(Args, CmdArgs);
 

Modified: cfe/trunk/test/Driver/fopenmp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fopenmp.c?rev=345003=345002=345003=diff
==
--- cfe/trunk/test/Driver/fopenmp.c (original)
+++ cfe/trunk/test/Driver/fopenmp.c Mon Oct 22 23:33:22 2018
@@ -10,6 +10,9 @@
 // RUN: %clang -target x86_64-netbsd -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
 // RUN: %clang -target x86_64-netbsd -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-NO-OPENMP
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 -c %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-CC1-OPENMP
 //
 // CHECK-CC1-OPENMP: "-cc1"
 // CHECK-CC1-OPENMP: "-fopenmp"
@@ -49,6 +52,14 @@
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libgomp %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
 // RUN: %clang -nostdlib -target x86_64-netbsd -fopenmp=libiomp5 %s -o %t -### 
2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5
 //
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libomp %s -o %t -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-LD-OMP
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-GOMP --check-prefix=CHECK-LD-GOMP-NO-RT
+// RUN: %clang -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t -### 2>&1 
| FileCheck %s --check-prefix=CHECK-LD-IOMP5MD
+//
+// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libomp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-OMP
+// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libgomp %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-GOMP
+// RUN: %clang -nostdlib -target x86_64-windows-gnu -fopenmp=libiomp5 %s -o %t 
-### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-IOMP5MD
+//
 // CHECK-LD-OMP: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD-OMP: "-lomp"
 //
@@ -60,6 +71,9 @@
 // CHECK-LD-IOMP5: "{{.*}}ld{{(.exe)?}}"
 // CHECK-LD-IOMP5: "-liomp5"
 //
+// CHECK-LD-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
+// CHECK-LD-IOMP5MD: "-liomp5md"
+//
 // CHECK-NO-OMP: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-OMP-NOT: "-lomp"
 //
@@ -69,6 +83,9 @@
 // CHECK-NO-IOMP5: "{{.*}}ld{{(.exe)?}}"
 // CHECK-NO-IOMP5-NOT: "-liomp5"
 //
+// CHECK-NO-IOMP5MD: "{{.*}}ld{{(.exe)?}}"
+// CHECK-NO-IOMP5MD-NOT: "-liomp5md"
+//
 // We'd like to check that the default is sane, but until we have the ability
 // to *always* semantically analyze OpenMP without always generating runtime
 // calls (in the event of an unsupported runtime), we don't have a good way to
@@ -79,6 +96,10 @@
 // RUN: %clang -target x86_64-darwin -fopenmp %s -o %t -### 2>&1 | FileCheck 
%s --check-prefix=CHECK-LD-ANY
 // RUN: %clang -target x86_64-freebsd -fopenmp %s -o %t -### 2>&1 | FileCheck 
%s --check-prefix=CHECK-LD-ANY
 // RUN: %clang -target x86_64-netbsd -fopenmp %s -o %t -### 2>&1 | FileCheck 
%s --check-prefix=CHECK-LD-ANY
+// RUN: %clang -target x86_64-windows-gnu -fopenmp %s -o %t -### 2>&1 | 

r345004 - [Driver] Use forward slashes in most linker arguments

2018-10-23 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Oct 22 23:33:26 2018
New Revision: 345004

URL: http://llvm.org/viewvc/llvm-project?rev=345004=rev
Log:
[Driver] Use forward slashes in most linker arguments

libtool inspects the output of $CC -v to detect what object files and
libraries are linked in by default. When clang is built as a native
windows executable, all paths are formatted with backslashes, and
the backslashes cause each argument to be enclosed in quotes. The
backslashes and quotes break further processing within libtool (which
is implemented in shell script, running in e.g. msys) pretty badly.

Between unix style pathes (that only work in tools that are linked
to the msys runtime, essentially the same as cygwin) and proper windows
style paths (with backslashes, that can easily break shell scripts
and msys environments), the best compromise is to use windows style
paths (starting with e.g. c:) but with forward slashes, which both
msys based tools, shell scripts and native windows executables can
cope with. This incidentally turns out to be the form of paths that
GCC prints out when run with -v on windows as well.

This change potentially makes the output from clang -v a bit more
inconsistent, but it is isn't necessarily very consistent to begin with.

Differential Revision: https://reviews.llvm.org/D53066

Modified:
cfe/trunk/lib/Driver/ToolChain.cpp

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=345004=345003=345004=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct 22 23:33:26 2018
@@ -378,7 +378,7 @@ std::string ToolChain::getCompilerRT(con
 SmallString<128> P(LibPath);
 llvm::sys::path::append(P, Prefix + Twine("clang_rt.") + Component + 
Suffix);
 if (getVFS().exists(P))
-  return P.str();
+  return llvm::sys::path::convert_to_slash(P);
   }
 
   StringRef Arch = getArchNameForCompilerRTLib(*this, Args);
@@ -386,7 +386,7 @@ std::string ToolChain::getCompilerRT(con
   SmallString<128> Path(getCompilerRTPath());
   llvm::sys::path::append(Path, Prefix + Twine("clang_rt.") + Component + "-" +
 Arch + Env + Suffix);
-  return Path.str();
+  return llvm::sys::path::convert_to_slash(Path);
 }
 
 const char *ToolChain::getCompilerRTArgString(const llvm::opt::ArgList ,
@@ -425,7 +425,7 @@ Tool *ToolChain::SelectTool(const JobAct
 }
 
 std::string ToolChain::GetFilePath(const char *Name) const {
-  return D.GetFilePath(Name, *this);
+  return llvm::sys::path::convert_to_slash(D.GetFilePath(Name, *this));
 }
 
 std::string ToolChain::GetProgramPath(const char *Name) const {
@@ -774,12 +774,14 @@ void ToolChain::AddCXXStdlibLibArgs(cons
 void ToolChain::AddFilePathLibArgs(const ArgList ,
ArgStringList ) const {
   for (const auto  : getLibraryPaths())
-if(LibPath.length() > 0)
-  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if (LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(
+  StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
 
   for (const auto  : getFilePaths())
-if(LibPath.length() > 0)
-  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibPath));
+if (LibPath.length() > 0)
+  CmdArgs.push_back(Args.MakeArgString(
+  StringRef("-L") + llvm::sys::path::convert_to_slash(LibPath)));
 }
 
 void ToolChain::AddCCKextLibArgs(const ArgList ,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r344412 - [MinGW] Allow using LTO when lld is used as linker

2018-10-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Oct 12 13:15:51 2018
New Revision: 344412

URL: http://llvm.org/viewvc/llvm-project?rev=344412=rev
Log:
[MinGW] Allow using LTO when lld is used as linker

Differential Revision: https://reviews.llvm.org/D53195

Added:
cfe/trunk/test/Driver/mingw-lto.c
Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=344412=344411=344412=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Fri Oct 12 13:15:51 2018
@@ -10,6 +10,7 @@
 #include "MinGW.h"
 #include "InputInfo.h"
 #include "CommonArgs.h"
+#include "clang/Config/config.h"
 #include "clang/Driver/Compilation.h"
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
@@ -376,6 +377,10 @@ toolchains::MinGW::MinGW(const Driver 
   getFilePaths().push_back(Base + "lib");
   // openSUSE
   getFilePaths().push_back(Base + Arch + "/sys-root/mingw/lib");
+
+  NativeLLVMSupport =
+  Args.getLastArgValue(options::OPT_fuse_ld_EQ, CLANG_DEFAULT_LINKER)
+  .equals_lower("lld");
 }
 
 bool toolchains::MinGW::IsIntegratedAssemblerDefault() const { return true; }
@@ -403,6 +408,10 @@ Tool *toolchains::MinGW::buildLinker() c
   return new tools::MinGW::Linker(*this);
 }
 
+bool toolchains::MinGW::HasNativeLLVMSupport() const {
+  return NativeLLVMSupport;
+}
+
 bool toolchains::MinGW::IsUnwindTablesDefault(const ArgList ) const {
   return getArch() == llvm::Triple::x86_64;
 }

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=344412=344411=344412=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Fri Oct 12 13:15:51 2018
@@ -59,6 +59,8 @@ public:
   MinGW(const Driver , const llvm::Triple ,
 const llvm::opt::ArgList );
 
+  bool HasNativeLLVMSupport() const override;
+
   bool IsIntegratedAssemblerDefault() const override;
   bool IsUnwindTablesDefault(const llvm::opt::ArgList ) const override;
   bool isPICDefault() const override;
@@ -99,6 +101,8 @@ private:
   void findGccLibDir();
   llvm::ErrorOr findGcc();
   llvm::ErrorOr findClangRelativeSysroot();
+
+  bool NativeLLVMSupport;
 };
 
 } // end namespace toolchains

Added: cfe/trunk/test/Driver/mingw-lto.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-lto.c?rev=344412=auto
==
--- cfe/trunk/test/Driver/mingw-lto.c (added)
+++ cfe/trunk/test/Driver/mingw-lto.c Fri Oct 12 13:15:51 2018
@@ -0,0 +1,4 @@
+// The default linker doesn't support LLVM bitcode
+// RUN: not %clang -target i686-pc-windows-gnu %s -flto -fuse-ld=bfd
+// When using lld, this is allowed though.
+// RUN: %clang -target i686-pc-windows-gnu -### %s -flto -fuse-ld=lld


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r344125 - [MinGW] Fix passing a sanitizer lib name as dependent lib

2018-10-10 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Oct 10 02:01:00 2018
New Revision: 344125

URL: http://llvm.org/viewvc/llvm-project?rev=344125=rev
Log:
[MinGW] Fix passing a sanitizer lib name as dependent lib

Differential Revision: https://reviews.llvm.org/D52990

Modified:
cfe/trunk/lib/CodeGen/TargetInfo.cpp
cfe/trunk/test/Driver/fsanitize.c

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=344125=344124=344125=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Wed Oct 10 02:01:00 2018
@@ -2337,7 +2337,7 @@ static std::string qualifyWindowsLibrary
   bool Quote = (Lib.find(" ") != StringRef::npos);
   std::string ArgStr = Quote ? "\"" : "";
   ArgStr += Lib;
-  if (!Lib.endswith_lower(".lib"))
+  if (!Lib.endswith_lower(".lib") && !Lib.endswith_lower(".a"))
 ArgStr += ".lib";
   ArgStr += Quote ? "\"" : "";
   return ArgStr;

Modified: cfe/trunk/test/Driver/fsanitize.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/fsanitize.c?rev=344125=344124=344125=diff
==
--- cfe/trunk/test/Driver/fsanitize.c (original)
+++ cfe/trunk/test/Driver/fsanitize.c Wed Oct 10 02:01:00 2018
@@ -17,9 +17,11 @@
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32
 // RUN: %clang -target i386-pc-win32 -fsanitize=undefined -x c++ %s -### 2>&1 
| FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN32 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64
+// RUN: %clang -target x86_64-w64-mingw32 -fsanitize=undefined %s -### 2>&1 | 
FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64-MINGW
 // RUN: %clang -target x86_64-pc-win32 -fsanitize=undefined -x c++ %s -### 
2>&1 | FileCheck %s --check-prefix=CHECK-UNDEFINED-WIN 
--check-prefix=CHECK-UNDEFINED-WIN64 --check-prefix=CHECK-UNDEFINED-WIN-CXX
 // CHECK-UNDEFINED-WIN32: "--dependent-lib={{[^"]*}}ubsan_standalone-i386.lib"
 // CHECK-UNDEFINED-WIN64: 
"--dependent-lib={{[^"]*}}ubsan_standalone-x86_64.lib"
+// CHECK-UNDEFINED-WIN64-MINGW: 
"--dependent-lib={{[^"]*}}libclang_rt.ubsan_standalone-x86_64.a"
 // CHECK-UNDEFINED-WIN-CXX: 
"--dependent-lib={{[^"]*}}ubsan_standalone_cxx{{[^"]*}}.lib"
 // CHECK-UNDEFINED-WIN-SAME: 
"-fsanitize={{((signed-integer-overflow|integer-divide-by-zero|float-divide-by-zero|shift-base|shift-exponent|unreachable|return|vla-bound|alignment|null|pointer-overflow|float-cast-overflow|array-bounds|enum|bool|builtin|returns-nonnull-attribute|nonnull-attribute),?){18}"}}
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343702 - [test] Use --sysroot instead of -B in print-multi-directory.c

2018-10-03 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Oct  3 11:24:05 2018
New Revision: 343702

URL: http://llvm.org/viewvc/llvm-project?rev=343702=rev
Log:
[test] Use --sysroot instead of -B in print-multi-directory.c

This avoids finding a similar matching GCC installation outside
of the test directory tree in the surrounding environment, which
would make the test fail. (This happened on Ubuntu 16.04.)

Differential Revision: https://reviews.llvm.org/D52533

Modified:
cfe/trunk/test/Driver/print-multi-directory.c

Modified: cfe/trunk/test/Driver/print-multi-directory.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/print-multi-directory.c?rev=343702=343701=343702=diff
==
--- cfe/trunk/test/Driver/print-multi-directory.c (original)
+++ cfe/trunk/test/Driver/print-multi-directory.c Wed Oct  3 11:24:05 2018
@@ -1,6 +1,6 @@
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \
 // RUN: -target i386-none-linux \
-// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \
+// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \
 // RUN: -print-multi-directory \
 // RUN:   | FileCheck --match-full-lines --check-prefix=CHECK-X86-MULTILIBS %s
 
@@ -9,7 +9,7 @@
 
 // RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>/dev/null \
 // RUN: -target i386-none-linux -m64 \
-// RUN: -B%S/Inputs/multilib_64bit_linux_tree/usr \
+// RUN: --sysroot=%S/Inputs/multilib_64bit_linux_tree/usr \
 // RUN: -print-multi-directory \
 // RUN:   | FileCheck --match-full-lines --check-prefix=CHECK-X86_64-MULTILIBS 
%s
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r343537 - [MinGW] Allow using ASan

2018-10-01 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Oct  1 13:53:25 2018
New Revision: 343537

URL: http://llvm.org/viewvc/llvm-project?rev=343537=rev
Log:
[MinGW] Allow using ASan

Linking to ASan for MinGW is similar to MSVC, but MinGW always links
the MSVCRT dynamically, so there is only one of the MSVC cases to
consider.

When linking to a shared compiler runtime library on MinGW, the suffix
of the import library is .dll.a.

The existing case of .dll as suffix for windows in general doesn't
seem correct (since this is used for linking). As long as callers never
actually set the Shared flag, the default static suffix of .lib also
worked fine for import libraries as well.

Differential Revision: https://reviews.llvm.org/D52538

Added:
cfe/trunk/test/Driver/mingw-sanitizers.c
Modified:
cfe/trunk/lib/Driver/ToolChain.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h

Modified: cfe/trunk/lib/Driver/ToolChain.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChain.cpp?rev=343537=343536=343537=diff
==
--- cfe/trunk/lib/Driver/ToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChain.cpp Mon Oct  1 13:53:25 2018
@@ -367,8 +367,10 @@ std::string ToolChain::getCompilerRT(con
   TT.isWindowsMSVCEnvironment() || TT.isWindowsItaniumEnvironment();
 
   const char *Prefix = IsITANMSVCWindows ? "" : "lib";
-  const char *Suffix = Shared ? (Triple.isOSWindows() ? ".dll" : ".so")
+  const char *Suffix = Shared ? (Triple.isOSWindows() ? ".lib" : ".so")
   : (IsITANMSVCWindows ? ".lib" : ".a");
+  if (Shared && Triple.isWindowsGNUEnvironment())
+Suffix = ".dll.a";
 
   for (const auto  : getLibraryPaths()) {
 SmallString<128> P(LibPath);

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=343537=343536=343537=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Mon Oct  1 13:53:25 2018
@@ -14,6 +14,7 @@
 #include "clang/Driver/Driver.h"
 #include "clang/Driver/DriverDiagnostic.h"
 #include "clang/Driver/Options.h"
+#include "clang/Driver/SanitizerArgs.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/Path.h"
@@ -95,7 +96,7 @@ void tools::MinGW::Linker::ConstructJob(
 const char *LinkingOutput) const {
   const ToolChain  = getToolChain();
   const Driver  = TC.getDriver();
-  // const SanitizerArgs  = TC.getSanitizerArgs();
+  const SanitizerArgs  = TC.getSanitizerArgs();
 
   ArgStringList CmdArgs;
 
@@ -187,8 +188,6 @@ void tools::MinGW::Linker::ConstructJob(
   TC.AddFilePathLibArgs(Args, CmdArgs);
   AddLinkerInputs(TC, Inputs, Args, CmdArgs, JA);
 
-  // TODO: Add ASan stuff here
-
   // TODO: Add profile stuff here
 
   if (TC.ShouldLinkCXXStdlib(Args)) {
@@ -231,6 +230,24 @@ void tools::MinGW::Linker::ConstructJob(
   if (Args.hasArg(options::OPT_pthread))
 CmdArgs.push_back("-lpthread");
 
+  if (Sanitize.needsAsanRt()) {
+// MinGW always links against a shared MSVCRT.
+CmdArgs.push_back(
+TC.getCompilerRTArgString(Args, "asan_dynamic", true));
+CmdArgs.push_back(
+TC.getCompilerRTArgString(Args, "asan_dynamic_runtime_thunk"));
+CmdArgs.push_back(Args.MakeArgString("--require-defined"));
+CmdArgs.push_back(Args.MakeArgString(TC.getArch() == llvm::Triple::x86
+ ? "___asan_seh_interceptor"
+ : "__asan_seh_interceptor"));
+// Make sure the linker consider all object files from the dynamic
+// runtime thunk.
+CmdArgs.push_back(Args.MakeArgString("--whole-archive"));
+CmdArgs.push_back(Args.MakeArgString(
+TC.getCompilerRT(Args, "asan_dynamic_runtime_thunk")));
+CmdArgs.push_back(Args.MakeArgString("--no-whole-archive"));
+  }
+
   if (!HasWindowsApp) {
 // Add system libraries. If linking to libwindowsapp.a, that import
 // library replaces all these and we shouldn't accidentally try to
@@ -407,6 +424,12 @@ toolchains::MinGW::GetExceptionModel(con
   return llvm::ExceptionHandling::DwarfCFI;
 }
 
+SanitizerMask toolchains::MinGW::getSupportedSanitizers() const {
+  SanitizerMask Res = ToolChain::getSupportedSanitizers();
+  Res |= SanitizerKind::Address;
+  return Res;
+}
+
 void toolchains::MinGW::AddCudaIncludeArgs(const ArgList ,
ArgStringList ) const {
   CudaInstallation.AddCudaIncludeArgs(DriverArgs, CC1Args);

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
URL: 

r343184 - [Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM

2018-09-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Sep 27 01:24:15 2018
New Revision: 343184

URL: http://llvm.org/viewvc/llvm-project?rev=343184=rev
Log:
[Sema] Handle __va_start for Windows/ARM64 in the same way as for ARM

This fixes PR39090.

Differential Revision: https://reviews.llvm.org/D52571

Modified:
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaCXX/microsoft-varargs.cpp

Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=343184=343183=343184=diff
==
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Sep 27 01:24:15 2018
@@ -929,6 +929,7 @@ Sema::CheckBuiltinFunctionCall(FunctionD
 break;
   case Builtin::BI__va_start: {
 switch (Context.getTargetInfo().getTriple().getArch()) {
+case llvm::Triple::aarch64:
 case llvm::Triple::arm:
 case llvm::Triple::thumb:
   if (SemaBuiltinVAStartARMMicrosoft(TheCall))

Modified: cfe/trunk/test/SemaCXX/microsoft-varargs.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/microsoft-varargs.cpp?rev=343184=343183=343184=diff
==
--- cfe/trunk/test/SemaCXX/microsoft-varargs.cpp (original)
+++ cfe/trunk/test/SemaCXX/microsoft-varargs.cpp Thu Sep 27 01:24:15 2018
@@ -1,4 +1,5 @@
 // RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only %s 
-verify
+// RUN: %clang_cc1 -triple aarch64-windows -fms-compatibility -fsyntax-only %s 
-verify
 // expected-no-diagnostics
 
 extern "C" {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r341217 - Fix existing code for SEH on ARM to compile correctly

2018-08-31 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Aug 31 07:56:55 2018
New Revision: 341217

URL: http://llvm.org/viewvc/llvm-project?rev=341217=rev
Log:
Fix existing code for SEH on ARM to compile correctly

Even though SEH for ARM is incomplete, make what code already exists
at least compile correctly.

The _LIBUNWIND_CURSOR_SIZE wasn't correct.

ARM (and AArch64) have a DISPATCHER_CONTEXT field named TargetPc
instead of TargetIp.

For the libunwind.h UNW_* constants, there is no UNW_ARM_PC, only
UNW_ARM_IP.

Don't use 'r' as loop variable when 'r' already is a Registers_arm
member.

Differential Revision: https://reviews.llvm.org/D51530

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/src/Unwind-seh.cpp
libunwind/trunk/src/UnwindCursor.hpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=341217=341216=341217=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Fri Aug 31 07:56:55 2018
@@ -63,7 +63,7 @@
 #  define _LIBUNWIND_TARGET_ARM 1
 #  if defined(__SEH__)
 #define _LIBUNWIND_CONTEXT_SIZE 42
-#define _LIBUNWIND_CURSOR_SIZE 85
+#define _LIBUNWIND_CURSOR_SIZE 80
 #  elif defined(__ARM_WMMX)
 #define _LIBUNWIND_CONTEXT_SIZE 61
 #define _LIBUNWIND_CURSOR_SIZE 68

Modified: libunwind/trunk/src/Unwind-seh.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-seh.cpp?rev=341217=341216=341217=diff
==
--- libunwind/trunk/src/Unwind-seh.cpp (original)
+++ libunwind/trunk/src/Unwind-seh.cpp Fri Aug 31 07:56:55 2018
@@ -164,17 +164,22 @@ _GCC_specific_handler(PEXCEPTION_RECORD
 // This should never happen in phase 1.
 if (!IS_UNWINDING(ms_exc->ExceptionFlags))
   _LIBUNWIND_ABORT("Personality installed context during phase 1!");
-exc->private_[2] = disp->TargetIp;
 #ifdef __x86_64__
+exc->private_[2] = disp->TargetIp;
 unw_get_reg(, UNW_X86_64_RAX, );
 unw_get_reg(, UNW_X86_64_RDX, >private_[3]);
 #elif defined(__arm__)
+exc->private_[2] = disp->TargetPc;
 unw_get_reg(, UNW_ARM_R0, );
 unw_get_reg(, UNW_ARM_R1, >private_[3]);
 #endif
 unw_get_reg(, UNW_REG_IP, );
 ms_exc->ExceptionCode = STATUS_GCC_UNWIND;
+#ifdef __x86_64__
 ms_exc->ExceptionInformation[2] = disp->TargetIp;
+#elif defined(__arm__)
+ms_exc->ExceptionInformation[2] = disp->TargetPc;
+#endif
 ms_exc->ExceptionInformation[3] = exc->private_[3];
 // Give NTRTL some scratch space to keep track of the collided unwind.
 // Don't use the one that was passed in; we don't want to overwrite the

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=341217=341216=341217=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Fri Aug 31 07:56:55 2018
@@ -606,14 +606,14 @@ UnwindCursor::UnwindCursor(unw_con
   _msContext.R12 = r.getRegister(UNW_ARM_R12);
   _msContext.Sp = r.getRegister(UNW_ARM_SP);
   _msContext.Lr = r.getRegister(UNW_ARM_LR);
-  _msContext.Pc = r.getRegister(UNW_ARM_PC);
-  for (int r = UNW_ARM_D0; r <= UNW_ARM_D31; ++r) {
+  _msContext.Pc = r.getRegister(UNW_ARM_IP);
+  for (int i = UNW_ARM_D0; i <= UNW_ARM_D31; ++i) {
 union {
   uint64_t w;
   double d;
 } d;
-d.d = r.getFloatRegister(r);
-_msContext.D[r - UNW_ARM_D0] = d.w;
+d.d = r.getFloatRegister(i);
+_msContext.D[i - UNW_ARM_D0] = d.w;
   }
 #endif
 }
@@ -682,7 +682,7 @@ unw_word_t UnwindCursor::getReg(in
   case UNW_ARM_SP: return _msContext.Sp;
   case UNW_ARM_LR: return _msContext.Lr;
   case UNW_REG_IP:
-  case UNW_ARM_PC: return _msContext.Pc;
+  case UNW_ARM_IP: return _msContext.Pc;
 #endif
   }
   _LIBUNWIND_ABORT("unsupported register");
@@ -728,7 +728,7 @@ void UnwindCursor::setReg(int regN
   case UNW_ARM_SP: _msContext.Sp = value; break;
   case UNW_ARM_LR: _msContext.Lr = value; break;
   case UNW_REG_IP:
-  case UNW_ARM_PC: _msContext.Pc = value; break;
+  case UNW_ARM_IP: _msContext.Pc = value; break;
 #endif
   default:
 _LIBUNWIND_ABORT("unsupported register");
@@ -842,7 +842,7 @@ const char *UnwindCursor::getRegis
   case UNW_ARM_SP: return "sp";
   case UNW_ARM_LR: return "lr";
   case UNW_REG_IP:
-  case UNW_ARM_PC: return "pc";
+  case UNW_ARM_IP: return "pc";
   case UNW_ARM_S0: return "s0";
   case UNW_ARM_S1: return "s1";
   case UNW_ARM_S2: return "s2";


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r340941 - [MinGW] Don't mark external variables as DSO local

2018-08-29 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Aug 29 10:26:58 2018
New Revision: 340941

URL: http://llvm.org/viewvc/llvm-project?rev=340941=rev
Log:
[MinGW] Don't mark external variables as DSO local

Since MinGW supports automatically importing external variables from
DLLs even without the DLLImport attribute, we shouldn't mark them
as DSO local unless we actually know them to be local for sure.

Keep marking thread local variables as DSO local.

Differential Revision: https://reviews.llvm.org/D51382

Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/test/CodeGen/dllimport.c
cfe/trunk/test/CodeGen/dso-local-executable.c
cfe/trunk/test/CodeGenCXX/dllexport.cpp
cfe/trunk/test/CodeGenCXX/dllimport-members.cpp
cfe/trunk/test/CodeGenCXX/dllimport.cpp
cfe/trunk/test/CodeGenCXX/dso-local-executable.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=340941=340940=340941=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Wed Aug 29 10:26:58 2018
@@ -730,6 +730,14 @@ static bool shouldAssumeDSOLocal(const C
 return false;
 
   const llvm::Triple  = CGM.getTriple();
+  if (TT.isWindowsGNUEnvironment()) {
+// In MinGW, variables without DLLImport can still be automatically
+// imported from a DLL by the linker; don't mark variables that
+// potentially could come from another DLL as DSO local.
+if (GV->isDeclarationForLinker() && isa(GV) &&
+!GV->isThreadLocal())
+  return false;
+  }
   // Every other GV is local on COFF.
   // Make an exception for windows OS in the triple: Some firmware builds use
   // *-win32-macho triples. This (accidentally?) produced windows relocations

Modified: cfe/trunk/test/CodeGen/dllimport.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dllimport.c?rev=340941=340940=340941=diff
==
--- cfe/trunk/test/CodeGen/dllimport.c (original)
+++ cfe/trunk/test/CodeGen/dllimport.c Wed Aug 29 10:26:58 2018
@@ -39,7 +39,8 @@ USEVAR(GlobalRedecl2)
 
 // NB: MSVC issues a warning and makes GlobalRedecl3 dllexport. We follow GCC
 // and drop the dllimport with a warning.
-// CHECK: @GlobalRedecl3 = external dso_local global i32
+// MS: @GlobalRedecl3 = external dso_local global i32
+// GNU: @GlobalRedecl3 = external global i32
 __declspec(dllimport) extern int GlobalRedecl3;
   extern int GlobalRedecl3; // dllimport ignored
 USEVAR(GlobalRedecl3)

Modified: cfe/trunk/test/CodeGen/dso-local-executable.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/dso-local-executable.c?rev=340941=340940=340941=diff
==
--- cfe/trunk/test/CodeGen/dso-local-executable.c (original)
+++ cfe/trunk/test/CodeGen/dso-local-executable.c Wed Aug 29 10:26:58 2018
@@ -9,6 +9,17 @@
 // COFF-DAG: @import_var = external dllimport global i32
 // COFF-DAG: declare dllimport void @import_func()
 
+// RUN: %clang_cc1 -triple x86_64-w64-mingw32 -emit-llvm %s -o - | FileCheck 
-allow-deprecated-dag-overlap --check-prefix=MINGW %s
+// MINGW-DAG: @bar = external global i32
+// MINGW-DAG: @weak_bar = extern_weak global i32
+// MINGW-DAG: declare dso_local void @foo()
+// MINGW-DAG: @baz = dso_local global i32 42
+// MINGW-DAG: define dso_local i32* @zed()
+// MINGW-DAG: @thread_var = external dso_local thread_local global i32
+// MINGW-DAG: @local_thread_var = dso_local thread_local global i32 42
+// MINGW-DAG: @import_var = external dllimport global i32
+// MINGW-DAG: declare dllimport void @import_func()
+
 // RUN: %clang_cc1 -triple x86_64-pc-linux -emit-llvm -mrelocation-model 
static %s -o - | FileCheck -allow-deprecated-dag-overlap --check-prefix=STATIC 
%s
 // STATIC-DAG: @bar = external dso_local global i32
 // STATIC-DAG: @weak_bar = extern_weak dso_local global i32

Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=340941=340940=340941=diff
==
--- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Wed Aug 29 10:26:58 2018
@@ -43,7 +43,7 @@ __declspec(dllexport) extern int ExternG
 
 // M64-DAG: @__ImageBase = external dso_local constant i8
 
-// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external dso_local global
+// GNU-DAG: @_ZTVN10__cxxabiv117__class_type_infoE = external global
 
 // dllexport implies a definition.
 // MSC-DAG: @"?GlobalDef@@3HA" = dso_local dllexport global i32 0, align 4
@@ -137,7 +137,7 @@ class __declspec(dllexport) i : h<> {};
 // Declarations are not exported.
 
 // MSC-DAG: 

r340334 - [CodeGen] Implicitly set stackrealign on the main function, if custom stack alignment is used

2018-08-21 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Aug 21 13:41:17 2018
New Revision: 340334

URL: http://llvm.org/viewvc/llvm-project?rev=340334=rev
Log:
[CodeGen] Implicitly set stackrealign on the main function, if custom stack 
alignment is used

If using a custom stack alignment, one is expected to make sure
that all callers provide such alignment, or realign the stack in
all entry points (and callbacks).

Despite this, the compiler can assume that the main function will
need realignment in these cases, since the startup routines calling
the main function most probably won't provide the custom alignment.

This matches what GCC does in similar cases; if compiling with
-mincoming-stack-boundary=X -mpreferred-stack-boundary=X, GCC normally
assumes such alignment on entry to a function, but specifically for
the main function still does realignment.

Differential Revision: https://reviews.llvm.org/D51026

Added:
cfe/trunk/test/CodeGen/stackrealign-main.c
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=340334=340333=340334=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Tue Aug 21 13:41:17 2018
@@ -979,6 +979,13 @@ void CodeGenFunction::StartFunction(Glob
   if (FD->isMain())
 Fn->addFnAttr(llvm::Attribute::NoRecurse);
 
+  // If a custom alignment is used, force realigning to this alignment on
+  // any main function which certainly will need it.
+  if (const FunctionDecl *FD = dyn_cast_or_null(D))
+if ((FD->isMain() || FD->isMSVCRTEntryPoint()) &&
+CGM.getCodeGenOpts().StackAlignment)
+  Fn->addFnAttr("stackrealign");
+
   llvm::BasicBlock *EntryBB = createBasicBlock("entry", CurFn);
 
   // Create a marker to make it easy to insert allocas into the entryblock

Added: cfe/trunk/test/CodeGen/stackrealign-main.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/stackrealign-main.c?rev=340334=auto
==
--- cfe/trunk/test/CodeGen/stackrealign-main.c (added)
+++ cfe/trunk/test/CodeGen/stackrealign-main.c Tue Aug 21 13:41:17 2018
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - 
-mstack-alignment=64 %s | FileCheck %s
+
+// CHECK-LABEL: define void @other()
+// CHECK: [[OTHER:#[0-9]+]]
+// CHECK: {
+void other(void) {}
+
+// CHECK-LABEL: define i32 @main(
+// CHECK: [[MAIN:#[0-9]+]]
+// CHECK: {
+int main(int argc, char **argv) {
+  other();
+  return 0;
+}
+
+// CHECK: attributes [[OTHER]] = { noinline nounwind optnone
+// CHECK-NOT: "stackrealign"
+// CHECK: }
+// CHECK: attributes [[MAIN]] = { noinline nounwind optnone 
{{.*}}"stackrealign"{{.*}} }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r339697 - [CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option

2018-08-14 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Aug 14 10:33:10 2018
New Revision: 339697

URL: http://llvm.org/viewvc/llvm-project?rev=339697=rev
Log:
[CMake] Fix the LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY option

This option should be available if LIBCXX_ENABLE_SHARED is enabled,
not LIBCXX_ENABLE_STATIC.

This fixes a typo from SVN r337814.

Differential Revision: https://reviews.llvm.org/D50691

Modified:
libcxx/trunk/CMakeLists.txt

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=339697=339696=339697=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Tue Aug 14 10:33:10 2018
@@ -175,7 +175,7 @@ cmake_dependent_option(LIBCXX_STATICALLY
 
 cmake_dependent_option(LIBCXX_STATICALLY_LINK_ABI_IN_SHARED_LIBRARY
   "Statically link the ABI library to shared library" ON
-  "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_STATIC" OFF)
+  "LIBCXX_ENABLE_STATIC_ABI_LIBRARY;LIBCXX_ENABLE_SHARED" OFF)
 
 # Generate and install a linker script inplace of libc++.so. The linker script
 # will link libc++ to the correct ABI library. This option is on by default


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r339642 - [cmake] Add MINGW_LIBRARIES to the linker flags

2018-08-14 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Aug 13 23:13:36 2018
New Revision: 339642

URL: http://llvm.org/viewvc/llvm-project?rev=339642=rev
Log:
[cmake] Add MINGW_LIBRARIES to the linker flags

This is essential when building with -nodefaultlibs.

In some CMake versions (noticed in 3.5.1), the same libraries are
picked up from CMAKE_REQUIRED_LIBRARIES in some exceptional situations
(if CXX probing failed, due to libc++ not being built yet, the libraries
from CMAKE_REQUIRED_LIBRARIES are used for linking the target library),
but not at all in other newer CMake versions (3.10).

This is similar to what already is done in libcxxabi in SVN r302760
and libcxx in SVN r312498.

Differential Revision: https://reviews.llvm.org/D50663

Modified:
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=339642=339641=339642=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Mon Aug 13 23:13:36 2018
@@ -62,6 +62,9 @@ append_if(LIBUNWIND_CXX_FLAGS LIBUNWIND_
 
 append_if(LIBUNWIND_LINK_FLAGS LIBUNWIND_HAS_NODEFAULTLIBS_FLAG -nodefaultlibs)
 
+# MINGW_LIBRARIES is defined in config-ix.cmake
+append_if(libraries MINGW "${MINGW_LIBRARIES}")
+
 if (LIBUNWIND_HAS_NO_EXCEPTIONS_FLAG AND LIBUNWIND_HAS_FUNWIND_TABLES)
   list(APPEND LIBUNWIND_COMPILE_FLAGS -fno-exceptions)
   list(APPEND LIBUNWIND_COMPILE_FLAGS -funwind-tables)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r339503 - Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0

2018-08-11 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sat Aug 11 12:36:06 2018
New Revision: 339503

URL: http://llvm.org/viewvc/llvm-project?rev=339503=rev
Log:
Add missing _LIBCXXABI_FUNC_VIS to __gxx_personality_seh0

This was missed in SVN r337754.

Modified:
libcxxabi/trunk/src/cxa_personality.cpp

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=339503=339502=339503=diff
==
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Sat Aug 11 12:36:06 2018
@@ -1038,7 +1038,7 @@ __gxx_personality_v0
 }
 
 #if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
-extern "C" EXCEPTION_DISPOSITION
+extern "C" _LIBCXXABI_FUNC_VIS EXCEPTION_DISPOSITION
 __gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
 {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r339170 - [Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64

2018-08-07 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Aug  7 13:02:40 2018
New Revision: 339170

URL: http://llvm.org/viewvc/llvm-project?rev=339170=rev
Log:
[Headers] Expand _Unwind_Exception for SEH on MinGW/x86_64

This matches how GCC defines this struct.

Differential Revision: https://reviews.llvm.org/D50380

Modified:
cfe/trunk/lib/Headers/unwind.h

Modified: cfe/trunk/lib/Headers/unwind.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/unwind.h?rev=339170=339169=339170=diff
==
--- cfe/trunk/lib/Headers/unwind.h (original)
+++ cfe/trunk/lib/Headers/unwind.h Tue Aug  7 13:02:40 2018
@@ -154,8 +154,12 @@ struct _Unwind_Control_Block {
 struct _Unwind_Exception {
   _Unwind_Exception_Class exception_class;
   _Unwind_Exception_Cleanup_Fn exception_cleanup;
+#if !defined (__USING_SJLJ_EXCEPTIONS__) && defined (__SEH__)
+  _Unwind_Word private_[6];
+#else
   _Unwind_Word private_1;
   _Unwind_Word private_2;
+#endif
   /* The Itanium ABI requires that _Unwind_Exception objects are "double-word
* aligned".  GCC has interpreted this to mean "use the maximum useful
* alignment for the target"; so do we. */


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r339048 - [MinGW] Predefine UNICODE if -municode is specified during compilation

2018-08-06 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Aug  6 12:48:44 2018
New Revision: 339048

URL: http://llvm.org/viewvc/llvm-project?rev=339048=rev
Log:
[MinGW] Predefine UNICODE if -municode is specified during compilation

Differential Revision: https://reviews.llvm.org/D50199

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/mingw.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=339048=339047=339048=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon Aug  6 12:48:44 2018
@@ -3346,6 +3346,9 @@ void Clang::ConstructJob(Compilation ,
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-static-define");
 
+  if (Args.hasArg(options::OPT_municode))
+CmdArgs.push_back("-DUNICODE");
+
   if (isa(JA))
 RenderAnalyzerOptions(Args, CmdArgs, Triple, Input);
 

Modified: cfe/trunk/test/Driver/mingw.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=339048=339047=339048=diff
==
--- cfe/trunk/test/Driver/mingw.cpp (original)
+++ cfe/trunk/test/Driver/mingw.cpp Mon Aug  6 12:48:44 2018
@@ -56,3 +56,8 @@
 // CHECK_MINGW_UBUNTU_POSIX_TREE: 
"{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32"
 // CHECK_MINGW_UBUNTU_POSIX_TREE: 
"{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}backward"
 // CHECK_MINGW_UBUNTU_POSIX_TREE: 
"{{.*}}/Inputs/mingw_ubuntu_posix_tree/usr{{/|}}x86_64-w64-mingw32{{/|}}include"
+
+// RUN: %clang -target i686-windows-gnu -E -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_NO_UNICODE %s
+// RUN: %clang -target i686-windows-gnu -E -### %s -municode 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_UNICODE %s
+// CHECK_MINGW_NO_UNICODE-NOT: "-DUNICODE"
+// CHECK_MINGW_UNICODE: "-DUNICODE"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r338819 - [CMake] Allow building standalone without any llvm-config available

2018-08-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Aug  2 22:51:31 2018
New Revision: 338819

URL: http://llvm.org/viewvc/llvm-project?rev=338819=rev
Log:
[CMake] Allow building standalone without any llvm-config available

This is the same as libcxxabi/libcxx do.

Differential Revision: https://reviews.llvm.org/D50135

Modified:
libunwind/trunk/CMakeLists.txt

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=338819=338818=338819=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Thu Aug  2 22:51:31 2018
@@ -66,9 +66,10 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
-message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "
-"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
-"or -DLLVM_PATH=path/to/llvm-source-root.")
+message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
+"llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
+"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+"or -DLLVM_PATH=path/to/llvm-source-root.")
   endif()
 
   if (EXISTS ${LLVM_CMAKE_PATH})
@@ -76,7 +77,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
 include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
 include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
   else()
-message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
+message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
   endif()
 
   set(PACKAGE_NAME libunwind)
@@ -366,4 +367,6 @@ if (LIBUNWIND_INCLUDE_DOCS)
   add_subdirectory(docs)
 endif()
 
-add_subdirectory(test)
+if (EXISTS ${LLVM_CMAKE_PATH})
+  add_subdirectory(test)
+endif()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r338749 - Work around more GCC miscompiles exposed by r338464.

2018-08-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Aug  2 11:12:08 2018
New Revision: 338749

URL: http://llvm.org/viewvc/llvm-project?rev=338749=rev
Log:
Work around more GCC miscompiles exposed by r338464.

This is the same fix as in r338478, for another occurrance of the
same pattern from r338464.

See gcc.gnu.org/PR86769 for details of the bug.

Modified:
cfe/trunk/lib/Sema/SemaInit.cpp

Modified: cfe/trunk/lib/Sema/SemaInit.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaInit.cpp?rev=338749=338748=338749=diff
==
--- cfe/trunk/lib/Sema/SemaInit.cpp (original)
+++ cfe/trunk/lib/Sema/SemaInit.cpp Thu Aug  2 11:12:08 2018
@@ -6371,8 +6371,12 @@ static bool implicitObjectParamIsLifetim
   const TypeSourceInfo *TSI = FD->getTypeSourceInfo();
   if (!TSI)
 return false;
+  // Don't declare this variable in the second operand of the for-statement;
+  // GCC miscompiles that by ending its lifetime before evaluating the
+  // third operand. See gcc.gnu.org/PR86769.
+  AttributedTypeLoc ATL;
   for (TypeLoc TL = TSI->getTypeLoc();
-   auto ATL = TL.getAsAdjusted();
+   (ATL = TL.getAsAdjusted());
TL = ATL.getModifiedLoc()) {
 if (ATL.getAttrKind() == AttributedType::attr_lifetimebound)
   return true;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r337946 - [windows] Fix warning about comparing ints of different signs

2018-07-25 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Jul 25 11:24:23 2018
New Revision: 337946

URL: http://llvm.org/viewvc/llvm-project?rev=337946=rev
Log:
[windows] Fix warning about comparing ints of different signs

This fixes a warning like this:

warning: comparison of integers of different signs:
  'std::__1::__libcpp_tls_key' (aka 'long') and 'DWORD'
  (aka 'unsigned long') [-Wsign-compare]
  if (*__key == FLS_OUT_OF_INDEXES)
  ~~ ^  ~~

Differential Revision: https://reviews.llvm.org/D49782

Modified:
libcxx/trunk/src/support/win32/thread_win32.cpp

Modified: libcxx/trunk/src/support/win32/thread_win32.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/win32/thread_win32.cpp?rev=337946=337945=337946=diff
==
--- libcxx/trunk/src/support/win32/thread_win32.cpp (original)
+++ libcxx/trunk/src/support/win32/thread_win32.cpp Wed Jul 25 11:24:23 2018
@@ -254,9 +254,10 @@ void __libcpp_thread_sleep_for(const chr
 int __libcpp_tls_create(__libcpp_tls_key* __key,
 void(_LIBCPP_TLS_DESTRUCTOR_CC* __at_exit)(void*))
 {
-  *__key = FlsAlloc(__at_exit);
-  if (*__key == FLS_OUT_OF_INDEXES)
+  DWORD index = FlsAlloc(__at_exit);
+  if (index == FLS_OUT_OF_INDEXES)
 return GetLastError();
+  *__key = index;
   return 0;
 }
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r337754 - Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0

2018-07-23 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Jul 23 15:09:23 2018
New Revision: 337754

URL: http://llvm.org/viewvc/llvm-project?rev=337754=rev
Log:
Implement a GCC compatible SEH unwinding personality, __gxx_personality_seh0

This allows handling SEH based exceptions, with unwind functions
provided by libgcc.

Differential Revision: https://reviews.llvm.org/D49638

Modified:
libcxxabi/trunk/src/cxa_personality.cpp

Modified: libcxxabi/trunk/src/cxa_personality.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/src/cxa_personality.cpp?rev=337754=337753=337754=diff
==
--- libcxxabi/trunk/src/cxa_personality.cpp (original)
+++ libcxxabi/trunk/src/cxa_personality.cpp Mon Jul 23 15:09:23 2018
@@ -23,6 +23,16 @@
 #include "private_typeinfo.h"
 #include "unwind.h"
 
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+#include 
+#include 
+
+extern "C" EXCEPTION_DISPOSITION _GCC_specific_handler(PEXCEPTION_RECORD,
+   void *, PCONTEXT,
+   PDISPATCHER_CONTEXT,
+   _Unwind_Personality_Fn);
+#endif
+
 /*
 Exception Header Layout:
 
@@ -934,12 +944,16 @@ _UA_CLEANUP_PHASE
 */
 
 #if !defined(_LIBCXXABI_ARM_EHABI)
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+static _Unwind_Reason_Code __gxx_personality_imp
+#else
 _LIBCXXABI_FUNC_VIS _Unwind_Reason_Code
 #ifdef __USING_SJLJ_EXCEPTIONS__
 __gxx_personality_sj0
 #else
 __gxx_personality_v0
 #endif
+#endif
 (int version, _Unwind_Action actions, uint64_t 
exceptionClass,
  _Unwind_Exception* unwind_exception, _Unwind_Context* 
context)
 {
@@ -1022,6 +1036,17 @@ __gxx_personality_v0
 // We were called improperly: neither a phase 1 or phase 2 search
 return _URC_FATAL_PHASE1_ERROR;
 }
+
+#if defined(__SEH__) && !defined(__USING_SJLJ_EXCEPTIONS__)
+extern "C" EXCEPTION_DISPOSITION
+__gxx_personality_seh0(PEXCEPTION_RECORD ms_exc, void *this_frame,
+   PCONTEXT ms_orig_context, PDISPATCHER_CONTEXT ms_disp)
+{
+  return _GCC_specific_handler(ms_exc, this_frame, ms_orig_context, ms_disp,
+   __gxx_personality_imp);
+}
+#endif
+
 #else
 
 extern "C" _Unwind_Reason_Code __gnu_unwind_frame(_Unwind_Exception*,


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r337352 - [AArch64] Define TARGET_HEADER_BUILTIN

2018-07-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jul 17 23:15:09 2018
New Revision: 337352

URL: http://llvm.org/viewvc/llvm-project?rev=337352=rev
Log:
[AArch64] Define TARGET_HEADER_BUILTIN

Without it, the new intrinsics became available for all language
variants. This was missed in SVN r337327.

Modified:
cfe/trunk/lib/Basic/Targets/AArch64.cpp

Modified: cfe/trunk/lib/Basic/Targets/AArch64.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/AArch64.cpp?rev=337352=337351=337352=diff
==
--- cfe/trunk/lib/Basic/Targets/AArch64.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/AArch64.cpp Tue Jul 17 23:15:09 2018
@@ -29,6 +29,8 @@ const Builtin::Info AArch64TargetInfo::B
{#ID, TYPE, ATTRS, nullptr, ALL_LANGUAGES, nullptr},
 #define LANGBUILTIN(ID, TYPE, ATTRS, LANG) 
\
   {#ID, TYPE, ATTRS, nullptr, LANG, nullptr},
+#define TARGET_HEADER_BUILTIN(ID, TYPE, ATTRS, HEADER, LANGS, FEATURE) 
\
+  {#ID, TYPE, ATTRS, HEADER, LANGS, FEATURE},
 #include "clang/Basic/BuiltinsAArch64.def"
 };
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r337146 - [MinGW] Automatically mangle Windows-specific entry points as C

2018-07-15 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sun Jul 15 22:42:25 2018
New Revision: 337146

URL: http://llvm.org/viewvc/llvm-project?rev=337146=rev
Log:
[MinGW] Automatically mangle Windows-specific entry points as C

This mangles entry points wmain, WinMain, wWinMain or DllMain as C
functions, to match the ABI for these functions.

We already did the same for these functions in MSVC mode, but we also
should do the same in the Itanium ABI.

This fixes PR38124.

Differential Revision: https://reviews.llvm.org/D49354

Added:
cfe/trunk/test/CodeGenCXX/mangle-mingw.cpp
Modified:
cfe/trunk/lib/AST/ItaniumMangle.cpp

Modified: cfe/trunk/lib/AST/ItaniumMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ItaniumMangle.cpp?rev=337146=337145=337146=diff
==
--- cfe/trunk/lib/AST/ItaniumMangle.cpp (original)
+++ cfe/trunk/lib/AST/ItaniumMangle.cpp Sun Jul 15 22:42:25 2018
@@ -592,6 +592,18 @@ bool ItaniumMangleContextImpl::shouldMan
 if (FD->isMain())
   return false;
 
+// The Windows ABI expects that we would never mangle "typical"
+// user-defined entry points regardless of visibility or freestanding-ness.
+//
+// N.B. This is distinct from asking about "main".  "main" has a lot of
+// special rules associated with it in the standard while these
+// user-defined entry points are outside of the purview of the standard.
+// For example, there can be only one definition for "main" in a standards
+// compliant program; however nothing forbids the existence of wmain and
+// WinMain in the same translation unit.
+if (FD->isMSVCRTEntryPoint())
+  return false;
+
 // C++ functions and those whose names are not a simple identifier need
 // mangling.
 if (!FD->getDeclName().isIdentifier() || L == CXXLanguageLinkage)

Added: cfe/trunk/test/CodeGenCXX/mangle-mingw.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/mangle-mingw.cpp?rev=337146=auto
==
--- cfe/trunk/test/CodeGenCXX/mangle-mingw.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/mangle-mingw.cpp Sun Jul 15 22:42:25 2018
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -triple=x86_64-w64-mingw32 | FileCheck %s
+
+int func() { return 0; }
+// CHECK-DAG: @_Z4funcv
+
+int main() { return 0; }
+// CHECK-DAG: @main
+
+int wmain() { return 0; }
+// CHECK-DAG: @wmain
+
+int WinMain() { return 0; }
+// CHECK-DAG: @WinMain
+
+int wWinMain() { return 0; }
+// CHECK-DAG: @wWinMain
+
+int DllMain() { return 0; }
+// CHECK-DAG: @DllMain


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r336655 - [MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified

2018-07-10 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jul 10 03:46:51 2018
New Revision: 336655

URL: http://llvm.org/viewvc/llvm-project?rev=336655=rev
Log:
[MinGW] Skip adding default win32 api libraries if -lwindowsapp is specified

In this setup, skip adding all the default windows import libraries,
if linking to windowsapp (which replaces them, when targeting the
windows store/UWP api subset).

With GCC, the same is achieved by using a custom spec file, but
since clang doesn't use spec files, we have to allow other means of
overriding what default libraries to use (without going all the
way to using -nostdlib, which would exclude everything). The same
approach, in detecting certain user specified libraries and omitting
others from the defaults, was already used in SVN r314138.

Differential Revision: https://reviews.llvm.org/D49059

Added:
cfe/trunk/test/Driver/mingw-windowsapp.c
Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=336655=336654=336655=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Jul 10 03:46:51 2018
@@ -201,6 +201,14 @@ void tools::MinGW::Linker::ConstructJob(
   CmdArgs.push_back("-Bdynamic");
   }
 
+  bool HasWindowsApp = false;
+  for (auto Lib : Args.getAllArgValues(options::OPT_l)) {
+if (Lib == "windowsapp") {
+  HasWindowsApp = true;
+  break;
+}
+  }
+
   if (!Args.hasArg(options::OPT_nostdlib)) {
 if (!Args.hasArg(options::OPT_nodefaultlibs)) {
   if (Args.hasArg(options::OPT_static))
@@ -223,15 +231,19 @@ void tools::MinGW::Linker::ConstructJob(
   if (Args.hasArg(options::OPT_pthread))
 CmdArgs.push_back("-lpthread");
 
-  // add system libraries
-  if (Args.hasArg(options::OPT_mwindows)) {
-CmdArgs.push_back("-lgdi32");
-CmdArgs.push_back("-lcomdlg32");
+  if (!HasWindowsApp) {
+// Add system libraries. If linking to libwindowsapp.a, that import
+// library replaces all these and we shouldn't accidentally try to
+// link to the normal desktop mode dlls.
+if (Args.hasArg(options::OPT_mwindows)) {
+  CmdArgs.push_back("-lgdi32");
+  CmdArgs.push_back("-lcomdlg32");
+}
+CmdArgs.push_back("-ladvapi32");
+CmdArgs.push_back("-lshell32");
+CmdArgs.push_back("-luser32");
+CmdArgs.push_back("-lkernel32");
   }
-  CmdArgs.push_back("-ladvapi32");
-  CmdArgs.push_back("-lshell32");
-  CmdArgs.push_back("-luser32");
-  CmdArgs.push_back("-lkernel32");
 
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("--end-group");

Added: cfe/trunk/test/Driver/mingw-windowsapp.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-windowsapp.c?rev=336655=auto
==
--- cfe/trunk/test/Driver/mingw-windowsapp.c (added)
+++ cfe/trunk/test/Driver/mingw-windowsapp.c Tue Jul 10 03:46:51 2018
@@ -0,0 +1,6 @@
+// RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_DEFAULT %s
+// RUN: %clang -v -target i686-pc-windows-gnu -### %s -lwindowsapp 2>&1 | 
FileCheck -check-prefix=CHECK_WINDOWSAPP %s
+
+// CHECK_DEFAULT: "-lmsvcrt" "-ladvapi32" "-lshell32" "-luser32" "-lkernel32" 
"-lmingw32"
+// CHECK_WINDOWSAPP: "-lwindowsapp" "-lmingw32"
+// CHECK_WINDOWSAPP-SAME: "-lmsvcrt" "-lmingw32"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r336654 - [MinGW] Treat any -lucrt* as replacing -lmsvcrt

2018-07-10 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jul 10 03:46:45 2018
New Revision: 336654

URL: http://llvm.org/viewvc/llvm-project?rev=336654=rev
Log:
[MinGW] Treat any -lucrt* as replacing -lmsvcrt

Since SVN r314138, we check if the user has specified any particular
alternative msvcrt/ucrt version, and skip the default -lmsvcrt
in those cases.

In addition to the existing names checked, we should also treat
a plain -lucrt in the same way, mingw-w64 has now added a separate
import library named libucrt.a, in addition to libucrtbase.a.

Differential Revision: https://reviews.llvm.org/D49054

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-msvcrt.c

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=336654=336653=336654=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Jul 10 03:46:45 2018
@@ -83,7 +83,7 @@ void tools::MinGW::Linker::AddLibGCC(con
   CmdArgs.push_back("-lmoldname");
   CmdArgs.push_back("-lmingwex");
   for (auto Lib : Args.getAllArgValues(options::OPT_l))
-if (StringRef(Lib).startswith("msvcr") || Lib == "ucrtbase")
+if (StringRef(Lib).startswith("msvcr") || 
StringRef(Lib).startswith("ucrt"))
   return;
   CmdArgs.push_back("-lmsvcrt");
 }

Modified: cfe/trunk/test/Driver/mingw-msvcrt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-msvcrt.c?rev=336654=336653=336654=diff
==
--- cfe/trunk/test/Driver/mingw-msvcrt.c (original)
+++ cfe/trunk/test/Driver/mingw-msvcrt.c Tue Jul 10 03:46:45 2018
@@ -1,6 +1,12 @@
 // RUN: %clang -v -target i686-pc-windows-gnu -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_DEFAULT %s
 // RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_MSVCR120 %s
+// RUN: %clang -v -target i686-pc-windows-gnu -lucrtbase -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_UCRTBASE %s
+// RUN: %clang -v -target i686-pc-windows-gnu -lucrt -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_UCRT %s
 
 // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32"
 // CHECK_MSVCR120: "-lmsvcr120"
 // CHECK_MSVCR120-SAME: "-lmingwex" "-ladvapi32"
+// CHECK_UCRTBASE: "-lucrtbase"
+// CHECK_UCRTBASE-SAME: "-lmingwex" "-ladvapi32"
+// CHECK_UCRT: "-lucrt"
+// CHECK_UCRT-SAME: "-lmingwex" "-ladvapi32"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r335172 - [CMake] Convert paths to the right form in standalone builds on Windows

2018-06-20 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Jun 20 14:03:34 2018
New Revision: 335172

URL: http://llvm.org/viewvc/llvm-project?rev=335172=rev
Log:
[CMake] Convert paths to the right form in standalone builds on Windows

The paths output from llvm-config --cmakedir and from clang
--print-libgcc-file-name can contain backslashes, while CMake
can't handle the paths in this form.

This matches what compiler-rt already does (since SVN r203789
and r293195).

Differential Revision: https://reviews.llvm.org/D48356

Modified:
libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake
libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake

Modified: libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335172=335171=335172=diff
==
--- libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 14:03:34 2018
@@ -14,6 +14,7 @@ function(find_compiler_rt_library name d
   OUTPUT_VARIABLE LIBRARY_FILE
   )
   string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+  file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
   string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
 message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
@@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_DIR
 )
 string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
+file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
 set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
   else()
 set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXX_COMPILE_FLAGS}
@@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_FILE
 )
 string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
 get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
   endif()
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")

Modified: libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335172=335171=335172=diff
==
--- libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxx/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 14:03:34 
2018
@@ -46,10 +46,11 @@ macro(find_llvm_parts)
   OUTPUT_VARIABLE CONFIG_OUTPUT
   ERROR_QUIET)
 if(NOT HAD_ERROR)
-  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
+  file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
 else()
-  set(LLVM_CMAKE_PATH
-  "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
+  set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
 set(LLVM_FOUND OFF)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxxabi] r335171 - [CMake] Convert paths to the right form in standalone builds on Windows

2018-06-20 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Jun 20 13:59:18 2018
New Revision: 335171

URL: http://llvm.org/viewvc/llvm-project?rev=335171=rev
Log:
[CMake] Convert paths to the right form in standalone builds on Windows

The paths output from llvm-config --cmakedir and from clang
--print-libgcc-file-name can contain backslashes, while CMake
can't handle the paths in this form.

This matches what compiler-rt already does (since SVN r203789
and r293195).

Differential Revision: https://reviews.llvm.org/D48355

Modified:
libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake
libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake

Modified: libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335171=335170=335171=diff
==
--- libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libcxxabi/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:59:18 
2018
@@ -14,6 +14,7 @@ function(find_compiler_rt_library name d
   OUTPUT_VARIABLE LIBRARY_FILE
   )
   string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+  file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
   string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
 message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
@@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_DIR
 )
 string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
+file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
 set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
   else()
 set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBCXXABI_COMPILE_FLAGS}
@@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_FILE
 )
 string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
 get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
   endif()
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")

Modified: libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake?rev=335171=335170=335171=diff
==
--- libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake (original)
+++ libcxxabi/trunk/cmake/Modules/HandleOutOfTreeLLVM.cmake Wed Jun 20 13:59:18 
2018
@@ -46,10 +46,11 @@ macro(find_llvm_parts)
   OUTPUT_VARIABLE CONFIG_OUTPUT
   ERROR_QUIET)
 if(NOT HAD_ERROR)
-  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
+  file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
 else()
-  set(LLVM_CMAKE_PATH
-  "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
+  set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
 set(LLVM_FOUND OFF)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r335169 - [CMake] Convert paths to the right form in standalone builds on Windows

2018-06-20 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Jun 20 13:53:19 2018
New Revision: 335169

URL: http://llvm.org/viewvc/llvm-project?rev=335169=rev
Log:
[CMake] Convert paths to the right form in standalone builds on Windows

The paths output from llvm-config --cmakedir and from clang
--print-libgcc-file-name can contain backslashes, while CMake
can't handle the paths in this form.

This matches what compiler-rt already does (since SVN r203789
and r293195).

Differential Revision: https://reviews.llvm.org/D48353

Modified:
libunwind/trunk/CMakeLists.txt
libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=335169=335168=335169=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Jun 20 13:53:19 2018
@@ -59,10 +59,11 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   OUTPUT_VARIABLE CONFIG_OUTPUT
   ERROR_QUIET)
 if(NOT HAD_ERROR)
-  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH)
+  string(STRIP "${CONFIG_OUTPUT}" LLVM_CMAKE_PATH_FROM_LLVM_CONFIG)
+  file(TO_CMAKE_PATH "${LLVM_CMAKE_PATH_FROM_LLVM_CONFIG}" LLVM_CMAKE_PATH)
 else()
-  set(LLVM_CMAKE_PATH
-  "${LLVM_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
+  file(TO_CMAKE_PATH "${LLVM_BINARY_DIR}" LLVM_BINARY_DIR_CMAKE_STYLE)
+  set(LLVM_CMAKE_PATH 
"${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
 endif()
   else()
 message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not 
defined. "

Modified: libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake?rev=335169=335168=335169=diff
==
--- libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake (original)
+++ libunwind/trunk/cmake/Modules/HandleCompilerRT.cmake Wed Jun 20 13:53:19 
2018
@@ -14,6 +14,7 @@ function(find_compiler_rt_library name d
   OUTPUT_VARIABLE LIBRARY_FILE
   )
   string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+  file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
   string(REPLACE "builtins" "${name}" LIBRARY_FILE "${LIBRARY_FILE}")
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_FILE}")
 message(STATUS "Found compiler-rt library: ${LIBRARY_FILE}")
@@ -37,6 +38,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_DIR
 )
 string(STRIP "${LIBRARY_DIR}" LIBRARY_DIR)
+file(TO_CMAKE_PATH "${LIBRARY_DIR}" LIBRARY_DIR)
 set(LIBRARY_DIR "${LIBRARY_DIR}/darwin")
   else()
 set(CLANG_COMMAND ${CMAKE_CXX_COMPILER} ${LIBUNWIND_COMPILE_FLAGS}
@@ -47,6 +49,7 @@ function(find_compiler_rt_dir dest)
 OUTPUT_VARIABLE LIBRARY_FILE
 )
 string(STRIP "${LIBRARY_FILE}" LIBRARY_FILE)
+file(TO_CMAKE_PATH "${LIBRARY_FILE}" LIBRARY_FILE)
 get_filename_component(LIBRARY_DIR "${LIBRARY_FILE}" DIRECTORY)
   endif()
   if (NOT HAD_ERROR AND EXISTS "${LIBRARY_DIR}")


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r333734 - [X86] Remove leftover semicolons at end of macros

2018-06-01 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Jun  1 02:40:50 2018
New Revision: 333734

URL: http://llvm.org/viewvc/llvm-project?rev=333734=rev
Log:
[X86] Remove leftover semicolons at end of macros

This was missed in a few places in SVN r333613, causing compilation
errors if these macros are used e.g. as parameter to a function.

Modified:
cfe/trunk/lib/Headers/avx512fintrin.h
cfe/trunk/lib/Headers/f16cintrin.h
cfe/trunk/lib/Headers/gfniintrin.h
cfe/trunk/lib/Headers/shaintrin.h
cfe/trunk/lib/Headers/vpclmulqdqintrin.h

Modified: cfe/trunk/lib/Headers/avx512fintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/avx512fintrin.h?rev=333734=333733=333734=diff
==
--- cfe/trunk/lib/Headers/avx512fintrin.h (original)
+++ cfe/trunk/lib/Headers/avx512fintrin.h Fri Jun  1 02:40:50 2018
@@ -2226,13 +2226,13 @@ _mm512_maskz_sub_ps(__mmask16 __U, __m51
   (__m512)__builtin_ia32_subps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)(__m512)(W), (__mmask16)(U), \
-   (int)(R));
+   (int)(R))
 
 #define _mm512_maskz_sub_round_ps(U, A, B, R)  \
   (__m512)__builtin_ia32_subps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)_mm512_setzero_ps(), \
-   (__mmask16)(U), (int)(R));
+   (__mmask16)(U), (int)(R))
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_mul_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
@@ -2361,13 +2361,13 @@ _mm512_maskz_mul_ps(__mmask16 __U, __m51
   (__m512)__builtin_ia32_mulps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)(__m512)(W), (__mmask16)(U), \
-   (int)(R));
+   (int)(R))
 
 #define _mm512_maskz_mul_round_ps(U, A, B, R)  \
   (__m512)__builtin_ia32_mulps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)_mm512_setzero_ps(), \
-   (__mmask16)(U), (int)(R));
+   (__mmask16)(U), (int)(R))
 
 static __inline__ __m128 __DEFAULT_FN_ATTRS
 _mm_mask_div_ss(__m128 __W, __mmask8 __U,__m128 __A, __m128 __B) {
@@ -2509,13 +2509,13 @@ _mm512_maskz_div_ps(__mmask16 __U, __m51
   (__m512)__builtin_ia32_divps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)(__m512)(W), (__mmask16)(U), \
-   (int)(R));
+   (int)(R))
 
 #define _mm512_maskz_div_round_ps(U, A, B, R)  \
   (__m512)__builtin_ia32_divps512_mask((__v16sf)(__m512)(A), \
(__v16sf)(__m512)(B), \
(__v16sf)_mm512_setzero_ps(), \
-   (__mmask16)(U), (int)(R));
+   (__mmask16)(U), (int)(R))
 
 #define _mm512_roundscale_ps(A, B) \
   (__m512)__builtin_ia32_rndscaleps_mask((__v16sf)(__m512)(A), (int)(B), \

Modified: cfe/trunk/lib/Headers/f16cintrin.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Headers/f16cintrin.h?rev=333734=333733=333734=diff
==
--- cfe/trunk/lib/Headers/f16cintrin.h (original)
+++ cfe/trunk/lib/Headers/f16cintrin.h Fri Jun  1 02:40:50 2018
@@ -79,7 +79,7 @@ _cvtsh_ss(unsigned short __a)
 /// \returns The converted 16-bit half-precision float value.
 #define _cvtss_sh(a, imm) \
   (unsigned short)(((__v8hi)__builtin_ia32_vcvtps2ph((__v4sf){a, 0, 0, 0}, \
- (imm)))[0]);
+ (imm)))[0])
 
 /// Converts a 128-bit vector containing 32-bit float values into a
 ///128-bit vector containing 16-bit half-precision float values.
@@ -105,7 +105,7 @@ _cvtsh_ss(unsigned short __a)
 ///values. The lower 64 bits are used to store the converted 16-bit
 ///half-precision floating-point values.
 #define _mm_cvtps_ph(a, imm) \
-  (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm));
+  (__m128i)__builtin_ia32_vcvtps2ph((__v4sf)(__m128)(a), (imm))
 
 /// Converts a 128-bit vector containing 16-bit half-precision float
 ///values into a 128-bit vector containing 32-bit float values.
@@ -148,7 +148,7 @@ _mm_cvtph_ps(__m128i __a)
 /// \returns A 128-bit vector containing the converted 16-bit half-precision
 ///float values.
 #define _mm256_cvtps_ph(a, 

r331858 - Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"

2018-05-09 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed May  9 02:11:01 2018
New Revision: 331858

URL: http://llvm.org/viewvc/llvm-project?rev=331858=rev
Log:
Revert "[Driver] Use -fuse-line-directives by default in MSVC mode"

This reverts commit SVN r331666.

It was afterwards pointed out in https://reviews.llvm.org/D46520
that #line directives lose information about what parts come from a
system header. That means the result of -E usually won't compile,
since Windows headers are typically full of warnings and
default-error warnings.

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331858=331857=331858=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Wed May  9 02:11:01 2018
@@ -4224,9 +4224,9 @@ void Clang::ConstructJob(Compilation ,
IsWindowsMSVC))
 CmdArgs.push_back("-fms-extensions");
 
-  // -fno-use-line-directives is default, except for MSVC targets.
+  // -fno-use-line-directives is default.
   if (Args.hasFlag(options::OPT_fuse_line_directives,
-   options::OPT_fno_use_line_directives, IsWindowsMSVC))
+   options::OPT_fno_use_line_directives, false))
 CmdArgs.push_back("-fuse-line-directives");
 
   // -fms-compatibility=0 is default.

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=331858=331857=331858=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Wed May  9 02:11:01 2018
@@ -28,7 +28,6 @@
 
 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
 // E: "-E"
-// E: "-fuse-line-directives"
 // E: "-o" "-"
 
 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r331807 - [Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets

2018-05-08 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue May  8 13:55:23 2018
New Revision: 331807

URL: http://llvm.org/viewvc/llvm-project?rev=331807=rev
Log:
[Driver] Don't add -dwarf-column-info when using -gcodeview on non-msvc targets

-dwarf-column-info is omitted if -gcodeview is specified for msvc
targets at the moment, but since -gcodeview is an option that can be
specified for any target, there's little reason to restrict this
handling to msvc targets.

This allows getting proper codeview debug info by passing -gcodeview
for e.g. MinGW targets as well.

Differential Revision: https://reviews.llvm.org/D46287

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/codeview-column-info.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331807=331806=331807=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Tue May  8 13:55:23 2018
@@ -3000,7 +3000,7 @@ static void RenderDebugOptions(const Too
   // debuggers don't handle missing end columns well, so it's better not to
   // include any column info.
   if (Args.hasFlag(options::OPT_gcolumn_info, options::OPT_gno_column_info,
-   /*Default=*/!(IsWindowsMSVC && EmitCodeView) &&
+   /*Default=*/!EmitCodeView &&
DebuggerTuning != llvm::DebuggerKind::SCE))
 CmdArgs.push_back("-dwarf-column-info");
 

Modified: cfe/trunk/test/Driver/codeview-column-info.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/codeview-column-info.c?rev=331807=331806=331807=diff
==
--- cfe/trunk/test/Driver/codeview-column-info.c (original)
+++ cfe/trunk/test/Driver/codeview-column-info.c Tue May  8 13:55:23 2018
@@ -6,6 +6,8 @@
 // RUN: FileCheck < %t1 %s
 // RUN: %clangxx -### --target=x86_64-windows-msvc -c -g -gcodeview %s 2> %t2
 // RUN: FileCheck < %t2 %s
+// RUN: %clangxx -### --target=x86_64-windows-gnu -c -g -gcodeview %s 2> %t2
+// RUN: FileCheck < %t2 %s
 // RUN: %clang_cl -### --target=x86_64-windows-msvc /c /Z7 -- %s 2> %t2
 // RUN: FileCheck < %t2 %s
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r331666 - [Driver] Use -fuse-line-directives by default in MSVC mode

2018-05-07 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon May  7 13:26:09 2018
New Revision: 331666

URL: http://llvm.org/viewvc/llvm-project?rev=331666=rev
Log:
[Driver] Use -fuse-line-directives by default in MSVC mode

Don't use the GNU extension form of line markers in MSVC mode.

Differential Revision: https://reviews.llvm.org/D46520

Modified:
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/cl-options.c

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=331666=331665=331666=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Mon May  7 13:26:09 2018
@@ -4215,9 +4215,9 @@ void Clang::ConstructJob(Compilation ,
IsWindowsMSVC))
 CmdArgs.push_back("-fms-extensions");
 
-  // -fno-use-line-directives is default.
+  // -fno-use-line-directives is default, except for MSVC targets.
   if (Args.hasFlag(options::OPT_fuse_line_directives,
-   options::OPT_fno_use_line_directives, false))
+   options::OPT_fno_use_line_directives, IsWindowsMSVC))
 CmdArgs.push_back("-fuse-line-directives");
 
   // -fms-compatibility=0 is default.

Modified: cfe/trunk/test/Driver/cl-options.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/cl-options.c?rev=331666=331665=331666=diff
==
--- cfe/trunk/test/Driver/cl-options.c (original)
+++ cfe/trunk/test/Driver/cl-options.c Mon May  7 13:26:09 2018
@@ -28,6 +28,7 @@
 
 // RUN: %clang_cl /E -### -- %s 2>&1 | FileCheck -check-prefix=E %s
 // E: "-E"
+// E: "-fuse-line-directives"
 // E: "-o" "-"
 
 // RUN: %clang_cl /EP -### -- %s 2>&1 | FileCheck -check-prefix=EP %s


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r331504 - [Driver] Don't warn about unused inputs in config files

2018-05-04 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu May  3 23:05:58 2018
New Revision: 331504

URL: http://llvm.org/viewvc/llvm-project?rev=331504=rev
Log:
[Driver] Don't warn about unused inputs in config files

This avoids warnings about unused linker parameters, just like
other flags are ignored if they're from config files.

Differential Revision: https://reviews.llvm.org/D46286

Modified:
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/Inputs/config-4.cfg
cfe/trunk/test/Driver/config-file.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=331504=331503=331504=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Thu May  3 23:05:58 2018
@@ -285,11 +285,12 @@ phases::ID Driver::getFinalPhase(const D
 }
 
 static Arg *MakeInputArg(DerivedArgList , OptTable ,
- StringRef Value) {
+ StringRef Value, bool Claim = true) {
   Arg *A = new Arg(Opts.getOption(options::OPT_INPUT), Value,
Args.getBaseArgs().MakeIndex(Value), Value.data());
   Args.AddSynthesizedArg(A);
-  A->claim();
+  if (Claim)
+A->claim();
   return A;
 }
 
@@ -357,7 +358,7 @@ DerivedArgList *Driver::TranslateInputAr
 if (A->getOption().matches(options::OPT__DASH_DASH)) {
   A->claim();
   for (StringRef Val : A->getValues())
-DAL->append(MakeInputArg(*DAL, *Opts, Val));
+DAL->append(MakeInputArg(*DAL, *Opts, Val, false));
   continue;
 }
 
@@ -2906,6 +2907,9 @@ void Driver::BuildActions(Compilation 
 // this compilation, warn the user about it.
 phases::ID InitialPhase = PL[0];
 if (InitialPhase > FinalPhase) {
+  if (InputArg->isClaimed())
+continue;
+
   // Claim here to avoid the more general unused warning.
   InputArg->claim();
 

Modified: cfe/trunk/test/Driver/Inputs/config-4.cfg
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/config-4.cfg?rev=331504=331503=331504=diff
==
--- cfe/trunk/test/Driver/Inputs/config-4.cfg (original)
+++ cfe/trunk/test/Driver/Inputs/config-4.cfg Thu May  3 23:05:58 2018
@@ -1,2 +1,3 @@
 -L/usr/local/lib
--stdlib=libc++
\ No newline at end of file
+-lfoo
+-stdlib=libc++

Modified: cfe/trunk/test/Driver/config-file.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/config-file.c?rev=331504=331503=331504=diff
==
--- cfe/trunk/test/Driver/config-file.c (original)
+++ cfe/trunk/test/Driver/config-file.c Thu May  3 23:05:58 2018
@@ -63,6 +63,7 @@
 //
 // RUN: %clang --config %S/Inputs/config-4.cfg -S %s -o /dev/null -v 2>&1 | 
FileCheck %s -check-prefix CHECK-UNUSED
 // CHECK-UNUSED-NOT: argument unused during compilation:
+// CHECK-UNUSED-NOT: 'linker' input unused
 
 
 //--- User directory is searched first.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330872 - [test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.

2018-04-25 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Apr 25 14:24:04 2018
New Revision: 330872

URL: http://llvm.org/viewvc/llvm-project?rev=330872=rev
Log:
[test] Add a testcase for MinGW sysroot detections from SVN r330244. NFC.

Differential Revision: https://reviews.llvm.org/D45985

Added:
cfe/trunk/test/Driver/mingw-sysroot.cpp

Added: cfe/trunk/test/Driver/mingw-sysroot.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-sysroot.cpp?rev=330872=auto
==
--- cfe/trunk/test/Driver/mingw-sysroot.cpp (added)
+++ cfe/trunk/test/Driver/mingw-sysroot.cpp Wed Apr 25 14:24:04 2018
@@ -0,0 +1,42 @@
+// REQUIRES: shell
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T/testroot-gcc/bin
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc ] || rm 
%T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: [ ! -s %T/testroot-gcc/bin/x86_64-w64-mingw32-clang ] || rm 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-gcc/x86_64-w64-mingw32 ] || rm 
%T/testroot-gcc/x86_64-w64-mingw32
+// RUN: [ ! -s %T/testroot-gcc/lib ] || rm %T/testroot-gcc/lib
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-gcc
+// RUN: ln -s %clang %T/testroot-gcc/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 
%T/testroot-gcc/x86_64-w64-mingw32
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/lib %T/testroot-gcc/lib
+
+// RUN: mkdir -p %T/testroot-clang/bin
+// RUN: [ ! -s %T/testroot-clang/bin/x86_64-w64-mingw32-clang ] || rm 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: [ ! -s %T/testroot-clang/x86_64-w64-mingw32 ] || rm 
%T/testroot-clang/x86_64-w64-mingw32
+// RUN: ln -s %clang %T/testroot-clang/bin/x86_64-w64-mingw32-clang
+// RUN: ln -s %S/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32 
%T/testroot-clang/x86_64-w64-mingw32
+
+
+// If we find a gcc in the path with the right triplet prefix, pick that as
+// sysroot:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" %clang -target 
x86_64-w64-mingw32 -rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_TESTROOT_GCC %s
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}x86_64-w64-mingw32"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}lib{{/|}}gcc{{/|}}x86_64-w64-mingw32{{/|}}5.3-posix{{/|}}include{{/|}}c++{{/|}}backward"
+// CHECK_TESTROOT_GCC: 
"{{.*}}/testroot-gcc{{/|}}x86_64-w64-mingw32{{/|}}include"
+
+
+// If there's a matching sysroot next to the clang binary itself, prefer that
+// over a gcc in the path:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-clang/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=compiler-rt -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_CLANG %s
+// CHECK_TESTROOT_CLANG: 
"{{.*}}/testroot-clang{{/|}}x86_64-w64-mingw32{{/|}}include"
+
+
+// If we pick a root based on a sysroot next to the clang binary, which also
+// happens to be in the same directory as gcc, make sure we still can pick up
+// the libgcc directory:
+
+// RUN: env "PATH=%T/testroot-gcc/bin:%PATH%" 
%T/testroot-gcc/bin/x86_64-w64-mingw32-clang -target x86_64-w64-mingw32 
-rtlib=platform -stdlib=libstdc++ -c -### %s 2>&1 | FileCheck 
-check-prefix=CHECK_TESTROOT_GCC %s


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330871 - [Driver] Fix implicit config files from prefixed symlinks

2018-04-25 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Apr 25 14:23:59 2018
New Revision: 330871

URL: http://llvm.org/viewvc/llvm-project?rev=330871=rev
Log:
[Driver] Fix implicit config files from prefixed symlinks

If -no-canonical-prefixes isn't used, the clang executable name used
is the one of the actual executable, not the name of the symlink that
the user invoked.

In these cases, the target prefix was overridden based on the clang
executable name. (On the other hand the implicit -target option
that such a symlink adds, is added as an actual command line parameter
in tools/driver/driver.cop, before resolving the symlink and finding
the actual clang executable.

Use the original ClangNameParts (set from argv[0] in
tools/driver/driver.cpp) if it seems to be initialized propery.

All existing tests of this feature used -no-canonical-prefixes
(possibly because it also makes the driver look in the directory
of the symlink instead of the directory of the executable); add
another one that uses --config-user-dir= to specify the directory
instead. (For actual users of such symlinks, outisde of the test
suite, the directory is probably the same for both.)

This makes this feature work more like what the documentation
describes.

Differential Revision: https://reviews.llvm.org/D45964

Modified:
cfe/trunk/include/clang/Driver/ToolChain.h
cfe/trunk/lib/Driver/Driver.cpp
cfe/trunk/test/Driver/config-file3.c

Modified: cfe/trunk/include/clang/Driver/ToolChain.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/ToolChain.h?rev=330871=330870=330871=diff
==
--- cfe/trunk/include/clang/Driver/ToolChain.h (original)
+++ cfe/trunk/include/clang/Driver/ToolChain.h Wed Apr 25 14:23:59 2018
@@ -78,6 +78,10 @@ struct ParsedClangName {
   bool IsRegistered)
   : TargetPrefix(Target), ModeSuffix(Suffix), DriverMode(Mode),
 TargetIsValid(IsRegistered) {}
+
+  bool isEmpty() const {
+return TargetPrefix.empty() && ModeSuffix.empty() && DriverMode == nullptr;
+  }
 };
 
 /// ToolChain - Access to tools for a single platform.

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=330871=330870=330871=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Apr 25 14:23:59 2018
@@ -129,7 +129,8 @@ Driver::Driver(StringRef ClangExecutable
 
 void Driver::ParseDriverMode(StringRef ProgramName,
  ArrayRef Args) {
-  ClangNameParts = ToolChain::getTargetAndModeFromProgramName(ProgramName);
+  if (ClangNameParts.isEmpty())
+ClangNameParts = ToolChain::getTargetAndModeFromProgramName(ProgramName);
   setDriverModeFromOption(ClangNameParts.DriverMode);
 
   for (const char *ArgPtr : Args) {

Modified: cfe/trunk/test/Driver/config-file3.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/config-file3.c?rev=330871=330870=330871=diff
==
--- cfe/trunk/test/Driver/config-file3.c (original)
+++ cfe/trunk/test/Driver/config-file3.c Wed Apr 25 14:23:59 2018
@@ -27,6 +27,14 @@
 // FULL-NAME: -Wundefined-func-template
 // FULL-NAME-NOT: -Werror
 //
+//--- Invocation qqq-clang-g++ tries to find config file qqq-clang-g++.cfg 
even without -no-canonical-prefixes.
+// (As the clang executable and symlink are in different directories, this
+// requires specifying the path via --config-*-dir= though.)
+//
+// RUN: %T/testdmode/qqq-clang-g++ --config-system-dir= 
--config-user-dir=%T/testdmode -c %s -### 2>&1 | FileCheck %s -check-prefix 
SYMLINK
+//
+// SYMLINK: Configuration file: {{.*}}/testdmode/qqq-clang-g++.cfg
+//
 //--- File specified by --config overrides config inferred from clang 
executable.
 //
 // RUN: %T/testdmode/qqq-clang-g++ --config-system-dir=%S/Inputs/config 
--config-user-dir= --config i386-qqq -c -no-canonical-prefixes %s -### 2>&1 | 
FileCheck %s -check-prefix CHECK-EXPLICIT


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330710 - [GCC] Don't keep a StringRef to a temporary std::string

2018-04-24 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Apr 24 04:57:02 2018
New Revision: 330710

URL: http://llvm.org/viewvc/llvm-project?rev=330710=rev
Log:
[GCC] Don't keep a StringRef to a temporary std::string

This fixes failures in asan builds and possibly other buildbots
as well, after SVN r330696.

Prior to that revision, the std::string was stored in another
variable, before assigning to a StringRef.

Modified:
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=330710=330709=330710=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 24 04:57:02 2018
@@ -1616,7 +1616,7 @@ Generic_GCC::GCCVersion Generic_GCC::GCC
   //   4.4.2-rc4
   //   4.4.x-patched
   // And retains any patch number it finds.
-  StringRef PatchText = Second.second.str();
+  StringRef PatchText = Second.second;
   if (!PatchText.empty()) {
 if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) {
   // Try to parse the number and any suffix.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330696 - [GCC] Match a GCC version with a patch suffix without a third version component

2018-04-24 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Apr 24 01:50:11 2018
New Revision: 330696

URL: http://llvm.org/viewvc/llvm-project?rev=330696=rev
Log:
[GCC] Match a GCC version with a patch suffix without a third version component

Previously it would only accept a string as a GCC version if it had
either two components and no suffix, or three components with an
optional suffix.

Debian and ubuntu provided mingw compilers have lib/gcc/target entries
like "5.3-posix" and "5.3-win32". This doesn't try to make any specific
preference between them (other than lexical sorting of the suffix).

Differential Revision: https://reviews.llvm.org/D45505

Added:
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/.keep

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/x86_64-w64-mingw32/.keep
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/include/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/x86_64-w64-mingw32/include/.keep
Modified:
cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
cfe/trunk/test/Driver/mingw.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/Gnu.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Gnu.cpp?rev=330696=330695=330696=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Gnu.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Gnu.cpp Tue Apr 24 01:50:11 2018
@@ -1594,21 +1594,29 @@ Generic_GCC::GCCVersion Generic_GCC::GCC
   GoodVersion.MajorStr = First.first.str();
   if (First.second.empty())
 return GoodVersion;
-  if (Second.first.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 
0)
+  StringRef MinorStr = Second.first;
+  if (Second.second.empty()) {
+if (size_t EndNumber = MinorStr.find_first_not_of("0123456789")) {
+  GoodVersion.PatchSuffix = MinorStr.substr(EndNumber);
+  MinorStr = MinorStr.slice(0, EndNumber);
+}
+  }
+  if (MinorStr.getAsInteger(10, GoodVersion.Minor) || GoodVersion.Minor < 0)
 return BadVersion;
-  GoodVersion.MinorStr = Second.first.str();
+  GoodVersion.MinorStr = MinorStr.str();
 
   // First look for a number prefix and parse that if present. Otherwise just
   // stash the entire patch string in the suffix, and leave the number
   // unspecified. This covers versions strings such as:
   //   5(handled above)
   //   4.4
+  //   4.4-patched
   //   4.4.0
   //   4.4.x
   //   4.4.2-rc4
   //   4.4.x-patched
   // And retains any patch number it finds.
-  StringRef PatchText = GoodVersion.PatchSuffix = Second.second.str();
+  StringRef PatchText = Second.second.str();
   if (!PatchText.empty()) {
 if (size_t EndNumber = PatchText.find_first_not_of("0123456789")) {
   // Try to parse the number and any suffix.

Added: 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include-fixed/.keep?rev=330696=auto
==
(empty)

Added: 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c++/backward/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_posix_tree/usr/lib/gcc/x86_64-w64-mingw32/5.3-posix/include/c%2B%2B/backward/.keep?rev=330696=auto
==
(empty)

Added: 

r330695 - [test] Fix a typo in a test directory name. NFC.

2018-04-24 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Apr 24 01:49:57 2018
New Revision: 330695

URL: http://llvm.org/viewvc/llvm-project?rev=330695=rev
Log:
[test] Fix a typo in a test directory name. NFC.

Added:

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/.keep
  - copied, changed from r330681, 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep
Removed:

cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep

Removed: 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/86_64-w64-mingw32/.keep?rev=330694=auto
==
(empty)

Copied: 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/x86_64-w64-mingw32/.keep
 (from r330681, 
cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c++/4.8/86_64-w64-mingw32/.keep)
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/x86_64-w64-mingw32/.keep?p2=cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/x86_64-w64-mingw32/.keep=cfe/trunk/test/Driver/Inputs/mingw_ubuntu_tree/usr/include/c%2B%2B/4.8/86_64-w64-mingw32/.keep=330681=330695=330695=diff
==
(empty)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330277 - [MinGW] Try to fix asan testing after r330244

2018-04-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Apr 18 10:34:29 2018
New Revision: 330277

URL: http://llvm.org/viewvc/llvm-project?rev=330277=rev
Log:
[MinGW] Try to fix asan testing after r330244

Twines shouldn't be stored as they can refer to temporaries.

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=330277=330276=330277=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Wed Apr 18 10:34:29 2018
@@ -308,14 +308,13 @@ llvm::ErrorOr toolchains::M
   Subdirs.emplace_back(getTriple().str());
   Subdirs.emplace_back(getTriple().getArchName());
   Subdirs[1] += "-w64-mingw32";
-  Twine ClangRoot =
-  llvm::sys::path::parent_path(getDriver().getInstalledDir()) +
-  llvm::sys::path::get_separator();
+  StringRef ClangRoot =
+  llvm::sys::path::parent_path(getDriver().getInstalledDir());
+  StringRef Sep = llvm::sys::path::get_separator();
   for (StringRef CandidateSubdir : Subdirs) {
-Twine Subdir = ClangRoot + CandidateSubdir;
-if (llvm::sys::fs::is_directory(Subdir)) {
+if (llvm::sys::fs::is_directory(ClangRoot + Sep + CandidateSubdir)) {
   Arch = CandidateSubdir;
-  return Subdir.str();
+  return (ClangRoot + Sep + CandidateSubdir).str();
 }
   }
   return make_error_code(std::errc::no_such_file_or_directory);


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r330244 - [MinGW] Look for a cross sysroot relative to the clang binary

2018-04-18 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Apr 18 01:47:26 2018
New Revision: 330244

URL: http://llvm.org/viewvc/llvm-project?rev=330244=rev
Log:
[MinGW] Look for a cross sysroot relative to the clang binary

If found, prefer this over looking for a similar gcc later in the
system path.

Differential Revision: https://reviews.llvm.org/D45504

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.h

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=330244=330243=330244=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Wed Apr 18 01:47:26 2018
@@ -275,7 +275,8 @@ void toolchains::MinGW::findGccLibDir()
   Archs.emplace_back(getTriple().getArchName());
   Archs[0] += "-w64-mingw32";
   Archs.emplace_back("mingw32");
-  Arch = Archs[0].str();
+  if (Arch.empty())
+Arch = Archs[0].str();
   // lib: Arch Linux, Ubuntu, Windows
   // lib64: openSUSE Linux
   for (StringRef CandidateLib : {"lib", "lib64"}) {
@@ -302,6 +303,24 @@ llvm::ErrorOr toolchains::M
   return make_error_code(std::errc::no_such_file_or_directory);
 }
 
+llvm::ErrorOr toolchains::MinGW::findClangRelativeSysroot() {
+  llvm::SmallVector, 2> Subdirs;
+  Subdirs.emplace_back(getTriple().str());
+  Subdirs.emplace_back(getTriple().getArchName());
+  Subdirs[1] += "-w64-mingw32";
+  Twine ClangRoot =
+  llvm::sys::path::parent_path(getDriver().getInstalledDir()) +
+  llvm::sys::path::get_separator();
+  for (StringRef CandidateSubdir : Subdirs) {
+Twine Subdir = ClangRoot + CandidateSubdir;
+if (llvm::sys::fs::is_directory(Subdir)) {
+  Arch = CandidateSubdir;
+  return Subdir.str();
+}
+  }
+  return make_error_code(std::errc::no_such_file_or_directory);
+}
+
 toolchains::MinGW::MinGW(const Driver , const llvm::Triple ,
  const ArgList )
 : ToolChain(D, Triple, Args), CudaInstallation(D, Triple, Args) {
@@ -309,6 +328,10 @@ toolchains::MinGW::MinGW(const Driver 
 
   if (getDriver().SysRoot.size())
 Base = getDriver().SysRoot;
+  // Look for /../; if found, use /.. as the
+  // base as it could still be a base for a gcc setup with libgcc.
+  else if (llvm::ErrorOr TargetSubdir = 
findClangRelativeSysroot())
+Base = llvm::sys::path::parent_path(TargetSubdir.get());
   else if (llvm::ErrorOr GPPName = findGcc())
 Base = llvm::sys::path::parent_path(
 llvm::sys::path::parent_path(GPPName.get()));

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.h?rev=330244=330243=330244=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.h Wed Apr 18 01:47:26 2018
@@ -96,6 +96,7 @@ private:
   mutable std::unique_ptr Compiler;
   void findGccLibDir();
   llvm::ErrorOr findGcc();
+  llvm::ErrorOr findClangRelativeSysroot();
 };
 
 } // end namespace toolchains


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r329946 - [MinGW] Look for libc++ headers in a triplet prefixed path as well

2018-04-12 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Apr 12 13:07:38 2018
New Revision: 329946

URL: http://llvm.org/viewvc/llvm-project?rev=329946=rev
Log:
[MinGW] Look for libc++ headers in a triplet prefixed path as well

This makes it consistent with libstdc++ and the other default
include directories.

If these headers are found in both locations and one isn't a
symlink to the other, this will cause errors due to libc++ headers
having wrapper headers for some standard C headers, wrappers that
do #include_next the actual one.

If the same libc++ standard C wrapper header exists in more than one
include directory before the real system one, the header include
guard will stop it from doing another #include_next to pick up the
real one, breaking things.

As this is a rather uncommon situation, this should be acceptable
and toolchain maintainers can adapt accordingly if necessary.

Also simplify some of the existing code with a local variable.

Differential Revision: https://reviews.llvm.org/D45500

Modified:
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw.cpp

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=329946=329945=329946=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Thu Apr 12 13:07:38 2018
@@ -453,11 +453,14 @@ void toolchains::MinGW::AddClangCXXStdli
   DriverArgs.hasArg(options::OPT_nostdincxx))
 return;
 
+  StringRef Slash = llvm::sys::path::get_separator();
+
   switch (GetCXXStdlibType(DriverArgs)) {
   case ToolChain::CST_Libcxx:
+addSystemInclude(DriverArgs, CC1Args, Base + Arch + Slash + "include" +
+  Slash + "c++" + Slash + "v1");
 addSystemInclude(DriverArgs, CC1Args,
- Base + "include" + llvm::sys::path::get_separator() +
- "c++" + llvm::sys::path::get_separator() + "v1");
+ Base + "include" + Slash + "c++" + Slash + "v1");
 break;
 
   case ToolChain::CST_Libstdcxx:
@@ -472,7 +475,7 @@ void toolchains::MinGW::AddClangCXXStdli
 llvm::sys::path::append(CppIncludeBases[3], "include", "c++");
 for (auto  : CppIncludeBases) {
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase);
-  CppIncludeBase += llvm::sys::path::get_separator();
+  CppIncludeBase += Slash;
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + Arch);
   addSystemInclude(DriverArgs, CC1Args, CppIncludeBase + "backward");
 }

Modified: cfe/trunk/test/Driver/mingw.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw.cpp?rev=329946=329945=329946=diff
==
--- cfe/trunk/test/Driver/mingw.cpp (original)
+++ cfe/trunk/test/Driver/mingw.cpp Thu Apr 12 13:07:38 2018
@@ -3,6 +3,10 @@
 // CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
 
 
+// RUN: %clang -target i686-windows-gnu -rtlib=platform -stdlib=libc++ -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE_LIBCXX %s
+// CHECK_MINGW_CLANG_TREE_LIBCXX: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include{{/|}}c++{{/|}}v1"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -rtlib=platform -stdlib=libstdc++ 
-c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326476 - [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC

2018-03-01 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Mar  1 12:22:57 2018
New Revision: 326476

URL: http://llvm.org/viewvc/llvm-project?rev=326476=rev
Log:
[RecordLayout] Only assert that fundamental type sizes are power of two on MSVC

Make types with sizes that aren't a power of two an error (that can
be disabled) in structs with ms_struct layout, except on mingw where
the situation is quite likely to occur and GCC handles it silently.

Differential Revision: https://reviews.llvm.org/D43908

Added:
cfe/trunk/test/CodeGen/ms_struct-long-double.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=326476=326475=326476=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Mar  1 12:22:57 
2018
@@ -759,6 +759,10 @@ def warn_cxx_ms_struct :
   Warning<"ms_struct may not produce Microsoft-compatible layouts for classes "
   "with base classes or virtual functions">,
   DefaultError, InGroup;
+def warn_npot_ms_struct :
+  Warning<"ms_struct may not produce Microsoft-compatible layouts with 
fundamental "
+  "data types with sizes that aren't a power of two">,
+  DefaultError, InGroup;
 def err_section_conflict : Error<"%0 causes a section type conflict with %1">;
 def err_no_base_classes : Error<"invalid use of '__super', %0 has no base 
classes">;
 def err_invalid_super_scope : Error<"invalid use of '__super', "

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=326476=326475=326476=diff
==
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Thu Mar  1 12:22:57 2018
@@ -1752,10 +1752,32 @@ void ItaniumRecordLayoutBuilder::LayoutF
   QualType T = Context.getBaseElementType(D->getType());
   if (const BuiltinType *BTy = T->getAs()) {
 CharUnits TypeSize = Context.getTypeSizeInChars(BTy);
-assert(
-(llvm::isPowerOf2_64(TypeSize.getQuantity()) ||
- Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) &&
-"Non PowerOf2 size outside of GNU mode");
+
+if (!llvm::isPowerOf2_64(TypeSize.getQuantity())) {
+  assert(
+  !Context.getTargetInfo().getTriple().isWindowsMSVCEnvironment() 
&&
+  "Non PowerOf2 size in MSVC mode");
+  // Base types with sizes that aren't a power of two don't work
+  // with the layout rules for MS structs. This isn't an issue in
+  // MSVC itself since there are no such base data types there.
+  // On e.g. x86_32 mingw and linux, long double is 12 bytes though.
+  // Any structs involving that data type obviously can't be ABI
+  // compatible with MSVC regardless of how it is laid out.
+
+  // Since ms_struct can be mass enabled (via a pragma or via the
+  // -mms-bitfields command line parameter), this can trigger for
+  // structs that don't actually need MSVC compatibility, so we
+  // need to be able to sidestep the ms_struct layout for these types.
+
+  // Since the combination of -mms-bitfields together with structs
+  // like max_align_t (which contains a long double) for mingw is
+  // quite comon (and GCC handles it silently), just handle it
+  // silently there. For other targets that have ms_struct enabled
+  // (most probably via a pragma or attribute), trigger a diagnostic
+  // that defaults to an error.
+  if (!Context.getTargetInfo().getTriple().isWindowsGNUEnvironment())
+Diag(D->getLocation(), diag::warn_npot_ms_struct);
+}
 if (TypeSize > FieldAlign &&
 llvm::isPowerOf2_64(TypeSize.getQuantity()))
   FieldAlign = TypeSize;

Added: cfe/trunk/test/CodeGen/ms_struct-long-double.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms_struct-long-double.c?rev=326476=auto
==
--- cfe/trunk/test/CodeGen/ms_struct-long-double.c (added)
+++ cfe/trunk/test/CodeGen/ms_struct-long-double.c Thu Mar  1 12:22:57 2018
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -emit-llvm-only -triple i686-windows-gnu 
-fdump-record-layouts %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm-only -triple i686-linux -fdump-record-layouts 
-Wno-incompatible-ms-struct %s | FileCheck %s
+// RUN: not %clang_cc1 -emit-llvm-only -triple i686-linux 
-fdump-record-layouts %s 2>&1 | FileCheck %s -check-prefix=ERROR
+
+struct ldb_struct {
+  char c;
+  long double ldb;

r326235 - [MinGW, CrossWindows] Allow passing -static together with -shared

2018-02-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Feb 27 11:42:19 2018
New Revision: 326235

URL: http://llvm.org/viewvc/llvm-project?rev=326235=rev
Log:
[MinGW, CrossWindows] Allow passing -static together with -shared

In these combinations, link a DLL as usual, but pass -Bstatic instead
of -Bdynamic to indicate prefering static libraries.

Differential Revision: https://reviews.llvm.org/D43811

Modified:
cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp
cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
cfe/trunk/test/Driver/mingw-libgcc.c
cfe/trunk/test/Driver/windows-cross.c

Modified: cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp?rev=326235=326234=326235=diff
==
--- cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/CrossWindows.cpp Tue Feb 27 11:42:19 2018
@@ -127,7 +127,8 @@ void tools::CrossWindows::Linker::Constr
 }
 
 CmdArgs.push_back("-shared");
-CmdArgs.push_back("-Bdynamic");
+CmdArgs.push_back(Args.hasArg(options::OPT_static) ? "-Bstatic"
+   : "-Bdynamic");
 
 CmdArgs.push_back("--enable-auto-image-base");
 

Modified: cfe/trunk/lib/Driver/ToolChains/MinGW.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MinGW.cpp?rev=326235=326234=326235=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MinGW.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MinGW.cpp Tue Feb 27 11:42:19 2018
@@ -141,22 +141,21 @@ void tools::MinGW::Linker::ConstructJob(
 CmdArgs.push_back("console");
   }
 
+  if (Args.hasArg(options::OPT_mdll))
+CmdArgs.push_back("--dll");
+  else if (Args.hasArg(options::OPT_shared))
+CmdArgs.push_back("--shared");
   if (Args.hasArg(options::OPT_static))
 CmdArgs.push_back("-Bstatic");
-  else {
-if (Args.hasArg(options::OPT_mdll))
-  CmdArgs.push_back("--dll");
-else if (Args.hasArg(options::OPT_shared))
-  CmdArgs.push_back("--shared");
+  else
 CmdArgs.push_back("-Bdynamic");
-if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) {
-  CmdArgs.push_back("-e");
-  if (TC.getArch() == llvm::Triple::x86)
-CmdArgs.push_back("_DllMainCRTStartup@12");
-  else
-CmdArgs.push_back("DllMainCRTStartup");
-  CmdArgs.push_back("--enable-auto-image-base");
-}
+  if (Args.hasArg(options::OPT_mdll) || Args.hasArg(options::OPT_shared)) {
+CmdArgs.push_back("-e");
+if (TC.getArch() == llvm::Triple::x86)
+  CmdArgs.push_back("_DllMainCRTStartup@12");
+else
+  CmdArgs.push_back("DllMainCRTStartup");
+CmdArgs.push_back("--enable-auto-image-base");
   }
 
   CmdArgs.push_back("-o");

Modified: cfe/trunk/test/Driver/mingw-libgcc.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-libgcc.c?rev=326235=326234=326235=diff
==
--- cfe/trunk/test/Driver/mingw-libgcc.c (original)
+++ cfe/trunk/test/Driver/mingw-libgcc.c Tue Feb 27 11:42:19 2018
@@ -2,11 +2,11 @@
 // Verified with gcc version 5.1.0 (i686-posix-dwarf-rev0, Built by MinGW-W64 
project).
 
 // gcc, static
-// RUN: %clang -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_STATIC %s
-// RUN: %clang -static -v -target i686-pc-windows-gnu -rtlib=platform -### %s 
2>&1 | FileCheck -check-prefix=CHECK_STATIC %s
-// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -rtlib=platform 
-### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s
-// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -rtlib=platform 
-### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s
-// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu 
-rtlib=platform -### %s 2>&1 | FileCheck -check-prefix=CHECK_STATIC %s
+// RUN: %clang -v -target i686-pc-windows-gnu -rtlib=platform -### %s 2>&1 | 
FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s
+// RUN: %clang -static -v -target i686-pc-windows-gnu -rtlib=platform -### %s 
2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BSTATIC %s
+// RUN: %clang -static-libgcc -v -target i686-pc-windows-gnu -rtlib=platform 
-### %s 2>&1 | FileCheck -check-prefixes=CHECK_STATIC,CHECK_BDYNAMIC %s
+// RUN: %clang -static -shared -v -target i686-pc-windows-gnu -rtlib=platform 
-### %s 2>&1 | FileCheck 
-check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BSTATIC %s
+// RUN: %clang -static-libgcc -shared -v -target i686-pc-windows-gnu 
-rtlib=platform -### %s 2>&1 | FileCheck 
-check-prefixes=CHECK_STATIC,CHECK_SHARED,CHECK_BDYNAMIC %s
 
 // gcc, dynamic
 // RUN: %clang -shared -v -target i686-pc-windows-gnu -rtlib=platform -### %s 
2>&1 | FileCheck -check-prefix=CHECK_DYNAMIC %s
@@ -21,5 +21,8 @@
 // RUN: 

r326180 - [test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.

2018-02-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Feb 27 00:35:35 2018
New Revision: 326180

URL: http://llvm.org/viewvc/llvm-project?rev=326180=rev
Log:
[test] Extend the Driver/mingw-msvcrt.c test with a -SAME check. NFC.

Modified:
cfe/trunk/test/Driver/mingw-msvcrt.c

Modified: cfe/trunk/test/Driver/mingw-msvcrt.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/mingw-msvcrt.c?rev=326180=326179=326180=diff
==
--- cfe/trunk/test/Driver/mingw-msvcrt.c (original)
+++ cfe/trunk/test/Driver/mingw-msvcrt.c Tue Feb 27 00:35:35 2018
@@ -2,4 +2,5 @@
 // RUN: %clang -v -target i686-pc-windows-gnu -lmsvcr120 -### %s 2>&1 | 
FileCheck -check-prefix=CHECK_MSVCR120 %s
 
 // CHECK_DEFAULT: "-lmingwex" "-lmsvcrt" "-ladvapi32"
-// CHECK_MSVCR120: "-lmingwex" "-ladvapi32"
+// CHECK_MSVCR120: "-lmsvcr120"
+// CHECK_MSVCR120-SAME: "-lmingwex" "-ladvapi32"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r326173 - [RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields

2018-02-26 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Feb 26 22:27:06 2018
New Revision: 326173

URL: http://llvm.org/viewvc/llvm-project?rev=326173=rev
Log:
[RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields

When targeting GNU/MinGW for i386, the size of the "long double" data
type is 12 bytes (while it is 8 bytes in MSVC). When building
with -mms-bitfields to have struct layouts match MSVC, data types
are laid out in a struct with alignment according to their size.
However, this doesn't make sense for the long double type, since
it doesn't match MSVC at all, and aligning to a non-power-of-2
size triggers other asserts later.

This matches what GCC does, aligning a long double to 4 bytes
in structs on i386 even when -mms-bitfields is specified.

This fixes asserts when using the max_align_t data type when
building for MinGW/i386 with the -mms-bitfields flag.

Differential Revision: https://reviews.llvm.org/D43734

Modified:
cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
cfe/trunk/test/CodeGen/mingw-long-double.c

Modified: cfe/trunk/lib/AST/RecordLayoutBuilder.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/RecordLayoutBuilder.cpp?rev=326173=326172=326173=diff
==
--- cfe/trunk/lib/AST/RecordLayoutBuilder.cpp (original)
+++ cfe/trunk/lib/AST/RecordLayoutBuilder.cpp Mon Feb 26 22:27:06 2018
@@ -1752,7 +1752,12 @@ void ItaniumRecordLayoutBuilder::LayoutF
   QualType T = Context.getBaseElementType(D->getType());
   if (const BuiltinType *BTy = T->getAs()) {
 CharUnits TypeSize = Context.getTypeSizeInChars(BTy);
-if (TypeSize > FieldAlign)
+assert(
+(llvm::isPowerOf2_64(TypeSize.getQuantity()) ||
+ Context.getTargetInfo().getTriple().isWindowsGNUEnvironment()) &&
+"Non PowerOf2 size outside of GNU mode");
+if (TypeSize > FieldAlign &&
+llvm::isPowerOf2_64(TypeSize.getQuantity()))
   FieldAlign = TypeSize;
   }
 }

Modified: cfe/trunk/test/CodeGen/mingw-long-double.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/mingw-long-double.c?rev=326173=326172=326173=diff
==
--- cfe/trunk/test/CodeGen/mingw-long-double.c (original)
+++ cfe/trunk/test/CodeGen/mingw-long-double.c Mon Feb 26 22:27:06 2018
@@ -1,5 +1,7 @@
 // RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s \
 // RUN:| FileCheck %s --check-prefix=GNU32
+// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -o - %s -mms-bitfields \
+// RUN:| FileCheck %s --check-prefix=GNU32
 // RUN: %clang_cc1 -triple x86_64-windows-gnu -emit-llvm -o - %s \
 // RUN:| FileCheck %s --check-prefix=GNU64
 // RUN: %clang_cc1 -triple x86_64-windows-msvc -emit-llvm -o - %s \


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r324059 - [MinGW] Emit typeinfo locally for dllimported classes without key functions

2018-02-01 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Feb  1 22:22:35 2018
New Revision: 324059

URL: http://llvm.org/viewvc/llvm-project?rev=324059=rev
Log:
[MinGW] Emit typeinfo locally for dllimported classes without key functions

This fixes building Qt as shared libraries with clang in MinGW
mode; previously subclasses of the QObjectData class (in other
DLLs than the base DLL) failed to find the typeinfo symbols
(that neither were emitted in the base DLL nor in the DLL
containing the subclass).

If the virtual destructor in the newly added testcase wouldn't
be pure (or if there'd be another non-pure virtual method),
it'd be a key function and things would work out even before this
change. Make sure to locally emit the typeinfo for these classes
as well.

This matches what GCC does in this specific testcase.

This fixes the root issue that spawned PR35146. (The difference
to GCC that is initially described in that bug still is present
though.)

Differential Revision: https://reviews.llvm.org/D42641

Added:
cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
Modified:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp

Modified: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp?rev=324059=324058=324059=diff
==
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp (original)
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp Thu Feb  1 22:22:35 2018
@@ -2761,6 +2761,11 @@ static bool ShouldUseExternalRTTIDescrip
 // N.B. We must always emit the RTTI data ourselves if there exists a key
 // function.
 bool IsDLLImport = RD->hasAttr();
+
+// Don't import the RTTI but emit it locally.
+if (CGM.getTriple().isWindowsGNUEnvironment() && IsDLLImport)
+  return false;
+
 if (CGM.getVTables().isVTableExternal(RD))
   return IsDLLImport && !CGM.getTriple().isWindowsItaniumEnvironment()
  ? false

Added: cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp?rev=324059=auto
==
--- cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp (added)
+++ cfe/trunk/test/CodeGenCXX/dllimport-missing-key.cpp Thu Feb  1 22:22:35 2018
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -triple i686-windows-gnu -emit-llvm -std=c++1y -O0 -o - %s 
-w | FileCheck --check-prefix=GNU %s
+
+class __declspec(dllimport) QObjectData {
+public:
+virtual ~QObjectData() = 0;
+void *ptr;
+
+int method() const;
+};
+
+class LocalClass : public QObjectData {
+};
+
+void call() {
+(new LocalClass())->method();
+}
+
+// GNU-DAG: @_ZTV11QObjectData = available_externally dllimport
+// GNU-DAG: @_ZTS11QObjectData = linkonce_odr
+// GNU-DAG: @_ZTI11QObjectData = linkonce_odr

Modified: cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp?rev=324059=324058=324059=diff
==
--- cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllimport-rtti.cpp Thu Feb  1 22:22:35 2018
@@ -12,7 +12,7 @@ struct __declspec(dllimport) S {
 // MSVC-DAG: @"\01??_R3S@@8" = linkonce_odr
 
 // GNU-DAG: @_ZTV1S = available_externally dllimport
-// GNU-DAG: @_ZTI1S = external dllimport
+// GNU-DAG: @_ZTI1S = linkonce_odr
 
 struct U : S {
 } u;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r323499 - Don't enable _LIBUNWIND_BUILD_ZERO_COST_APIS if building the SJLJ APIs

2018-01-25 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Jan 25 22:50:07 2018
New Revision: 323499

URL: http://llvm.org/viewvc/llvm-project?rev=323499=rev
Log:
Don't enable _LIBUNWIND_BUILD_ZERO_COST_APIS if building the SJLJ APIs

Otherwise, a shared library build with SJLJ APIs enabled would
end up with duplicate symbols.

This didn't occur for the apple && arm case due to specifically
checking for that in the surrounding ifdef.

Differential Revision: https://reviews.llvm.org/D42555

Modified:
libunwind/trunk/src/config.h

Modified: libunwind/trunk/src/config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=323499=323498=323499=diff
==
--- libunwind/trunk/src/config.h (original)
+++ libunwind/trunk/src/config.h Thu Jan 25 22:50:07 2018
@@ -72,8 +72,10 @@
 (!defined(__APPLE__) && defined(__arm__)) ||   
\
 (defined(__arm64__) || defined(__aarch64__)) ||
\
 defined(__mips__)
+#if !defined(_LIBUNWIND_BUILD_SJLJ_APIS)
 #define _LIBUNWIND_BUILD_ZERO_COST_APIS
 #endif
+#endif
 
 #if defined(__powerpc64__) && defined(_ARCH_PWR8)
 #define PPC64_HAS_VMX


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r322596 - [PPC64] Added vector registers.

2018-01-16 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan 16 12:54:10 2018
New Revision: 322596

URL: http://llvm.org/viewvc/llvm-project?rev=322596=rev
Log:
[PPC64] Added vector registers.

The Registers_ppc64 class needed a couple of changes, both to accommodate the
new registers as well as to handle the overlaps of VS register set
without wasting space.

The save/restore code of V and VS registers was added.
As VS registers depend on the VMX extension, they are processed only if
VMX support is detected (_ARCH_PWR8 for now).

Patch by Leandro Lupori!

Differential Revision: https://reviews.llvm.org/D41906

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/assembly.h
libunwind/trunk/src/config.h

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=322596=322595=322596=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Tue Jan 16 12:54:10 2018
@@ -18,7 +18,7 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86   8
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC   112
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 116
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   287
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K  31
@@ -42,8 +42,8 @@
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64
 # elif defined(__powerpc64__)
 #  define _LIBUNWIND_TARGET_PPC64 1
-#  define _LIBUNWIND_CONTEXT_SIZE 136
-#  define _LIBUNWIND_CURSOR_SIZE 148
+#  define _LIBUNWIND_CONTEXT_SIZE 167
+#  define _LIBUNWIND_CURSOR_SIZE 179
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
@@ -96,8 +96,8 @@
 # define _LIBUNWIND_TARGET_OR1K 1
 # define _LIBUNWIND_TARGET_MIPS_O32 1
 # define _LIBUNWIND_TARGET_MIPS_NEWABI 1
-# define _LIBUNWIND_CONTEXT_SIZE 136
-# define _LIBUNWIND_CURSOR_SIZE 148
+# define _LIBUNWIND_CONTEXT_SIZE 167
+# define _LIBUNWIND_CURSOR_SIZE 179
 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
 #endif // _LIBUNWIND_IS_NATIVE_ONLY
 

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=322596=322595=322596=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Tue Jan 16 12:54:10 2018
@@ -327,116 +327,186 @@ enum {
 
 // 64-bit ppc register numbers
 enum {
-  UNW_PPC64_R0  = 0,
-  UNW_PPC64_R1  = 1,
-  UNW_PPC64_R2  = 2,
-  UNW_PPC64_R3  = 3,
-  UNW_PPC64_R4  = 4,
-  UNW_PPC64_R5  = 5,
-  UNW_PPC64_R6  = 6,
-  UNW_PPC64_R7  = 7,
-  UNW_PPC64_R8  = 8,
-  UNW_PPC64_R9  = 9,
-  UNW_PPC64_R10 = 10,
-  UNW_PPC64_R11 = 11,
-  UNW_PPC64_R12 = 12,
-  UNW_PPC64_R13 = 13,
-  UNW_PPC64_R14 = 14,
-  UNW_PPC64_R15 = 15,
-  UNW_PPC64_R16 = 16,
-  UNW_PPC64_R17 = 17,
-  UNW_PPC64_R18 = 18,
-  UNW_PPC64_R19 = 19,
-  UNW_PPC64_R20 = 20,
-  UNW_PPC64_R21 = 21,
-  UNW_PPC64_R22 = 22,
-  UNW_PPC64_R23 = 23,
-  UNW_PPC64_R24 = 24,
-  UNW_PPC64_R25 = 25,
-  UNW_PPC64_R26 = 26,
-  UNW_PPC64_R27 = 27,
-  UNW_PPC64_R28 = 28,
-  UNW_PPC64_R29 = 29,
-  UNW_PPC64_R30 = 30,
-  UNW_PPC64_R31 = 31,
-  UNW_PPC64_F0  = 32,
-  UNW_PPC64_F1  = 33,
-  UNW_PPC64_F2  = 34,
-  UNW_PPC64_F3  = 35,
-  UNW_PPC64_F4  = 36,
-  UNW_PPC64_F5  = 37,
-  UNW_PPC64_F6  = 38,
-  UNW_PPC64_F7  = 39,
-  UNW_PPC64_F8  = 40,
-  UNW_PPC64_F9  = 41,
-  UNW_PPC64_F10 = 42,
-  UNW_PPC64_F11 = 43,
-  UNW_PPC64_F12 = 44,
-  UNW_PPC64_F13 = 45,
-  UNW_PPC64_F14 = 46,
-  UNW_PPC64_F15 = 47,
-  UNW_PPC64_F16 = 48,
-  UNW_PPC64_F17 = 49,
-  UNW_PPC64_F18 = 50,
-  UNW_PPC64_F19 = 51,
-  UNW_PPC64_F20 = 52,
-  UNW_PPC64_F21 = 53,
-  UNW_PPC64_F22 = 54,
-  UNW_PPC64_F23 = 55,
-  UNW_PPC64_F24 = 56,
-  UNW_PPC64_F25 = 57,
-  UNW_PPC64_F26 = 58,
-  UNW_PPC64_F27 = 59,
-  UNW_PPC64_F28 = 60,
-  UNW_PPC64_F29 = 61,
-  UNW_PPC64_F30 = 62,
-  UNW_PPC64_F31 = 63,
-  UNW_PPC64_LR  = 64,
-  UNW_PPC64_CTR = 65,
-  UNW_PPC64_CR0 = 66,
-  UNW_PPC64_CR1 = 67,
-  UNW_PPC64_CR2 = 68,
-  UNW_PPC64_CR3 = 69,
-  UNW_PPC64_CR4 = 70,
-  UNW_PPC64_CR5 = 71,
-  UNW_PPC64_CR6 = 72,
-  UNW_PPC64_CR7 = 73,
-  UNW_PPC64_XER = 74,
-  UNW_PPC64_V0  = 75,
-  UNW_PPC64_V1  = 76,
-  UNW_PPC64_V2  = 77,
-  UNW_PPC64_V3  = 78,
-  UNW_PPC64_V4  = 79,
-  UNW_PPC64_V5  = 80,
-  UNW_PPC64_V6  = 81,
-  UNW_PPC64_V7  = 82,
-  UNW_PPC64_V8  = 83,
-  UNW_PPC64_V9  = 84,
-  UNW_PPC64_V10 = 85,
-  UNW_PPC64_V11 = 

[libcxx] r321896 - [cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 threads

2018-01-05 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Jan  5 12:48:29 2018
New Revision: 321896

URL: http://llvm.org/viewvc/llvm-project?rev=321896=rev
Log:
[cmake] Add a config option LIBCXX_HAS_WIN32_THREAD_API for enforcing win32 
threads

This allows keeping libcxx using win32 threads even if a
version of pthread.h is installed.

This matches the existing cmake option LIBCXX_HAS_PTHREAD_API.

Also add missing documentation about the internal define
_LIBCPP_HAS_THREAD_API_WIN32.

Differential Revision: https://reviews.llvm.org/D41764

Modified:
libcxx/trunk/CMakeLists.txt
libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst
libcxx/trunk/include/__config_site.in

Modified: libcxx/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/CMakeLists.txt?rev=321896=321895=321896=diff
==
--- libcxx/trunk/CMakeLists.txt (original)
+++ libcxx/trunk/CMakeLists.txt Fri Jan  5 12:48:29 2018
@@ -202,6 +202,7 @@ option(LIBCXX_ENABLE_MONOTONIC_CLOCK
This option may only be set to OFF when LIBCXX_ENABLE_THREADS=OFF." ON)
 option(LIBCXX_HAS_MUSL_LIBC "Build libc++ with support for the Musl C library" 
OFF)
 option(LIBCXX_HAS_PTHREAD_API "Ignore auto-detection and force use of pthread 
API" OFF)
+option(LIBCXX_HAS_WIN32_THREAD_API "Ignore auto-detection and force use of 
win32 thread API" OFF)
 option(LIBCXX_HAS_EXTERNAL_THREAD_API
   "Build libc++ with an externalized threading API.
This option may only be set to ON when LIBCXX_ENABLE_THREADS=ON." OFF)
@@ -273,6 +274,10 @@ if(NOT LIBCXX_ENABLE_THREADS)
 message(FATAL_ERROR "LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY can only be set "
 "to ON when LIBCXX_ENABLE_THREADS is also set to ON.")
   endif()
+  if (LIBCXX_HAS_WIN32_THREAD_API)
+message(FATAL_ERROR "LIBCXX_HAS_WIN32_THREAD_API can only be set to ON"
+" when LIBCXX_ENABLE_THREADS is also set to ON.")
+  endif()
 
 endif()
 
@@ -287,6 +292,19 @@ if (LIBCXX_HAS_EXTERNAL_THREAD_API)
 "and LIBCXX_HAS_PTHREAD_API cannot be both"
 "set to ON at the same time.")
   endif()
+  if (LIBCXX_HAS_WIN32_THREAD_API)
+message(FATAL_ERROR "The options LIBCXX_HAS_EXTERNAL_THREAD_API"
+"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
+"set to ON at the same time.")
+  endif()
+endif()
+
+if (LIBCXX_HAS_PTHREAD_API)
+  if (LIBCXX_HAS_WIN32_THREAD_API)
+message(FATAL_ERROR "The options LIBCXX_HAS_PTHREAD_API"
+"and LIBCXX_HAS_WIN32_THREAD_API cannot be both"
+"set to ON at the same time.")
+  endif()
 endif()
 
 # Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
@@ -613,6 +631,7 @@ config_define_if_not(LIBCXX_ENABLE_THREA
 
 config_define_if(LIBCXX_HAS_PTHREAD_API _LIBCPP_HAS_THREAD_API_PTHREAD)
 config_define_if(LIBCXX_HAS_EXTERNAL_THREAD_API 
_LIBCPP_HAS_THREAD_API_EXTERNAL)
+config_define_if(LIBCXX_HAS_WIN32_THREAD_API _LIBCPP_HAS_THREAD_API_WIN32)
 config_define_if(LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY 
_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL)
 config_define_if(LIBCXX_HAS_MUSL_LIBC _LIBCPP_HAS_MUSL_LIBC)
 config_define_if(LIBCXX_NO_VCRUNTIME _LIBCPP_NO_VCRUNTIME)

Modified: libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst?rev=321896=321895=321896=diff
==
--- libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst (original)
+++ libcxx/trunk/docs/DesignDocs/ThreadingSupportAPI.rst Fri Jan  5 12:48:29 
2018
@@ -66,6 +66,10 @@ Threading Configuration Macros
   This macro is defined when libc++ should use POSIX threads to implement the
   internal threading API.
 
+**_LIBCPP_HAS_THREAD_API_WIN32**
+  This macro is defined when libc++ should use Win32 threads to implement the
+  internal threading API.
+
 **_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL**
   This macro is defined when libc++ expects the definitions of the internal
   threading API to be provided by an external library. When defined

Modified: libcxx/trunk/include/__config_site.in
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config_site.in?rev=321896=321895=321896=diff
==
--- libcxx/trunk/include/__config_site.in (original)
+++ libcxx/trunk/include/__config_site.in Fri Jan  5 12:48:29 2018
@@ -23,6 +23,7 @@
 #cmakedefine _LIBCPP_HAS_MUSL_LIBC
 #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD
 #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL
+#cmakedefine _LIBCPP_HAS_THREAD_API_WIN32
 #cmakedefine _LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL
 #cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
 #cmakedefine _LIBCPP_NO_VCRUNTIME


___
cfe-commits mailing list
cfe-commits@lists.llvm.org

[libunwind] r321680 - Reland [PPC64] Port to ppc64le - initial version

2018-01-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan  2 14:11:30 2018
New Revision: 321680

URL: http://llvm.org/viewvc/llvm-project?rev=321680=rev
Log:
Reland [PPC64] Port to ppc64le - initial version

Initial working version of libunwind for PowerPC 64. Tested on
little-endian ppc64 host only.
Based on the existing PowerPC 32 code.

It supports:

- context save/restore (unw_getcontext, unw_init_local, unw_resume)
- read/write from/to saved registers
- backtrace (unw_step)

Patch by Leandro Lupori!

Differential Revision: https://reviews.llvm.org/D41386

Now builds with LIBUNWIND_ENABLE_CROSS_UNWINDING=ON should
work.

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindCursor.hpp
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/assembly.h
libunwind/trunk/src/config.h
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=321680=321679=321680=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Tue Jan  2 14:11:30 2018
@@ -18,6 +18,7 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86   8
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC   112
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   287
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K  31
@@ -39,6 +40,11 @@
 #define _LIBUNWIND_CURSOR_SIZE 33
 #  endif
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64
+# elif defined(__powerpc64__)
+#  define _LIBUNWIND_TARGET_PPC64 1
+#  define _LIBUNWIND_CONTEXT_SIZE 136
+#  define _LIBUNWIND_CURSOR_SIZE 148
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
 #  define _LIBUNWIND_CONTEXT_SIZE 117
@@ -84,13 +90,14 @@
 # define _LIBUNWIND_TARGET_I386
 # define _LIBUNWIND_TARGET_X86_64 1
 # define _LIBUNWIND_TARGET_PPC 1
+# define _LIBUNWIND_TARGET_PPC64 1
 # define _LIBUNWIND_TARGET_AARCH64 1
 # define _LIBUNWIND_TARGET_ARM 1
 # define _LIBUNWIND_TARGET_OR1K 1
 # define _LIBUNWIND_TARGET_MIPS_O32 1
 # define _LIBUNWIND_TARGET_MIPS_N64 1
-# define _LIBUNWIND_CONTEXT_SIZE 128
-# define _LIBUNWIND_CURSOR_SIZE 140
+# define _LIBUNWIND_CONTEXT_SIZE 136
+# define _LIBUNWIND_CURSOR_SIZE 148
 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
 #endif // _LIBUNWIND_IS_NATIVE_ONLY
 

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=321680=321679=321680=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Tue Jan  2 14:11:30 2018
@@ -325,6 +325,120 @@ enum {
   UNW_PPC_SPEFSCR = 112
 };
 
+// 64-bit ppc register numbers
+enum {
+  UNW_PPC64_R0  = 0,
+  UNW_PPC64_R1  = 1,
+  UNW_PPC64_R2  = 2,
+  UNW_PPC64_R3  = 3,
+  UNW_PPC64_R4  = 4,
+  UNW_PPC64_R5  = 5,
+  UNW_PPC64_R6  = 6,
+  UNW_PPC64_R7  = 7,
+  UNW_PPC64_R8  = 8,
+  UNW_PPC64_R9  = 9,
+  UNW_PPC64_R10 = 10,
+  UNW_PPC64_R11 = 11,
+  UNW_PPC64_R12 = 12,
+  UNW_PPC64_R13 = 13,
+  UNW_PPC64_R14 = 14,
+  UNW_PPC64_R15 = 15,
+  UNW_PPC64_R16 = 16,
+  UNW_PPC64_R17 = 17,
+  UNW_PPC64_R18 = 18,
+  UNW_PPC64_R19 = 19,
+  UNW_PPC64_R20 = 20,
+  UNW_PPC64_R21 = 21,
+  UNW_PPC64_R22 = 22,
+  UNW_PPC64_R23 = 23,
+  UNW_PPC64_R24 = 24,
+  UNW_PPC64_R25 = 25,
+  UNW_PPC64_R26 = 26,
+  UNW_PPC64_R27 = 27,
+  UNW_PPC64_R28 = 28,
+  UNW_PPC64_R29 = 29,
+  UNW_PPC64_R30 = 30,
+  UNW_PPC64_R31 = 31,
+  UNW_PPC64_F0  = 32,
+  UNW_PPC64_F1  = 33,
+  UNW_PPC64_F2  = 34,
+  UNW_PPC64_F3  = 35,
+  UNW_PPC64_F4  = 36,
+  UNW_PPC64_F5  = 37,
+  UNW_PPC64_F6  = 38,
+  UNW_PPC64_F7  = 39,
+  UNW_PPC64_F8  = 40,
+  UNW_PPC64_F9  = 41,
+  UNW_PPC64_F10 = 42,
+  UNW_PPC64_F11 = 43,
+  UNW_PPC64_F12 = 44,
+  UNW_PPC64_F13 = 45,
+  UNW_PPC64_F14 = 46,
+  UNW_PPC64_F15 = 47,
+  UNW_PPC64_F16 = 48,
+  UNW_PPC64_F17 = 49,
+  UNW_PPC64_F18 = 50,
+  UNW_PPC64_F19 = 51,
+  UNW_PPC64_F20 = 52,
+  UNW_PPC64_F21 = 53,
+  UNW_PPC64_F22 = 54,
+  UNW_PPC64_F23 = 55,
+  UNW_PPC64_F24 = 56,
+  UNW_PPC64_F25 = 57,
+  UNW_PPC64_F26 = 58,
+  UNW_PPC64_F27 = 59,
+  UNW_PPC64_F28 = 60,
+  UNW_PPC64_F29 = 61,
+  UNW_PPC64_F30 = 62,
+  UNW_PPC64_F31 = 63,
+  UNW_PPC64_LR  = 64,
+  UNW_PPC64_CTR = 65,
+  UNW_PPC64_CR0 = 66,
+  UNW_PPC64_CR1 = 67,
+  UNW_PPC64_CR2 = 68,
+  UNW_PPC64_CR3 = 69,
+  UNW_PPC64_CR4 = 70,
+  UNW_PPC64_CR5 = 71,
+  

[libunwind] r321679 - Don't use a strict larger-than comparison in the check_fit/does_fit static assert

2018-01-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan  2 14:11:22 2018
New Revision: 321679

URL: http://llvm.org/viewvc/llvm-project?rev=321679=rev
Log:
Don't use a strict larger-than comparison in the check_fit/does_fit static 
assert

For builds that only target one architecture, this was required to
be an exact match, while it previously required the allocation to be
strictly larger than the largest concrete one. Requiring it to be
larger than on equal should be enough.

This makes it more straightforward to update _LIBUNWIND_CONTEXT_SIZE
and _LIBUNWIND_CURSOR_SIZE.

Modified:
libunwind/trunk/src/config.h

Modified: libunwind/trunk/src/config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=321679=321678=321679=diff
==
--- libunwind/trunk/src/config.h (original)
+++ libunwind/trunk/src/config.h Tue Jan  2 14:11:22 2018
@@ -155,7 +155,7 @@
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
 # define COMP_OP ==
 #else
-# define COMP_OP <
+# define COMP_OP <=
 #endif
 template 
 struct check_fit {


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r321667 - [PPC64] Port to ppc64le - initial version

2018-01-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Jan  2 12:10:54 2018
New Revision: 321667

URL: http://llvm.org/viewvc/llvm-project?rev=321667=rev
Log:
[PPC64] Port to ppc64le - initial version

Initial working version of libunwind for PowerPC 64. Tested on
little-endian ppc64 host only.
Based on the existing PowerPC 32 code.

It supports:

- context save/restore (unw_getcontext, unw_init_local, unw_resume)
- read/write from/to saved registers
- backtrace (unw_step)

Patch by Leandro Lupori!

Differential Revision: https://reviews.llvm.org/D41386

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/AddressSpace.hpp
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindCursor.hpp
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S
libunwind/trunk/src/assembly.h
libunwind/trunk/src/config.h
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=321667=321666=321667=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Tue Jan  2 12:10:54 2018
@@ -18,6 +18,7 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86   8
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC   112
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   287
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K  31
@@ -39,6 +40,11 @@
 #define _LIBUNWIND_CURSOR_SIZE 33
 #  endif
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64
+# elif defined(__powerpc64__)
+#  define _LIBUNWIND_TARGET_PPC64 1
+#  define _LIBUNWIND_CONTEXT_SIZE 136
+#  define _LIBUNWIND_CURSOR_SIZE 148
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
 #  define _LIBUNWIND_CONTEXT_SIZE 117
@@ -84,13 +90,14 @@
 # define _LIBUNWIND_TARGET_I386
 # define _LIBUNWIND_TARGET_X86_64 1
 # define _LIBUNWIND_TARGET_PPC 1
+# define _LIBUNWIND_TARGET_PPC64 1
 # define _LIBUNWIND_TARGET_AARCH64 1
 # define _LIBUNWIND_TARGET_ARM 1
 # define _LIBUNWIND_TARGET_OR1K 1
 # define _LIBUNWIND_TARGET_MIPS_O32 1
 # define _LIBUNWIND_TARGET_MIPS_N64 1
-# define _LIBUNWIND_CONTEXT_SIZE 128
-# define _LIBUNWIND_CURSOR_SIZE 140
+# define _LIBUNWIND_CONTEXT_SIZE 136
+# define _LIBUNWIND_CURSOR_SIZE 148
 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
 #endif // _LIBUNWIND_IS_NATIVE_ONLY
 

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=321667=321666=321667=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Tue Jan  2 12:10:54 2018
@@ -325,6 +325,120 @@ enum {
   UNW_PPC_SPEFSCR = 112
 };
 
+// 64-bit ppc register numbers
+enum {
+  UNW_PPC64_R0  = 0,
+  UNW_PPC64_R1  = 1,
+  UNW_PPC64_R2  = 2,
+  UNW_PPC64_R3  = 3,
+  UNW_PPC64_R4  = 4,
+  UNW_PPC64_R5  = 5,
+  UNW_PPC64_R6  = 6,
+  UNW_PPC64_R7  = 7,
+  UNW_PPC64_R8  = 8,
+  UNW_PPC64_R9  = 9,
+  UNW_PPC64_R10 = 10,
+  UNW_PPC64_R11 = 11,
+  UNW_PPC64_R12 = 12,
+  UNW_PPC64_R13 = 13,
+  UNW_PPC64_R14 = 14,
+  UNW_PPC64_R15 = 15,
+  UNW_PPC64_R16 = 16,
+  UNW_PPC64_R17 = 17,
+  UNW_PPC64_R18 = 18,
+  UNW_PPC64_R19 = 19,
+  UNW_PPC64_R20 = 20,
+  UNW_PPC64_R21 = 21,
+  UNW_PPC64_R22 = 22,
+  UNW_PPC64_R23 = 23,
+  UNW_PPC64_R24 = 24,
+  UNW_PPC64_R25 = 25,
+  UNW_PPC64_R26 = 26,
+  UNW_PPC64_R27 = 27,
+  UNW_PPC64_R28 = 28,
+  UNW_PPC64_R29 = 29,
+  UNW_PPC64_R30 = 30,
+  UNW_PPC64_R31 = 31,
+  UNW_PPC64_F0  = 32,
+  UNW_PPC64_F1  = 33,
+  UNW_PPC64_F2  = 34,
+  UNW_PPC64_F3  = 35,
+  UNW_PPC64_F4  = 36,
+  UNW_PPC64_F5  = 37,
+  UNW_PPC64_F6  = 38,
+  UNW_PPC64_F7  = 39,
+  UNW_PPC64_F8  = 40,
+  UNW_PPC64_F9  = 41,
+  UNW_PPC64_F10 = 42,
+  UNW_PPC64_F11 = 43,
+  UNW_PPC64_F12 = 44,
+  UNW_PPC64_F13 = 45,
+  UNW_PPC64_F14 = 46,
+  UNW_PPC64_F15 = 47,
+  UNW_PPC64_F16 = 48,
+  UNW_PPC64_F17 = 49,
+  UNW_PPC64_F18 = 50,
+  UNW_PPC64_F19 = 51,
+  UNW_PPC64_F20 = 52,
+  UNW_PPC64_F21 = 53,
+  UNW_PPC64_F22 = 54,
+  UNW_PPC64_F23 = 55,
+  UNW_PPC64_F24 = 56,
+  UNW_PPC64_F25 = 57,
+  UNW_PPC64_F26 = 58,
+  UNW_PPC64_F27 = 59,
+  UNW_PPC64_F28 = 60,
+  UNW_PPC64_F29 = 61,
+  UNW_PPC64_F30 = 62,
+  UNW_PPC64_F31 = 63,
+  UNW_PPC64_LR  = 64,
+  UNW_PPC64_CTR = 65,
+  UNW_PPC64_CR0 = 66,
+  UNW_PPC64_CR1 = 67,
+  UNW_PPC64_CR2 = 68,
+  UNW_PPC64_CR3 = 69,
+  UNW_PPC64_CR4 = 70,
+  UNW_PPC64_CR5 = 71,
+  UNW_PPC64_CR6 = 72,
+  UNW_PPC64_CR7 = 73,
+  UNW_PPC64_XER = 74,
+  UNW_PPC64_V0 

[libunwind] r319300 - Support building libunwind as a DLL

2017-11-29 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Nov 29 00:21:12 2017
New Revision: 319300

URL: http://llvm.org/viewvc/llvm-project?rev=319300=rev
Log:
Support building libunwind as a DLL

Differential Revision: https://reviews.llvm.org/D40483

Modified:
libunwind/trunk/CMakeLists.txt
libunwind/trunk/src/config.h

Modified: libunwind/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/CMakeLists.txt?rev=319300=319299=319300=diff
==
--- libunwind/trunk/CMakeLists.txt (original)
+++ libunwind/trunk/CMakeLists.txt Wed Nov 29 00:21:12 2017
@@ -308,6 +308,11 @@ if (MSVC)
   add_definitions(-D_CRT_SECURE_NO_WARNINGS)
 endif()
 
+# Disable DLL annotations on Windows for static builds.
+if (WIN32 AND LIBUNWIND_ENABLE_STATIC AND NOT LIBUNWIND_ENABLE_SHARED)
+  add_definitions(-D_LIBUNWIND_DISABLE_VISIBILITY_ANNOTATIONS)
+endif()
+
 
#===
 # Setup Source Code
 
#===

Modified: libunwind/trunk/src/config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/config.h?rev=319300=319299=319300=diff
==
--- libunwind/trunk/src/config.h (original)
+++ libunwind/trunk/src/config.h Wed Nov 29 00:21:12 2017
@@ -50,9 +50,13 @@
   #define _LIBUNWIND_EXPORT
   #define _LIBUNWIND_HIDDEN
 #else
-  // FIXME: these macros are not correct for COFF targets
-  #define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
-  #define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+  #if !defined(__ELF__) && !defined(__MACH__)
+#define _LIBUNWIND_EXPORT __declspec(dllexport)
+#define _LIBUNWIND_HIDDEN
+  #else
+#define _LIBUNWIND_EXPORT __attribute__((visibility("default")))
+#define _LIBUNWIND_HIDDEN __attribute__((visibility("hidden")))
+  #endif
 #endif
 
 #if (defined(__APPLE__) && defined(__arm__)) || 
defined(__USING_SJLJ_EXCEPTIONS__)


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r319299 - [CMake] Use the variable from the right project in install-unwind

2017-11-29 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Nov 29 00:20:57 2017
New Revision: 319299

URL: http://llvm.org/viewvc/llvm-project?rev=319299=rev
Log:
[CMake] Use the variable from the right project in install-unwind

Modified:
libunwind/trunk/src/CMakeLists.txt

Modified: libunwind/trunk/src/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=319299=319298=319299=diff
==
--- libunwind/trunk/src/CMakeLists.txt (original)
+++ libunwind/trunk/src/CMakeLists.txt Wed Nov 29 00:20:57 2017
@@ -143,5 +143,5 @@ if (NOT CMAKE_CONFIGURATION_TYPES AND LI
 DEPENDS unwind
 COMMAND "${CMAKE_COMMAND}"
 -DCMAKE_INSTALL_COMPONENT=unwind
--P "${LIBCXXABI_BINARY_DIR}/cmake_install.cmake")
+-P "${LIBUNWIND_BINARY_DIR}/cmake_install.cmake")
 endif()


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r319145 - [test] Fix a typo in a test comment. NFC.

2017-11-27 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Nov 27 21:47:24 2017
New Revision: 319145

URL: http://llvm.org/viewvc/llvm-project?rev=319145=rev
Log:
[test] Fix a typo in a test comment. NFC.

Modified:
cfe/trunk/test/CodeGenCXX/dllexport.cpp

Modified: cfe/trunk/test/CodeGenCXX/dllexport.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/dllexport.cpp?rev=319145=319144=319145=diff
==
--- cfe/trunk/test/CodeGenCXX/dllexport.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/dllexport.cpp Mon Nov 27 21:47:24 2017
@@ -826,7 +826,7 @@ struct __declspec(dllexport) B {
 // M32-DAG: define weak_odr dllexport x86_thiscallcc void 
@"\01??_FB@pr26490@@QAEXXZ"
 }
 
-// dllexport trumps dllexport on an explicit instantiation.
+// dllexport trumps dllimport on an explicit instantiation.
 template  struct ExplicitInstantiationTwoAttributes { void f() {} 
};
 template struct __declspec(dllexport) __declspec(dllimport) 
ExplicitInstantiationTwoAttributes;
 // M32-DAG: define weak_odr dllexport x86_thiscallcc void 
@"\01?f@?$ExplicitInstantiationTwoAttributes@H@@QAEXXZ"


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libcxx] r318902 - Allow to set locale on Windows.

2017-11-23 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Nov 23 02:38:18 2017
New Revision: 318902

URL: http://llvm.org/viewvc/llvm-project?rev=318902=rev
Log:
Allow to set locale on Windows.

Fix the problem PR31516 with setting locale on Windows by wrapping
_locale_t with a pointer-like class.

Reduces 74 test failures in std/localization test suite to 47 test
failures (on llvm clang, Visual Studio 2015). Number of test failures
doesn't depend on the platform (x86 or x64).

Patch by Andrey Khalyavin.

Differential Revision: https://reviews.llvm.org/D40181

Modified:
libcxx/trunk/include/__config
libcxx/trunk/include/__locale
libcxx/trunk/include/support/win32/locale_win32.h
libcxx/trunk/src/support/win32/locale_win32.cpp

Modified: libcxx/trunk/include/__config
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__config?rev=318902=318901=318902=diff
==
--- libcxx/trunk/include/__config (original)
+++ libcxx/trunk/include/__config Thu Nov 23 02:38:18 2017
@@ -890,7 +890,7 @@ template  struct __static_asse
 #define _LIBCPP_NONUNIQUE_RTTI_BIT (1ULL << 63)
 #endif
 
-#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT) ||   
\
+#if defined(__APPLE__) || defined(__FreeBSD__) || defined(_LIBCPP_MSVCRT_LIKE) 
|| \
 defined(__sun__) || defined(__NetBSD__) || defined(__CloudABI__)
 #define _LIBCPP_LOCALE__L_EXTENSIONS 1
 #endif

Modified: libcxx/trunk/include/__locale
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__locale?rev=318902=318901=318902=diff
==
--- libcxx/trunk/include/__locale (original)
+++ libcxx/trunk/include/__locale Thu Nov 23 02:38:18 2017
@@ -49,7 +49,7 @@
 
 _LIBCPP_BEGIN_NAMESPACE_STD
 
-#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS) || defined(_LIBCPP_MSVCRT)
+#if !defined(_LIBCPP_LOCALE__L_EXTENSIONS)
 struct __libcpp_locale_guard {
   _LIBCPP_INLINE_VISIBILITY
   __libcpp_locale_guard(locale_t& __loc) : __old_loc_(uselocale(__loc)) {}
@@ -65,6 +65,32 @@ private:
   __libcpp_locale_guard(__libcpp_locale_guard const&);
   __libcpp_locale_guard& operator=(__libcpp_locale_guard const&);
 };
+#elif defined(_LIBCPP_MSVCRT_LIKE)
+struct __libcpp_locale_guard {
+__libcpp_locale_guard(locale_t __l) :
+__status(_configthreadlocale(_ENABLE_PER_THREAD_LOCALE)),
+__locale_collate(setlocale(LC_COLLATE, __l.__get_locale())),
+__locale_ctype(setlocale(LC_CTYPE, __l.__get_locale())),
+__locale_monetary(setlocale(LC_MONETARY, __l.__get_locale())),
+__locale_numeric(setlocale(LC_NUMERIC, __l.__get_locale())),
+__locale_time(setlocale(LC_TIME, __l.__get_locale()))
+// LC_MESSAGES is not supported on Windows.
+{}
+~__libcpp_locale_guard() {
+setlocale(LC_COLLATE, __locale_collate);
+setlocale(LC_CTYPE, __locale_ctype);
+setlocale(LC_MONETARY, __locale_monetary);
+setlocale(LC_NUMERIC, __locale_numeric);
+setlocale(LC_TIME, __locale_time);
+_configthreadlocale(__status);
+}
+int __status;
+char* __locale_collate;
+char* __locale_ctype;
+char* __locale_monetary;
+char* __locale_numeric;
+char* __locale_time;
+};
 #endif
 
 

Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=318902=318901=318902=diff
==
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Thu Nov 23 02:38:18 2017
@@ -14,6 +14,7 @@
 #include <__config>
 #include 
 #include  // _locale_t
+#include <__nullptr>
 
 #define LC_COLLATE_MASK _M_COLLATE
 #define LC_CTYPE_MASK _M_CTYPE
@@ -28,13 +29,77 @@
  | LC_NUMERIC_MASK \
  | LC_TIME_MASK )
 
-#define locale_t _locale_t
+class locale_t {
+public:
+locale_t()
+: __locale(nullptr), __locale_str(nullptr) {}
+locale_t(std::nullptr_t)
+: __locale(nullptr), __locale_str(nullptr) {}
+locale_t(_locale_t __locale, const char* __locale_str)
+: __locale(__locale), __locale_str(__locale_str) {}
+
+friend bool operator==(const locale_t& __left, const locale_t& __right) {
+return __left.__locale == __right.__locale;
+}
+
+friend bool operator==(const locale_t& __left, int __right) {
+return __left.__locale == nullptr && __right == 0;
+}
+
+friend bool operator==(const locale_t& __left, std::nullptr_t) {
+return __left.__locale == nullptr;
+}
+
+friend bool operator==(int __left, const locale_t& __right) {
+return __left == 0 && nullptr == __right.__locale;
+}
+
+friend bool operator==(std::nullptr_t, const locale_t& __right) {
+return nullptr == __right.__locale;
+}
+
+friend bool 

[libcxx] r318810 - Remove a broken win32 locale function redirection

2017-11-21 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Tue Nov 21 14:41:15 2017
New Revision: 318810

URL: http://llvm.org/viewvc/llvm-project?rev=318810=rev
Log:
Remove a broken win32 locale function redirection

One can't replace vsscanf(_l) with a sscanf(_l) that doesn't
take a va_list.

This has been untouched since it was added in SVN r140728, so
apparently it hasn't been used since. One reason for this mistake
originally might have been that there was no _vsscanf_l until MSVC
2015.

Since it's unused, just remove this define.

Differential Revision: https://reviews.llvm.org/D40323

Modified:
libcxx/trunk/include/support/win32/locale_win32.h

Modified: libcxx/trunk/include/support/win32/locale_win32.h
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/support/win32/locale_win32.h?rev=318810=318809=318810=diff
==
--- libcxx/trunk/include/support/win32/locale_win32.h (original)
+++ libcxx/trunk/include/support/win32/locale_win32.h Tue Nov 21 14:41:15 2017
@@ -106,7 +106,6 @@ isupper_l(int c, _locale_t loc)
 #define strftime_l _strftime_l
 #endif
 #define sscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
-#define vsscanf_l( __s, __l, __f, ...) _sscanf_l( __s, __f, __l, __VA_ARGS__ )
 #define sprintf_l( __s, __l, __f, ... ) _sprintf_l( __s, __f, __l, __VA_ARGS__ 
)
 #define vsprintf_l( __s, __l, __f, ... ) _vsprintf_l( __s, __f, __l, 
__VA_ARGS__ )
 #define vsnprintf_l( __s, __n, __l, __f, ... ) _vsnprintf_l( __s, __n, __f, 
__l, __VA_ARGS__ )


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r318511 - [MinGW] Define __ARM_DWARF_EH__ for MinGW/ARM

2017-11-17 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Fri Nov 17 00:06:49 2017
New Revision: 318511

URL: http://llvm.org/viewvc/llvm-project?rev=318511=rev
Log:
[MinGW] Define __ARM_DWARF_EH__ for MinGW/ARM

Since SVN r318510, the MinGW/ARM configuration defaults to
dwarf exception handling.

Differential Revision: https://reviews.llvm.org/D39533

Modified:
cfe/trunk/lib/Basic/Targets/ARM.cpp
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/lib/Basic/Targets/ARM.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/ARM.cpp?rev=318511=318510=318511=diff
==
--- cfe/trunk/lib/Basic/Targets/ARM.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/ARM.cpp Fri Nov 17 00:06:49 2017
@@ -1002,6 +1002,7 @@ void MinGWARMTargetInfo::getTargetDefine
   DefineStd(Builder, "WIN32", Opts);
   DefineStd(Builder, "WINNT", Opts);
   Builder.defineMacro("_ARM_");
+  Builder.defineMacro("__ARM_DWARF_EH__");
   addMinGWDefines(Opts, Builder);
 }
 

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=318511=318510=318511=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Fri Nov 17 00:06:49 2017
@@ -2645,6 +2645,10 @@
 // Thumbebv7: #define __THUMB_INTERWORK__ 1
 // Thumbebv7: #define __thumb2__ 1
 
+// RUN: %clang -E -dM -ffreestanding -target thumbv7-pc-mingw32 %s -o - | 
FileCheck -match-full-lines -check-prefix THUMB-MINGW %s
+
+// THUMB-MINGW:#define __ARM_DWARF_EH__ 1
+
 //
 // RUN: %clang_cc1 -E -dM -ffreestanding -triple=i386-none-none < /dev/null | 
FileCheck -match-full-lines -check-prefix I386 %s
 //


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r318446 - Remove a FIXME about truncated section names

2017-11-16 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Nov 16 11:36:48 2017
New Revision: 318446

URL: http://llvm.org/viewvc/llvm-project?rev=318446=rev
Log:
Remove a FIXME about truncated section names

If the linker chose to store the full section name instead of truncating
it, this field doesn't contain a truncated name, but an offset into
the string table of the binary. The string table isn't loaded/mapped
into memory during runtime though, so it's not possible to read the
full section name, unless we try to locate the DLL/EXE on disk that
the HMODULE corresponds to and load that manually.

Due to this, lld now always prefers writing a truncated section name
for sections that will be mapped at runtime, even when debug info is
enabled.

Differential Revision: https://reviews.llvm.org/D39918

Modified:
libunwind/trunk/src/AddressSpace.hpp

Modified: libunwind/trunk/src/AddressSpace.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/AddressSpace.hpp?rev=318446=318445=318446=diff
==
--- libunwind/trunk/src/AddressSpace.hpp (original)
+++ libunwind/trunk/src/AddressSpace.hpp Thu Nov 16 11:36:48 2017
@@ -382,8 +382,6 @@ inline bool LocalAddressSpace::findUnwin
   found_obj = true;
   } else if (!strncmp((const char *)pish->Name, ".eh_frame",
   IMAGE_SIZEOF_SHORT_NAME)) {
-// FIXME: This section name actually is truncated, ideally we
-// should locate and check the full long name instead.
 info.dwarf_section = begin;
 info.dwarf_section_length = pish->Misc.VirtualSize;
 found_hdr = true;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r318383 - [docs] Mention that dwarf unwinding should be supported on arm64/windows

2017-11-15 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Wed Nov 15 23:16:36 2017
New Revision: 318383

URL: http://llvm.org/viewvc/llvm-project?rev=318383=rev
Log:
[docs] Mention that dwarf unwinding should be supported on arm64/windows

This didn't require any further changes to libunwind as long as win64
in general is handled correctly.

Differential Revision: https://reviews.llvm.org/D39632

Modified:
libunwind/trunk/docs/index.rst

Modified: libunwind/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=318383=318382=318383=diff
==
--- libunwind/trunk/docs/index.rst (original)
+++ libunwind/trunk/docs/index.rst Wed Nov 15 23:16:36 2017
@@ -41,19 +41,19 @@ Platform and Compiler Support
 
 libunwind is known to work on the following platforms:
 
-   
-OS   Arch CompilersUnwind Info
-   
-Any  i386, x86_64, ARMClangSjLj
-Bare Metal   ARM  Clang, GCC   EHABI
-FreeBSD  i386, x86_64, ARM64  ClangDWARF CFI
-iOS  ARM  ClangSjLj
-LinuxARM  Clang, GCC   EHABI
-Linuxi386, x86_64, ARM64  Clang, GCC   DWARF CFI
-Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
-NetBSD   x86_64   Clang, GCC   DWARF CFI
-Windows  i386, x86_64, ARMClangDWARF CFI
-   
+   
+OS   Arch CompilersUnwind Info
+   
+Any  i386, x86_64, ARMClangSjLj
+Bare Metal   ARM  Clang, GCC   EHABI
+FreeBSD  i386, x86_64, ARM64  ClangDWARF CFI
+iOS  ARM  ClangSjLj
+LinuxARM  Clang, GCC   EHABI
+Linuxi386, x86_64, ARM64  Clang, GCC   DWARF CFI
+Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
+NetBSD   x86_64   Clang, GCC   DWARF CFI
+Windows  i386, x86_64, ARM, ARM64 ClangDWARF CFI
+   
 
 The following minimum compiler versions are strongly recommended.
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r317504 - [X86] Add 3dnow and 3dnowa to the list of valid target features

2017-11-06 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Nov  6 12:33:13 2017
New Revision: 317504

URL: http://llvm.org/viewvc/llvm-project?rev=317504=rev
Log:
[X86] Add 3dnow and 3dnowa to the list of valid target features

These were missed in SVN r316783, which broke compiling mingw-w64 CRT.

Differential Revision: https://reviews.llvm.org/D39631

Added:
cfe/trunk/test/Headers/mm3dnow.c
Modified:
cfe/trunk/lib/Basic/Targets/X86.cpp

Modified: cfe/trunk/lib/Basic/Targets/X86.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets/X86.cpp?rev=317504=317503=317504=diff
==
--- cfe/trunk/lib/Basic/Targets/X86.cpp (original)
+++ cfe/trunk/lib/Basic/Targets/X86.cpp Mon Nov  6 12:33:13 2017
@@ -1121,6 +1121,8 @@ void X86TargetInfo::getTargetDefines(con
 
 bool X86TargetInfo::isValidFeatureName(StringRef Name) const {
   return llvm::StringSwitch(Name)
+  .Case("3dnow", true)
+  .Case("3dnowa", true)
   .Case("aes", true)
   .Case("avx", true)
   .Case("avx2", true)

Added: cfe/trunk/test/Headers/mm3dnow.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Headers/mm3dnow.c?rev=317504=auto
==
--- cfe/trunk/test/Headers/mm3dnow.c (added)
+++ cfe/trunk/test/Headers/mm3dnow.c Mon Nov  6 12:33:13 2017
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding %s -verify
+// RUN: %clang_cc1 -fsyntax-only -ffreestanding -x c++ %s -verify
+// expected-no-diagnostics
+
+#if defined(i386) || defined(__x86_64__)
+#include 
+
+int __attribute__((__target__(("3dnow" foo(int a) {
+  _m_femms();
+  return 4;
+}
+
+__m64 __attribute__((__target__(("3dnowa" bar(__m64 a) {
+  return _m_pf2iw(a);
+}
+#endif


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[libunwind] r317423 - Add ifdefs around ELF specific parts of UnwindRegisters*.S for arm

2017-11-04 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sat Nov  4 14:01:31 2017
New Revision: 317423

URL: http://llvm.org/viewvc/llvm-project?rev=317423=rev
Log:
Add ifdefs around ELF specific parts of UnwindRegisters*.S for arm

This allows using dwarf exceptions on MinGW/ARM.

Differential Revision: https://reviews.llvm.org/D39534

Modified:
libunwind/trunk/docs/index.rst
libunwind/trunk/src/UnwindRegistersRestore.S
libunwind/trunk/src/UnwindRegistersSave.S

Modified: libunwind/trunk/docs/index.rst
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/docs/index.rst?rev=317423=317422=317423=diff
==
--- libunwind/trunk/docs/index.rst (original)
+++ libunwind/trunk/docs/index.rst Sat Nov  4 14:01:31 2017
@@ -52,7 +52,7 @@ LinuxARM  Clang,
 Linuxi386, x86_64, ARM64  Clang, GCC   DWARF CFI
 Mac OS X i386, x86_64 Clang, GCC   DWARF CFI
 NetBSD   x86_64   Clang, GCC   DWARF CFI
-Windows  i386, x86_64 ClangDWARF CFI
+Windows  i386, x86_64, ARMClangDWARF CFI
    
 
 The following minimum compiler versions are strongly recommended.

Modified: libunwind/trunk/src/UnwindRegistersRestore.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersRestore.S?rev=317423=317422=317423=diff
==
--- libunwind/trunk/src/UnwindRegistersRestore.S (original)
+++ libunwind/trunk/src/UnwindRegistersRestore.S Sat Nov  4 14:01:31 2017
@@ -391,7 +391,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3-d16
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMDEPy)
   @ VFP and iwMMX instructions are only available when compiling with the flags
   @ that enable them. We do not want to do that in the library (because we do 
not
@@ -410,7 +412,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3-d16
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreVFPWithFLDMXEPy)
   vldmia r0, {d0-d15} @ fldmiax is deprecated in ARMv7+ and now behaves like 
vldmia
   JMP(lr)
@@ -422,7 +426,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreVFPv3EPy)
   vldmia r0, {d16-d31}
   JMP(lr)
@@ -436,7 +442,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .arch armv5te
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm12restoreiWMMXEPy)
   ldcl p1, cr0, [r0], #8  @ wldrd wR0, [r0], #8
   ldcl p1, cr1, [r0], #8  @ wldrd wR1, [r0], #8
@@ -463,7 +471,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .arch armv5te
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm19restoreiWMMXControlEPj)
   ldc2 p1, cr8, [r0], #4  @ wldrw wCGR0, [r0], #4
   ldc2 p1, cr9, [r0], #4  @ wldrw wCGR1, [r0], #4

Modified: libunwind/trunk/src/UnwindRegistersSave.S
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindRegistersSave.S?rev=317423=317422=317423=diff
==
--- libunwind/trunk/src/UnwindRegistersSave.S (original)
+++ libunwind/trunk/src/UnwindRegistersSave.S Sat Nov  4 14:01:31 2017
@@ -375,7 +375,9 @@ DEFINE_LIBUNWIND_FUNCTION(unw_getcontext
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3-d16
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMDEPy)
   vstmia r0, {d0-d15}
   JMP(lr)
@@ -387,7 +389,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3-d16
+#endif
 
DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm16saveVFPWithFSTMXEPy)
   vstmia r0, {d0-d15} @ fstmiax is deprecated in ARMv7+ and now behaves like 
vstmia
   JMP(lr)
@@ -399,7 +403,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .fpu vfpv3
+#endif
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveVFPv3EPy)
   @ VFP and iwMMX instructions are only available when compiling with the flags
   @ that enable them. We do not want to do that in the library (because we do 
not
@@ -420,7 +426,9 @@ DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9li
 @  values pointer is in r0
 @
   .p2align 2
+#if defined(__ELF__)
   .arch armv5te
+#endif
 DEFINE_LIBUNWIND_PRIVATE_FUNCTION(_ZN9libunwind13Registers_arm9saveiWMMXEPy)
   stcl p1, cr0, [r0], #8  @ wstrd 

[libunwind] r317192 - Fix building for ARM with dwarf exception handling

2017-11-02 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Thu Nov  2 01:16:16 2017
New Revision: 317192

URL: http://llvm.org/viewvc/llvm-project?rev=317192=rev
Log:
Fix building for ARM with dwarf exception handling

The previous definition of _LIBUNWIND_HIGHEST_DWARF_REGISTER seems
to be a copy of the ARM64 value (introduced in SVN r276128); since
the code actually hasn't compiled properly for arm in dwarf mode
before, this hasn't actually been used. Set it to the correct value
based on the UNW_ARM_* enum values.

The iwmmx control variables have to be made mutable, since they are
touched from within getRegister (which previously wasn't const), and
getRegister is used on a const Registers object in DwarfInstructions.hpp.

Differential Revision: https://reviews.llvm.org/D39251

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/Registers.hpp
libunwind/trunk/src/UnwindCursor.hpp
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=317192=317191=317192=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Thu Nov  2 01:16:16 2017
@@ -19,7 +19,7 @@
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC   112
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   95
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   287
 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K  31
 
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
@@ -75,7 +75,7 @@
 # define _LIBUNWIND_TARGET_OR1K 1
 # define _LIBUNWIND_CONTEXT_SIZE 128
 # define _LIBUNWIND_CURSOR_SIZE 140
-# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 119
+# define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287
 #endif // _LIBUNWIND_IS_NATIVE_ONLY
 
 #endif // LIBUNWIND_CONFIG_H__

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=317192=317191=317192=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Thu Nov  2 01:16:16 2017
@@ -73,7 +73,7 @@ typedef struct unw_addr_space *unw_addr_
 
 typedef int unw_regnum_t;
 typedef uintptr_t unw_word_t;
-#if defined(_LIBUNWIND_ARM_EHABI)
+#if defined(__arm__)
 typedef uint64_t unw_fpreg_t;
 #else
 typedef double unw_fpreg_t;

Modified: libunwind/trunk/src/Registers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=317192=317191=317192=diff
==
--- libunwind/trunk/src/Registers.hpp (original)
+++ libunwind/trunk/src/Registers.hpp Thu Nov  2 01:16:16 2017
@@ -1386,7 +1386,7 @@ public:
   Registers_arm(const void *registers);
 
   boolvalidRegister(int num) const;
-  uint32_tgetRegister(int num);
+  uint32_tgetRegister(int num) const;
   voidsetRegister(int num, uint32_t value);
   boolvalidFloatRegister(int num) const;
   unw_fpreg_t getFloatRegister(int num);
@@ -1399,6 +1399,7 @@ public:
 restoreSavedFloatRegisters();
 restoreCoreAndJumpTo();
   }
+  static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM; }
 
   uint32_t  getSP() const { return _registers.__sp; }
   void  setSP(uint32_t value) { _registers.__sp = value; }
@@ -1472,11 +1473,11 @@ private:
   // Whether iWMMX data registers are saved.
   bool _saved_iwmmx;
   // Whether iWMMX control registers are saved.
-  bool _saved_iwmmx_control;
+  mutable bool _saved_iwmmx_control;
   // iWMMX registers
   unw_fpreg_t _iwmmx[16];
   // iWMMX control registers
-  uint32_t _iwmmx_control[4];
+  mutable uint32_t _iwmmx_control[4];
 #endif
 };
 
@@ -1533,7 +1534,7 @@ inline bool Registers_arm::validRegister
   return false;
 }
 
-inline uint32_t Registers_arm::getRegister(int regNum) {
+inline uint32_t Registers_arm::getRegister(int regNum) const {
   if (regNum == UNW_REG_SP || regNum == UNW_ARM_SP)
 return _registers.__sp;
 

Modified: libunwind/trunk/src/UnwindCursor.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/UnwindCursor.hpp?rev=317192=317191=317192=diff
==
--- libunwind/trunk/src/UnwindCursor.hpp (original)
+++ libunwind/trunk/src/UnwindCursor.hpp Thu Nov  2 01:16:16 2017
@@ -583,6 +583,12 @@ private:
   }
 #endif
 
+#if defined(_LIBUNWIND_TARGET_ARM)
+  compact_unwind_encoding_t dwarfEncoding(Registers_arm &) const {
+return 0;
+  }
+#endif
+
 #if defined (_LIBUNWIND_TARGET_OR1K)
   compact_unwind_encoding_t dwarfEncoding(Registers_or1k &) const {
 return 0;

Modified: 

[libunwind] r316942 - Change unw_word_t to always have the same size as the pointer size

2017-10-30 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Mon Oct 30 12:06:34 2017
New Revision: 316942

URL: http://llvm.org/viewvc/llvm-project?rev=316942=rev
Log:
Change unw_word_t to always have the same size as the pointer size

This matches the original libunwind API. This also unifies the
type between ARM EHABI and the other configurations, and allows
getting rid of a number of casts in log messages.

The cursor size updates for ppc and or1k are untested, but
unw_proc_info_t shrinks by 4 uint64_t units on i386 at least.

Differential Revision: https://reviews.llvm.org/D39365

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/include/libunwind.h
libunwind/trunk/src/Unwind-EHABI.cpp
libunwind/trunk/src/UnwindLevel1-gcc-ext.c
libunwind/trunk/src/UnwindLevel1.c
libunwind/trunk/src/libunwind.cpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=316942=316941=316942=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Mon Oct 30 12:06:34 2017
@@ -26,7 +26,7 @@
 # if defined(__i386__)
 #  define _LIBUNWIND_TARGET_I386
 #  define _LIBUNWIND_CONTEXT_SIZE 8
-#  define _LIBUNWIND_CURSOR_SIZE 19
+#  define _LIBUNWIND_CURSOR_SIZE 15
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86
 # elif defined(__x86_64__)
 #  define _LIBUNWIND_TARGET_X86_64 1
@@ -41,7 +41,7 @@
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
 #  define _LIBUNWIND_CONTEXT_SIZE 117
-#  define _LIBUNWIND_CURSOR_SIZE 128
+#  define _LIBUNWIND_CURSOR_SIZE 124
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC
 # elif defined(__aarch64__)
 #  define _LIBUNWIND_TARGET_AARCH64 1
@@ -61,7 +61,7 @@
 # elif defined(__or1k__)
 #  define _LIBUNWIND_TARGET_OR1K 1
 #  define _LIBUNWIND_CONTEXT_SIZE 16
-#  define _LIBUNWIND_CURSOR_SIZE 28
+#  define _LIBUNWIND_CURSOR_SIZE 24
 #  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K
 # else
 #  error "Unsupported architecture."

Modified: libunwind/trunk/include/libunwind.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/libunwind.h?rev=316942=316941=316942=diff
==
--- libunwind/trunk/include/libunwind.h (original)
+++ libunwind/trunk/include/libunwind.h Mon Oct 30 12:06:34 2017
@@ -72,11 +72,10 @@ typedef struct unw_cursor_t unw_cursor_t
 typedef struct unw_addr_space *unw_addr_space_t;
 
 typedef int unw_regnum_t;
+typedef uintptr_t unw_word_t;
 #if defined(_LIBUNWIND_ARM_EHABI)
-typedef uint32_t unw_word_t;
 typedef uint64_t unw_fpreg_t;
 #else
-typedef uint64_t unw_word_t;
 typedef double unw_fpreg_t;
 #endif
 

Modified: libunwind/trunk/src/Unwind-EHABI.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-EHABI.cpp?rev=316942=316941=316942=diff
==
--- libunwind/trunk/src/Unwind-EHABI.cpp (original)
+++ libunwind/trunk/src/Unwind-EHABI.cpp Mon Oct 30 12:06:34 2017
@@ -14,6 +14,7 @@
 
 #if defined(_LIBUNWIND_ARM_EHABI)
 
+#include 
 #include 
 #include 
 #include 
@@ -468,11 +469,11 @@ unwind_phase1(unw_context_t *uc, unw_cur
   unw_word_t pc;
   unw_get_reg(cursor, UNW_REG_IP, );
   _LIBUNWIND_TRACE_UNWINDING(
-  "unwind_phase1(ex_ojb=%p): pc=0x%llX, start_ip=0x%llX, func=%s, "
-  "lsda=0x%llX, personality=0x%llX",
-  static_cast(exception_object), (long long)pc,
-  (long long)frameInfo.start_ip, functionName,
-  (long long)frameInfo.lsda, (long long)frameInfo.handler);
+  "unwind_phase1(ex_ojb=%p): pc=0x%" PRIxPTR ", start_ip=0x%" PRIxPTR 
", func=%s, "
+  "lsda=0x%" PRIxPTR ", personality=0x%" PRIxPTR,
+  static_cast(exception_object), pc,
+  frameInfo.start_ip, functionName,
+  frameInfo.lsda, frameInfo.handler);
 }
 
 // If there is a personality routine, ask it if it will want to stop at
@@ -584,11 +585,11 @@ static _Unwind_Reason_Code unwind_phase2
   (frameInfo.start_ip + offset > frameInfo.end_ip))
 functionName = ".anonymous.";
   _LIBUNWIND_TRACE_UNWINDING(
-  "unwind_phase2(ex_ojb=%p): start_ip=0x%llX, func=%s, sp=0x%llX, "
-  "lsda=0x%llX, personality=0x%llX",
-  static_cast(exception_object), (long long)frameInfo.start_ip,
-  functionName, (long long)sp, (long long)frameInfo.lsda,
-  (long long)frameInfo.handler);
+  "unwind_phase2(ex_ojb=%p): start_ip=0x%" PRIxPTR ", func=%s, sp=0x%" 
PRIxPTR ", "
+  "lsda=0x%" PRIxPTR ", personality=0x%" PRIxPTR "",
+  static_cast(exception_object), frameInfo.start_ip,
+  functionName, sp, frameInfo.lsda,
+  frameInfo.handler);

[libunwind] r316843 - Restore arch specific lastDwarfRegNum in builds without _LIBUNWIND_IS_NATIVE_ONLY

2017-10-28 Thread Martin Storsjo via cfe-commits
Author: mstorsjo
Date: Sat Oct 28 13:19:49 2017
New Revision: 316843

URL: http://llvm.org/viewvc/llvm-project?rev=316843=rev
Log:
Restore arch specific lastDwarfRegNum in builds without 
_LIBUNWIND_IS_NATIVE_ONLY

This restores the previous behaviour of the Registers_* classes
after SVN r316745.

Differential Revision: https://reviews.llvm.org/D39382

Modified:
libunwind/trunk/include/__libunwind_config.h
libunwind/trunk/src/Registers.hpp

Modified: libunwind/trunk/include/__libunwind_config.h
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/include/__libunwind_config.h?rev=316843=316842=316843=diff
==
--- libunwind/trunk/include/__libunwind_config.h (original)
+++ libunwind/trunk/include/__libunwind_config.h Sat Oct 28 13:19:49 2017
@@ -15,33 +15,39 @@
 #define _LIBUNWIND_ARM_EHABI
 #endif
 
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86   8
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_6432
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC   112
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM   95
+#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K  31
+
 #if defined(_LIBUNWIND_IS_NATIVE_ONLY)
 # if defined(__i386__)
 #  define _LIBUNWIND_TARGET_I386
 #  define _LIBUNWIND_CONTEXT_SIZE 8
 #  define _LIBUNWIND_CURSOR_SIZE 19
-#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 8
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86
 # elif defined(__x86_64__)
 #  define _LIBUNWIND_TARGET_X86_64 1
 #  if defined(_WIN64)
 #define _LIBUNWIND_CONTEXT_SIZE 54
 #define _LIBUNWIND_CURSOR_SIZE 66
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER 32
 #  else
 #define _LIBUNWIND_CONTEXT_SIZE 21
 #define _LIBUNWIND_CURSOR_SIZE 33
-#define _LIBUNWIND_HIGHEST_DWARF_REGISTER 16
 #  endif
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64
 # elif defined(__ppc__)
 #  define _LIBUNWIND_TARGET_PPC 1
 #  define _LIBUNWIND_CONTEXT_SIZE 117
 #  define _LIBUNWIND_CURSOR_SIZE 128
-#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 112
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC
 # elif defined(__aarch64__)
 #  define _LIBUNWIND_TARGET_AARCH64 1
 #  define _LIBUNWIND_CONTEXT_SIZE 66
 #  define _LIBUNWIND_CURSOR_SIZE 78
-#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 95
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64
 # elif defined(__arm__)
 #  define _LIBUNWIND_TARGET_ARM 1
 #  if defined(__ARM_WMMX)
@@ -51,12 +57,12 @@
 #define _LIBUNWIND_CONTEXT_SIZE 42
 #define _LIBUNWIND_CURSOR_SIZE 49
 #  endif
-#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 95
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM
 # elif defined(__or1k__)
 #  define _LIBUNWIND_TARGET_OR1K 1
 #  define _LIBUNWIND_CONTEXT_SIZE 16
 #  define _LIBUNWIND_CURSOR_SIZE 28
-#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 31
+#  define _LIBUNWIND_HIGHEST_DWARF_REGISTER 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K
 # else
 #  error "Unsupported architecture."
 # endif

Modified: libunwind/trunk/src/Registers.hpp
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Registers.hpp?rev=316843=316842=316843=diff
==
--- libunwind/trunk/src/Registers.hpp (original)
+++ libunwind/trunk/src/Registers.hpp Sat Oct 28 13:19:49 2017
@@ -44,7 +44,7 @@ public:
   voidsetVectorRegister(int num, v128 value);
   const char *getRegisterName(int num);
   voidjumpto();
-  static int  lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER; }
+  static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86; }
 
   uint32_t  getSP() const  { return _registers.__esp; }
   void  setSP(uint32_t value)  { _registers.__esp = value; }
@@ -250,7 +250,7 @@ public:
   voidsetVectorRegister(int num, v128 value);
   const char *getRegisterName(int num);
   voidjumpto();
-  static int  lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER; }
+  static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64; }
 
   uint64_t  getSP() const  { return _registers.__rsp; }
   void  setSP(uint64_t value)  { _registers.__rsp = value; }
@@ -560,7 +560,7 @@ public:
   voidsetVectorRegister(int num, v128 value);
   const char *getRegisterName(int num);
   voidjumpto();
-  static int  lastDwarfRegNum() { return _LIBUNWIND_HIGHEST_DWARF_REGISTER; }
+  static int  lastDwarfRegNum() { return 
_LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC; }
 
   uint64_t  getSP() const { return _registers.__r1; }
   void  setSP(uint32_t value) { _registers.__r1 = value; }
@@ -1126,7 +1126,7 @@ public:
   voidsetVectorRegister(int num, v128 value);
   const char *getRegisterName(int num);
   

  1   2   >