[PATCH] D26082: Support for Python 3 in libclang python bindings
jbcoe added a comment. Thanks Mathieu. Tests ran without issues when I submitted my patch but I tested on macOS. I'll have a look into this and see if I can reproduce the problem. Repository: rL LLVM https://reviews.llvm.org/D26082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23765: Fix for clang PR 29087
This revision was automatically updated to reflect the committed changes. Closed by commit rL287999: Adjust type-trait evaluation to properly handle Using(Shadow)Decls (authored by hfinkel). Changed prior to commit: https://reviews.llvm.org/D23765?vs=76817&id=79354#toc Repository: rL LLVM https://reviews.llvm.org/D23765 Files: cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/SemaCXX/cxx11-crashes.cpp Index: cfe/trunk/test/SemaCXX/cxx11-crashes.cpp === --- cfe/trunk/test/SemaCXX/cxx11-crashes.cpp +++ cfe/trunk/test/SemaCXX/cxx11-crashes.cpp @@ -91,3 +91,15 @@ Foo(lambda); } } + +namespace pr29091 { + struct X{ X(const X &x); }; + struct Y: X { using X::X; }; + bool foo() { return __has_nothrow_constructor(Y); } + bool bar() { return __has_nothrow_copy(Y); } + + struct A { template A(); }; + struct B : A { using A::A; }; + bool baz() { return __has_nothrow_constructor(B); } + bool qux() { return __has_nothrow_copy(B); } +} Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp === --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4416,9 +4416,12 @@ // A template constructor is never a copy constructor. // FIXME: However, it may actually be selected at the actual overload // resolution point. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) continue; -const CXXConstructorDecl *Constructor = cast(ND); +// UsingDecl itself is not a constructor +if (isa(ND)) + continue; +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isCopyConstructor(FoundTQs)) { FoundConstructor = true; const FunctionProtoType *CPT @@ -4452,9 +4455,12 @@ bool FoundConstructor = false; for (const auto *ND : Self.LookupConstructors(RD)) { // FIXME: In C++0x, a constructor template can be a default constructor. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) + continue; +// UsingDecl itself is not a constructor +if (isa(ND)) continue; -const CXXConstructorDecl *Constructor = cast(ND); +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isDefaultConstructor()) { FoundConstructor = true; const FunctionProtoType *CPT Index: cfe/trunk/test/SemaCXX/cxx11-crashes.cpp === --- cfe/trunk/test/SemaCXX/cxx11-crashes.cpp +++ cfe/trunk/test/SemaCXX/cxx11-crashes.cpp @@ -91,3 +91,15 @@ Foo(lambda); } } + +namespace pr29091 { + struct X{ X(const X &x); }; + struct Y: X { using X::X; }; + bool foo() { return __has_nothrow_constructor(Y); } + bool bar() { return __has_nothrow_copy(Y); } + + struct A { template A(); }; + struct B : A { using A::A; }; + bool baz() { return __has_nothrow_constructor(B); } + bool qux() { return __has_nothrow_copy(B); } +} Index: cfe/trunk/lib/Sema/SemaExprCXX.cpp === --- cfe/trunk/lib/Sema/SemaExprCXX.cpp +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp @@ -4416,9 +4416,12 @@ // A template constructor is never a copy constructor. // FIXME: However, it may actually be selected at the actual overload // resolution point. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) continue; -const CXXConstructorDecl *Constructor = cast(ND); +// UsingDecl itself is not a constructor +if (isa(ND)) + continue; +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isCopyConstructor(FoundTQs)) { FoundConstructor = true; const FunctionProtoType *CPT @@ -4452,9 +4455,12 @@ bool FoundConstructor = false; for (const auto *ND : Self.LookupConstructors(RD)) { // FIXME: In C++0x, a constructor template can be a default constructor. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) + continue; +// UsingDecl itself is not a constructor +if (isa(ND)) continue; -const CXXConstructorDecl *Constructor = cast(ND); +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isDefaultConstructor()) { FoundConstructor = true; const FunctionProtoType *CPT ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
r287999 - Adjust type-trait evaluation to properly handle Using(Shadow)Decls
Author: hfinkel Date: Sun Nov 27 10:26:14 2016 New Revision: 287999 URL: http://llvm.org/viewvc/llvm-project?rev=287999&view=rev Log: Adjust type-trait evaluation to properly handle Using(Shadow)Decls Since r274049, for an inheriting constructor declaration, the name of the using declaration (and using shadow declaration comes from the using declaration) is the name of a derived class, not the base class (line 8225-8232 of lib/Sema/SemaDeclCXX.cpp in https://reviews.llvm.org/rL274049). Because of this, name-based lookup performed inside Sema::LookupConstructors returns not only CXXConstructorDecls but also Using(Shadow)Decls, which results assertion failure reported in PR29087. Patch by Taewook Oh, thanks! Differential Revision: https://reviews.llvm.org/D23765 Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp cfe/trunk/test/SemaCXX/cxx11-crashes.cpp Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=287999&r1=287998&r2=287999&view=diff == --- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original) +++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Sun Nov 27 10:26:14 2016 @@ -4416,9 +4416,12 @@ static bool EvaluateUnaryTypeTrait(Sema // A template constructor is never a copy constructor. // FIXME: However, it may actually be selected at the actual overload // resolution point. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) continue; -const CXXConstructorDecl *Constructor = cast(ND); +// UsingDecl itself is not a constructor +if (isa(ND)) + continue; +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isCopyConstructor(FoundTQs)) { FoundConstructor = true; const FunctionProtoType *CPT @@ -4452,9 +4455,12 @@ static bool EvaluateUnaryTypeTrait(Sema bool FoundConstructor = false; for (const auto *ND : Self.LookupConstructors(RD)) { // FIXME: In C++0x, a constructor template can be a default constructor. -if (isa(ND)) +if (isa(ND->getUnderlyingDecl())) + continue; +// UsingDecl itself is not a constructor +if (isa(ND)) continue; -const CXXConstructorDecl *Constructor = cast(ND); +auto *Constructor = cast(ND->getUnderlyingDecl()); if (Constructor->isDefaultConstructor()) { FoundConstructor = true; const FunctionProtoType *CPT Modified: cfe/trunk/test/SemaCXX/cxx11-crashes.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/cxx11-crashes.cpp?rev=287999&r1=287998&r2=287999&view=diff == --- cfe/trunk/test/SemaCXX/cxx11-crashes.cpp (original) +++ cfe/trunk/test/SemaCXX/cxx11-crashes.cpp Sun Nov 27 10:26:14 2016 @@ -91,3 +91,15 @@ void test(int some_number) { // expecte Foo(lambda); } } + +namespace pr29091 { + struct X{ X(const X &x); }; + struct Y: X { using X::X; }; + bool foo() { return __has_nothrow_constructor(Y); } + bool bar() { return __has_nothrow_copy(Y); } + + struct A { template A(); }; + struct B : A { using A::A; }; + bool baz() { return __has_nothrow_constructor(B); } + bool qux() { return __has_nothrow_copy(B); } +} ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: r282411 - [analyzer] Improve CastToStruct checker so it can also detect widening casts of struct data
Il 26/09/2016 17:17, Daniel Marjamaki via cfe-commits ha scritto: > Author: danielmarjamaki > Date: Mon Sep 26 10:17:18 2016 > New Revision: 282411 > > URL: http://llvm.org/viewvc/llvm-project?rev=282411&view=rev > Log: > [analyzer] Improve CastToStruct checker so it can also detect widening casts > of struct data > > Example: > > struct AB { > int A; > int B; > }; > > struct ABC { > int A; > int B; > int C; > }; > > void f() { > struct AB Data; > struct ABC *P = (struct ABC *)&Data; > } > This commit introduces the regression filed in https://llvm.org/bugs/show_bug.cgi?id=31173 -- Abramo Bagnara BUGSENG srl - http://bugseng.com mailto:abramo.bagn...@bugseng.com ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26082: Support for Python 3 in libclang python bindings
MathieuDuponchelle added a comment. Hey, for what it's worth when skipping the free at this line: https://github.com/llvm-mirror/clang/blob/master/bindings/python/clang/cindex.py#L181 the issues are gone, I haven't investigated the reason why. Repository: rL LLVM https://reviews.llvm.org/D26082 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D25717: [x86][inline-asm][clang][fixup] accept 'v' constraint
coby abandoned this revision. coby added a comment. deprecated Repository: rL LLVM https://reviews.llvm.org/D25717 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26934: [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
smeenai updated this revision to Diff 79358. smeenai added a comment. Herald added a subscriber: mgorny. Addressing comments https://reviews.llvm.org/D26934 Files: CMakeLists.txt docs/UsingLibcxx.rst include/__config include/__config_site.in Index: include/__config_site.in === --- include/__config_site.in +++ include/__config_site.in @@ -21,6 +21,6 @@ #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL -#cmakedefine _LIBCPP_DISABLE_DLL_IMPORT_EXPORT +#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #endif // _LIBCPP_CONFIG_SITE Index: include/__config === --- include/__config +++ include/__config @@ -511,6 +511,10 @@ #ifdef _WIN32 #if defined(_LIBCPP_DISABLE_DLL_IMPORT_EXPORT) +// this can be removed once any existing users have switched to the new macro +# error "Use _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS instead of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT" +#endif +#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_DLL_VIS # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS @@ -546,18 +550,30 @@ #endif // _WIN32 #ifndef _LIBCPP_HIDDEN +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) +#else +#define _LIBCPP_HIDDEN +#endif #endif #ifndef _LIBCPP_FUNC_VIS +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) +#else +#define _LIBCPP_FUNC_VIS +#endif #endif #ifndef _LIBCPP_TYPE_VIS -# if __has_attribute(__type_visibility__) -#define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +#if __has_attribute(__type_visibility__) +# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) +#else +# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) +#endif # else -#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) +#define _LIBCPP_TYPE_VIS # endif #endif @@ -574,19 +590,23 @@ #endif #ifndef _LIBCPP_EXCEPTION_ABI +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +#else +#define _LIBCPP_EXCEPTION_ABI +#endif #endif #ifndef _LIBCPP_ENUM_VIS -# if __has_attribute(__type_visibility__) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) #define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) # else #define _LIBCPP_ENUM_VIS # endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# if __has_attribute(__type_visibility__) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default"))) # else #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS @@ -598,15 +618,27 @@ #endif #ifndef _LIBCPP_INLINE_VISIBILITY +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#else +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +#endif #endif #ifndef _LIBCPP_ALWAYS_INLINE +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) +#else +#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# else +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) +# endif #endif #ifndef _LIBCPP_PREFERRED_OVERLOAD Index: docs/UsingLibcxx.rst === --- docs/UsingLibcxx.rst +++ docs/UsingLibcxx.rst @@ -149,3 +149,9 @@ This macro is used to enable -Wthread-safety annotations on libc++'s ``std::mutex`` and ``std::lock_guard``. By default these annotations are disabled and must be manually enabled by the user. + +**_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS**: + This macro is used to disable all visibility annotations inside libc++. + Defining this macro and then building libc++ with hidden visibility gives a + build of libc++ which does not export any symbols, which can be useful when + building statically for inclusion into another library. Index: CMakeLists.txt ==
[PATCH] D26934: [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
smeenai added inline comments. Comment at: include/__config:513-516 #if defined(_LIBCPP_DISABLE_DLL_IMPORT_EXPORT) +// this can be removed once any existing users have switched to the new macro +# error "Use _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS instead of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT" +#endif I'd like to remove this before the 4.0 release, if that's all right with you. I don't think there would be many users of the existing macro, and I'd prefer it to not make its way to a release. https://reviews.llvm.org/D26934 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D26934: [libc++] Add _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS
smeenai updated this revision to Diff 79359. smeenai added a comment. Not changing non-Windows behavior, to make sure I'm not breaking anyone https://reviews.llvm.org/D26934 Files: CMakeLists.txt docs/UsingLibcxx.rst include/__config include/__config_site.in Index: include/__config_site.in === --- include/__config_site.in +++ include/__config_site.in @@ -21,6 +21,6 @@ #cmakedefine _LIBCPP_HAS_MUSL_LIBC #cmakedefine _LIBCPP_HAS_THREAD_API_PTHREAD #cmakedefine _LIBCPP_HAS_THREAD_API_EXTERNAL -#cmakedefine _LIBCPP_DISABLE_DLL_IMPORT_EXPORT +#cmakedefine _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS #endif // _LIBCPP_CONFIG_SITE Index: include/__config === --- include/__config +++ include/__config @@ -511,6 +511,10 @@ #ifdef _WIN32 #if defined(_LIBCPP_DISABLE_DLL_IMPORT_EXPORT) +// this can be removed once any existing users have switched to the new macro +# error "Use _LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS instead of _LIBCPP_DISABLE_DLL_IMPORT_EXPORT" +#endif +#if defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) # define _LIBCPP_DLL_VIS # define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS # define _LIBCPP_CLASS_TEMPLATE_INSTANTIATION_VIS @@ -546,18 +550,30 @@ #endif // _WIN32 #ifndef _LIBCPP_HIDDEN +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_HIDDEN __attribute__ ((__visibility__("hidden"))) +#else +#define _LIBCPP_HIDDEN +#endif #endif #ifndef _LIBCPP_FUNC_VIS +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_FUNC_VIS __attribute__ ((__visibility__("default"))) +#else +#define _LIBCPP_FUNC_VIS +#endif #endif #ifndef _LIBCPP_TYPE_VIS -# if __has_attribute(__type_visibility__) -#define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +#if __has_attribute(__type_visibility__) +# define _LIBCPP_TYPE_VIS __attribute__ ((__type_visibility__("default"))) +#else +# define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) +#endif # else -#define _LIBCPP_TYPE_VIS __attribute__ ((__visibility__("default"))) +#define _LIBCPP_TYPE_VIS # endif #endif @@ -574,19 +590,23 @@ #endif #ifndef _LIBCPP_EXCEPTION_ABI +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_EXCEPTION_ABI __attribute__ ((__visibility__("default"))) +#else +#define _LIBCPP_EXCEPTION_ABI +#endif #endif #ifndef _LIBCPP_ENUM_VIS -# if __has_attribute(__type_visibility__) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) #define _LIBCPP_ENUM_VIS __attribute__ ((__type_visibility__("default"))) # else #define _LIBCPP_ENUM_VIS # endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS -# if __has_attribute(__type_visibility__) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) && __has_attribute(__type_visibility__) #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS __attribute__ ((__type_visibility__("default"))) # else #define _LIBCPP_EXTERN_TEMPLATE_TYPE_VIS @@ -598,15 +618,27 @@ #endif #ifndef _LIBCPP_INLINE_VISIBILITY +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__visibility__("hidden"), __always_inline__)) +#else +#define _LIBCPP_INLINE_VISIBILITY __attribute__ ((__always_inline__)) +#endif #endif #ifndef _LIBCPP_ALWAYS_INLINE +#if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__visibility__("hidden"), __always_inline__)) +#else +#define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#endif #endif #ifndef _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY -# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# if !defined(_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS) +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__visibility__("default"), __always_inline__)) +# else +# define _LIBCPP_EXTERN_TEMPLATE_INLINE_VISIBILITY __attribute__((__always_inline__)) +# endif #endif #ifndef _LIBCPP_PREFERRED_OVERLOAD Index: docs/UsingLibcxx.rst === --- docs/UsingLibcxx.rst +++ docs/UsingLibcxx.rst @@ -149,3 +149,9 @@ This macro is used to enable -Wthread-safety annotations on libc++'s ``std::mutex`` and ``std::lock_guard``. By default these annotations are disabled and must be manually enabled by the user. + +**_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS**: + This macro is used to disable all visibility annotations inside libc++. + Defining this macro and then building libc++ with hidden visibility gives a + build of libc++ which does not export any symbols, which can be useful when + building statically for inclusion into another library. Index: CMakeLists.txt =
[PATCH] D27153: [libc++] Make __num_get_float hidden
smeenai created this revision. smeenai added reviewers: EricWF, mclow.lists. smeenai added a subscriber: cfe-commits. It's an internal function and shouldn't be exported. It's also a source of discrepancy in the published ABI list; these symbols aren't exported for me on CentOS 7 or Ubuntu 16.04, leading to spurious check-cxx-abilist failures. https://reviews.llvm.org/D27153 Files: include/locale lib/abi/x86_64-unknown-linux-gnu.abilist Index: lib/abi/x86_64-unknown-linux-gnu.abilist === --- lib/abi/x86_64-unknown-linux-gnu.abilist +++ lib/abi/x86_64-unknown-linux-gnu.abilist @@ -936,9 +936,6 @@ {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD1Ev'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD2Ev'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__get_classnameEPKcb'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIdEET_PKcS3_Rj'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIeEET_PKcS3_Rj'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIfEET_PKcS3_Rj'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_struct25notify_all_at_thread_exitEPNS_18condition_variableEPNS_5mutexE'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_struct27__make_ready_at_thread_exitEPNS_17__assoc_sub_stateE'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_structC1Ev'} Index: include/locale === --- include/locale +++ include/locale @@ -779,6 +779,7 @@ } template +_LIBCPP_HIDDEN _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) { Index: lib/abi/x86_64-unknown-linux-gnu.abilist === --- lib/abi/x86_64-unknown-linux-gnu.abilist +++ lib/abi/x86_64-unknown-linux-gnu.abilist @@ -936,9 +936,6 @@ {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD1Ev'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__114error_categoryD2Ev'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__get_classnameEPKcb'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIdEET_PKcS3_Rj'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIeEET_PKcS3_Rj'} -{'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__num_get_floatIfEET_PKcS3_Rj'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_struct25notify_all_at_thread_exitEPNS_18condition_variableEPNS_5mutexE'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_struct27__make_ready_at_thread_exitEPNS_17__assoc_sub_stateE'} {'is_defined': True, 'type': 'FUNC', 'name': '_ZNSt3__115__thread_structC1Ev'} Index: include/locale === --- include/locale +++ include/locale @@ -779,6 +779,7 @@ } template +_LIBCPP_HIDDEN _Tp __num_get_float(const char* __a, const char* __a_end, ios_base::iostate& __err) { ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27153: [libc++] Make __num_get_float hidden
smeenai added a comment. I'm having some second thoughts about this. Visibility for template functions makes my head spin :/ Is there a general policy we've been following for these? I didn't find much just scanning through other definitions. https://reviews.llvm.org/D27153 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27157: IRGen: Remove all uses of CreateDefaultAlignedLoad.
pcc created this revision. pcc added a reviewer: rsmith. pcc added subscribers: cfe-commits, rjmccall. https://reviews.llvm.org/D27157 Files: clang/lib/CodeGen/CGBuilder.h clang/lib/CodeGen/CGBuiltin.cpp clang/lib/CodeGen/CGCall.cpp clang/lib/CodeGen/CGObjCGNU.cpp clang/lib/CodeGen/TargetInfo.cpp Index: clang/lib/CodeGen/TargetInfo.cpp === --- clang/lib/CodeGen/TargetInfo.cpp +++ clang/lib/CodeGen/TargetInfo.cpp @@ -3548,15 +3548,16 @@ llvm::Value *RegHiAddr = TyLo->isFPOrFPVectorTy() ? GPAddr : FPAddr; // Copy the first element. -llvm::Value *V = - CGF.Builder.CreateDefaultAlignedLoad( - CGF.Builder.CreateBitCast(RegLoAddr, PTyLo)); +llvm::Value *V = CGF.Builder.CreateAlignedLoad( +TyLo, CGF.Builder.CreateBitCast(RegLoAddr, PTyLo), +CharUnits::fromQuantity(getDataLayout().getABITypeAlignment(TyLo))); CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 0, CharUnits::Zero())); // Copy the second element. -V = CGF.Builder.CreateDefaultAlignedLoad( - CGF.Builder.CreateBitCast(RegHiAddr, PTyHi)); +V = CGF.Builder.CreateAlignedLoad( +TyHi, CGF.Builder.CreateBitCast(RegHiAddr, PTyHi), +CharUnits::fromQuantity(getDataLayout().getABITypeAlignment(TyHi))); CharUnits Offset = CharUnits::fromQuantity( getDataLayout().getStructLayout(ST)->getElementOffset(1)); CGF.Builder.CreateStore(V, CGF.Builder.CreateStructGEP(Tmp, 1, Offset)); Index: clang/lib/CodeGen/CGObjCGNU.cpp === --- clang/lib/CodeGen/CGObjCGNU.cpp +++ clang/lib/CodeGen/CGObjCGNU.cpp @@ -2890,9 +2890,11 @@ if (RuntimeVersion < 10 || CGF.CGM.getTarget().getTriple().isKnownWindowsMSVCEnvironment()) return CGF.Builder.CreateZExtOrBitCast( - CGF.Builder.CreateDefaultAlignedLoad(CGF.Builder.CreateAlignedLoad( - ObjCIvarOffsetVariable(Interface, Ivar), - CGF.getPointerAlign(), "ivar")), + CGF.Builder.CreateAlignedLoad( + Int32Ty, CGF.Builder.CreateAlignedLoad( + ObjCIvarOffsetVariable(Interface, Ivar), + CGF.getPointerAlign(), "ivar"), + CharUnits::fromQuantity(4)), PtrDiffTy); std::string name = "__objc_ivar_offset_value_" + Interface->getNameAsString() +"." + Ivar->getNameAsString(); Index: clang/lib/CodeGen/CGCall.cpp === --- clang/lib/CodeGen/CGCall.cpp +++ clang/lib/CodeGen/CGCall.cpp @@ -2884,13 +2884,13 @@ // FIXME: Generate IR in one pass, rather than going back and fixing up these // placeholders. llvm::Type *IRTy = CGF.ConvertTypeForMem(Ty); - llvm::Value *Placeholder = -llvm::UndefValue::get(IRTy->getPointerTo()->getPointerTo()); - Placeholder = CGF.Builder.CreateDefaultAlignedLoad(Placeholder); + llvm::Type *IRPtrTy = IRTy->getPointerTo(); + llvm::Value *Placeholder = llvm::UndefValue::get(IRPtrTy->getPointerTo()); // FIXME: When we generate this IR in one pass, we shouldn't need // this win32-specific alignment hack. CharUnits Align = CharUnits::fromQuantity(4); + Placeholder = CGF.Builder.CreateAlignedLoad(IRPtrTy, Placeholder, Align); return AggValueSlot::forAddr(Address(Placeholder, Align), Ty.getQualifiers(), Index: clang/lib/CodeGen/CGBuiltin.cpp === --- clang/lib/CodeGen/CGBuiltin.cpp +++ clang/lib/CodeGen/CGBuiltin.cpp @@ -2192,7 +2192,8 @@ Builder.CreateIntToPtr(EmitScalarExpr(E->getArg(0)), llvm::PointerType::get(IntTy, 257)); LoadInst *Load = -Builder.CreateDefaultAlignedLoad(IntToPtr, /*isVolatile=*/true); +Builder.CreateAlignedLoad(IntTy, IntToPtr, CharUnits::fromQuantity(4)); +Load->setVolatile(true); return RValue::get(Load); } @@ -5440,9 +5441,11 @@ switch (BuiltinID) { default: break; case NEON::BI__builtin_neon_vldrq_p128: { -llvm::Type *Int128PTy = llvm::Type::getIntNPtrTy(getLLVMContext(), 128); +llvm::Type *Int128Ty = llvm::Type::getIntNTy(getLLVMContext(), 128); +llvm::Type *Int128PTy = llvm::PointerType::get(Int128Ty, 0); Value *Ptr = Builder.CreateBitCast(EmitScalarExpr(E->getArg(0)), Int128PTy); -return Builder.CreateDefaultAlignedLoad(Ptr); +return Builder.CreateAlignedLoad(Int128Ty, Ptr, + CharUnits::fromQuantity(16)); } case NEON::BI__builtin_neon_vstrq_p128: { llvm::Type *Int128PTy = llvm::Type::getIntNPtrTy(getLLVMContext(), 128); @@ -6615,27 +6618,37 @@ return EmitNeonCall(CGM.getIntrinsic(Int, Tys), Ops, ""); } case NEON::BI__builtin_neon_vld1_v: - case NEON::BI__bui
[PATCH] D26904: [astimporter] Support importing CXXDependentScopeMemberExpr and FunctionTemplateDecl
khazem updated this revision to Diff 79371. khazem added a comment. Thanks for the comments, Aleksei! I've merged some aspects of the code you pointed me to, although I had to change some of it because some of the function calls have changed since 2015. In particular, I'm checking for already-imported functions, and adding the decl to the imported map. I'm not sure how to proceed with tests. I was looking at test/ASTMerge/class-template-partial-spec.cpp, would it be something like this? But I'm not sure what error I should throw if we have already imported the function, there is no appropriate error in include/clang/Basic/DiagnosticASTKinds.td. Should I define a new error, e.g. "function %0 defined in multiple translation units"? https://reviews.llvm.org/D26904 Files: include/clang/ASTMatchers/ASTMatchers.h lib/AST/ASTImporter.cpp lib/ASTMatchers/Dynamic/Registry.cpp unittests/AST/ASTImporterTest.cpp Index: unittests/AST/ASTImporterTest.cpp === --- unittests/AST/ASTImporterTest.cpp +++ unittests/AST/ASTImporterTest.cpp @@ -489,5 +489,54 @@ } +TEST(ImportDecl, ImportFunctionTemplateDecl) { + MatchVerifier Verifier; + EXPECT_TRUE( +testImport( + "template void declToImport() { };", + Lang_CXX, "", Lang_CXX, Verifier, + functionTemplateDecl())); +} + + +TEST(ImportExpr, ImportCXXDependentScopeMemberExpr) { + MatchVerifier Verifier; + EXPECT_TRUE( +testImport( + "template class C { T t; };" + "template void declToImport() {" +"C d;" +"d.t = T();" + "}", + Lang_CXX, "", Lang_CXX, Verifier, + functionTemplateDecl( +has( + functionDecl( +has( + compoundStmt( +has( + binaryOperator( +has( + cxxDependentScopeMemberExpr())); + EXPECT_TRUE( +testImport( + "template class C { T t; };" + "template void declToImport() {" +"C d;" +"(&d)->t = T();" + "}", + Lang_CXX, "", Lang_CXX, Verifier, + functionTemplateDecl( +has( + functionDecl( +has( + compoundStmt( +has( + binaryOperator( +has( + cxxDependentScopeMemberExpr())); +} + + } // end namespace ast_matchers } // end namespace clang Index: lib/ASTMatchers/Dynamic/Registry.cpp === --- lib/ASTMatchers/Dynamic/Registry.cpp +++ lib/ASTMatchers/Dynamic/Registry.cpp @@ -141,6 +141,7 @@ REGISTER_MATCHER(cxxCtorInitializer); REGISTER_MATCHER(cxxDefaultArgExpr); REGISTER_MATCHER(cxxDeleteExpr); + REGISTER_MATCHER(cxxDependentScopeMemberExpr); REGISTER_MATCHER(cxxDestructorDecl); REGISTER_MATCHER(cxxDynamicCastExpr); REGISTER_MATCHER(cxxForRangeStmt); Index: lib/AST/ASTImporter.cpp === --- lib/AST/ASTImporter.cpp +++ lib/AST/ASTImporter.cpp @@ -124,6 +124,9 @@ ImportDefinitionKind Kind = IDK_Default); bool ImportDefinition(ObjCProtocolDecl *From, ObjCProtocolDecl *To, ImportDefinitionKind Kind = IDK_Default); + +void ImportAttributes(Decl *From, Decl *To); + TemplateParameterList *ImportTemplateParameterList( TemplateParameterList *Params); TemplateArgument ImportTemplateArgument(const TemplateArgument &From); @@ -138,6 +141,8 @@ bool Complain = true); bool IsStructuralMatch(EnumDecl *FromEnum, EnumDecl *ToRecord); bool IsStructuralMatch(EnumConstantDecl *FromEC, EnumConstantDecl *ToEC); +bool IsStructuralMatch(FunctionTemplateDecl *From, + FunctionTemplateDecl *To); bool IsStructuralMatch(ClassTemplateDecl *From, ClassTemplateDecl *To); bool IsStructuralMatch(VarTemplateDecl *From, VarTemplateDecl *To); Decl *VisitDecl(Decl *D); @@ -160,6 +165,7 @@ Decl *VisitFieldDecl(FieldDecl *D); Decl *VisitIndirectFieldDecl(IndirectFieldDecl *D); Decl *VisitFriendDecl(FriendDecl *D); +Decl *VisitFunctionTemplateDecl(FunctionTemplateDecl *D); Decl *VisitObjCIvarDecl(ObjCIvarDecl *D); Decl *VisitVarDecl(VarDecl *D); Decl *VisitImplicitParamDecl(ImplicitParamDecl *D); @@ -266,6 +272,7 @@ Expr *VisitMaterializeTemporaryExpr(MaterializeTemporaryExpr *E); Expr *VisitCXXNewExpr(CXXNewExpr *CE); Expr *VisitCXXDeleteExpr(CXXDeleteExpr *E); +Expr *VisitCXXDependentScopeMemberExpr(CXXDependentScopeMemberExpr *E); Expr *VisitCXXConstructExpr(CXXConstructExpr *E); Expr *VisitCXXMemberCallExpr(CXXMemberC
[PATCH] D27157: IRGen: Remove all uses of CreateDefaultAlignedLoad.
rjmccall added a comment. Thanks for doing this! A couple minor questions / comments. Comment at: clang/lib/CodeGen/CGBuiltin.cpp:2195 LoadInst *Load = -Builder.CreateDefaultAlignedLoad(IntToPtr, /*isVolatile=*/true); +Builder.CreateAlignedLoad(IntTy, IntToPtr, CharUnits::fromQuantity(4)); +Load->setVolatile(true); Why 4? Comment at: clang/lib/CodeGen/TargetInfo.cpp:3560 +TyHi, CGF.Builder.CreateBitCast(RegHiAddr, PTyHi), +CharUnits::fromQuantity(getDataLayout().getABITypeAlignment(TyHi))); CharUnits Offset = CharUnits::fromQuantity( Please leave a comment mentioning that this is probably pessimistic. https://reviews.llvm.org/D27157 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D27099: [OpenCL] Prohibit using reserve_id_t in program scope.
echuraev updated this revision to Diff 79372. echuraev marked 2 inline comments as done. https://reviews.llvm.org/D27099 Files: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaDecl.cpp test/SemaOpenCL/event_t.cl test/SemaOpenCL/invalid-clk-events-cl2.0.cl test/SemaOpenCL/invalid-pipes-cl2.0.cl Index: test/SemaOpenCL/invalid-pipes-cl2.0.cl === --- test/SemaOpenCL/invalid-pipes-cl2.0.cl +++ test/SemaOpenCL/invalid-pipes-cl2.0.cl @@ -1,5 +1,8 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 +global pipe int gp;// expected-error {{type '__global read_only pipe int' can only be used as a function parameter in OpenCL}} +global reserve_id_t rid; // expected-error {{the '__global reserve_id_t' type cannot be used to declare a program scope variable}} + void test1(pipe int *p) {// expected-error {{pipes packet types cannot be of reference type}} } void test2(pipe p) {// expected-error {{missing actual type specifier for pipe}} @@ -20,3 +23,8 @@ typedef pipe int pipe_int_t; pipe_int_t test6() {} // expected-error{{declaring function return value of type 'pipe_int_t' (aka 'read_only pipe int') is not allowed}} + +bool test_id_comprision(void) { + reserve_id_t id1, id2; + return (id1 == id2); // expected-error {{invalid operands to binary expression ('reserve_id_t' and 'reserve_id_t')}} +} Index: test/SemaOpenCL/invalid-clk-events-cl2.0.cl === --- /dev/null +++ test/SemaOpenCL/invalid-clk-events-cl2.0.cl @@ -0,0 +1,3 @@ +// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -cl-std=CL2.0 + +global clk_event_t ce; // expected-error {{the '__global clk_event_t' type cannot be used to declare a program scope variable}} Index: test/SemaOpenCL/event_t.cl === --- test/SemaOpenCL/event_t.cl +++ test/SemaOpenCL/event_t.cl @@ -1,6 +1,6 @@ // RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only -event_t glb_evt; // expected-error {{the event_t type cannot be used to declare a program scope variable}} +event_t glb_evt; // expected-error {{the 'event_t' type cannot be used to declare a program scope variable}} constant struct evt_s { event_t evt; // expected-error {{the 'event_t' type cannot be used to declare a structure or union field}} Index: lib/Sema/SemaDecl.cpp === --- lib/Sema/SemaDecl.cpp +++ lib/Sema/SemaDecl.cpp @@ -5909,32 +5909,31 @@ return nullptr; } - // OpenCL v2.0 s6.9.b - Image type can only be used as a function argument. - // OpenCL v2.0 s6.13.16.1 - Pipe type can only be used as a function - // argument. - if (getLangOpts().OpenCL && (R->isImageType() || R->isPipeType())) { -Diag(D.getIdentifierLoc(), - diag::err_opencl_type_can_only_be_used_as_function_parameter) -<< R; -D.setInvalidType(); -return nullptr; - } - - DeclSpec::SCS SCSpec = D.getDeclSpec().getStorageClassSpec(); - StorageClass SC = StorageClassSpecToVarDeclStorageClass(D.getDeclSpec()); - - // dllimport globals without explicit storage class are treated as extern. We - // have to change the storage class this early to get the right DeclContext. - if (SC == SC_None && !DC->isRecord() && - hasParsedAttr(S, D, AttributeList::AT_DLLImport) && - !hasParsedAttr(S, D, AttributeList::AT_DLLExport)) -SC = SC_Extern; + if (getLangOpts().OpenCL) { +// OpenCL v2.0 s6.9.b - Image type can only be used as a function argument. +// OpenCL v2.0 s6.13.16.1 - Pipe type can only be used as a function +// argument. +if (R->isImageType() || R->isPipeType()) { + Diag(D.getIdentifierLoc(), + diag::err_opencl_type_can_only_be_used_as_function_parameter) + << R; + D.setInvalidType(); + return nullptr; +} - DeclContext *OriginalDC = DC; - bool IsLocalExternDecl = SC == SC_Extern && - adjustContextForLocalExternDecl(DC); +// OpenCL v1.2 s6.9.r: +// The event type cannot be used to declare a program scope variable. +// OpenCL v2.0 s6.9.q: +// The clk_event_t and reserve_id_t types cannot be declared in program scope. +if (NULL == S->getParent()) { + if (R->isReserveIDT() || R->isClkEventT() || R->isEventT()) { +Diag(D.getIdentifierLoc(), + diag::err_invalid_type_for_program_scope_var) << R; +D.setInvalidType(); +return nullptr; + } +} - if (getLangOpts().OpenCL) { // OpenCL v1.0 s6.8.a.3: Pointers to functions are not allowed. QualType NR = R; while (NR->isPointerType()) { @@ -5954,8 +5953,40 @@ D.setInvalidType(); } } + +// OpenCL v1.2 s6.9.b p4: +// The sampler type cannot be used with the __local and __global address +// space qualifiers. +if (R->isSamplerT() &&