[PATCH] D50144: Add Windows support for the GNUstep Objective-C ABI V2.
compnerd added inline comments. Comment at: lib/AST/MicrosoftMangle.cpp:1886 case BuiltinType::ObjCId: -mangleArtificalTagType(TTK_Struct, "objc_object"); +mangleArtificalTagType(TTK_Struct, ".objc_object"); break; DHowett-MSFT wrote: > I'm interested in @smeenai's take on this, as well. Hmm, doesn't this break ObjC/ObjC++ interoperability? I don't think that we should be changing the decoration here for the MS ABI case. Repository: rC Clang https://reviews.llvm.org/D50144 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
compnerd added a comment. It would be nice if we had a test case added for this, but, seems correct to me. Comment at: src/DwarfInstructions.hpp:195 } +else if (i == (int)cieInfo.returnAddressRegister) + returnAddress = registers.getRegister(i); I think that we should stick to LLVM style (coddled braces) and use C++ style casts. Repository: rUNW libunwind https://reviews.llvm.org/D46971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46791: Make -gsplit-dwarf generally available
compnerd added inline comments. Comment at: test/Driver/split-debug.c:23 +// Macosx // RUN: %clang -target x86_64-macosx -gsplit-dwarf -c -### %s 2> %t NIT: macOS or the legacy spelling of Mac OS X. https://reviews.llvm.org/D46791 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38249: [libunwind] Skip building unused parts when targeting SJLJ
compnerd accepted this revision. compnerd added inline comments. This revision is now accepted and ready to land. Comment at: src/libunwind.cpp:27 +#ifndef __USING_SJLJ_EXCEPTIONS__ #include "AddressSpace.hpp" I would prefer that you used: #if !defined(__USING_SJLJ_EXCEPTIONS__) https://reviews.llvm.org/D38249 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. I have a complete implementation for this which is known to work on Windows at least. The only thing that `__thread` requires is a working linker (which does not include binutils -- I do have a local patch to make that work though). Are these two the only ones that are missing? At the very least, the implementation of `SetTopOfFunctionStack` is incorrect. https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37905: [libclang, bindings]: add spelling location
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. If I'm not mistaken, the change just means that the python bindings need a "newer" libclang, libclang's interfaces don't really change. I think that is acceptable. Comment at: bindings/python/clang/cindex.py:320 +return self._get_spelling()['offset'] def __eq__(self, other): Does it make sense to introduce two new properties `expansion` and `spelling` and have the four fields be properties on those properties? It seems like it would be more pythonic. Comment at: tools/libclang/CXSourceLocation.cpp:321 *static_cast(location.ptr_data[0]); // FIXME: This should call SourceManager::getSpellingLoc(). + SourceLocation SpellLoc = SM.getSpellingLoc(Loc); Remove the FIXME please. https://reviews.llvm.org/D37905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37905: [libclang, bindings]: add spelling location
compnerd accepted this revision. compnerd added inline comments. This revision is now accepted and ready to land. Comment at: bindings/python/clang/cindex.py:320 +return self._get_spelling()['offset'] def __eq__(self, other): frutiger wrote: > compnerd wrote: > > Does it make sense to introduce two new properties `expansion` and > > `spelling` and have the four fields be properties on those properties? It > > seems like it would be more pythonic. > I agree, but I was concerned about breaking existing users that might be > using the expansion properties directly on this object. Would marking them > deprecated in the documentation suffice? Yeah, I think thats a great approach. https://reviews.llvm.org/D37905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38381: [libunwind] Skip building x86 parts of UnwindRegisters*.S when targeting SjLj
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. I really wish that there was a way to handle this in the build system instead. https://reviews.llvm.org/D38381 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38380: [libunwind] Add CMake support for building for MinGW
compnerd added a comment. With an explanation of the `gcc_s` vs `gcc`, I think this LG. Comment at: cmake/config-ix.cmake:38 +else () + set(MINGW_RUNTIME gcc_s gcc) +endif() This seems really weird. `gcc_s` and `gcc` are the same library, the former is the shared version of the latter. Is this really correct? https://reviews.llvm.org/D38380 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable
compnerd added a comment. Ugh, I was mixing up `_Unwind_SjLj_Register` with this function. Comment at: src/Unwind-sjlj.c:468 +#ifndef __APPLE__ +__thread struct _Unwind_FunctionContext *stack = NULL; I would prefer: #if !defined(__APPLE__) Comment at: src/Unwind-sjlj.c:469 +#ifndef __APPLE__ +__thread struct _Unwind_FunctionContext *stack = NULL; + Please make this `static`. Comment at: src/Unwind-sjlj.c:481 +#endif // !defined(__APPLE__) + #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) Can't both of these also be static? https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable
compnerd accepted this revision. compnerd added inline comments. This revision is now accepted and ready to land. Comment at: src/Unwind-sjlj.c:481 +#endif // !defined(__APPLE__) + #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) mstorsjo wrote: > compnerd wrote: > > Can't both of these also be static? > No, since they're declared earlier as non-static. Yeah, that is a bug :-). `__Unwind_SjLj_GetTopOfFunctionStack` and `__Unwind_SjLj_SetToOfFunctionStack` are implementation details of LLVM's libunwind. They are not part of the public interfaces, and are not used outside of this TU, and should be marked as static as such. I think that changing the prototype declaration to indicate this is reasonable. I suppose that I can make that change separately. https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. Actually, Ill go ahead and make the more invasive change and that will provide this properly. https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38250: [libunwind] Implement the Get/SetTopOfFunctionStack functions via a __thread TLS variable
compnerd added a comment. I believe that SVN r314632 should address the issue more thorougly. https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38522: [libc++] Support Microsoft ABI without vcruntime headers
compnerd added a comment. Why do we expect the tests to fail without vcruntime headers? Comment at: src/support/runtime/exception_msvc.ipp:31 +extern "C" { +typedef void(__CRTDECL* terminate_handler)(); +_ACRTIMP terminate_handler __cdecl set_terminate( Really? clang-format removes the space there? typedef void (__CRTDECL * terminate_handler)(void); seems so much more readable. https://reviews.llvm.org/D38522 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver
compnerd updated this revision to Diff 117832. compnerd added a comment. Moves the logic back into Basic. The flags are now optional, but controlled by the driver. The test adjustments are to map the old `-fshort-wchar` to `-fwchar-type=short -fno-signed-wchar` for the most part, there is one case where we were checking that we were passing `-fshort-wchar` through to the frontend, which we no longer do. https://reviews.llvm.org/D37891 Files: include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/LangOptions.def include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Basic/TargetInfo.cpp lib/Basic/Targets/AArch64.cpp lib/Basic/Targets/ARM.cpp lib/Basic/Targets/AVR.h lib/Basic/Targets/OSTargets.h lib/Basic/Targets/X86.h lib/Basic/Targets/XCore.h lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInstance.cpp lib/Frontend/CompilerInvocation.cpp test/CXX/conv/conv.prom/p2.cpp test/CodeGen/arm-metadata.c test/CodeGen/pascal-wchar-string.c test/CodeGen/string-literal-short-wstring.c test/CodeGen/string-literal-unicode-conversion.c test/CodeGen/wchar-size.c test/Driver/clang_f_opts.c test/Headers/wchar_limits.cpp test/Index/index-pch.cpp test/Lexer/wchar.c test/Preprocessor/init.c test/Preprocessor/pr19649-unsigned-wchar_t.c test/Preprocessor/wchar_t.c test/Sema/wchar.c test/SemaCXX/short-wchar-sign.cpp Index: test/SemaCXX/short-wchar-sign.cpp === --- test/SemaCXX/short-wchar-sign.cpp +++ test/SemaCXX/short-wchar-sign.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -pedantic -verify %s -// RUN: %clang_cc1 -fshort-wchar -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -pedantic -verify %s // expected-no-diagnostics Index: test/Sema/wchar.c === --- test/Sema/wchar.c +++ test/Sema/wchar.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -// RUN: %clang_cc1 %s -fsyntax-only -fshort-wchar -verify -DSHORT_WCHAR +// RUN: %clang_cc1 %s -fsyntax-only -fwchar-type=short -fno-signed-wchar -verify -DSHORT_WCHAR typedef __WCHAR_TYPE__ wchar_t; Index: test/Preprocessor/wchar_t.c === --- /dev/null +++ test/Preprocessor/wchar_t.c @@ -0,0 +1,90 @@ +// RUN: %clang_cc1 -triple i386-pc-solaris -dM -E %s -o - | FileCheck %s -check-prefix CHECK-SOLARIS +// CHECK-SOLARIS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-SOLARIS-DAG: #define __WCHAR_TYPE__ int +// CHECK-SOLARIS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple avr-unknown-unknown -fwchar-type=int -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-AVR +// CHECK-AVR-DAG: #define __WCHAR_MAX__ 32767 +// CHECK-AVR-DAG: #define __WCHAR_TYPE__ int +// CHECK-AVR-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-none-gnu -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-APCS +// CHECK-ARM-APCS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-APCS-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-APCS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-netbsd-gnu -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-NETBSD-AAPCS +// CHECK-ARM-NETBSD-AAPCS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-NETBSD-AAPCS-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-NETBSD-AAPCS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-openbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-OPENBSD +// CHECK-ARM-OPENBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-OPENBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-OPENBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm64-apple-ios -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-DARWIN +// CHECK-ARM64-DARWIN-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-DARWIN-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-DARWIN-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-netbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-NETBSD +// CHECK-ARM64-NETBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-NETBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-NETBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-openbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-OPENBSD +// CHECK-ARM64-OPENBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-OPENBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-OPENBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-none -fwchar-type=int -fno-signed-wchar -dM -E %s -o - | FileChec
[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver
compnerd added inline comments. Comment at: lib/Basic/TargetInfo.cpp:29 +namespace { +TargetInfo::IntType GetDefaultWCharType(const llvm::Triple &T) { + const llvm::Triple::ArchType Arch = T.getArch(); rnk wrote: > How is this better than what we had before? It's totally inconsistent with > our existing strategy for figuring out type widths and sizes. Our current > approach can be extended for new targets, this requires modifying shared > TargetInfo code. This refactoring *should* be NFC anyway, so if we did want > to do it, we'd want to split it out. The previous thing was split across and was fairly difficult to identify what was going on. I tend to think that this makes it easier to identify what is going on. However, if you have a strong opinion on this, Im willing to switch it back (though, possibly retain some of the adjustments to make it easier to follow). https://reviews.llvm.org/D37891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver
compnerd updated this revision to Diff 118085. compnerd added a comment. Split the defaulting back to all the various targets. Repository: rL LLVM https://reviews.llvm.org/D37891 Files: include/clang/Basic/DiagnosticFrontendKinds.td include/clang/Basic/LangOptions.def include/clang/Driver/CC1Options.td include/clang/Driver/Options.td lib/Basic/TargetInfo.cpp lib/Basic/Targets/AArch64.cpp lib/Basic/Targets/ARM.cpp lib/Basic/Targets/AVR.h lib/Basic/Targets/OSTargets.h lib/Basic/Targets/X86.h lib/Driver/ToolChains/Clang.cpp lib/Frontend/CompilerInstance.cpp lib/Frontend/CompilerInvocation.cpp test/CXX/conv/conv.prom/p2.cpp test/CodeGen/arm-metadata.c test/CodeGen/pascal-wchar-string.c test/CodeGen/string-literal-short-wstring.c test/CodeGen/string-literal-unicode-conversion.c test/CodeGen/wchar-size.c test/Driver/clang_f_opts.c test/Headers/wchar_limits.cpp test/Index/index-pch.cpp test/Lexer/wchar.c test/Preprocessor/init.c test/Preprocessor/pr19649-unsigned-wchar_t.c test/Preprocessor/wchar_t.c test/Sema/wchar.c test/SemaCXX/short-wchar-sign.cpp Index: test/SemaCXX/short-wchar-sign.cpp === --- test/SemaCXX/short-wchar-sign.cpp +++ test/SemaCXX/short-wchar-sign.cpp @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple i386-mingw32 -fsyntax-only -pedantic -verify %s -// RUN: %clang_cc1 -fshort-wchar -fsyntax-only -pedantic -verify %s +// RUN: %clang_cc1 -fwchar-type=short -fno-signed-wchar -fsyntax-only -pedantic -verify %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsyntax-only -pedantic -verify %s // expected-no-diagnostics Index: test/Sema/wchar.c === --- test/Sema/wchar.c +++ test/Sema/wchar.c @@ -1,5 +1,5 @@ // RUN: %clang_cc1 %s -fsyntax-only -verify -// RUN: %clang_cc1 %s -fsyntax-only -fshort-wchar -verify -DSHORT_WCHAR +// RUN: %clang_cc1 %s -fsyntax-only -fwchar-type=short -fno-signed-wchar -verify -DSHORT_WCHAR typedef __WCHAR_TYPE__ wchar_t; Index: test/Preprocessor/wchar_t.c === --- /dev/null +++ test/Preprocessor/wchar_t.c @@ -0,0 +1,90 @@ +// RUN: %clang_cc1 -triple i386-pc-solaris -dM -E %s -o - | FileCheck %s -check-prefix CHECK-SOLARIS +// CHECK-SOLARIS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-SOLARIS-DAG: #define __WCHAR_TYPE__ int +// CHECK-SOLARIS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple avr-unknown-unknown -fwchar-type=int -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-AVR +// CHECK-AVR-DAG: #define __WCHAR_MAX__ 32767 +// CHECK-AVR-DAG: #define __WCHAR_TYPE__ int +// CHECK-AVR-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-none-gnu -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-APCS +// CHECK-ARM-APCS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-APCS-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-APCS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-netbsd-gnu -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-NETBSD-AAPCS +// CHECK-ARM-NETBSD-AAPCS-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-NETBSD-AAPCS-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-NETBSD-AAPCS-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm-unknown-openbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM-OPENBSD +// CHECK-ARM-OPENBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM-OPENBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM-OPENBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple arm64-apple-ios -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-DARWIN +// CHECK-ARM64-DARWIN-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-DARWIN-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-DARWIN-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-netbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-NETBSD +// CHECK-ARM64-NETBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-NETBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-NETBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-openbsd -fsigned-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-OPENBSD +// CHECK-ARM64-OPENBSD-DAG: #define __WCHAR_MAX__ 2147483647 +// CHECK-ARM64-OPENBSD-DAG: #define __WCHAR_TYPE__ int +// CHECK-ARM64-OPENBSD-NOT: #define __WCHAR_UNSIGNED__ 0 + +// RUN: %clang_cc1 -triple aarch64-unknown-none -fwchar-type=int -fno-signed-wchar -dM -E %s -o - | FileCheck %s -check-prefix CHECK-ARM64-AAPCS64 +// CHECK-ARM64-AAPCS64-DAG: #define __WCHAR_MAX__ 4294967295U +// CHECK-ARM64-AAPCS64-DAG: #define __WCHAR_TYPE__ unsigned int +// CHECK-ARM64-AAPCS64-DAG: #define __WCHAR_UNSIGNED__ 1 + +// RUN: %clang_cc1 -triple xcore-unknown-unknown -fwchar-type=
[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver
compnerd added inline comments. Comment at: lib/Basic/Targets/AArch64.cpp:47-51 + bool IsNetBSD = getTriple().getOS() == llvm::Triple::NetBSD; + bool IsOpenBSD = getTriple().getOS() == llvm::Triple::OpenBSD; + if (!getTriple().isOSDarwin() && !IsNetBSD && !IsOpenBSD) +WCharType = UnsignedInt; + rnk wrote: > I felt like this was clearer the way it was before, and we're already > checking for the BSDs above. Okay, I'll swap it back. Comment at: lib/Basic/Targets/AArch64.cpp:160-161 - Builder.defineMacro("__ARM_SIZEOF_WCHAR_T", Opts.ShortWChar ? "2" : "4"); + Builder.defineMacro("__ARM_SIZEOF_WCHAR_T", + llvm::utostr(Opts.WCharSize ? Opts.WCharSize : 4)); rnk wrote: > This is correct because we compute macros after we apply the flag override, > right? Correct :-) Repository: rL LLVM https://reviews.llvm.org/D37891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37891: Driver: hoist the `wchar_t` handling to the driver
compnerd closed this revision. compnerd added a comment. SVN r315126 Repository: rL LLVM https://reviews.llvm.org/D37891 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38680: [libunwind] Fix handling of DW_CFA_GNU_args_size
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. I think that the problem is that we are using the generic register name, but we need to use the target specific register name. On x86, EIP/ESP are swapped. We should also have a test case for this. I had reduced this down to a simpler test case of: void f(int,int,int,int,int,int,int,int,int); int main() { try { f(0,1,2,3,4,5,6,7,8); } catch (int) { return 0; } return 1; } https://reviews.llvm.org/D38680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38821: [COFF, ARM64] Add MS builtins __dmb, __dsb, __isb
compnerd added a comment. Don't you need a change to the intrinsics to actually map the builtin? https://reviews.llvm.org/D38821 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38819: [libunwind] Add support for dwarf unwinding on windows on x86_64
compnerd added inline comments. Comment at: include/unwind.h:125 uintptr_t private_2; // holds sp that phase1 found for phase2 to use -#ifndef __LP64__ +#if !defined(__LP64__) && !defined(_WIN64) // The implementation of _Unwind_Exception uses an attribute mode on the I think I would prefer that we do this generically as: #if __POINTER_WIDTH__ == 32 Comment at: src/AddressSpace.hpp:145 public: -#ifdef __LP64__ +#if defined(__LP64__) || defined(_WIN64) typedef uint64_t pint_t; I think I prefer the generic: #if __POINTER_WIDTH__ == 64 Comment at: src/AddressSpace.hpp:197 inline uintptr_t LocalAddressSpace::getP(pint_t addr) { -#ifdef __LP64__ +#if defined(__LP64__) || defined(_WIN64) return get64(addr); Same. Comment at: src/UnwindRegistersRestore.S:68 # +#if defined(_WIN32) +# On entry, thread_state pointer is in rcx This is confusing. Why is this `_WIN32`? Shouldn't this be `_WIN64`? Comment at: src/UnwindRegistersRestore.S:72 + movq 56(%rcx), %rax # rax holds new stack pointer + subq $16, %rax + movq %rax, 56(%rcx) Hmm, why is this `$16`? The `$rsp` was adjusted by `$8` in the `setjmp`. Comment at: src/UnwindRegistersSave.S:66 DEFINE_LIBUNWIND_FUNCTION(unw_getcontext) +#if defined(_WIN32) + movq %rax, (%rcx) Shouldn't this be `_WIN64`? https://reviews.llvm.org/D38819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37905: [libclang, bindings]: add spelling location
compnerd accepted this revision. compnerd added a comment. @frutiger you have commit rights now right? https://reviews.llvm.org/D37905 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39156: [libunwind] Make HIDDEN_DIRECTIVE a function-like macro. NFCI.
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. Thanks for cleaning this up. IIRC, I have similar behavior in compiler-rt for `HIDDEN_SYMBOL`. https://reviews.llvm.org/D39156 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38819: [libunwind] Add support for dwarf unwinding on windows on x86_64
compnerd added inline comments. Comment at: src/UnwindRegistersRestore.S:98 + # skip fs + # skip gs + movq 56(%rcx), %rsp # cut back rsp to new location Doesn't Win64 ABI require some of the MMX registers be saved/restored too? https://reviews.llvm.org/D38819 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39217: [libclang, bindings]: add spelling location
compnerd added a subscriber: akyrtzi. compnerd added a comment. I think that this is reasonable given that it is addressing a long standing issue. CC'ing @akyrtzi for his opinion as well. https://reviews.llvm.org/D39217 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39206: [libunwind] Add missing checks for register number
compnerd accepted this revision. compnerd added a comment. I'd say out of range rather than too big. https://reviews.llvm.org/D39206 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39251: [libunwind] Fix building for ARM with dwarf exception handling
compnerd added a comment. Whats the motivation for adding DWARF based unwinding on ARM? What environment is using this? Comment at: src/Registers.hpp:1342 } + static int lastDwarfRegNum() { return 287; } Can we not use `_LIBUNWIND_HIGHEST_DWARF_REGISTER` here? Comment at: src/UnwindLevel1.c:79 _LIBUNWIND_TRACE_UNWINDING( "unwind_phase1(ex_ojb=%p): pc=0x%" PRIx64 ", start_ip=0x%" PRIx64 ", func=%s, lsda=0x%" PRIx64 ", personality=0x%" PRIx64 "", Please convert these to `%p` instead. The casting and conversion is kinda ... unnecessary. https://reviews.llvm.org/D39251 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42758: Support `#pragma comment(lib, "name")` in the frontend for ELF
compnerd added a comment. @jhenderson I believe that the first one is what this is implementing. I believe that adding the last two as a patch following this one is preferable as that is specific to the needs for PS4, but, both of those should be possible to accommodate. I would love to see a single unified approach here, so Im happy to help get that implemented. Repository: rC Clang https://reviews.llvm.org/D42758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42758: Support `#pragma comment(lib, "name")` in the frontend for ELF
compnerd updated this revision to Diff 133030. compnerd added a comment. Add additional test, update docs Repository: rC Clang https://reviews.llvm.org/D42758 Files: docs/LanguageExtensions.rst lib/CodeGen/CodeGenModule.cpp lib/CodeGen/CodeGenModule.h lib/Parse/ParsePragma.cpp test/CodeGen/elf-linker-options.c test/CodeGen/pragma-comment.c test/Preprocessor/pragma-comment-linux.c test/Preprocessor/pragma_microsoft.c Index: test/Preprocessor/pragma_microsoft.c === --- test/Preprocessor/pragma_microsoft.c +++ test/Preprocessor/pragma_microsoft.c @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -fsyntax-only -verify -fms-extensions -Wunknown-pragmas -// RUN: not %clang_cc1 %s -fms-extensions -E | FileCheck %s +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc %s -fsyntax-only -verify -fms-extensions -Wunknown-pragmas +// RUN: not %clang_cc1 -triple i686-unknown-windows-msvc %s -fms-extensions -E | FileCheck %s // REQUIRES: non-ps4-sdk // rdar://6495941 Index: test/Preprocessor/pragma-comment-linux.c === --- /dev/null +++ test/Preprocessor/pragma-comment-linux.c @@ -0,0 +1,5 @@ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fsyntax-only -verify %s -Wunknown-pragmas + +#pragma comment(linker, "") +// expected-warning@-1 {{'#pragma comment linker' ignored}} + Index: test/CodeGen/pragma-comment.c === --- test/CodeGen/pragma-comment.c +++ test/CodeGen/pragma-comment.c @@ -23,10 +23,9 @@ // CHECK: ![[bar]] = !{!" /bar=2"} // CHECK: ![[foo]] = !{!" /foo=\22foo bar\22"} -// LINUX: !{!"-lmsvcrt.lib"} -// LINUX: !{!"-lkernel32"} -// LINUX: !{!"-lUSER32.LIB"} -// LINUX: !{!" /bar=2"} +// LINUX: !{!"lib", !"msvcrt.lib"} +// LINUX: !{!"lib", !"kernel32"} +// LINUX: !{!"lib", !"USER32.LIB"} // PS4: !{!"\01msvcrt.lib"} // PS4: !{!"\01kernel32"} Index: test/CodeGen/elf-linker-options.c === --- /dev/null +++ test/CodeGen/elf-linker-options.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple i686---elf -emit-llvm %s -o - | FileCheck %s + +#pragma comment(lib, "alpha") + +// CHECK: !llvm.linker.options = !{[[NODE:![0-9]+]]} +// CHECK: [[NODE]] = !{!"lib", !"alpha"} + Index: lib/Parse/ParsePragma.cpp === --- lib/Parse/ParsePragma.cpp +++ lib/Parse/ParsePragma.cpp @@ -295,7 +295,8 @@ OpenMPHandler.reset(new PragmaNoOpenMPHandler()); PP.AddPragmaHandler(OpenMPHandler.get()); - if (getLangOpts().MicrosoftExt || getTargetInfo().getTriple().isPS4()) { + if (getLangOpts().MicrosoftExt || + getTargetInfo().getTriple().isOSBinFormatELF()) { MSCommentHandler.reset(new PragmaCommentHandler(Actions)); PP.AddPragmaHandler(MSCommentHandler.get()); } @@ -377,7 +378,8 @@ PP.RemovePragmaHandler(OpenMPHandler.get()); OpenMPHandler.reset(); - if (getLangOpts().MicrosoftExt || getTargetInfo().getTriple().isPS4()) { + if (getLangOpts().MicrosoftExt || + getTargetInfo().getTriple().isOSBinFormatELF()) { PP.RemovePragmaHandler(MSCommentHandler.get()); MSCommentHandler.reset(); } @@ -2449,6 +2451,12 @@ return; } + if (PP.getTargetInfo().getTriple().isOSBinFormatELF() && Kind != PCK_Lib) { +PP.Diag(Tok.getLocation(), diag::warn_pragma_comment_ignored) +<< II->getName(); +return; + } + // On PS4, issue a warning about any pragma comments other than // #pragma comment lib. if (PP.getTargetInfo().getTriple().isPS4() && Kind != PCK_Lib) { Index: lib/CodeGen/CodeGenModule.h === --- lib/CodeGen/CodeGenModule.h +++ lib/CodeGen/CodeGenModule.h @@ -1094,6 +1094,8 @@ /// value. void AddDependentLib(StringRef Lib); + void AddELFLibDirective(StringRef Lib); + llvm::GlobalVariable::LinkageTypes getFunctionLinkage(GlobalDecl GD); void setFunctionLinkage(GlobalDecl GD, llvm::Function *F) { Index: lib/CodeGen/CodeGenModule.cpp === --- lib/CodeGen/CodeGenModule.cpp +++ lib/CodeGen/CodeGenModule.cpp @@ -1411,6 +1411,12 @@ LinkerOptionsMetadata.push_back(llvm::MDNode::get(getLLVMContext(), MDOpts)); } +void CodeGenModule::AddELFLibDirective(StringRef Lib) { + auto &C = getLLVMContext(); + LinkerOptionsMetadata.push_back(llvm::MDNode::get( + C, {llvm::MDString::get(C, "lib"), llvm::MDString::get(C, Lib)})); +} + void CodeGenModule::AddDependentLib(StringRef Lib) { llvm::SmallString<24> Opt; getTargetCodeGenInfo().getDependentLibraryOption(Lib, Opt); @@ -4345,7 +4351,11 @@ AppendLinkerOptions(PCD->getArg()); break; case PCK_Lib: - AddDependentLib(PCD->getArg()); + if (getTarget().getTriple().isOSBinFormatELF() && + !getTarget().getTriple().isPS4())
[PATCH] D42768: AST: add an extension to support SwiftCC on MS ABI
compnerd updated this revision to Diff 133087. compnerd added a comment. address design changes Repository: rC Clang https://reviews.llvm.org/D42768 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-swiftcall-cc.cpp Index: test/CodeGenCXX/msabi-swiftcall-cc.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-swiftcall-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: @"\01?f@@YAU?$__swiftcall__@X@@XZ" + +void (__attribute__((__swiftcall__)) *p)(); +// CHECK-DAG: @"\01?p@@3P6AU?$__swiftcall__@X@@XZA" + +namespace { +void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { } +// CHECK-DAG: "\01?f@?A@@YAU?$__swiftcall__@X@@XZ" +} + +namespace n { +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: "\01?f@n@@YAU?$__swiftcall__@X@@XZ" +} + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__swiftcall__)) m() { } + // CHECK-DAG: "\01?m@S@@QAAU?$__swiftcall__@X@@XZ" +}; + +void f(void (__attribute__((__swiftcall__))())) {} +// CHECK-DAG: "\01?f@@YAXP6AU?$__swiftcall__@X@@XZ@Z" + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -316,6 +316,17 @@ return ND == Structor || getStructor(ND) == Structor; } + void mangleSwiftCall(QualType T, SourceRange R, QualifierMangleMode QMM) { +llvm::SmallString<64> TemplateMangling; +llvm::raw_svector_ostream Stream(TemplateMangling); +MicrosoftCXXNameMangler Extra(Context, Stream); + +Stream << "?$"; +Extra.mangleSourceName("__swiftcall__"); +Extra.mangleType(T, R, QMM); +mangleArtificalTagType(TTK_Struct, TemplateMangling); + } + void mangleUnqualifiedName(const NamedDecl *ND) { mangleUnqualifiedName(ND, ND->getDeclName()); } @@ -950,11 +961,10 @@ } } +// ::= [] +// ::= [] void MicrosoftCXXNameMangler::mangleNestedName(const NamedDecl *ND) { - // ::= [] - // ::= [] const DeclContext *DC = getEffectiveDeclContext(ND); - while (!DC->isTranslationUnit()) { if (isa(ND) || isa(ND)) { unsigned Disc; @@ -1959,7 +1969,7 @@ mangleQualifiers(Quals, /*IsMember=*/false); } - mangleCallingConvention(CC); + mangleCallingConvention(CC == CC_Swift ? CC_C : CC); // ::= // ::= @ # structors (they have no declared return type) @@ -2017,7 +2027,10 @@ } else { if (ResultType->isVoidType()) ResultType = ResultType.getUnqualifiedType(); - mangleType(ResultType, Range, QMM_Result); + if (CC == CC_Swift) +mangleSwiftCall(ResultType, Range, QMM_Result); + else +mangleType(ResultType, Range, QMM_Result); } } Index: test/CodeGenCXX/msabi-swiftcall-cc.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-swiftcall-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: @"\01?f@@YAU?$__swiftcall__@X@@XZ" + +void (__attribute__((__swiftcall__)) *p)(); +// CHECK-DAG: @"\01?p@@3P6AU?$__swiftcall__@X@@XZA" + +namespace { +void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { } +// CHECK-DAG: "\01?f@?A@@YAU?$__swiftcall__@X@@XZ" +} + +namespace n { +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: "\01?f@n@@YAU?$__swiftcall__@X@@XZ" +} + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__swiftcall__)) m() { } + // CHECK-DAG: "\01?m@S@@QAAU?$__swiftcall__@X@@XZ" +}; + +void f(void (__attribute__((__swiftcall__))())) {} +// CHECK-DAG: "\01?f@@YAXP6AU?$__swiftcall__@X@@XZ@Z" + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -316,6 +316,17 @@ return ND == Structor || getStructor(ND) == Structor; } + void mangleSwiftCall(QualType T, SourceRange R, QualifierMangleMode QMM) { +llvm::SmallString<64> TemplateMangling; +llvm::raw_svector_ostream Stream(TemplateMangling); +MicrosoftCXXNameMangler Extra(Context, Stream); + +Stream << "?$"; +Extra.mangleSourceName("__swiftcall__"); +Extra.mangleType(T, R, QMM); +mangleArtificalTagType(TTK_Struct, TemplateMangling); + } + void mangleUnqualifiedName(const NamedDecl *ND) { mangleUnqualifiedName(ND, ND->getDeclName()); } @@ -950,11 +961,10 @@ } } +// ::= [] +// ::= [] void MicrosoftCXXNameMangler::mangleNestedName(const NamedDecl *ND) { - // ::= [] - // ::= [] const DeclContext *DC = g
[PATCH] D42768: AST: support SwiftCC on MS ABI
compnerd updated this revision to Diff 133114. compnerd retitled this revision from "AST: add an extension to support SwiftCC on MS ABI" to "AST: support SwiftCC on MS ABI". compnerd edited the summary of this revision. compnerd added a comment. Update to what Microsoft has communicated offline Repository: rC Clang https://reviews.llvm.org/D42768 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-swiftcall-cc.cpp Index: test/CodeGenCXX/msabi-swiftcall-cc.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-swiftcall-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: @"\01?f@@YSXXZ" + +void (__attribute__((__swiftcall__)) *p)(); +// CHECK-DAG: @"\01?p@@3P6SXXZA" + +namespace { +void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { } +// CHECK-DAG: "\01?f@?A@@YSXXZ" +} + +namespace n { +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: "\01?f@n@@YSXXZ" +} + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__swiftcall__)) m() { } + // CHECK-DAG: "\01?m@S@@QASXXZ" +}; + +void f(void (__attribute__((__swiftcall__))())) {} +// CHECK-DAG: "\01?f@@YAXP6SXXZ@Z" + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -950,11 +950,10 @@ } } +// ::= [] +// ::= [] void MicrosoftCXXNameMangler::mangleNestedName(const NamedDecl *ND) { - // ::= [] - // ::= [] const DeclContext *DC = getEffectiveDeclContext(ND); - while (!DC->isTranslationUnit()) { if (isa(ND) || isa(ND)) { unsigned Disc; @@ -2151,6 +2150,7 @@ case CC_X86StdCall: Out << 'G'; break; case CC_X86FastCall: Out << 'I'; break; case CC_X86VectorCall: Out << 'Q'; break; +case CC_Swift: Out << 'S'; break; case CC_X86RegCall: Out << 'w'; break; } } Index: test/CodeGenCXX/msabi-swiftcall-cc.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-swiftcall-cc.cpp @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fdeclspec -emit-llvm %s -o - | FileCheck %s + +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: @"\01?f@@YSXXZ" + +void (__attribute__((__swiftcall__)) *p)(); +// CHECK-DAG: @"\01?p@@3P6SXXZA" + +namespace { +void __attribute__((__swiftcall__)) __attribute__((__used__)) f() { } +// CHECK-DAG: "\01?f@?A@@YSXXZ" +} + +namespace n { +void __attribute__((__swiftcall__)) f() {} +// CHECK-DAG: "\01?f@n@@YSXXZ" +} + +struct __declspec(dllexport) S { + S(const S &) = delete; + S & operator=(const S &) = delete; + void __attribute__((__swiftcall__)) m() { } + // CHECK-DAG: "\01?m@S@@QASXXZ" +}; + +void f(void (__attribute__((__swiftcall__))())) {} +// CHECK-DAG: "\01?f@@YAXP6SXXZ@Z" + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -950,11 +950,10 @@ } } +// ::= [] +// ::= [] void MicrosoftCXXNameMangler::mangleNestedName(const NamedDecl *ND) { - // ::= [] - // ::= [] const DeclContext *DC = getEffectiveDeclContext(ND); - while (!DC->isTranslationUnit()) { if (isa(ND) || isa(ND)) { unsigned Disc; @@ -2151,6 +2150,7 @@ case CC_X86StdCall: Out << 'G'; break; case CC_X86FastCall: Out << 'I'; break; case CC_X86VectorCall: Out << 'Q'; break; +case CC_Swift: Out << 'S'; break; case CC_X86RegCall: Out << 'w'; break; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42758: Support `#pragma comment(lib, "name")` in the frontend for ELF
compnerd added inline comments. Comment at: docs/LanguageExtensions.rst:2732 + +The ``#pragma comment(lib, ...)`` directive is supported on all ELF targets. +The second parameter is the library name (without the traditional Unix prefix of erichkeane wrote: > The newlines in this section are seemingly inconsistent with what is above. > Does that one violate the 80 char rule, or is this just short? Yeah, the previous section has 80-column violations :-(. Repository: rC Clang https://reviews.llvm.org/D42758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42758: Support `#pragma comment(lib, "name")` in the frontend for ELF
compnerd closed this revision. compnerd added a comment. SVN r324438 Repository: rC Clang https://reviews.llvm.org/D42758 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42768: AST: support SwiftCC on MS ABI
compnerd closed this revision. compnerd added a comment. SVN r324439 Repository: rC Clang https://reviews.llvm.org/D42768 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42933: [Sema] Avoid -Wformat warning for NSInteger/NSUInteger 'int' values with %zu/%zi long specifiers
compnerd added a comment. @aaron.ballman, yeah, I believe that the warning is working as intended, it just so happens that at runtime things just happened to work out. Repository: rC Clang https://reviews.llvm.org/D42933 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
compnerd updated this revision to Diff 133319. compnerd edited the summary of this revision. compnerd added a comment. Address comments from @rjmccall Repository: rC Clang https://reviews.llvm.org/D42614 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenObjCXX/msabi-objc-extensions.mm test/CodeGenObjCXX/msabi-protocol-conformance.mm Index: test/CodeGenObjCXX/msabi-protocol-conformance.mm === --- test/CodeGenObjCXX/msabi-protocol-conformance.mm +++ /dev/null @@ -1,34 +0,0 @@ -// RUN: %clang_cc1 -triple thumbv7-windows-msvc -fobjc-runtime=ios-6.0 -o - -emit-llvm %s | FileCheck %s - -@protocol P; -@protocol Q; - -@class I; - -void f(id, id, id, id) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@YPPAUobjc_object@@01@Z" - -void f(id, id, id, id) {} -// CHECK-LABEL: "\01?f@@YAXPAUobjc_object@@PAU?$objc_object@YP10@Z" - -void f(id, id) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@YP0@Z" - -void f(id) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@YP@Z" - -void f(id) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@YP@@YQ@Z" - -void f(Class) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_class@YP@Z" - -void f(Class) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$objc_class@YP@@YQ@Z" - -void f(I *) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$I@YP@Z" - -void f(I *) {} -// CHECK-LABEL: "\01?f@@YAXPAU?$I@YP@@YQ@Z" - Index: test/CodeGenObjCXX/msabi-objc-extensions.mm === --- /dev/null +++ test/CodeGenObjCXX/msabi-objc-extensions.mm @@ -0,0 +1,66 @@ +// RUN: %clang_cc1 -triple thumbv7-windows-msvc -fobjc-runtime=ios-6.0 -fobjc-arc -o - -emit-llvm %s | FileCheck %s + +@protocol P; +@protocol Q; + +@class I; + +void f(id, id, id, id) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@U?$Protocol@UP@@@__ObjCPAUobjc_object@@01@Z" + +void f(id, id, id, id) {} +// CHECK-LABEL: "\01?f@@YAXPAUobjc_object@@PAU?$objc_object@U?$Protocol@UP@@@__ObjC10@Z" + +void f(id, id) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@U?$Protocol@UP@@@__ObjC0@Z" + +void f(id) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@U?$Protocol@UP@@@__ObjC@Z" + +void f(id) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_object@U?$Protocol@UP@@@__ObjC@@U?$Protocol@UQ@@@2Z" + +void f(Class) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_class@U?$Protocol@UP@@@__ObjC@Z" + +void f(Class) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$objc_class@U?$Protocol@UP@@@__ObjC@@U?$Protocol@UQ@@@2Z" + +void f(I *) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$I@U?$Protocol@UP@@@__ObjC@Z" + +void f(I *) {} +// CHECK-LABEL: "\01?f@@YAXPAU?$I@U?$Protocol@UP@@@__ObjC@@U?$Protocol@UQ@@@2Z" + +template +struct S {}; + +void f(S<__unsafe_unretained id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@PAUobjc_object@Z" + +void f(S<__autoreleasing id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@U?$Autoreleasing@PAUobjc_object@@@__ObjC@Z" + +void f(S<__strong id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@U?$Strong@PAUobjc_object@@@__ObjC@Z" + +void f(S<__weak id>) {} +// CHECK-LABEL: "\01?f@@YAXU?$S@U?$Weak@PAUobjc_object@@@__ObjC@Z" + +void w(__weak id) {} +// CHECK-LABEL: "\01?w@@YAXPAUobjc_object@@@Z" + +void s(__strong id) {} +// CHECK-LABEL: "\01?s@@YAXPAUobjc_object@@@Z" + +void a(__autoreleasing id) {} +// CHECK-LABEL: "\01?a@@YAXPAUobjc_object@@@Z" + +void u(__unsafe_unretained id) {} +// CHECK-LABEL: "\01?u@@YAXPAUobjc_object@@@Z" + +S<__autoreleasing id> g() { return S<__autoreleasing id>(); } +// CHECK-LABEL: "\01?g@@YA?AU?$S@U?$Autoreleasing@PAUobjc_object@@@__ObjCXZ" + +__autoreleasing id h() { return nullptr; } +// CHECK-LABEL: "\01?h@@YAPAUobjc_object@@XZ" Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -362,6 +362,10 @@ const TemplateArgumentList &TemplateArgs); void mangleTemplateArg(const TemplateDecl *TD, const TemplateArgument &TA, const NamedDecl *Parm); + + void mangleObjCProtocol(const ObjCProtocolDecl *PD); + void mangleObjCLifetime(const QualType T, Qualifiers Quals, + SourceRange Range); }; } @@ -1456,6 +1460,47 @@ } } +void MicrosoftCXXNameMangler::mangleObjCProtocol(const ObjCProtocolDecl *PD) { + llvm::SmallString<64> TemplateMangling; + llvm::raw_svector_ostream Stream(TemplateMangling); + MicrosoftCXXNameMangler Extra(Context, Stream); + + Stream << "?$"; + Extra.mangleSourceName("Protocol"); + Extra.mangleArtificalTagType(TTK_Struct, PD->getName()); + + mangleArtificalTagType(TTK_Struct, TemplateMangling, {"__ObjC"}); +} + +void MicrosoftCXXNameMangler::mangleObjCLifetime(const QualType Type, + Qualifiers Quals, + SourceRange Range) { + llvm::SmallString<64> TemplateMangling; + llvm::raw_sv
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
compnerd added a comment. @rjmccall, I've updated the approach and no longer abuse the existing decoration styles. This uses a custom namespace with artificial types to differentiate the types. I've also ensured that the parameter types do not encode the type information. Repository: rC Clang https://reviews.llvm.org/D42614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D42614: AST: support ObjC lifetime qualifiers in MS ABI
compnerd closed this revision. compnerd added a comment. SVN r324701 Repository: rC Clang https://reviews.llvm.org/D42614 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34365: [FrontEnd] Allow overriding the default C/C++ -std via CMake vars
compnerd added a comment. Is there a need for this given the changes for 6.0? https://reviews.llvm.org/D34365 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43586: CodeGen: handle blocks correctly when inalloca'ed
compnerd updated this revision to Diff 135304. compnerd added a comment. Update comment Repository: rC Clang https://reviews.llvm.org/D43586 Files: lib/CodeGen/CGDecl.cpp test/CodeGenCXX/block-inalloca.cpp Index: test/CodeGenCXX/block-inalloca.cpp === --- /dev/null +++ test/CodeGenCXX/block-inalloca.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fblocks -emit-llvm -o - %s | FileCheck %s + +struct S { + S(const struct S &) {} +}; + +void (^b)(S) = ^(S) {}; + +// CHECK: [[DESCRIPTOR:%.*]] = getelementptr inbounds <{ i8*, %struct.S, [3 x i8] }>, <{ i8*, %struct.S, [3 x i8] }>* %0, i32 0, i32 0 +// CHECK: load i8*, i8** [[DESCRIPTOR]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1848,9 +1848,12 @@ // Use better IR generation for certain implicit parameters. if (auto IPD = dyn_cast(&D)) { // The only implicit argument a block has is its literal. -// We assume this is always passed directly. +// This may be passed as an inalloca'ed value on Windows x86. if (BlockInfo) { - setBlockContextParameter(IPD, ArgNo, Arg.getDirectValue()); + llvm::Value *V = Arg.isIndirect() + ? Builder.CreateLoad(Arg.getIndirectAddress()) + : Arg.getDirectValue(); + setBlockContextParameter(IPD, ArgNo, V); return; } } Index: test/CodeGenCXX/block-inalloca.cpp === --- /dev/null +++ test/CodeGenCXX/block-inalloca.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fblocks -emit-llvm -o - %s | FileCheck %s + +struct S { + S(const struct S &) {} +}; + +void (^b)(S) = ^(S) {}; + +// CHECK: [[DESCRIPTOR:%.*]] = getelementptr inbounds <{ i8*, %struct.S, [3 x i8] }>, <{ i8*, %struct.S, [3 x i8] }>* %0, i32 0, i32 0 +// CHECK: load i8*, i8** [[DESCRIPTOR]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1848,9 +1848,12 @@ // Use better IR generation for certain implicit parameters. if (auto IPD = dyn_cast(&D)) { // The only implicit argument a block has is its literal. -// We assume this is always passed directly. +// This may be passed as an inalloca'ed value on Windows x86. if (BlockInfo) { - setBlockContextParameter(IPD, ArgNo, Arg.getDirectValue()); + llvm::Value *V = Arg.isIndirect() + ? Builder.CreateLoad(Arg.getIndirectAddress()) + : Arg.getDirectValue(); + setBlockContextParameter(IPD, ArgNo, V); return; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43586: CodeGen: handle blocks correctly when inalloca'ed
compnerd created this revision. compnerd added a reviewer: rnk. Herald added a subscriber: cfe-commits. When using blocks with C++ on Windows x86, it is possible to have the block literal be pushed into the inalloca'ed parameters. Teach IRGen to handle the case properly by extracting the block literal from the inalloca parameter. This fixes the use of blocks with C++ on Windows x86. Repository: rC Clang https://reviews.llvm.org/D43586 Files: lib/CodeGen/CGDecl.cpp test/CodeGenCXX/block-inalloca.cpp Index: test/CodeGenCXX/block-inalloca.cpp === --- /dev/null +++ test/CodeGenCXX/block-inalloca.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fblocks -emit-llvm -o - %s | FileCheck %s + +struct S { + S(const struct S &) {} +}; + +void (^b)(S) = ^(S) {}; + +// CHECK: [[DESCRIPTOR:%.*]] = getelementptr inbounds <{ i8*, %struct.S, [3 x i8] }>, <{ i8*, %struct.S, [3 x i8] }>* %0, i32 0, i32 0 +// CHECK: load i8*, i8** [[DESCRIPTOR]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1850,7 +1850,10 @@ // The only implicit argument a block has is its literal. // We assume this is always passed directly. if (BlockInfo) { - setBlockContextParameter(IPD, ArgNo, Arg.getDirectValue()); + llvm::Value *V = Arg.isIndirect() + ? Builder.CreateLoad(Arg.getIndirectAddress()) + : Arg.getDirectValue(); + setBlockContextParameter(IPD, ArgNo, V); return; } } Index: test/CodeGenCXX/block-inalloca.cpp === --- /dev/null +++ test/CodeGenCXX/block-inalloca.cpp @@ -0,0 +1,11 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fblocks -emit-llvm -o - %s | FileCheck %s + +struct S { + S(const struct S &) {} +}; + +void (^b)(S) = ^(S) {}; + +// CHECK: [[DESCRIPTOR:%.*]] = getelementptr inbounds <{ i8*, %struct.S, [3 x i8] }>, <{ i8*, %struct.S, [3 x i8] }>* %0, i32 0, i32 0 +// CHECK: load i8*, i8** [[DESCRIPTOR]] + Index: lib/CodeGen/CGDecl.cpp === --- lib/CodeGen/CGDecl.cpp +++ lib/CodeGen/CGDecl.cpp @@ -1850,7 +1850,10 @@ // The only implicit argument a block has is its literal. // We assume this is always passed directly. if (BlockInfo) { - setBlockContextParameter(IPD, ArgNo, Arg.getDirectValue()); + llvm::Value *V = Arg.isIndirect() + ? Builder.CreateLoad(Arg.getIndirectAddress()) + : Arg.getDirectValue(); + setBlockContextParameter(IPD, ArgNo, V); return; } } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43586: CodeGen: handle blocks correctly when inalloca'ed
compnerd closed this revision. compnerd added a comment. SVN r325724 Repository: rC Clang https://reviews.llvm.org/D43586 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43734: [RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
compnerd added inline comments. Comment at: lib/AST/RecordLayoutBuilder.cpp:1755 CharUnits TypeSize = Context.getTypeSizeInChars(BTy); -if (TypeSize > FieldAlign) +if (TypeSize > FieldAlign && +llvm::isPowerOf2_64(TypeSize.getQuantity())) Can you add an assertion that the size is a power of two unless it is the GNU environment? Repository: rC Clang https://reviews.llvm.org/D43734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43734: [RecordLayout] Don't align to non-power-of-2 sizes when using -mms-bitfields
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. If its easy enough to wire that through to the frontend as a proper diagnostic, that would be better with a test. Otherwise, this is good to continue to make progress. https://reviews.llvm.org/D43734 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33259: Don't defer to the GCC driver for linking arm-baremetal
compnerd added a comment. Looks generally pretty good. This is going to be a pretty cool addition! Comment at: lib/Driver/ToolChains/BareMetal.cpp:68 + SmallString<128> Dir(getDriver().ResourceDir); + llvm::sys::path::append(Dir, "lib", "baremetal"); + return Dir.str(); jroelofs wrote: > compnerd wrote: > > jroelofs wrote: > > > compnerd wrote: > > > > jroelofs wrote: > > > > > compnerd wrote: > > > > > > Why not just the standard `arm` directory? > > > > > There are a few differences between the stuff in the existing ones, > > > > > and what is needed on baremetal. For example __enable_execute_stack, > > > > > emutls, as well as anything else that assumes existence of pthreads > > > > > support shouldn't be there. > > > > Well, I think that "baremetal" here is a bad idea. How about using the > > > > android approach? Use `clang_rt.builtins-arm-baremetal.a` ? > > > Why? Given the way the cmake goop works in lib/runtimes + compiler-rt, > > > the folder name there has to be the same as the CMAKE_SYSTEM_NAME. The > > > alternative, I guess, is to call it 'generic', but I'm not convinced > > > that's better than 'baremetal'. > > Because I can have a baremetal environment that uses a different > > architecture. How do you differentiate between the MIPS and ARM bare metal > > runtimes? The way that the compiler actually looks up the builtins is that > > it uses `clang_rt.[component]-[arch][-variant]` > Yes, and that's still how they're being looked up (and built/installed), even > in this patch: > > `lib/clang/[version]/lib/[cmake_system_name]/libclangrt.[component]-[arch][-variant].a` > > Having arch+variant in the name means they won't intersect, just as they > don't for any other system. The only difference here is that baremetal > doesn't really have a "system" per se, and it's not appropriate to use the > darwin/linux/whatever ones, hence the 'baremetal' folder. Ah. I see, I was visualizing the tree incorrectly. Using `baremetal` this way is fine by me. Comment at: lib/Driver/ToolChains/BareMetal.cpp:110 + SmallString<128> Dir(SysRoot); + llvm::sys::path::append(Dir, "include", "c++", "v1"); + return Dir.str(); Is this layout consistent between libc++ and libstdc++? Comment at: lib/Driver/ToolChains/BareMetal.cpp:130-133 +if (Value == "libc++") + return ToolChain::CST_Libcxx; +else if (Value == "libstdc++") + return ToolChain::CST_Libstdcxx; Use `StringSwitch`? Comment at: lib/Driver/ToolChains/BareMetal.h:39 + bool isPICDefaultForced() const override { return false; } + bool SupportsProfiling() const override { return true; } + bool SupportsObjCGC() const override { return false; } Is the profiler support in compiler-rt sufficiently standalone to build it for baremetal? https://reviews.llvm.org/D33259 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D33637: [libcxxabi][demangler] Fix a exponential string copying bug
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. Thanks for looking into this, its been on my list for a while now. Comment at: src/cxa_demangle.cpp:2918 } +if (!isalpha(*p0) && !isdigit(*p0) && *p0 != '_') +{ Hmm, I wonder if we should negate and hoist this into the condition rather than the explicit check here. It makes it slightly more obvious what we are trying to do here. However, it does make failing more challenging (since we cannot as easily identify if the extraction failed. https://reviews.llvm.org/D33637 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D32269: [Driver] Add iSOFTLinux to GNU ToolChains X86Triple
compnerd added inline comments. Comment at: test/Driver/linux-ld.c:467-471 +// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-everest-linux +// RUN: %clang %s -### -o %t.o 2>&1 --target=x86_64-pure64-linux +// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-isoft-linux +// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-everest-linux +// RUN: %clang %s -### -o %t.o 2>&1 --target=i686-pure64-linux These only invoke clang, but don't actually test anything. Repository: rL LLVM https://reviews.llvm.org/D32269 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd created this revision. compnerd added a project: clang. When generating the decorated name for a static variable inside a BlockDecl, construct a scope for the block invocation function that homes the parameter. This allows for arbitrary nesting of the blocks even if the variables are shadowed. Furthermore, using this for the name allows for undname to properly undecorated the name for us. It shows up as the synthetic __block_invocation function that the compiler emitted in the local scope. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -emit-llvm -o - %s | FileCheck %s + +auto b = ^() { + static int i = 0; + return ++i; +}; + + +void f() { + auto l = ^() { +static int i = 0; +return ++i; + }; + auto m = ^() { +static int i = 0; +return ++i; + }; + auto n = ^() { +auto o = ^() { + static int i = 0; + return ++i; +}; + }; +} + +template +void g() { + auto p = ^() { +static int i = 0; +return ++i; + }; +} + +template void g(); +template void g(); + +// CHECK: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?2??_block_invoke_5@@YAXPAU__block_literal_5@@@Z?2???$g@D@@YAXXZ@4HA" = linkonce_odr +// CHECK: @"\01?i@?2??_block_invoke_6@@YAXPAU__block_literal_6@@@Z?2???$g@H@@YAXXZ@4HA" = linkonce_odr Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,14 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); - Out << '@'; + auto Discriminator = Context.getBlockId(BD, false); + Out << "?_block_invoke"; + if (Discriminator) +Out << '_' << Discriminator; + Out << "@@YAXPAU__block_literal"; + if (Discriminator) +Out << '_' << Discriminator; + Out << "@@@Z"; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodName(Method); } else if (isa(DC)) { Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -emit-llvm -o - %s | FileCheck %s + +auto b = ^() { + static int i = 0; + return ++i; +}; + + +void f() { + auto l = ^() { +static int i = 0; +return ++i; + }; + auto m = ^() { +static int i = 0; +return ++i; + }; + auto n = ^() { +auto o = ^() { + static int i = 0; + return ++i; +}; + }; +} + +template +void g() { + auto p = ^() { +static int i = 0; +return ++i; + }; +} + +template void g(); +template void g(); + +// CHECK: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" = internal +// CHECK: @"\01?i@?2??_block_invoke_5@@YAXPAU__block_literal_5@@@Z?2???$g@D@@YAXXZ@4HA" = linkonce_odr +// CHECK: @"\01?i@?2??_block_invoke_6@@YAXPAU__block_literal_6@@@Z?2???$g@H@@YAXXZ@4HA" = linkonce_odr Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,14 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FI
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd added a comment. @efriedma hmm...using `getBlockManglingNumber` causes the name to be duplicated. Ill look into that. However, wouldn't all the block invocation functions be defined and COMDAT'ed? @majnemer Sure, will add more tests. Repository: rL LLVM https://reviews.llvm.org/D34523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103768. compnerd added a comment. Add additional test cases, improve coverage and mangling. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +extern int e(void); + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_5@@YAXPAU__block_literal_5@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_6@@YAXPAU__block_literal_6@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-DAG: @"\01?i@?2??_block_invoke_9@@YAXPAU__block_literal_9@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +struct s { + int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_10@s@@YAXPAU__block_literal_10@@@Z@4HA" ={{.*}} global i32 0 + + int j = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_11@s@@YAXPAU__block_literal_11@@@Z@4HA" ={{.*}} global i32 0 + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} + +// CHECK-DAG: @"\01?i@?0??_block_invoke_7@@YAXPAU__block_literal_7@@@Z?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-DAG: @"\01?i@?0??_block_invoke_8@@YAXPAU__block_literal_8@@@Z?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +}; + + +void j(void) { + h(); + struct s s; + s.m(); +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,23 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); + DC = getEffectiveDeclContext(BD); + unsigned Discriminator = Context.getBlockId(BD, /*Local=*/false); + Out << "?_block_invoke"; + if (Discriminator) +Out<< '_' << Discriminator; Out << '@'; + if (const auto *RD = dyn_cast(DC)) +mangleName(RD); + else +Out << '@'; + Out << "YAXPAU__block_literal"; + if (Discriminator) +Out<< '_' << Discriminator; + Out << "@@@Z"; + if (isa(DC)) +break; + continue; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodName(Method); } else if (isa(DC)) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd added a comment. @efriedma which bit of the Itanium mangling should I be looking at? A BlockDecl does not have visibility associated with them, so Im not sure what I should be checking to see if the block is visible or not. What is the best way forward for finishing this up? Repository: rL LLVM https://reviews.llvm.org/D34523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd added a comment. @efriedma I think that Im still not understanding the case that you are trying to point out. How do we end up in a state where the block invocation function is referenced external to the TU? The block would be referenced to by name of the block, no? AFAICT, this is for local storage in a block, which is scoped to the block invocation function, which is TU local, and will be referenced by the block_literal (which contains the block invocation function and is dispatched via the BlocksRuntime). Repository: rL LLVM https://reviews.llvm.org/D34523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103794. compnerd added a comment. This is a step in the right direction. Although the NSDMI cases and default parameter value cases are not yet handled, they break due to tracking of the global mangling number tracking, not due to the scheme. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,63 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +extern int e(void); + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +#if 0 +struct s { + int i = ^{ static int i = e(); return ++i; }(); + int j = ^{ static int i = e(); return ++i; }(); + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} +}; +#endif + +void j(void) { + h(); +#if 0 + struct s s; + s.m(); +#endif +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,25 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); + DC = getEffectiveDeclContext(BD); + unsigned Discriminator = BD->getBlockManglingNumber(); + if (!Discriminator) +Discriminator = Context.getBlockId(BD, /*Local=*/false); + Out << "?_block_invoke"; + if (Discriminator) +Out<< '_' << Discriminator; Out << '@'; + if (const auto *RD = dyn_cast(DC)) +mangleName(RD); + else +Out << '@'; + Out << "YAXPAU__block_literal"; + if (Discriminator) +Out<< '_' << Discriminator; + Out << "@@@Z"; + if (isa(DC)) +break; + continue; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodName(Method); } else if (isa(DC)) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd added a comment. Ah, thanks for the explanation @efriedma. Comment at: lib/AST/MicrosoftMangle.cpp:981-984 + Out << "YAXPAU__block_literal"; + if (Discriminator) +Out<< '_' << Discriminator; + Out << "@@@Z"; majnemer wrote: > I think you want to use mangleArtificalTagType here. I was considering that. The addition of the `Discriminator` makes that harder. I can create a local buffer and create the name and then mangle that though if you feel strongly about that. Repository: rL LLVM https://reviews.llvm.org/D34523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103845. compnerd added a comment. Address feedback. Also fix the case that was previously not working. This now covers all the various cases that have been discussed. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s + +extern int e(void); + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +struct s { + int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + int j = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0 + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 + +}; + +void j(void) { + h(); + struct s s; + s.m(); +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,40 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); - Out << '@'; + auto Discriminate = [](StringRef Name, + const unsigned Discriminator) -> std::string { +std::string Buffer; +llvm::raw_string_ostream Stream(Buffer); +Stream << Name; +if (Discriminator) + Stream << '_' << Discriminator; +return Stream.str(); + }; + + unsigned Discriminator = BD->getBlockManglingNumber(); + if (!Discriminator) +Discriminator = Context.getBlockId(BD, /*Local=*/false); + + DC = getEffectiveDeclContext(BD); + + Out << '?' << Discriminate("_block_invoke", Discriminator) << '@'; + if (const auto *RD = dyn_cast(DC)) +mangleName(RD); + else +Out << '@'; + Out << "YAX"; + Out << "PA"; + mangleArtificalTagType(TTK_Struct, + Discriminate("__block_literal", Discriminator)); + Out << "@Z"; + + if (const auto *MC = BD->getBlockManglingContextDecl()) +if (const auto *ND = dyn_cast(MC)) + mangleUnqualifiedName(ND); + + if (isa(DC)) +break; + continue; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodName(Method); } else if (isa(DC)) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34588: Check for _MSC_VER before define _LIBCPP_MSVCRT
compnerd added inline comments. Comment at: include/__config:234-235 +// a MS compatibility version is specified. # ifndef __MINGW32__ -#define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library +#ifdef _MSC_VER +# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library smeenai wrote: > You can combine this into just > > ``` > # if defined(_MSC_VER) && !defined(__MINGW32__) > ``` > > I don't know if `__MINGW32__` and `_MSC_VER` will ever be compiled > simultaneously. (clang never defines `_MSC_VER` for its MinGW triples, for > example.) What if MinGW is built with clang/c2 and MSVC extensions? I think that the two could be defined together. What about cygwin and clang/c2? I guess we can ignore that since cygwin is not under active development. I think this really goes back to my idea for an additional flag to indicate the C library in use. We can interpret it from the canonicalized triple that LLVM/clang use. https://reviews.llvm.org/D34588 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103879. compnerd marked 2 inline comments as done. compnerd added a comment. Use `mangleSourceName` Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,68 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s + +extern int e(void); + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +struct s { + int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + int j = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0 + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 + +}; + +void j(void) { + h(); + struct s s; + s.m(); +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,43 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); - Out << '@'; + auto Discriminate = [](StringRef Name, + const unsigned Discriminator) -> std::string { +std::string Buffer; +llvm::raw_string_ostream Stream(Buffer); +Stream << Name; +if (Discriminator) + Stream << '_' << Discriminator; +return Stream.str(); + }; + + unsigned Discriminator = BD->getBlockManglingNumber(); + if (!Discriminator) +Discriminator = Context.getBlockId(BD, /*Local=*/false); + + DC = getEffectiveDeclContext(BD); + + Out << '?'; + mangleSourceName(Discriminate("_block_invoke", Discriminator)); + if (const auto *RD = dyn_cast(DC)) +mangleName(RD); + else +Out << '@'; + // void __cdecl + Out << "YAX"; + // struct __block_literal * + Out << "PA"; + mangleArtificalTagType(TTK_Struct, + Discriminate("__block_literal", Discriminator)); + Out << "@Z"; + + if (const auto *MC = BD->getBlockManglingContextDecl()) +if (const auto *ND = dyn_cast(MC)) + mangleUnqualifiedName(ND); + + if (isa(DC)) +break; + continue; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodName(Method); } else if (isa(DC)) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd added a comment. I can add the nested/nested classes. What were other nested concepts you thinking of? Comment at: lib/AST/MicrosoftMangle.cpp:980-981 + unsigned Discriminator = BD->getBlockManglingNumber(); + if (!Discriminator) +Discriminator = Context.getBlockId(BD, /*Local=*/false); + majnemer wrote: > Why isn't it local? This code path is global blocks only AFAIK. Comment at: lib/AST/MicrosoftMangle.cpp:991-992 +Out << '@'; + // void __cdecl + Out << "YAX"; + // struct __block_literal * majnemer wrote: > Can blocks not be given a specific calling convention? Not AFAIK. The synthetic function here is dispatched through the BlocksRuntime and is assumed to be cdecl. Comment at: lib/AST/MicrosoftMangle.cpp:993-994 + Out << "YAX"; + // struct __block_literal * + Out << "PA"; + mangleArtificalTagType(TTK_Struct, majnemer wrote: > Shouldn't we also mangle an 'E' in here on 64-bit platforms? I suppose that the default handling in x86_64 would give that. I don't have a strong enough opinion on that. I can add that if you think it makes a difference. Repository: rL LLVM https://reviews.llvm.org/D34523 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103887. compnerd added a comment. Some more comments, add test case. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,78 @@ +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s + +extern int e(void); + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +struct s { + int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + int j = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0 + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 + +}; + +struct t { + struct u { +int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-DAG: @"\01?i@?0??_block_invoke_1@u@t@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + }; +}; + +void j(void) { + h(); + struct s s; + s.m(); + struct t::u t; +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,48 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); - Out << '@'; + auto Discriminate = [](StringRef Name, + const unsigned Discriminator) -> std::string { +std::string Buffer; +llvm::raw_string_ostream Stream(Buffer); +Stream << Name; +if (Discriminator) + Stream << '_' << Discriminator; +return Stream.str(); + }; + + unsigned Discriminator = BD->getBlockManglingNumber(); + if (!Discriminator) +Discriminator = Context.getBlockId(BD, /*Local=*/false); + + DC = getEffectiveDeclContext(BD); + + Out << '?'; + mangleSourceName(Discriminate("_block_invoke", Discriminator)); + if (const auto *RD = dyn_cast(DC)) +mangleName(RD); + else +Out << '@'; + // void __cdecl + Out << "YAX"; + // struct __block_literal * + Out << "PA"; + mangleArtificalTagType(TTK_Struct, + Discriminate("__block_literal", Discriminator)); + Out << "@Z"; + + // If we have a block mangling context, encode that now. Although the + // mangling is not perfect, it allows us to discriminate between multiple + // instances in the same scope. + if (const auto *MC = BD->getBlockManglingContextDecl()) +if (const auto *ND = dyn_cast(MC)) + mangleUnqualifiedName(ND); + + // If the effective context was a Record, we have fully mangled the + // qualified name and do not need to continue. + if (isa(DC)) +break; + continue; } else if (const ObjCMethodDecl *Method = dyn_cast(DC)) { mangleObjCMethodN
[PATCH] D34523: AST: mangle BlockDecls under MS ABI
compnerd updated this revision to Diff 103981. compnerd added a comment. __ptr64 mangling, add tests for 32-bit. Repository: rL LLVM https://reviews.llvm.org/D34523 Files: lib/AST/MicrosoftMangle.cpp test/CodeGenCXX/msabi-blocks.cpp Index: test/CodeGenCXX/msabi-blocks.cpp === --- /dev/null +++ test/CodeGenCXX/msabi-blocks.cpp @@ -0,0 +1,90 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s -check-prefix CHECK-X32 +// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -std=c++11 -fblocks -S -o - -emit-llvm %s | FileCheck %s -check-prefix CHECK-X64 + +extern int e(void); + +void (^b)() = ^{ + static int i = 0; +}; + +// CHECK-X32-DAG: @"\01?i@?1??_block_invoke@@YAXPAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?1??_block_invoke@@YAXPEAU__block_literal@@@Z@4HA" ={{.*}} global i32 0 + +void f(void) { + static int i = 0; + ^{ static int i = e(); }(); + +// CHECK-X32-DAG: @"\01?i@?1??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?1??_block_invoke_1@@YAXPEAU__block_literal_1@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ static int i = e(); }(); + +// CHECK-X32-DAG: @"\01?i@?1??_block_invoke_2@@YAXPAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?1??_block_invoke_2@@YAXPEAU__block_literal_2@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 + + ^{ ^{ static int i = e(); }(); }(); + +// CHECK-X32-DAG: @"\01?i@?1??_block_invoke_3@@YAXPAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?1??_block_invoke_3@@YAXPEAU__block_literal_3@@@Z?1??_block_invoke_4@@YAXPEAU__block_literal_4@@@Z?1??f@@YAXXZ@4HA" ={{.*}} global i32 0 +} + + +template +void g(void) { + ^{ static int i = e(); }(); +} + +template void g(void); + +// CHECK-X32-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?2??_block_invoke_1@@YAXPEAU__block_literal_1@@@Z?2???$g@D@@YAXXZ@4HA" ={{.*}} global i32 0 + +template void g(void); + +// CHECK-X32-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?2??_block_invoke_1@@YAXPEAU__block_literal_1@@@Z?2???$g@H@@YAXXZ@4HA" ={{.*}} global i32 0 + +inline void h(void) { + ^{ static int i = e(); }(); +} + +// CHECK-X32-DAG: @"\01?i@?2??_block_invoke_1@@YAXPAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?2??_block_invoke_1@@YAXPEAU__block_literal_1@@@Z?2??h@@YAXXZ@4HA" ={{.*}} global i32 0 + +struct s { + int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-X32-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPEAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + int j = ^{ static int i = e(); return ++i; }(); + +// CHECK-X64-DAG: @"\01?i@?0??_block_invoke_1@s@@YAXPEAU__block_literal_1@@@Zj@@4HA" ={{.*}} global i32 0 + + void m(int i = ^{ static int i = e(); return ++i; }(), + int j = ^{ static int i = e(); return ++i; }()) {} + +// CHECK-X32-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Zj@?0??m@s@@QAEXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-X32-DAG: @"\01?i@?0??_block_invoke_1@@YAXPAU__block_literal_1@@@Z0?0??m@s@@QAEXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?0??_block_invoke_1@@YAXPEAU__block_literal_1@@@Zj@?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?0??_block_invoke_1@@YAXPEAU__block_literal_1@@@Z0?0??m@s@@QEAAXHH@Z@4HA" ={{.*}} global i32 0 + +}; + +struct t { + struct u { +int i = ^{ static int i = e(); return ++i; }(); + +// CHECK-X32-DAG: @"\01?i@?0??_block_invoke_1@u@t@@YAXPAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 +// CHECK-X64-DAG: @"\01?i@?0??_block_invoke_1@u@t@@YAXPEAU__block_literal_1@@@Z0@4HA" ={{.*}} global i32 0 + + }; +}; + +void j(void) { + h(); + struct s s; + s.m(); + struct t::u t; +} + Index: lib/AST/MicrosoftMangle.cpp === --- lib/AST/MicrosoftMangle.cpp +++ lib/AST/MicrosoftMangle.cpp @@ -966,16 +966,52 @@ } if (const BlockDecl *BD = dyn_cast(DC)) { - DiagnosticsEngine &Diags = Context.getDiags(); - unsigned DiagID = - Diags.getCustomDiagID(DiagnosticsEngine::Error, -"cannot mangle a local inside this block yet"); - Diags.Report(BD->getLocation(), DiagID); - - // FIXME: This is completely, utterly, wrong; see ItaniumMangle - // for how this should be done. - Out << "__block_invoke" << Context.getBlockId(BD, false); - Out << '@'; + auto Discriminate = [](StringRef Name, +
[PATCH] D41623: [cmake] [libcxxabi] Fix path problems when cross compiling.
compnerd added a comment. I think that it might be better to handle this as a single global change: if(CMAKE_FIND_ROOT_PATH) set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER) endif() Repository: rCXXA libc++abi https://reviews.llvm.org/D41623 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41621: [cmake] [libunwind] Fix path problems when cross compiling.
compnerd requested changes to this revision. compnerd added a comment. This revision now requires changes to proceed. Similar to the libc++abi and libc++ changes. https://reviews.llvm.org/D41621 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41622: [cmake] [libcxx] Fix path and flag problems when cross compiling.
compnerd added a comment. Similar to the libc++abi wrt `find_path`. The `CMAKE_REQUIRED_FLAGS` handling LGTM. Repository: rCXX libc++ https://reviews.llvm.org/D41622 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D39074: [libunwind][MIPS]: Add support for unwinding in N32 processes.
compnerd added a comment. Looking over this patch again, I think I really would prefer that this was split up into two patches. The first one should be entirely mechanical, replacing `n64` with `newabi`. The second patch would actually make the changes that you are are after. That would really help with focusing what the issue here actually is. I don't see anything technically that is an issue (I admit I didn't verify the sizes, but the assertions should hopefully catch that). Beyond that split up, Id like to get a signoff from @sdardis for the MIPS specific bits, but from the libunwind side, LGTM. https://reviews.llvm.org/D39074 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41706: [Driver] Update default sanitizer blacklist location
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. This seems fine, but will need https://reviews.llvm.org/D41673 to go in at the same time. The sanitizers are pretty tightly coupled with the compiler, so I don't think that it is too big of a deal, but it may be nice to have a more robust upgrade path. Repository: rC Clang https://reviews.llvm.org/D41706 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D41842: [libunwind][MIPS]: Rename Registers_mips_n64 to Registers_mips_newabi.
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. Thanks for splitting this up! https://reviews.llvm.org/D41842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43842: CodeGenObjCXX: handle inalloca appropriately for msgSend variant
compnerd created this revision. compnerd added reviewers: rjmccall, rnk. objc_msgSend_stret takes a hidden parameter for the returned structure's address for the construction. When the function signature is rewritten for the inalloca passing, the return type is no longer marked as indirect but rather inalloca stret. This enhances the test for the indirect return to check for that case as well. This fixes the incorrect return classification for Windows x86. Repository: rC Clang https://reviews.llvm.org/D43842 Files: lib/CodeGen/CGCall.cpp test/CodeGenObjCXX/msabi-stret.mm Index: test/CodeGenObjCXX/msabi-stret.mm === --- /dev/null +++ test/CodeGenObjCXX/msabi-stret.mm @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fobjc-runtime=ios-6.0 -Os -S -emit-llvm -o - %s -mdisable-fp-elim | FileCheck %s + +struct S { + S() = default; + S(const S &) {} +}; + +@interface I ++ (S)m:(S)s; +@end + +S f() { + return [I m:S()]; +} + +// CHECK: declare dllimport void @objc_msgSend_stret(i8*, i8*, ...) +// CHECK-NOT: declare dllimport void @objc_msgSend(i8*, i8*, ...) + Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1479,7 +1479,8 @@ /***/ bool CodeGenModule::ReturnTypeUsesSRet(const CGFunctionInfo &FI) { - return FI.getReturnInfo().isIndirect(); + const auto &RI = FI.getReturnInfo(); + return RI.isIndirect() || (RI.isInAlloca() && RI.getInAllocaSRet()); } bool CodeGenModule::ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI) { Index: test/CodeGenObjCXX/msabi-stret.mm === --- /dev/null +++ test/CodeGenObjCXX/msabi-stret.mm @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple i686-unknown-windows-msvc -fobjc-runtime=ios-6.0 -Os -S -emit-llvm -o - %s -mdisable-fp-elim | FileCheck %s + +struct S { + S() = default; + S(const S &) {} +}; + +@interface I ++ (S)m:(S)s; +@end + +S f() { + return [I m:S()]; +} + +// CHECK: declare dllimport void @objc_msgSend_stret(i8*, i8*, ...) +// CHECK-NOT: declare dllimport void @objc_msgSend(i8*, i8*, ...) + Index: lib/CodeGen/CGCall.cpp === --- lib/CodeGen/CGCall.cpp +++ lib/CodeGen/CGCall.cpp @@ -1479,7 +1479,8 @@ /***/ bool CodeGenModule::ReturnTypeUsesSRet(const CGFunctionInfo &FI) { - return FI.getReturnInfo().isIndirect(); + const auto &RI = FI.getReturnInfo(); + return RI.isIndirect() || (RI.isInAlloca() && RI.getInAllocaSRet()); } bool CodeGenModule::ReturnSlotInterferesWithArgs(const CGFunctionInfo &FI) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43842: CodeGenObjCXX: handle inalloca appropriately for msgSend variant
compnerd added a comment. Yeah, this is still an indirect return. I can see your point about the representation, nfortunately, I think that change is way out of scope for this. That would be a pretty large and invasive change to wire that through. Repository: rC Clang https://reviews.llvm.org/D43842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43842: CodeGenObjCXX: handle inalloca appropriately for msgSend variant
compnerd closed this revision. compnerd added a comment. SVN r326362 Repository: rC Clang https://reviews.llvm.org/D43842 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43908: [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
compnerd accepted this revision. compnerd added a comment. Ugh, really not a fan of this change. Repository: rC Clang https://reviews.llvm.org/D43908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D43908: [RecordLayout] Only assert that fundamental type sizes are power of two on MSVC
compnerd accepted this revision. compnerd added a comment. Awesome, thanks, this makes me feel much more comfortable. https://reviews.llvm.org/D43908 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44278: CodeGen: simplify and validate exception personalities
compnerd created this revision. compnerd added reviewers: rnk, smeenai. Simplify the dispatching for the personality routines. This really had no test coverage previously, so add test coverage for the various cases. This turns out to be pretty complicated as the various languages and models interact to change personalities around. You really should feel bad for the compiler if you are using exceptions. There is no reason for this type of cruelty. Repository: rC Clang https://reviews.llvm.org/D44278 Files: lib/CodeGen/CGException.cpp test/CodeGen/personality.c test/CodeGenCXX/personality.cpp test/CodeGenObjC/personality.m test/CodeGenObjCXX/personality.mm Index: test/CodeGenObjCXX/personality.mm === --- /dev/null +++ test/CodeGenObjCXX/personality.mm @@ -0,0 +1,129 @@ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE-SEH +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE-SJLJ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gnustep-1.7 -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GNUSTEP-1_7 +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gnustep -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GNUSTEP +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix
[PATCH] D44278: CodeGen: simplify and validate exception personalities
compnerd updated this revision to Diff 137668. compnerd added a comment. add more context Repository: rC Clang https://reviews.llvm.org/D44278 Files: lib/CodeGen/CGException.cpp test/CodeGen/personality.c test/CodeGenCXX/personality.cpp test/CodeGenObjC/personality.m test/CodeGenObjCXX/personality.mm Index: test/CodeGenObjCXX/personality.mm === --- /dev/null +++ test/CodeGenObjCXX/personality.mm @@ -0,0 +1,129 @@ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE-SEH +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx-fragile -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-MACOSX-FRAGILE-SJLJ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=macosx -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=ios -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=watchos -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-NS +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gnustep-1.7 -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GNUSTEP-1_7 +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gnustep -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GNUSTEP +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fdwarf-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fseh-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC-SEH +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fsjlj-exceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=gcc -S -emit-llvm %s -o - | FileCheck %s -check-prefix CHECK-GCC-SJLJ +// RUN: %clang_cc1 -triple i686-unknown-linux-gnu -fexceptions -fobjc-exceptions -fcxx-exceptions -fobjc-runtime=objfw -S -emit-llvm %s -o - | Fi
[PATCH] D44278: CodeGen: simplify and validate exception personalities
compnerd closed this revision. compnerd added a comment. SVN r327105 Repository: rC Clang https://reviews.llvm.org/D44278 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44327: ObjCARC: teach the cloner about funclets
compnerd created this revision. compnerd added a reviewer: gottesmm. Herald added a subscriber: cfe-commits. compnerd added a reviewer: ahatanak. compnerd added subscribers: rnk, majnemer. In the case that the CallInst that is being moved has an associated operand bundle which is a funclet, the move will construct an invalid instruction. The new site will have a different token and needs to be reassociated with the new instruction. Unfortunately, there is no way to alter the bundle after the construction of the instruction. Replace the call instruction cloning with a custom helper to clone the instruction and reassociate the funclet token. Repository: rC Clang https://reviews.llvm.org/D44327 Files: lib/Transforms/ObjCARC/ObjCARCOpts.cpp test/Transforms/ObjCARC/funclet.ll Index: test/Transforms/ObjCARC/funclet.ll === --- /dev/null +++ test/Transforms/ObjCARC/funclet.ll @@ -0,0 +1,54 @@ +; RUN: %opt -mtriple x86_64-unknown-windows-msvc -objc-arc -S -o - %s | FileCheck %s + +declare zeroext i1 @"\01?g@@YA_NXZ"() local_unnamed_addr +declare i8* @"\01?h@@YAPEAUobjc_object@@XZ"() local_unnamed_addr + +declare dllimport void @objc_release(i8*) local_unnamed_addr +declare dllimport i8* @objc_retainAutoreleasedReturnValue(i8* returned) local_unnamed_addr + +declare i32 @__CxxFrameHandler3(...) + +define void @"\01?f@@YAXXZ"() local_unnamed_addr personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { +entry: + %call = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont unwind label %ehcleanup6 + +invoke.cont: ; preds = %entry + br i1 %call, label %if.then, label %if.end + +if.then: ; preds = %invoke.cont + %call2 = invoke i8* @"\01?h@@YAPEAUobjc_object@@XZ"() + to label %invoke.cont1 unwind label %ehcleanup6 + +invoke.cont1: ; preds = %if.then + %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call2) + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + br label %if.end + +if.end: ; preds = %invoke.cont1, %invoke.cont + %a.0 = phi i8* [ %call2, %invoke.cont1 ], [ null, %invoke.cont ] + %call4 = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont3 unwind label %ehcleanup + +invoke.cont3: ; preds = %if.end + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + tail call void @objc_release(i8* %a.0), !clang.imprecise_release !1 + ret void + +ehcleanup:; preds = %if.end + %1 = cleanuppad within none [] + call void @objc_release(i8* null) [ "funclet"(token %1) ], !clang.imprecise_release !1 + cleanupret from %1 unwind label %ehcleanup6 + +ehcleanup6: ; preds = %ehcleanup, %if.then, %entry + %a.1 = phi i8* [ %a.0, %ehcleanup ], [ null, %if.then ], [ null, %entry ] + %2 = cleanuppad within none [] + call void @objc_release(i8* %a.1) [ "funclet"(token %2) ], !clang.imprecise_release !1 + cleanupret from %2 unwind to caller +} + +; CHECK: call void @objc_release(i8* {{.*}}) {{.*}}[ "funclet"(token %1) ] +; CHECK-NOT: call void @objc_release(i8* {{.*}}) {{.*}}[ "funclet"(token %2) ] + +!1 = !{} + Index: lib/Transforms/ObjCARC/ObjCARCOpts.cpp === --- lib/Transforms/ObjCARC/ObjCARCOpts.cpp +++ lib/Transforms/ObjCARC/ObjCARCOpts.cpp @@ -684,6 +684,27 @@ DEBUG(dbgs() << "New: " << *AutoreleaseRV << "\n"); } +namespace { +Instruction *CloneCallInstForBB(Instruction &I, BasicBlock &BB) { + auto *CI = dyn_cast(&I); + assert(CI && "CloneCallInst must receive a CallInst"); + + SmallVector OpBundles; + for (unsigned I = 0, E = CI->getNumOperandBundles(); I != E; ++I) { +auto Bundle = CI->getOperandBundleAt(I); +// funclets will be reassociated in the future +if (Bundle.getTagID() == LLVMContext::OB_funclet) + continue; +OpBundles.emplace_back(Bundle); + } + + if (auto *CleanupPad = dyn_cast(BB.getFirstNonPHI())) +OpBundles.emplace_back("funclet", CleanupPad); + + return CallInst::Create(CI, OpBundles); +} +} + /// Visit each call, one at a time, and make simplifications without doing any /// additional analysis. void ObjCARCOpt::OptimizeIndividualCalls(Function &F) { @@ -927,9 +948,10 @@ Value *Incoming = GetRCIdentityRoot(PN->getIncomingValue(i)); if (!IsNullOrUndef(Incoming)) { - CallInst *Clone = cast(CInst->clone()); Value *Op = PN->getIncomingValue(i); Instruction *InsertPos = &PN->getIncomingBlock(i)->back(); + CallInst *Clone = cast( + CloneCallInstForBB(*CInst, *InsertPos->getParent())); if (Op->getType() != ParamTy) Op =
[PATCH] D43797: [CMake] Copy the generated __config header into build directory
compnerd accepted this revision. compnerd added inline comments. This revision is now accepted and ready to land. Comment at: libcxx/include/CMakeLists.txt:19 +DEPENDS ${LIBCXX_BINARY_DIR}/__generated_config) + set(generated_config_deps generate_config_header) +endif() Where is `generated_config_deps` used? Repository: rCXX libc++ https://reviews.llvm.org/D43797 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44327: ObjCARC: teach the cloner about funclets
compnerd updated this revision to Diff 137867. compnerd added a comment. Use the BB colorizer to detect the token. Fortunately, there is no BB removal/splitting happening here, so there is no state to maintain. Repository: rL LLVM https://reviews.llvm.org/D44327 Files: lib/Transforms/ObjCARC/ObjCARCOpts.cpp test/Transforms/ObjCARC/funclet.ll Index: test/Transforms/ObjCARC/funclet.ll === --- /dev/null +++ test/Transforms/ObjCARC/funclet.ll @@ -0,0 +1,112 @@ +; RUN: opt -mtriple x86_64-unknown-windows-msvc -objc-arc -S -o - %s | FileCheck %s + +; bool g(); +; id h(); +; +; void f() { +; id a = nullptr; +; if (g()) +; a = h(); +; id b = nullptr; +; g(); +; } + +declare zeroext i1 @"\01?g@@YA_NXZ"() local_unnamed_addr +declare i8* @"\01?h@@YAPEAUobjc_object@@XZ"() local_unnamed_addr + +declare dllimport void @objc_release(i8*) local_unnamed_addr +declare dllimport i8* @objc_retainAutoreleasedReturnValue(i8* returned) local_unnamed_addr + +declare i32 @__CxxFrameHandler3(...) + +define void @"\01?f@@YAXXZ"() local_unnamed_addr personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { +entry: + %call = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont unwind label %ehcleanup6 + +invoke.cont: ; preds = %entry + br i1 %call, label %if.then, label %if.end + +if.then: ; preds = %invoke.cont + %call2 = invoke i8* @"\01?h@@YAPEAUobjc_object@@XZ"() + to label %invoke.cont1 unwind label %ehcleanup6 + +invoke.cont1: ; preds = %if.then + %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call2) + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + br label %if.end + +if.end: ; preds = %invoke.cont1, %invoke.cont + %a.0 = phi i8* [ %call2, %invoke.cont1 ], [ null, %invoke.cont ] + %call4 = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont3 unwind label %ehcleanup + +invoke.cont3: ; preds = %if.end + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + tail call void @objc_release(i8* %a.0), !clang.imprecise_release !1 + ret void + +ehcleanup:; preds = %if.end + %1 = cleanuppad within none [] + call void @objc_release(i8* null) [ "funclet"(token %1) ], !clang.imprecise_release !1 + cleanupret from %1 unwind label %ehcleanup6 + +ehcleanup6: ; preds = %ehcleanup, %if.then, %entry + %a.1 = phi i8* [ %a.0, %ehcleanup ], [ null, %if.then ], [ null, %entry ] + %2 = cleanuppad within none [] + call void @objc_release(i8* %a.1) [ "funclet"(token %2) ], !clang.imprecise_release !1 + cleanupret from %2 unwind to caller +} + +; CHECK-LABEL: ?f@@YAXXZ +; CHECK: call void @objc_release(i8* {{.*}}) {{.*}}[ "funclet"(token %1) ] +; CHECK-NOT: call void @objc_release(i8* {{.*}}) {{.*}}[ "funclet"(token %2) ] + +define void @"\01?i@@YAXXZ"() local_unnamed_addr personality i8* bitcast (i32 (...)* @__CxxFrameHandler3 to i8*) { +entry: + %call = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont unwind label %ehcleanup6 + +invoke.cont: ; preds = %entry + br i1 %call, label %if.then, label %if.end + +if.then: ; preds = %invoke.cont + %call2 = invoke i8* @"\01?h@@YAPEAUobjc_object@@XZ"() + to label %invoke.cont1 unwind label %ehcleanup6 + +invoke.cont1: ; preds = %if.then + %0 = tail call i8* @objc_retainAutoreleasedReturnValue(i8* %call2) + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + br label %if.end + +if.end: ; preds = %invoke.cont1, %invoke.cont + %a.0 = phi i8* [ %call2, %invoke.cont1 ], [ null, %invoke.cont ] + %call4 = invoke zeroext i1 @"\01?g@@YA_NXZ"() + to label %invoke.cont3 unwind label %ehcleanup + +invoke.cont3: ; preds = %if.end + tail call void @objc_release(i8* null), !clang.imprecise_release !1 + tail call void @objc_release(i8* %a.0), !clang.imprecise_release !1 + ret void + +ehcleanup:; preds = %if.end + %1 = cleanuppad within none [] + call void @objc_release(i8* null) [ "funclet"(token %1) ], !clang.imprecise_release !1 + br label %ehcleanup.1 + +ehcleanup.1: + cleanupret from %1 unwind label %ehcleanup6 + +ehcleanup6: ; preds = %ehcleanup, %if.then, %entry + %a.1 = phi i8* [ %a.0, %ehcleanup.1 ], [ null, %if.then ], [ null, %entry ] + %2 = cleanuppad within none [] + call void @objc_release(i8* %a.1) [ "funclet"(token %2) ], !clang.imprecise_release !1 + cleanupret from %2 unwind to caller +} + +; CHECK-LAB
[PATCH] D44327: ObjCARC: teach the cloner about funclets
compnerd closed this revision. compnerd added a comment. SVN r327336. Addressed comments in SVN r327351, because I forgot to incorporate them in the first try. Repository: rL LLVM https://reviews.llvm.org/D44327 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D44646: Sema: in msvc compatibility mode, don't allow forceinline on variadics
compnerd added a comment. What happens in the case that you have a variadic in C code marked with `__forceinline`? Does that also cause a warning with MSVC? Comment at: test/Sema/ms-forceinline-on-variadic.cpp:1 +// RUN: %clang_cc1 -emit-llvm -o - -triple i686-windows -verify -fms-extensions %s \ +// RUN:| FileCheck %s Personally, I prefer the fully canonicalized triple name `i686-unknown-windows-msvc`. Comment at: test/Sema/ms-forceinline-on-variadic.cpp:14 +__builtin_va_end(ap); +} + Would be nice to have a second test that uses the Microsoft definitions (`char *` and the offsetting handling for the `va_list` since when building against the Windows SDK, that is the way that `va_list` and the `va_*` family of functions will get handled. Repository: rC Clang https://reviews.llvm.org/D44646 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38680: [libunwind] Fix handling of DW_CFA_GNU_args_size
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. This makes much more sense. Thanks @joerg https://reviews.llvm.org/D38680 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D46971: [DWARF] Get RA from RA register even if it appears unused
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. x86-Linux-only test is good. LG with the discussed changes. Comment at: src/DwarfInstructions.hpp:195 } +else if (i == (int)cieInfo.returnAddressRegister) + returnAddress = registers.getRegister(i); whitequark wrote: > compnerd wrote: > > I think that we should stick to LLVM style (coddled braces) and use C++ > > style casts. > Ack re braces. > > I was copying that cast from ten lines above. Should I change that too? This > should be a static_cast, right? Yeah, it should be a `static_cast`. And, yes, it should be fine to adjust the style there too (just do it as a separate commit). Repository: rUNW libunwind https://reviews.llvm.org/D46971 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57001: [libunwind] Don't define unw_fpreg_t to uint64_t for __ARM_DWARF_EH__
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. `double` should be safe for ARM DWARF EH, though, technically, `long double` is more appropriate of a type definition (the FPU state that is saved should be the widest floating point type). That would be `long double` (aka FP80 on x86, FP128 on AArch64/PPC, FP64 elsewhere). This happens to work because ARM uses FP64 irrespective of DWARF or EHABI. Repository: rUNW libunwind CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57001/new/ https://reviews.llvm.org/D57001 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57404: build: remove use of llvm-config
compnerd created this revision. compnerd added reviewers: chandlerc, rnk. Herald added a subscriber: mgorny. Update the CMake build to use the LLVM CMake Config package rather than invoking `llvm-config` to find the parameters. Users can specify `-DLLVM_DIR=` to CMake to indicate where the LLVM build is (as opposed to `-DLLVM_CONFIG=`. For uses where the system provides LLVM or LLVM's build output is in the CMake search path, no parameters are necessary. This removes use of `llvm-config` which is helpful on the path to removing `llvm-config` from LLVM. Repository: rC Clang https://reviews.llvm.org/D57404 Files: CMakeLists.txt lib/Basic/CMakeLists.txt runtime/CMakeLists.txt Index: runtime/CMakeLists.txt === --- runtime/CMakeLists.txt +++ runtime/CMakeLists.txt @@ -22,7 +22,7 @@ endif() endfunction() -set(COMPILER_RT_SRC_ROOT ${LLVM_MAIN_SRC_DIR}/projects/compiler-rt) +set(COMPILER_RT_SRC_ROOT ${LLVM_BUILD_MAIN_SRC_DIR}/projects/compiler-rt) # Fallback to the external path, if the other one isn't available. # This is the same behavior (try "internal", then check the LLVM_EXTERNAL_... # variable) as in add_llvm_external_project Index: lib/Basic/CMakeLists.txt === --- lib/Basic/CMakeLists.txt +++ lib/Basic/CMakeLists.txt @@ -4,7 +4,7 @@ Support ) -find_first_existing_vc_file(llvm_vc "${LLVM_MAIN_SRC_DIR}") +find_first_existing_vc_file(llvm_vc "${LLVM_BUILD_MAIN_SRC_DIR}") find_first_existing_vc_file(clang_vc "${CLANG_SOURCE_DIR}") # The VC revision include that we want to generate. @@ -17,7 +17,7 @@ add_custom_command(OUTPUT "${version_inc}" DEPENDS "${llvm_vc}" "${clang_vc}" "${get_svn_script}" COMMAND -${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLVM_MAIN_SRC_DIR}" +${CMAKE_COMMAND} "-DFIRST_SOURCE_DIR=${LLVM_BUILD_MAIN_SRC_DIR}" "-DFIRST_NAME=LLVM" "-DSECOND_SOURCE_DIR=${CLANG_SOURCE_DIR}" "-DSECOND_NAME=SVN" Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -9,82 +9,34 @@ if( CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR ) project(Clang) - # Rely on llvm-config. - set(CONFIG_OUTPUT) - if(LLVM_CONFIG) -set (LLVM_CONFIG_FOUND 1) -message(STATUS "Found LLVM_CONFIG as ${LLVM_CONFIG}") -message(DEPRECATION "Using llvm-config to detect the LLVM installation is \ - deprecated. The installed cmake files should be used \ - instead. CMake should be able to detect your LLVM install \ - automatically, but you can also use LLVM_DIR to specify \ - the path containing LLVMConfig.cmake.") -set(CONFIG_COMMAND ${LLVM_CONFIG} - "--assertion-mode" - "--bindir" - "--libdir" - "--includedir" - "--prefix" - "--src-root" - "--cmakedir") -execute_process( - COMMAND ${CONFIG_COMMAND} - RESULT_VARIABLE HAD_ERROR - OUTPUT_VARIABLE CONFIG_OUTPUT -) -if(NOT HAD_ERROR) - string(REGEX REPLACE -"[ \t]*[\r\n]+[ \t]*" ";" -CONFIG_OUTPUT ${CONFIG_OUTPUT}) -else() - string(REPLACE ";" " " CONFIG_COMMAND_STR "${CONFIG_COMMAND}") - message(STATUS "${CONFIG_COMMAND_STR}") - message(FATAL_ERROR "llvm-config failed with status ${HAD_ERROR}") -endif() - -list(GET CONFIG_OUTPUT 0 ENABLE_ASSERTIONS) -list(GET CONFIG_OUTPUT 1 TOOLS_BINARY_DIR) -list(GET CONFIG_OUTPUT 2 LIBRARY_DIR) -list(GET CONFIG_OUTPUT 3 INCLUDE_DIR) -list(GET CONFIG_OUTPUT 4 LLVM_OBJ_ROOT) -list(GET CONFIG_OUTPUT 5 MAIN_SRC_DIR) -list(GET CONFIG_OUTPUT 6 LLVM_CONFIG_CMAKE_PATH) - -# Normalize LLVM_CMAKE_PATH. --cmakedir might contain backslashes. -# CMake assumes slashes as PATH. -file(TO_CMAKE_PATH ${LLVM_CONFIG_CMAKE_PATH} LLVM_CMAKE_PATH) - endif() - - - if(NOT MSVC_IDE) -set(LLVM_ENABLE_ASSERTIONS ${ENABLE_ASSERTIONS} - CACHE BOOL "Enable assertions") -# Assertions should follow llvm-config's. -mark_as_advanced(LLVM_ENABLE_ASSERTIONS) - endif() - - find_package(LLVM REQUIRED HINTS "${LLVM_CMAKE_PATH}") + find_package(LLVM REQUIRED CONFIG NO_CMAKE_FIND_ROOT_PATH) list(APPEND CMAKE_MODULE_PATH ${LLVM_DIR}) - # We can't check LLVM_CONFIG here, because find_package(LLVM ...) also sets - # LLVM_CONFIG. - if (NOT LLVM_CONFIG_FOUND) -# Pull values from LLVMConfig.cmake. We can drop this once the llvm-config -# path is removed. -set(TOOLS_BINARY_DIR ${LLVM_TOOLS_BINARY_DIR}) -set(LIBRARY_DIR ${LLVM_LIBRARY_DIR}) -set(INCLUDE_DIR ${LLVM_INCLUDE_DIR}) -set(LLVM_OBJ_DIR ${LLVM_BINARY_DIR}) - endif() + if(CMAKE_CROSSCOMPILING) +set(LLVM_NATIVE_BUILD "${LLVM_BINARY_DIR}/NATIVE") +if(NOT EXISTS "${LLVM_NATIVE_BUILD}") + message(FATAL_ERROR +"Attempting to cross-compile Clang s
[PATCH] D57404: build: remove use of llvm-config
compnerd added a comment. @mgorny, no, you should specify `-DLLVM_DIR=/path/to/where/the/config/lives` instead. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57404/new/ https://reviews.llvm.org/D57404 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55525: [Driver] Add support for -fembed-bitcode for assembly file
compnerd added a comment. This really feels odd. Why not expect that the developer will add the content themselves? I'm not sure I understand the motivation for this change. I think that this should be easy to write a test case for as well. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55525/new/ https://reviews.llvm.org/D55525 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55229: [COFF] Statically link certain runtime library functions
compnerd added a subscriber: theraven. compnerd added inline comments. Comment at: CodeGen/CodeGenModule.cpp:2957-2958 !getCodeGenOpts().LTOVisibilityPublicStd && - !getTriple().isWindowsGNUEnvironment()) { + !getTriple().isWindowsGNUEnvironment() && + !getTriple().isWindowsMSVCEnvironment()) { const FunctionDecl *FD = GetRuntimeFunctionDecl(Context, Name); rnk wrote: > The condition here of `T.isOSBinFormatCOFF() && !T.isWindowsGNUEnvironment() > && !T.isWindowsMSVCEnvironment()` is essentially equivalent to > `T.isWindowsItaniumEnvironment()`. Please simplify the condition to that. The > other relevant environments are Cygnus for Cygwin and CoreCLR, which probably > want to follow the MSVC/GNU behavior. IIRC, one of the issues was that lldb couldn't deal very well with the thunks. The other thing is that there is a small penalty for something that we know that we are going to redirect through. However, I think that if lldb is able to deal with the thunks now, I would be okay with the penalty to make the behavior more similar to MSVC. Basically, if lldb works, lets just get rid of the special behavior for the itanium environment. Comment at: CodeGenObjC/gnu-init.m:103 +// Make sure we do not have dllimport on the load function +// CHECK-WIN: declare dso_local void @__objc_load rnk wrote: > mgrang wrote: > > I had to remove dllimport in this and the next unit test. I am not sure of > > the wider implications of this change. Maybe controlling this via a flag > > (like -flto-visibility-public-std) is a better/more localized option? > These are the ones that I think @compnerd really cares about since the objc > runtime is typically dynamically linked and frequently called. We might want > to arrange things such that we have a separate codepath for ObjC runtime > helpers. I'm surprised we don't already have such a code path. I think that @theraven would care more about this code path than I. I think that this change may be wrong, because the load here is supposed to be in the ObjC runtime, and this becoming local to the module would break the global registration. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D55229/new/ https://reviews.llvm.org/D55229 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D55586: Basic: make `int_least64_t` and `int_fast64_t` match on Darwin
compnerd created this revision. compnerd added reviewers: ahatanak, rjmccall. The Darwin targets use `int64_t` and `uint64_t` to define the `int_least64_t` and `int_fast64_t` types. The underlying type is actually a `long long`. Match the types to allow the printf specifiers to work properly and have the compiler vended macros match the implementation on the target. Repository: rC Clang https://reviews.llvm.org/D55586 Files: lib/Basic/Targets/OSTargets.h test/Preprocessor/init.c Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -1331,10 +1331,10 @@ // AARCH64-DARWIN: #define __INT_FAST32_FMTi__ "i" // AARCH64-DARWIN: #define __INT_FAST32_MAX__ 2147483647 // AARCH64-DARWIN: #define __INT_FAST32_TYPE__ int -// AARCH64-DARWIN: #define __INT_FAST64_FMTd__ "ld" -// AARCH64-DARWIN: #define __INT_FAST64_FMTi__ "li" -// AARCH64-DARWIN: #define __INT_FAST64_MAX__ 9223372036854775807L -// AARCH64-DARWIN: #define __INT_FAST64_TYPE__ long int +// AARCH64-DARWIN: #define __INT_FAST64_FMTd__ "lld" +// AARCH64-DARWIN: #define __INT_FAST64_FMTi__ "lli" +// AARCH64-DARWIN: #define __INT_FAST64_MAX__ 9223372036854775807LL +// AARCH64-DARWIN: #define __INT_FAST64_TYPE__ long long int // AARCH64-DARWIN: #define __INT_FAST8_FMTd__ "hhd" // AARCH64-DARWIN: #define __INT_FAST8_FMTi__ "hhi" // AARCH64-DARWIN: #define __INT_FAST8_MAX__ 127 @@ -1347,10 +1347,10 @@ // AARCH64-DARWIN: #define __INT_LEAST32_FMTi__ "i" // AARCH64-DARWIN: #define __INT_LEAST32_MAX__ 2147483647 // AARCH64-DARWIN: #define __INT_LEAST32_TYPE__ int -// AARCH64-DARWIN: #define __INT_LEAST64_FMTd__ "ld" -// AARCH64-DARWIN: #define __INT_LEAST64_FMTi__ "li" -// AARCH64-DARWIN: #define __INT_LEAST64_MAX__ 9223372036854775807L -// AARCH64-DARWIN: #define __INT_LEAST64_TYPE__ long int +// AARCH64-DARWIN: #define __INT_LEAST64_FMTd__ "lld" +// AARCH64-DARWIN: #define __INT_LEAST64_FMTi__ "lli" +// AARCH64-DARWIN: #define __INT_LEAST64_MAX__ 9223372036854775807LL +// AARCH64-DARWIN: #define __INT_LEAST64_TYPE__ long long int // AARCH64-DARWIN: #define __INT_LEAST8_FMTd__ "hhd" // AARCH64-DARWIN: #define __INT_LEAST8_FMTi__ "hhi" // AARCH64-DARWIN: #define __INT_LEAST8_MAX__ 127 @@ -1418,16 +1418,16 @@ // AARCH64-DARWIN: #define __UINT_FAST16_TYPE__ unsigned short // AARCH64-DARWIN: #define __UINT_FAST32_MAX__ 4294967295U // AARCH64-DARWIN: #define __UINT_FAST32_TYPE__ unsigned int -// AARCH64-DARWIN: #define __UINT_FAST64_MAX__ 18446744073709551615UL -// AARCH64-DARWIN: #define __UINT_FAST64_TYPE__ long unsigned int +// AARCH64-DARWIN: #define __UINT_FAST64_MAX__ 18446744073709551615ULL +// AARCH64-DARWIN: #define __UINT_FAST64_TYPE__ long long unsigned int // AARCH64-DARWIN: #define __UINT_FAST8_MAX__ 255 // AARCH64-DARWIN: #define __UINT_FAST8_TYPE__ unsigned char // AARCH64-DARWIN: #define __UINT_LEAST16_MAX__ 65535 // AARCH64-DARWIN: #define __UINT_LEAST16_TYPE__ unsigned short // AARCH64-DARWIN: #define __UINT_LEAST32_MAX__ 4294967295U // AARCH64-DARWIN: #define __UINT_LEAST32_TYPE__ unsigned int -// AARCH64-DARWIN: #define __UINT_LEAST64_MAX__ 18446744073709551615UL -// AARCH64-DARWIN: #define __UINT_LEAST64_TYPE__ long unsigned int +// AARCH64-DARWIN: #define __UINT_LEAST64_MAX__ 18446744073709551615ULL +// AARCH64-DARWIN: #define __UINT_LEAST64_TYPE__ long long unsigned int // AARCH64-DARWIN: #define __UINT_LEAST8_MAX__ 255 // AARCH64-DARWIN: #define __UINT_LEAST8_TYPE__ unsigned char // AARCH64-DARWIN: #define __USER_LABEL_PREFIX__ _ Index: lib/Basic/Targets/OSTargets.h === --- lib/Basic/Targets/OSTargets.h +++ lib/Basic/Targets/OSTargets.h @@ -133,6 +133,15 @@ /// is very similar to ELF's "protected"; Darwin requires a "weak" /// attribute on declarations that can be dynamically replaced. bool hasProtectedVisibility() const override { return false; } + + TargetInfo::IntType getLeastIntTypeByWidth(unsigned BitWidth, + bool IsSigned) const final { +// Darwin uses `long long` for `int_least64_t` and `int_fast64_t`. +return BitWidth == 64 + ? (IsSigned ? TargetInfo::SignedLongLong + : TargetInfo::UnsignedLongLong) + : TargetInfo::getLeastIntTypeByWidth(BitWidth, IsSigned); + } }; // DragonFlyBSD Target Index: test/Preprocessor/init.c === --- test/Preprocessor/init.c +++ test/Preprocessor/init.c @@ -1331,10 +1331,10 @@ // AARCH64-DARWIN: #define __INT_FAST32_FMTi__ "i" // AARCH64-DARWIN: #define __INT_FAST32_MAX__ 2147483647 // AARCH64-DARWIN: #define __INT_FAST32_TYPE__ int -// AARCH64-DARWIN: #define __INT_FAST64_FMTd__ "ld" -// AARCH64-DARWIN: #define __INT_FAST64_FMTi__ "li" -// AARCH64-DARWIN: #define __INT_FAST64_MAX__ 9223372036854775807L -// AARCH64-DARWIN
[PATCH] D58649: Fix inline assembler constraint validation
compnerd accepted this revision. compnerd added a comment. This revision is now accepted and ready to land. Nice find! CHANGES SINCE LAST ACTION https://reviews.llvm.org/D58649/new/ https://reviews.llvm.org/D58649 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D59745: [NFC] Move writeFuncOrVarName out of class CodegenNameGenerator so that it can be reused more easily.
compnerd added a comment. Hmm, what exactly does the libclang interfaces not give you or what exactly did you intend to have this be used as. Perhaps with some more details we can find a good solution for the specific case that you have in mind. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D59745/new/ https://reviews.llvm.org/D59745 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60274: [ELF] Implement Dependent Libraries Feature
compnerd added inline comments. Comment at: lld/ELF/InputFiles.cpp:662 } + case SHT_LLVM_DEPLIBS: { +if (Config->Relocatable) Can you make the flag here reflect the name as well? (`SHT_LLVM_DEPENDENT_LIBRARIES`) Comment at: lld/ELF/Options.td:74 +defm deplibs: B<"deplibs", +"Process dependent library specifiers from input files (default)", I think that I prefer the `--dependent-libraries` flag which is similar to the recent additions to the linker options. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60274/new/ https://reviews.llvm.org/D60274 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. @jakehehrlich I think you are misunderstanding this. The intent here is to provide a means to emit just the interfaces from a library into a stub that can be used for building. However, rather than have the interfaces be defined elsewhere, having clang run through the sources and compute the public interfaces as written means that no matter how you write your interfaces, the same set of interfaces will always be emitted into the interface library. The "linker" literally is a merge of all the public interfaces in each translation unit. It is important to understand that there are interfaces which may be declared in sources (yes, that is terrible, but not all software is well designed or well written unfortunately). This means that you need to do a syntactic pass of the sources (along with the flags that you are building with) to ensure that all the public interfaces are made visible. You can do this by a separate step of consuming the compilation database and running through each of the target's TUs, this is just a slightly different approach to that. Once you have enumerated the public interfaces, you just emit a stub containing that set of interfaces (preserving whether it is a text or data symbol). I'm not sure how modules play into this at all. Yes, C++ modules could let you control some of the interfaces, but that is orthogonal to what this is meant to do. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. I'm well versed in the complexities of a linker - I've worked extensively on the GNU linkers as well as with lld. The visibility of the symbols is actually computed by the compiler - the STV_* flags associated with the symtab entry give you that information which is actually tracked through the frontend to the backend. Yes, each linker behaves differently - including lld which completely changes the semantics of Unix/ELF linking guarantees. In fact every single attribute that you mentioned is something which is emitted from the compiler - which we have access to here given that we are in clang itself. I think that this can be made to work properly, though will probably require some iteration to get all the corner cases, and that you may be slightly dismissive of this approach. Ah, okay, I didn't pick up that you were using module as the actual module from the context since normally the module doesn't control what it exposes itself. Note that I am not advocating that this change go in as is - I think that this is far from something which would be useful, and until it can produce something meaningful, this shouldn't really be merged (i.e. generate something which obj2yaml or some other tool can consume to generate the barest ELF stub). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. BTW, to clarify how this is intended to be used: the collection of the public interfaces defines the *public* interfaces of the module. This information can be used to generate a **minimally** viable ELF module that the linker can use to link against - no `.text` segment or any other metadata (IIRC, you just need `.symtab`, `.shstrtab`, `.strtab`, `.dynsym` and the ELF header, but that is off the top of my head, and may be incorrect). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added inline comments. Comment at: clang/lib/Frontend/FrontendActions.cpp:326 +(*OS) << " - Name:.text\n"; +(*OS) << "Type:STT_SECTION\n"; +(*OS) << "Section: .text\n"; This is wrong, this marks the type to be a section symbol, which is not correct. Comment at: clang/lib/Frontend/FrontendActions.cpp:332 +<< "Section: .text\n" +<< "Binding: STB_GLOBAL\n"; +(*OS) << "...\n"; Hmm, you need to classify the data symbols properly and mark them appropriately, not as `STT_FUNC`. This is particularly important on ARM where the ISA selection bit may alter the address. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. The strong motivation here is to avoid having the list be maintained outside of the source code. I am not too strongly tied to the YAML approach as long as the binaries that we get at the end are equivalent to the pruned ELF binaries from the YAML2ELF approach. However, the trade off here is valuable - it allows for the source code to be the source of truth for the interface set. The intermediate emission is due to the fact that this requires program level visibility and having the intermediates an extra step to merge is relatively simpler. In fact, you could emit the TBE files from this and check that into the tree if you really wanted (but allowing the source to remain the source of truth I think is a valid and valuable trade off). The reason for the selection of YAML is simply pragmatism - that is already available in the tree. If the TBE linker is available now, I have no issue with that being the intermediate representation (assuming that the representation is easy to parse programatically). Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. Okay, if the TBE isn't suitable for the pre-merged format, then I think that this should be okay with the current approach. This is more about the generation and not wanting to have to maintain a separate side table of information manually. It just is a different trade off. But, sounds like we are converging towards a solution that can be used to address the various tradeoff points that seem to matter. Repository: rC Clang CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. @jakehehrlich - when do you expect to have your idea put up? I don't think that it is fair to have this wait until you have time to put something up that can be discussed. I think that getting this working and then iterating on it and migrating it over to some shared representation is something which we could do - that tends to be a common thing that I have seen happen multiple times with the necessary work never materialising. Re-use of the YAML structure means that we can iterate and identify the pieces that are necessary, though, I expect that largely, what will be needed is the name, the binding, the visibility, possibly the size (for TBEs), the section, and the type, at least for anything which adheres to the GABI. If you have extensions outside of GABI, this will need to be adjusted. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. @phosek - I completely agree, I really would prefer that this not promote the `yaml2obj` tool to an officially supported tool. The reason for using the same output format is for testing convenience, and this should not really invoke the tool (this should work without a `yaml2obj` or `obj2yaml` available on the system). It is similar to the idea of the IR - just a serialization format for testing/debugging/inspecting. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D60974: Clang IFSO driver action.
compnerd added a comment. @jakehehrlich - unfortunately, removing the attributes on the sections will make the content look different with `nm` which is something we do need to appear proper for consumers of the interface libraries. Versioning has a number of problems inherent to it (unfortunately, its the closest to multi-level namespaces in ELF). I think that getting something in tree and iterating on it is far better than continuing to argue over this in the dream of something that unifies the TAPI approach and this approach. The section names are relevant (you can add attributes to put symbols into alternate sections and you can have section relative relocations). I think that you are loosing fidelity in the final output which is sufficient for your needs, but I think that there are places where the full fidelity can be needed. This currently works and allows us to generate the interface library which means that this is actually further than what you are proposing still. Is there something technical that this is doing incorrectly or breaking something? Otherwise, this really does seem like it is devolving into a bike shedding argument that isn't really going anywhere. This is not a large amount of code and there is backing to maintain it, so it is not an issue of "this is adding un-maintained complexity" either. Just like the LLVM APIs, this can/will evolve. I don't see why this needs to be set in stone from the initial implementation. There are use cases which can come up which require reworking the solution. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D60974/new/ https://reviews.llvm.org/D60974 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits