[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list= to match gcc options.
choikwa added a comment. In https://reviews.llvm.org/D37624#885308, @hfinkel wrote: > In https://reviews.llvm.org/D37624#885295, @choikwa wrote: > > > In https://reviews.llvm.org/D37624#885290, @hfinkel wrote: > > > > > In https://reviews.llvm.org/D37624#885288, @choikwa wrote: > > > > > > > - add comment to CPP test to explain usage > > > > > > > > > Thanks. Please also add some tests showing matching overloaded functions, > > > functions with template parameters, etc. > > > > > > Do we need to strip whitespace before trying to match the demangled names? > > > > > > Some cursory testing with g++ shows that only the 'test5' of 'test5(float, > > int, int*)' is matched. 'test5(' or 'test5 (' is not matched. It seems > > weird that arguments are not matched. > > > > g++ man page shows > > > > "The function name to be matched is its user-visible name, such as > > "vector blah(const vector &)", not the internal mangled name" > > > > but it doesn't seem to be including parameters. > > > Interesting. Can you tell what GCC is doing w.r.t. namespace names, class > names, etc. and template parameters? > > > Also uncovered a bug where sub argument list containing comma needs to be > > surrounded by single quote, but clang seems to ignores single quote. > > I'll try to dig around ArgList implementation to see if it can return > > argument surrounded by single-quote as a whole. Given A::B::C(T a), only 'C' is meaningful in g++'s matcher. Adding anything else escapes the match [ 'B::C', 'C(' ]. https://reviews.llvm.org/D37624 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38444: [compiler-rt] [cmake] Create dummy gtest target for stand-alone builds
mgorny created this revision. Herald added a subscriber: dberris. Create a dummy 'gtest' target to satisfy the test dependencies while doing stand-alone builds. Historically those dependencies were conditional to non-stand-alone builds but the refactoring in https://reviews.llvm.org/rL310971 has made them unconditional, breaking stand-alone builds as a result. Given the added complexity of maintaining a large number of conditionals scattered around the different CMakeLists.txt files and the likeliness of people mistakenly adding more unconditional dependencies, adding a dummy target seems an easier way forward. Repository: rL LLVM https://reviews.llvm.org/D38444 Files: cmake/Modules/AddCompilerRT.cmake Index: cmake/Modules/AddCompilerRT.cmake === --- cmake/Modules/AddCompilerRT.cmake +++ cmake/Modules/AddCompilerRT.cmake @@ -291,6 +291,12 @@ -I${COMPILER_RT_GTEST_PATH} ) +if(COMPILER_RT_STANDALONE_BUILD) + # Add a dummy target to satisfy dependencies on GTest when building + # stand-alone. GTest itself is provided via COMPILER_RT_GTEST_SOURCES. + add_custom_target(gtest) +endif() + append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS) append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS) Index: cmake/Modules/AddCompilerRT.cmake === --- cmake/Modules/AddCompilerRT.cmake +++ cmake/Modules/AddCompilerRT.cmake @@ -291,6 +291,12 @@ -I${COMPILER_RT_GTEST_PATH} ) +if(COMPILER_RT_STANDALONE_BUILD) + # Add a dummy target to satisfy dependencies on GTest when building + # stand-alone. GTest itself is provided via COMPILER_RT_GTEST_SOURCES. + add_custom_target(gtest) +endif() + append_list_if(COMPILER_RT_DEBUG -DSANITIZER_DEBUG=1 COMPILER_RT_UNITTEST_CFLAGS) append_list_if(COMPILER_RT_HAS_WCOVERED_SWITCH_DEFAULT_FLAG -Wno-covered-switch-default COMPILER_RT_UNITTEST_CFLAGS) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38445: [x86][inlin-asm] allow recognition of MPX regs inside ms inline-asm blob
coby created this revision. Herald added a subscriber: eraman. Repository: rL LLVM https://reviews.llvm.org/D38445 Files: lib/Basic/Targets/X86.cpp test/CodeGen/ms-inline-asm.c Index: lib/Basic/Targets/X86.cpp === --- lib/Basic/Targets/X86.cpp +++ lib/Basic/Targets/X86.cpp @@ -60,6 +60,7 @@ "k2","k3","k4","k5","k6", "k7", "cr0", "cr2", "cr3", "cr4", "cr8", "dr0", "dr1", "dr2", "dr3", "dr6", "dr7", +"bnd0", "bnd1", "bnd2", "bnd3", }; const TargetInfo::AddlRegName AddlRegNames[] = { Index: test/CodeGen/ms-inline-asm.c === --- test/CodeGen/ms-inline-asm.c +++ test/CodeGen/ms-inline-asm.c @@ -661,6 +661,17 @@ // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", "~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"() } +void t47() { + // CHECK-LABEL: define void @t47 + __asm { +bndmk bnd0, dword ptr [eax] +bndmk bnd1, dword ptr [ebx] +bndmk bnd2, dword ptr [ecx] +bndmk bnd3, dword ptr [edx] + } + // CHECK: call void asm sideeffect inteldialect "bndmk bnd0, dword ptr [eax]\0A\09bndmk bnd1, dword ptr [ebx]\0A\09bndmk bnd2, dword ptr [ecx]\0A\09bndmk bnd3, dword ptr [edx]", "~{bnd0},~{bnd1},~{bnd2},~{bnd3},~{dirflag},~{fpsr},~{flags}"() +} + void dot_operator(){ // CHECK-LABEL: define void @dot_operator __asm { mov eax, 3[ebx]A.b} Index: lib/Basic/Targets/X86.cpp === --- lib/Basic/Targets/X86.cpp +++ lib/Basic/Targets/X86.cpp @@ -60,6 +60,7 @@ "k2","k3","k4","k5","k6", "k7", "cr0", "cr2", "cr3", "cr4", "cr8", "dr0", "dr1", "dr2", "dr3", "dr6", "dr7", +"bnd0", "bnd1", "bnd2", "bnd3", }; const TargetInfo::AddlRegName AddlRegNames[] = { Index: test/CodeGen/ms-inline-asm.c === --- test/CodeGen/ms-inline-asm.c +++ test/CodeGen/ms-inline-asm.c @@ -661,6 +661,17 @@ // CHECK: call void asm sideeffect inteldialect "add eax, [eax + $$-128]", "~{eax},~{flags},~{dirflag},~{fpsr},~{flags}"() } +void t47() { + // CHECK-LABEL: define void @t47 + __asm { +bndmk bnd0, dword ptr [eax] +bndmk bnd1, dword ptr [ebx] +bndmk bnd2, dword ptr [ecx] +bndmk bnd3, dword ptr [edx] + } + // CHECK: call void asm sideeffect inteldialect "bndmk bnd0, dword ptr [eax]\0A\09bndmk bnd1, dword ptr [ebx]\0A\09bndmk bnd2, dword ptr [ecx]\0A\09bndmk bnd3, dword ptr [edx]", "~{bnd0},~{bnd1},~{bnd2},~{bnd3},~{dirflag},~{fpsr},~{flags}"() +} + void dot_operator(){ // CHECK-LABEL: define void @dot_operator __asm { mov eax, 3[ebx]A.b} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37466: D37461: fixups for existing InlineAsm tests + adding new ones
coby added inline comments. Comment at: test/CodeGen/ms-inline-asm.cpp:37-38 - int lvar = 10; - __asm mov eax, offset Foo::ptr - __asm mov eax, offset Foo::Bar::ptr -// CHECK-LABEL: define void @_Z2t2v() rnk wrote: > These don't seem tested anywhere now I've tested them against msvc, and they are seem to be unsupported there as well, so I don't see any value in keeping this one around :\ Repository: rL LLVM https://reviews.llvm.org/D37466 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r314623 - Test Commit.
Author: agozillon Date: Sun Oct 1 05:16:24 2017 New Revision: 314623 URL: http://llvm.org/viewvc/llvm-project?rev=314623&view=rev Log: Test Commit. Modified: cfe/trunk/lib/Sema/SemaType.cpp Modified: cfe/trunk/lib/Sema/SemaType.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaType.cpp?rev=314623&r1=314622&r2=314623&view=diff == --- cfe/trunk/lib/Sema/SemaType.cpp (original) +++ cfe/trunk/lib/Sema/SemaType.cpp Sun Oct 1 05:16:24 2017 @@ -5606,7 +5606,6 @@ ParsedType Sema::ActOnObjCInstanceType(S /// space for the type. static void HandleAddressSpaceTypeAttribute(QualType &Type, const AttributeList &Attr, Sema &S){ - // If this type is already address space qualified, reject it. // ISO/IEC TR 18037 S5.3 (amending C99 6.7.3): "No type shall be qualified by // qualifiers for two or more different address spaces." ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list= to match gcc options.
hfinkel added a comment. In https://reviews.llvm.org/D37624#885311, @choikwa wrote: > In https://reviews.llvm.org/D37624#885308, @hfinkel wrote: > > > In https://reviews.llvm.org/D37624#885295, @choikwa wrote: > > > > > In https://reviews.llvm.org/D37624#885290, @hfinkel wrote: > > > > > > > In https://reviews.llvm.org/D37624#885288, @choikwa wrote: > > > > > > > > > - add comment to CPP test to explain usage > > > > > > > > > > > > Thanks. Please also add some tests showing matching overloaded > > > > functions, functions with template parameters, etc. > > > > > > > > Do we need to strip whitespace before trying to match the demangled > > > > names? > > > > > > > > > Some cursory testing with g++ shows that only the 'test5' of > > > 'test5(float, int, int*)' is matched. 'test5(' or 'test5 (' is not > > > matched. It seems weird that arguments are not matched. > > > > > > g++ man page shows > > > > > > "The function name to be matched is its user-visible name, such as > > > "vector blah(const vector &)", not the internal mangled name" > > > > > > but it doesn't seem to be including parameters. > > > > > > Interesting. Can you tell what GCC is doing w.r.t. namespace names, class > > names, etc. and template parameters? > > > > > Also uncovered a bug where sub argument list containing comma needs to be > > > surrounded by single quote, but clang seems to ignores single quote. > > > I'll try to dig around ArgList implementation to see if it can return > > > argument surrounded by single-quote as a whole. > > > Given A::B::C(T a), only 'C' is meaningful in g++'s matcher. Adding > anything else escapes the match [ 'B::C', 'C(' ]. > It seems like g++ will also not match single quotes as a whole, ie. int > fooboo() is matched by 'foo,boo'. Can you get more information on what GCC actually implemented and why? It's not clear to me that ignoring the namespaces is the most-useful way to do this. I don't want to emulate GCC bugs, but maybe there's a good reason why their implementation works this way. https://reviews.llvm.org/D37624 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38048: [clangd] Add textDocument/signatureHelp
rwols added inline comments. Comment at: clangd/ClangdUnit.cpp:442 static void FillSortText(const CodeCompletionString &CCS, CompletionItem &Item) { I seem to have inadvertently used the old fillSortText during the merge from upstream, let me fix that (this is why tests were failing probably). https://reviews.llvm.org/D38048 ___ 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] D38048: [clangd] Add textDocument/signatureHelp
rwols updated this revision to Diff 117290. rwols added a comment. - Fix fillSortText: used the old version, now using new version from upstream - Fix initialize-params.test and initialize-params-invalid.test to account for signature help - All tests pass now https://reviews.llvm.org/D38048 Files: clangd/ClangdLSPServer.cpp clangd/ClangdLSPServer.h clangd/ClangdServer.cpp clangd/ClangdServer.h clangd/ClangdUnit.cpp clangd/ClangdUnit.h clangd/Protocol.cpp clangd/Protocol.h clangd/ProtocolHandlers.cpp clangd/ProtocolHandlers.h test/clangd/formatting.test test/clangd/initialize-params-invalid.test test/clangd/initialize-params.test test/clangd/signature-help.test Index: test/clangd/signature-help.test === --- /dev/null +++ test/clangd/signature-help.test @@ -0,0 +1,42 @@ +# RUN: clangd -run-synchronously < %s | FileCheck %s +# It is absolutely vital that this file has CRLF line endings. + +# Start a session. +Content-Length: 125 + +{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}} + +# Modify the document. +Content-Length: 333 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":1,"text":"void foo(int x, int y);\nvoid foo(int x, float y);\nvoid foo(float x, int y);\nvoid foo(float x, float y);\nvoid bar(int x, int y = 0);\nvoid bar(float x = 0, int y = 42);\nint main() { foo("}}} + +# Ask for signature help. +Content-Length: 151 + +{"jsonrpc":"2.0","id":1,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":8,"character":9}}} +# CHECK: {"jsonrpc":"2.0","id":1,"result":{"activeSignature":0,"activeParameter":0,"signatures":[ +# CHECK-DAG: {"label":"foo(float x, float y) -> void","parameters":[{"label":"float x"},{"label":"float y"}]} +# CHECK-DAG: {"label":"foo(float x, int y) -> void","parameters":[{"label":"float x"},{"label":"int y"}]} +# CHECK-DAG: {"label":"foo(int x, float y) -> void","parameters":[{"label":"int x"},{"label":"float y"}]} +# CHECK-DAG: {"label":"foo(int x, int y) -> void","parameters":[{"label":"int x"},{"label":"int y"}]} +# CHECK: ]} + +# Modify the document +Content-Length: 333 + +{"jsonrpc":"2.0","method":"textDocument/didOpen","params":{"textDocument":{"uri":"file:///main.cpp","languageId":"cpp","version":2,"text":"void foo(int x, int y);\nvoid foo(int x, float y);\nvoid foo(float x, int y);\nvoid foo(float x, float y);\nvoid bar(int x, int y = 0);\nvoid bar(float x = 0, int y = 42);\nint main() { bar("}}} + +# Ask for signature help (this checks default argument handling). +Content-Length: 151 + +{"jsonrpc":"2.0","id":2,"method":"textDocument/signatureHelp","params":{"textDocument":{"uri":"file:///main.cpp"},"position":{"line":8,"character":9}}} +# CHECK: {"jsonrpc":"2.0","id":2,"result":{"activeSignature":0,"activeParameter":0,"signatures":[ +# CHECK-DAG: {"label":"bar(int x, int y = 0) -> void","parameters":[{"label":"int x"},{"label":"int y = 0"}]} +# CHECK-DAG: {"label":"bar(float x = 0, int y = 42) -> void","parameters":[{"label":"float x = 0"},{"label":"int y = 42"}]} +# CHECK: ]} + +# Shutdown. +Content-Length: 49 + +{"jsonrpc":"2.0","id":10,"method":"shutdown"} Index: test/clangd/initialize-params.test === --- test/clangd/initialize-params.test +++ test/clangd/initialize-params.test @@ -5,14 +5,15 @@ Content-Length: 143 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootUri":"file:///path/to/workspace","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 466 +# CHECK: Content-Length: 535 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingProvider": true, # CHECK: "documentOnTypeFormattingProvider": {"firstTriggerCharacter":"}","moreTriggerCharacter":[]}, # CHECK: "codeActionProvider": true, # CHECK: "completionProvider": {"resolveProvider": false, "triggerCharacters": [".",">",":"]}, +# CHECK: "signatureHelpProvider": {"triggerCharacters": ["(",","]}, # CHECK: "definitionProvider": true # CHECK: }}} # Index: test/clangd/initialize-params-invalid.test === --- test/clangd/initialize-params-invalid.test +++ test/clangd/initialize-params-invalid.test @@ -5,14 +5,15 @@ Content-Length: 142 {"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":"","rootUri":"file:///path/to/workspace","capabilities":{},"trace":"off"}} -# CHECK: Content-Length: 466 +# CHECK: Content-Length: 535 # CHECK: {"jsonrpc":"2.0","id":0,"result":{"capabilities":{ # CHECK: "textDocumentSync": 1, # CHECK: "documentFormattingProvider": true, # CHECK: "documentRangeFormattingP
[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
mstorsjo added inline comments. Comment at: src/Unwind-sjlj.c:481 +#endif // !defined(__APPLE__) + #endif // defined(_LIBUNWIND_BUILD_SJLJ_APIS) compnerd wrote: > 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. Yes, except that in the apple case, those functions are provided by another TU (Unwind_AppleExtras.cpp). So in that case, those functions only should be static in the non-apple case. https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314632 - SjLj: make the SjLj implementation more portable
Author: compnerd Date: Sun Oct 1 13:06:48 2017 New Revision: 314632 URL: http://llvm.org/viewvc/llvm-project?rev=314632&view=rev Log: SjLj: make the SjLj implementation more portable This moves the definition of the internal helpers `__Unwind_SjLj_GetTopOfFunctionStack` and `__Unwind_SjLj_SetTopOfFunctionStack` into `Unwind-sjlj.c`. These are not extra functions specific to Apple, but rather are internal implementation details of SjLj support in the LLVM libunwind implementation. This allows us to remove the internal header unwind_ext.h, as these functions are not meant to be used as SPI either. Because they are static, they will be given implicit hidden visibility, but due to the simplicity should get fully inlined into the actual use. Use the C11 standard static TLS annotation (`_Thread_local`) if possible, otherwise, use the Windows specific `__declspec(thread)` when targeting Windows or the GNU `__thread` extension. In theory, it should be possible for this implementation to use a `pthread_setspecific` and `pthread_getspecific` on platforms with pthreads or `SetFlsValue` and `GetFlsValue` on Windows for non-static TLS. However, static TLS tends to be significantly faster, so we really should prefer that over the dynamic TLS approach. On Apple environments, when not building for the loader (dyld), use the pre-allocated TLS slot in the loader rather than the local static TLS variable. Note that the un-threaded support of libunwind is still present as before, however, it is unsafe to use in a threaded environment as the cleanup stack may be mutated incorrectly due to lack of locking across threads. In the static TLS model, the lock is unneeded as each thread of execution retains its own copy of the cleanup stack. Take the opportunity to clean up the comment block, removing the iOS specific note as the SjLj implementation can be used outside of the context of iOS. Convert the rest of the explanation to a doxygen style comment block. Removed: libunwind/trunk/src/unwind_ext.h Modified: libunwind/trunk/src/CMakeLists.txt libunwind/trunk/src/Unwind-sjlj.c libunwind/trunk/src/Unwind_AppleExtras.cpp Modified: libunwind/trunk/src/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/CMakeLists.txt?rev=314632&r1=314631&r2=314632&view=diff == --- libunwind/trunk/src/CMakeLists.txt (original) +++ libunwind/trunk/src/CMakeLists.txt Sun Oct 1 13:06:48 2017 @@ -31,7 +31,6 @@ set(LIBUNWIND_HEADERS libunwind_ext.h Registers.hpp UnwindCursor.hpp -unwind_ext.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/libunwind.h ${CMAKE_CURRENT_SOURCE_DIR}/../include/unwind.h) Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=314632&r1=314631&r2=314632&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Sun Oct 1 13:06:48 2017 @@ -17,20 +17,14 @@ #include #include "config.h" -#include "unwind_ext.h" -// -// 32-bit iOS uses setjump/longjump based C++ exceptions. -// Other architectures use "zero cost" exceptions. -// -// With SJLJ based exceptions, any function that has a catch clause or needs to -// do any clean up when an exception propagates through it, needs to call -// _Unwind_SjLj_Register() at the start of the function and -// _Unwind_SjLj_Unregister() at the end. The register function is called with -// the address of a block of memory in the function's stack frame. The runtime -// keeps a linked list (stack) of these blocks - one per thread. The calling -// function also sets the personality and lsda fields of the block. -// +/// With SJLJ based exceptions, any function that has a catch clause or needs to +/// do any clean up when an exception propagates through it, needs to call +/// \c _Unwind_SjLj_Register at the start of the function and +/// \c _Unwind_SjLj_Unregister at the end. The register function is called with +/// the address of a block of memory in the function's stack frame. The runtime +/// keeps a linked list (stack) of these blocks - one per thread. The calling +/// function also sets the personality and lsda fields of the block. #if defined(_LIBUNWIND_BUILD_SJLJ_APIS) @@ -53,6 +47,48 @@ struct _Unwind_FunctionContext { void *jbuf[]; }; +#if defined(_LIBUNWIND_HAS_NO_THREADS) +# define _LIBUNWIND_THREAD_LOCAL +#else +# if __STDC_VERSION__ >= 201112L +# define _LIBUNWIND_THREAD_LOCAL _Thread_local +# elif defined(_WIN32) +# define _LIBUNWIND_THREAD_LOCAL __declspec(thread) +# elif defined(__GNUC__) || defined(__clang__) +# define _LIBUNWIND_THREAD_LOCAL __thread +# else +# error Unable to create thread local storage +# endif +#endif + + +#if !defined(FOR_DYLD) + +#if defined(__APPLE__) +#include +#els
[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] D37624: add support for -fno-instrument-functions and -finstrument-functions-exclude-{file, function}-list= to match gcc options.
choikwa added a comment. > Can you get more information on what GCC actually implemented and why? It's > not clear to me that ignoring the namespaces is the most-useful way to do > this. I don't want to emulate GCC bugs, but maybe there's a good reason why > their implementation works this way. This is what I found, https://gcc.gnu.org/ml/gcc-patches/2015-12/msg00473.html Diff shows it doesn't seem to specially treat single quotes. +case OPT_finstrument_functions_include_function_list_: + add_comma_separated_to_vector + (&opts->x_flag_instrument_functions_include_functions, arg); + break; https://reviews.llvm.org/D37624 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libunwind] r314635 - SjLj: Fix building after SVN r314632
Author: mstorsjo Date: Sun Oct 1 13:22:40 2017 New Revision: 314635 URL: http://llvm.org/viewvc/llvm-project?rev=314635&view=rev Log: SjLj: Fix building after SVN r314632 The code moved from Unwind_AppleExtras.cpp to Unwind-sjlj.c needed a few minor modifications to build as C instead of C++. Modified: libunwind/trunk/src/Unwind-sjlj.c Modified: libunwind/trunk/src/Unwind-sjlj.c URL: http://llvm.org/viewvc/llvm-project/libunwind/trunk/src/Unwind-sjlj.c?rev=314635&r1=314634&r2=314635&view=diff == --- libunwind/trunk/src/Unwind-sjlj.c (original) +++ libunwind/trunk/src/Unwind-sjlj.c Sun Oct 1 13:22:40 2017 @@ -67,7 +67,7 @@ struct _Unwind_FunctionContext { #if defined(__APPLE__) #include #else -static _LIBUNWIND_THREAD_LOCAL _Unwind_FunctionContext *stack = nullptr; +static _LIBUNWIND_THREAD_LOCAL struct _Unwind_FunctionContext *stack = NULL; #endif static struct _Unwind_FunctionContext *__Unwind_SjLj_GetTopOfFunctionStack() { ___ 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
mstorsjo abandoned this revision. mstorsjo added a comment. Works fine with the version from r314632 (with a minor fixup in r314635). https://reviews.llvm.org/D38250 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r314634 - Let get_work_dim take exactly 0 arguments
Author: jketema Date: Sun Oct 1 13:11:46 2017 New Revision: 314634 URL: http://llvm.org/viewvc/llvm-project?rev=314634&view=rev Log: Let get_work_dim take exactly 0 arguments Reviewed-by: Jan Vesely Modified: libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl libclc/trunk/generic/include/clc/workitem/get_work_dim.h libclc/trunk/r600/lib/workitem/get_work_dim.cl Modified: libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl?rev=314634&r1=314633&r2=314634&view=diff == --- libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl (original) +++ libclc/trunk/amdgcn/lib/workitem/get_work_dim.cl Sun Oct 1 13:11:46 2017 @@ -1,6 +1,6 @@ #include -_CLC_DEF uint get_work_dim() +_CLC_DEF uint get_work_dim(void) { __attribute__((address_space(2))) uint * ptr = (__attribute__((address_space(2))) uint *) Modified: libclc/trunk/generic/include/clc/workitem/get_work_dim.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/workitem/get_work_dim.h?rev=314634&r1=314633&r2=314634&view=diff == --- libclc/trunk/generic/include/clc/workitem/get_work_dim.h (original) +++ libclc/trunk/generic/include/clc/workitem/get_work_dim.h Sun Oct 1 13:11:46 2017 @@ -1 +1 @@ -_CLC_DECL uint get_work_dim(); +_CLC_DECL uint get_work_dim(void); Modified: libclc/trunk/r600/lib/workitem/get_work_dim.cl URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/r600/lib/workitem/get_work_dim.cl?rev=314634&r1=314633&r2=314634&view=diff == --- libclc/trunk/r600/lib/workitem/get_work_dim.cl (original) +++ libclc/trunk/r600/lib/workitem/get_work_dim.cl Sun Oct 1 13:11:46 2017 @@ -1,6 +1,6 @@ #include -_CLC_DEF uint get_work_dim() +_CLC_DEF uint get_work_dim(void) { __attribute__((address_space(7))) uint * ptr = (__attribute__((address_space(7))) uint *) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libclc] r314633 - Do no circularly define NULL
Author: jketema Date: Sun Oct 1 13:10:14 2017 New Revision: 314633 URL: http://llvm.org/viewvc/llvm-project?rev=314633&view=rev Log: Do no circularly define NULL Reviewed-by: Jan Vesely Modified: libclc/trunk/generic/include/clc/clcmacros.h Modified: libclc/trunk/generic/include/clc/clcmacros.h URL: http://llvm.org/viewvc/llvm-project/libclc/trunk/generic/include/clc/clcmacros.h?rev=314633&r1=314632&r2=314633&view=diff == --- libclc/trunk/generic/include/clc/clcmacros.h (original) +++ libclc/trunk/generic/include/clc/clcmacros.h Sun Oct 1 13:10:14 2017 @@ -9,7 +9,7 @@ #define CLC_VERSION_1_2 120 #endif -#define NULL ((void*)NULL) +#define NULL ((void*)0) #define __kernel_exec(X, typen) __kernel \ __attribute__((work_group_size_hint(X, 1, 1))) \ ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D37856: [refactor] add support for refactoring options
ioeric accepted this revision. ioeric added a comment. This revision is now accepted and ready to land. Looks good with some nits. Comment at: include/clang/Tooling/Refactoring/RefactoringActionRuleRequirements.h:73 +template +class OptionRequirement : public RefactoringOptionsRequirement { +public: nit: `OptionRequirement` sounds more general than the base class `RefactoringOptionsRequirement`. Comment at: include/clang/Tooling/Refactoring/RefactoringOption.h:47 + /// invoke the \c visit method with a reference to an std::string value. + virtual void passToVisitor(RefactoringOptionVisitor &Consumer) = 0; +}; nit: s/Consumer/Visitor/ Comment at: tools/clang-refactor/ClangRefactor.cpp:129 + const cl::opt & + getStringOption(const RefactoringOption &Opt) const { +auto It = StringOptions.find(&Opt); We use templated method for adding options above but type-specific interfaces (e.g. `getStringOption`) for getting options. I think we should make either both templated or separate interfaces. I am a bit inclined to separate interfaces for each type for clarity. Comment at: tools/clang-refactor/ClangRefactor.cpp:149 +/// refactoring action rule. +class CommandLineRefactoringOptionConsumer final +: public RefactoringOptionVisitor { Visitor? Repository: rL LLVM https://reviews.llvm.org/D37856 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38441: [compiler-rt] [cmake] Add a separate CMake var to control profile runtime
vsk accepted this revision. vsk added a comment. This revision is now accepted and ready to land. Thanks, lgtm. Repository: rL LLVM https://reviews.llvm.org/D38441 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38290: Add a ld64.lld alias for the MACHO LLD target
ruiu added a comment. This patch virtually sets `ld64` the linker command name for macOS. I'd be a bit reluctant doing that, because `ld64` sounds like a too generic name to indicate "a linker for macOS". But that's probably okay because we don't have a better name. Can you get an LGTM from someone who owns the clang driver? Repository: rL LLVM https://reviews.llvm.org/D38290 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D38441: [compiler-rt] [cmake] Add a separate CMake var to control profile runtime
This revision was automatically updated to reflect the committed changes. Closed by commit rL314646: [cmake] Add a separate CMake var to control profile runtime (authored by mgorny). Changed prior to commit: https://reviews.llvm.org/D38441?vs=117255&id=117299#toc Repository: rL LLVM https://reviews.llvm.org/D38441 Files: compiler-rt/trunk/CMakeLists.txt compiler-rt/trunk/lib/CMakeLists.txt compiler-rt/trunk/test/CMakeLists.txt Index: compiler-rt/trunk/lib/CMakeLists.txt === --- compiler-rt/trunk/lib/CMakeLists.txt +++ compiler-rt/trunk/lib/CMakeLists.txt @@ -41,7 +41,7 @@ endforeach() endif() -if (COMPILER_RT_HAS_PROFILE) +if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) compiler_rt_build_runtime(profile) endif() Index: compiler-rt/trunk/test/CMakeLists.txt === --- compiler-rt/trunk/test/CMakeLists.txt +++ compiler-rt/trunk/test/CMakeLists.txt @@ -10,7 +10,7 @@ set(SANITIZER_COMMON_LIT_TEST_DEPS) -if (COMPILER_RT_HAS_PROFILE) +if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile) endif() @@ -72,7 +72,7 @@ endif() endforeach() endif() - if (COMPILER_RT_HAS_PROFILE) + if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) compiler_rt_test_runtime(profile) endif() if(COMPILER_RT_BUILD_XRAY) Index: compiler-rt/trunk/CMakeLists.txt === --- compiler-rt/trunk/CMakeLists.txt +++ compiler-rt/trunk/CMakeLists.txt @@ -38,6 +38,8 @@ mark_as_advanced(COMPILER_RT_BUILD_XRAY) option(COMPILER_RT_BUILD_LIBFUZZER "Build libFuzzer" ON) mark_as_advanced(COMPILER_RT_BUILD_LIBFUZZER) +option(COMPILER_RT_BUILD_PROFILE "Build profile runtime" ON) +mark_as_advanced(COMPILER_RT_BUILD_PROFILE) option(COMPILER_RT_BUILD_XRAY_NO_PREINIT "Build xray with no preinit patching" OFF) mark_as_advanced(COMPILER_RT_BUILD_XRAY_NO_PREINIT) Index: compiler-rt/trunk/lib/CMakeLists.txt === --- compiler-rt/trunk/lib/CMakeLists.txt +++ compiler-rt/trunk/lib/CMakeLists.txt @@ -41,7 +41,7 @@ endforeach() endif() -if (COMPILER_RT_HAS_PROFILE) +if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) compiler_rt_build_runtime(profile) endif() Index: compiler-rt/trunk/test/CMakeLists.txt === --- compiler-rt/trunk/test/CMakeLists.txt +++ compiler-rt/trunk/test/CMakeLists.txt @@ -10,7 +10,7 @@ set(SANITIZER_COMMON_LIT_TEST_DEPS) -if (COMPILER_RT_HAS_PROFILE) +if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) list(APPEND SANITIZER_COMMON_LIT_TEST_DEPS profile) endif() @@ -72,7 +72,7 @@ endif() endforeach() endif() - if (COMPILER_RT_HAS_PROFILE) + if(COMPILER_RT_BUILD_PROFILE AND COMPILER_RT_HAS_PROFILE) compiler_rt_test_runtime(profile) endif() if(COMPILER_RT_BUILD_XRAY) Index: compiler-rt/trunk/CMakeLists.txt === --- compiler-rt/trunk/CMakeLists.txt +++ compiler-rt/trunk/CMakeLists.txt @@ -38,6 +38,8 @@ mark_as_advanced(COMPILER_RT_BUILD_XRAY) option(COMPILER_RT_BUILD_LIBFUZZER "Build libFuzzer" ON) mark_as_advanced(COMPILER_RT_BUILD_LIBFUZZER) +option(COMPILER_RT_BUILD_PROFILE "Build profile runtime" ON) +mark_as_advanced(COMPILER_RT_BUILD_PROFILE) option(COMPILER_RT_BUILD_XRAY_NO_PREINIT "Build xray with no preinit patching" OFF) mark_as_advanced(COMPILER_RT_BUILD_XRAY_NO_PREINIT) ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r314649 - Dependent Address Space Support
Author: agozillon Date: Sun Oct 1 23:25:51 2017 New Revision: 314649 URL: http://llvm.org/viewvc/llvm-project?rev=314649&view=rev Log: Dependent Address Space Support This patch relates to: https://reviews.llvm.org/D33666 This adds support for template parameters to be passed to the address_space attribute. The main goal is to add further flexibility to the attribute and allow for it to be used easily with templates. The main additions are a new type (DependentAddressSpaceType) alongside its TypeLoc and its mangling. As well as the logic required to support dependent address spaces which mainly resides in TreeTransform.h and SemaType.cpp. Modified: cfe/trunk/include/clang/AST/ASTContext.h cfe/trunk/include/clang/AST/RecursiveASTVisitor.h cfe/trunk/include/clang/AST/Type.h cfe/trunk/include/clang/AST/TypeLoc.h cfe/trunk/include/clang/AST/TypeNodes.def cfe/trunk/include/clang/Sema/Sema.h cfe/trunk/include/clang/Serialization/ASTBitCodes.h cfe/trunk/lib/AST/ASTContext.cpp cfe/trunk/lib/AST/ASTStructuralEquivalence.cpp cfe/trunk/lib/AST/ItaniumMangle.cpp cfe/trunk/lib/AST/MicrosoftMangle.cpp cfe/trunk/lib/AST/Type.cpp cfe/trunk/lib/AST/TypePrinter.cpp cfe/trunk/lib/Sema/SemaDecl.cpp cfe/trunk/lib/Sema/SemaTemplate.cpp cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp cfe/trunk/lib/Sema/SemaType.cpp cfe/trunk/lib/Sema/TreeTransform.h cfe/trunk/lib/Serialization/ASTReader.cpp cfe/trunk/lib/Serialization/ASTWriter.cpp cfe/trunk/tools/libclang/CIndex.cpp Modified: cfe/trunk/include/clang/AST/ASTContext.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=314649&r1=314648&r2=314649&view=diff == --- cfe/trunk/include/clang/AST/ASTContext.h (original) +++ cfe/trunk/include/clang/AST/ASTContext.h Sun Oct 1 23:25:51 2017 @@ -143,6 +143,8 @@ class ASTContext : public RefCountedBase mutable llvm::FoldingSet DependentSizedArrayTypes; mutable llvm::FoldingSet DependentSizedExtVectorTypes; + mutable llvm::FoldingSet + DependentAddressSpaceTypes; mutable llvm::FoldingSet VectorTypes; mutable llvm::FoldingSet FunctionNoProtoTypes; mutable llvm::ContextualFoldingSet @@ -1070,6 +1072,13 @@ public: /// replaced. QualType getAddrSpaceQualType(QualType T, unsigned AddressSpace) const; + /// \brief Remove any existing address space on the type and returns the type + /// with qualifiers intact (or that's the idea anyway) + /// + /// The return type should be T with all prior qualifiers minus the address + /// space. + QualType removeAddrSpaceQualType(QualType T) const; + /// \brief Apply Objective-C protocol qualifiers to the given type. /// \param allowOnPointerType specifies if we can apply protocol /// qualifiers on ObjCObjectPointerType. It can be set to true when @@ -1270,6 +1279,10 @@ public: Expr *SizeExpr, SourceLocation AttrLoc) const; + QualType getDependentAddressSpaceType(QualType PointeeType, +Expr *AddrSpaceExpr, +SourceLocation AttrLoc) const; + /// \brief Return a K&R style C function type like 'int()'. QualType getFunctionNoProtoType(QualType ResultTy, const FunctionType::ExtInfo &Info) const; Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=314649&r1=314648&r2=314649&view=diff == --- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original) +++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Sun Oct 1 23:25:51 2017 @@ -988,6 +988,11 @@ DEF_TRAVERSE_TYPE(DependentSizedArrayTyp TRY_TO(TraverseStmt(T->getSizeExpr())); }) +DEF_TRAVERSE_TYPE(DependentAddressSpaceType, { + TRY_TO(TraverseStmt(T->getAddrSpaceExpr())); + TRY_TO(TraverseType(T->getPointeeType())); +}) + DEF_TRAVERSE_TYPE(DependentSizedExtVectorType, { if (T->getSizeExpr()) TRY_TO(TraverseStmt(T->getSizeExpr())); @@ -1198,6 +1203,11 @@ DEF_TRAVERSE_TYPELOC(DependentSizedArray return TraverseArrayTypeLocHelper(TL); }) +DEF_TRAVERSE_TYPELOC(DependentAddressSpaceType, { + TRY_TO(TraverseStmt(TL.getTypePtr()->getAddrSpaceExpr())); + TRY_TO(TraverseType(TL.getTypePtr()->getPointeeType())); +}) + // FIXME: order? why not size expr first? // FIXME: base VectorTypeLoc is unfinished DEF_TRAVERSE_TYPELOC(DependentSizedExtVectorType, { Modified: cfe/trunk/include/clang/AST/Type.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=314649&r1=314648&r2=314649&view=diff == --- cfe/trunk/include/cla
r314650 - Dependent Address Space Support Test File
Author: agozillon Date: Sun Oct 1 23:31:25 2017 New Revision: 314650 URL: http://llvm.org/viewvc/llvm-project?rev=314650&view=rev Log: Dependent Address Space Support Test File Adding regression test for Dependent Address Spaces in relation to https://reviews.llvm.org/D33666 I forgot to svn add the test file before commiting the prior changes. I appologies. Added: cfe/trunk/test/SemaTemplate/address_space-dependent.cpp Added: cfe/trunk/test/SemaTemplate/address_space-dependent.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/address_space-dependent.cpp?rev=314650&view=auto == --- cfe/trunk/test/SemaTemplate/address_space-dependent.cpp (added) +++ cfe/trunk/test/SemaTemplate/address_space-dependent.cpp Sun Oct 1 23:31:25 2017 @@ -0,0 +1,119 @@ +// RUN: %clang_cc1 -x c++ -std=c++14 -fsyntax-only -verify %s + +template +void car() { + int __attribute__((address_space(I))) __attribute__((address_space(J))) * Y; // expected-error {{multiple address spaces specified for type}} + int *__attribute__((address_space(I))) __attribute__((address_space(J))) * Z; // expected-error {{multiple address spaces specified for type}} + + __attribute__((address_space(I))) int local;// expected-error {{automatic variable qualified with an address space}} + __attribute__((address_space(J))) int array[5]; // expected-error {{automatic variable qualified with an address space}} + __attribute__((address_space(I))) int arrarr[5][5]; // expected-error {{automatic variable qualified with an address space}} + + __attribute__((address_space(J))) * x; // expected-error {{C++ requires a type specifier for all declarations}} + + __attribute__((address_space(I))) float *B; + + typedef __attribute__((address_space(J))) int AS2Int; + struct HasASFields { +AS2Int typedef_as_field; // expected-error {{field may not be qualified with an address space}} + }; + + struct _st { +int x, y; + } s __attribute((address_space(I))) = {1, 1}; +} + +template +struct HasASTemplateFields { + __attribute__((address_space(I))) int as_field; // expected-error {{field may not be qualified with an address space}} +}; + +template +void foo(__attribute__((address_space(I))) float *a, // expected-note {{candidate template ignored: substitution failure [with I = 1, J = 2]: parameter may not be qualified with an address space}} + __attribute__((address_space(J))) float b) { + *a = 5.0f + b; +} + +template void foo<1, 2>(float *, float); // expected-error {{explicit instantiation of 'foo' does not refer to a function template, variable template, member function, member class, or static data member}} + +template +void neg() { + __attribute__((address_space(I))) int *bounds; // expected-error {{address space is negative}} +} + +template +void toBig() { + __attribute__((address_space(I))) int *bounds; // expected-error {{address space is larger than the maximum supported (8388599)}} +} + +template +void correct() { + __attribute__((address_space(I))) int *bounds; +} + +template +char *cmp(__attribute__((address_space(I))) char *x, __attribute__((address_space(J))) char *y) { + return x < y ? x : y; // expected-error {{comparison of distinct pointer types ('__attribute__((address_space(1))) char *' and '__attribute__((address_space(2))) char *')}} +} + +typedef void ft(void); + +template +struct fooFunction { + __attribute__((address_space(I))) void **const base = 0; + + void *get_0(void) { +return base[0]; // expected-error {{cannot initialize return object of type 'void *' with an lvalue of type '__attribute__((address_space(1))) void *}} + } + + __attribute__((address_space(I))) ft qf; // expected-error {{function type may not be qualified with an address space}} + __attribute__((address_space(I))) char *test3_val; + + void test3(void) { +extern void test3_helper(char *p); // expected-note {{passing argument to parameter 'p' here}} +test3_helper(test3_val); // expected-error {{cannot initialize a parameter of type 'char *' with an lvalue of type '__attribute__((address_space(1))) char *'}} + } +}; + +template +int GetAddressSpaceValue(T __attribute__((address_space(N))) * p) { + return N; +} + +template int __attribute__((address_space(A))) *same_template(); +template int __attribute__((address_space(B))) *same_template(); +void test_same_template() { (void) same_template<0>(); } + +template int __attribute__((address_space(A))) *different_template(); // expected-note {{candidate function [with A = 0]}} +template int __attribute__((address_space(B+1))) *different_template(); // expected-note {{candidate function [with B = 0]}} +void test_different_template() { (void) different_template<0>(); } // expected-error {{call to 'different_template' is ambiguous}} + +template struct partial_spec_deduce_as; +template +struct partial_spec_deduce_as <__a