Re: [PATCH] D23926: [libcxx] Don't use C99 math ops in -std=c++03 mode
rmaprath added a comment. In https://reviews.llvm.org/D23926#527080, @EricWF wrote: > We already provide many C++11 extensions in C++03 mode, why should this be an > exception? This is kind of what I wanted to find out. Do we document what those extensions are? We have quite a strict C library which is picky about what it exposes under different standards. For example, it won't expose `C99` math ops if it is being used under `__cplusplus < 201103L`, which leads to compiler errors (when integrated with `libc++` and used with `-std=c++03`) for a simple program like: #include int x; We could make our C library a bit more lenient to fix this, but I couldn't find it documented anywhere what stand `libcxx` takes on C++03 support. I also sent an email to `cfe-dev` about this but didn't get much attention, so I decided to start with a patch instead :) I'm happy to document these C++03 extensions on libcxx.llvm.org if I can find out what those extensions are. Any pointers? Cheers, / Asiri https://reviews.llvm.org/D23926 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23746: Basic/Targets.cpp: Add polaris10 and polaris11 gpus
olesalscheider added inline comments. Comment at: lib/Basic/Targets.cpp:1959 @@ -1959,1 +1958,3 @@ +GK_VOLCANIC_ISLANDS, +GK_ARCTIC_ISLANDS } GPU; arsenm wrote: > tstellarAMD wrote: > > We're trying to move to more descriptive GPU family names, so this should > > be GK_GFX8 instead of GK_ARCTIC_ISLANDS. GK_VOLCANIC_ISLANDS should also > > be changed to GK_GFX8, but that can be done in another patch, and would not > > be a prerequisite for this patch. > For now I think polaris10/11 should just be left as VOLCANIC_ISLANDS Ok... I'll leave it as VOLCANIC_ISLANDS and propose a follow-up patch that replaces all GCN names then. https://reviews.llvm.org/D23746 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23746: Basic/Targets.cpp: Add polaris10 and polaris11 gpus
olesalscheider updated this revision to Diff 69485. https://reviews.llvm.org/D23746 Files: lib/Basic/Targets.cpp Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2110,21 +2110,23 @@ static GPUKind parseAMDGCNName(StringRef Name) { return llvm::StringSwitch(Name) - .Case("tahiti", GK_SOUTHERN_ISLANDS) - .Case("pitcairn", GK_SOUTHERN_ISLANDS) - .Case("verde",GK_SOUTHERN_ISLANDS) - .Case("oland",GK_SOUTHERN_ISLANDS) - .Case("hainan", GK_SOUTHERN_ISLANDS) - .Case("bonaire", GK_SEA_ISLANDS) - .Case("kabini", GK_SEA_ISLANDS) - .Case("kaveri", GK_SEA_ISLANDS) - .Case("hawaii", GK_SEA_ISLANDS) - .Case("mullins", GK_SEA_ISLANDS) - .Case("tonga",GK_VOLCANIC_ISLANDS) - .Case("iceland", GK_VOLCANIC_ISLANDS) - .Case("carrizo", GK_VOLCANIC_ISLANDS) - .Case("fiji", GK_VOLCANIC_ISLANDS) - .Case("stoney", GK_VOLCANIC_ISLANDS) + .Case("tahiti",GK_SOUTHERN_ISLANDS) + .Case("pitcairn", GK_SOUTHERN_ISLANDS) + .Case("verde", GK_SOUTHERN_ISLANDS) + .Case("oland", GK_SOUTHERN_ISLANDS) + .Case("hainan",GK_SOUTHERN_ISLANDS) + .Case("bonaire", GK_SEA_ISLANDS) + .Case("kabini",GK_SEA_ISLANDS) + .Case("kaveri",GK_SEA_ISLANDS) + .Case("hawaii",GK_SEA_ISLANDS) + .Case("mullins", GK_SEA_ISLANDS) + .Case("tonga", GK_VOLCANIC_ISLANDS) + .Case("iceland", GK_VOLCANIC_ISLANDS) + .Case("carrizo", GK_VOLCANIC_ISLANDS) + .Case("fiji", GK_VOLCANIC_ISLANDS) + .Case("stoney",GK_VOLCANIC_ISLANDS) + .Case("polaris10", GK_VOLCANIC_ISLANDS) + .Case("polaris11", GK_VOLCANIC_ISLANDS) .Default(GK_NONE); } Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -2110,21 +2110,23 @@ static GPUKind parseAMDGCNName(StringRef Name) { return llvm::StringSwitch(Name) - .Case("tahiti", GK_SOUTHERN_ISLANDS) - .Case("pitcairn", GK_SOUTHERN_ISLANDS) - .Case("verde",GK_SOUTHERN_ISLANDS) - .Case("oland",GK_SOUTHERN_ISLANDS) - .Case("hainan", GK_SOUTHERN_ISLANDS) - .Case("bonaire", GK_SEA_ISLANDS) - .Case("kabini", GK_SEA_ISLANDS) - .Case("kaveri", GK_SEA_ISLANDS) - .Case("hawaii", GK_SEA_ISLANDS) - .Case("mullins", GK_SEA_ISLANDS) - .Case("tonga",GK_VOLCANIC_ISLANDS) - .Case("iceland", GK_VOLCANIC_ISLANDS) - .Case("carrizo", GK_VOLCANIC_ISLANDS) - .Case("fiji", GK_VOLCANIC_ISLANDS) - .Case("stoney", GK_VOLCANIC_ISLANDS) + .Case("tahiti",GK_SOUTHERN_ISLANDS) + .Case("pitcairn", GK_SOUTHERN_ISLANDS) + .Case("verde", GK_SOUTHERN_ISLANDS) + .Case("oland", GK_SOUTHERN_ISLANDS) + .Case("hainan",GK_SOUTHERN_ISLANDS) + .Case("bonaire", GK_SEA_ISLANDS) + .Case("kabini",GK_SEA_ISLANDS) + .Case("kaveri",GK_SEA_ISLANDS) + .Case("hawaii",GK_SEA_ISLANDS) + .Case("mullins", GK_SEA_ISLANDS) + .Case("tonga", GK_VOLCANIC_ISLANDS) + .Case("iceland", GK_VOLCANIC_ISLANDS) + .Case("carrizo", GK_VOLCANIC_ISLANDS) + .Case("fiji", GK_VOLCANIC_ISLANDS) + .Case("stoney",GK_VOLCANIC_ISLANDS) + .Case("polaris10", GK_VOLCANIC_ISLANDS) + .Case("polaris11", GK_VOLCANIC_ISLANDS) .Default(GK_NONE); } ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23957: Replace the Radeon GCN GPU family names by more descriptive ones
olesalscheider created this revision. olesalscheider added reviewers: cfe-commits, arsenm, tstellarAMD. https://reviews.llvm.org/D23957 Files: lib/Basic/Targets.cpp Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -1953,9 +1953,9 @@ GK_EVERGREEN_DOUBLE_OPS, GK_NORTHERN_ISLANDS, GK_CAYMAN, -GK_SOUTHERN_ISLANDS, -GK_SEA_ISLANDS, -GK_VOLCANIC_ISLANDS +GK_GFX6, +GK_GFX7, +GK_GFX8 } GPU; bool hasFP64:1; @@ -1970,7 +1970,7 @@ public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , - GPU(isAMDGCN(Triple) ? GK_SOUTHERN_ISLANDS : GK_R600), + GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), hasFP64(false), hasFMAF(false), hasLDEXPF(false), @@ -2110,23 +2110,23 @@ static GPUKind parseAMDGCNName(StringRef Name) { return llvm::StringSwitch(Name) - .Case("tahiti",GK_SOUTHERN_ISLANDS) - .Case("pitcairn", GK_SOUTHERN_ISLANDS) - .Case("verde", GK_SOUTHERN_ISLANDS) - .Case("oland", GK_SOUTHERN_ISLANDS) - .Case("hainan",GK_SOUTHERN_ISLANDS) - .Case("bonaire", GK_SEA_ISLANDS) - .Case("kabini",GK_SEA_ISLANDS) - .Case("kaveri",GK_SEA_ISLANDS) - .Case("hawaii",GK_SEA_ISLANDS) - .Case("mullins", GK_SEA_ISLANDS) - .Case("tonga", GK_VOLCANIC_ISLANDS) - .Case("iceland", GK_VOLCANIC_ISLANDS) - .Case("carrizo", GK_VOLCANIC_ISLANDS) - .Case("fiji", GK_VOLCANIC_ISLANDS) - .Case("stoney",GK_VOLCANIC_ISLANDS) - .Case("polaris10", GK_VOLCANIC_ISLANDS) - .Case("polaris11", GK_VOLCANIC_ISLANDS) + .Case("tahiti",GK_GFX6) + .Case("pitcairn", GK_GFX6) + .Case("verde", GK_GFX6) + .Case("oland", GK_GFX6) + .Case("hainan",GK_GFX6) + .Case("bonaire", GK_GFX7) + .Case("kabini",GK_GFX7) + .Case("kaveri",GK_GFX7) + .Case("hawaii",GK_GFX7) + .Case("mullins", GK_GFX7) + .Case("tonga", GK_GFX8) + .Case("iceland", GK_GFX8) + .Case("carrizo", GK_GFX8) + .Case("fiji", GK_GFX8) + .Case("stoney",GK_GFX8) + .Case("polaris10", GK_GFX8) + .Case("polaris11", GK_GFX8) .Default(GK_NONE); } @@ -2153,7 +2153,7 @@ Opts.cl_khr_local_int32_base_atomics = 1; Opts.cl_khr_local_int32_extended_atomics = 1; } -if (GPU >= GK_SOUTHERN_ISLANDS) { +if (GPU >= GK_GFX6) { Opts.cl_khr_fp16 = 1; Opts.cl_khr_int64_base_atomics = 1; Opts.cl_khr_int64_extended_atomics = 1; @@ -2255,11 +2255,11 @@ CPU = "tahiti"; switch (parseAMDGCNName(CPU)) { -case GK_SOUTHERN_ISLANDS: -case GK_SEA_ISLANDS: +case GK_GFX6: +case GK_GFX7: break; -case GK_VOLCANIC_ISLANDS: +case GK_GFX8: Features["s-memrealtime"] = true; Features["16-bit-insts"] = true; break; Index: lib/Basic/Targets.cpp === --- lib/Basic/Targets.cpp +++ lib/Basic/Targets.cpp @@ -1953,9 +1953,9 @@ GK_EVERGREEN_DOUBLE_OPS, GK_NORTHERN_ISLANDS, GK_CAYMAN, -GK_SOUTHERN_ISLANDS, -GK_SEA_ISLANDS, -GK_VOLCANIC_ISLANDS +GK_GFX6, +GK_GFX7, +GK_GFX8 } GPU; bool hasFP64:1; @@ -1970,7 +1970,7 @@ public: AMDGPUTargetInfo(const llvm::Triple &Triple, const TargetOptions &Opts) : TargetInfo(Triple) , - GPU(isAMDGCN(Triple) ? GK_SOUTHERN_ISLANDS : GK_R600), + GPU(isAMDGCN(Triple) ? GK_GFX6 : GK_R600), hasFP64(false), hasFMAF(false), hasLDEXPF(false), @@ -2110,23 +2110,23 @@ static GPUKind parseAMDGCNName(StringRef Name) { return llvm::StringSwitch(Name) - .Case("tahiti",GK_SOUTHERN_ISLANDS) - .Case("pitcairn", GK_SOUTHERN_ISLANDS) - .Case("verde", GK_SOUTHERN_ISLANDS) - .Case("oland", GK_SOUTHERN_ISLANDS) - .Case("hainan",GK_SOUTHERN_ISLANDS) - .Case("bonaire", GK_SEA_ISLANDS) - .Case("kabini",GK_SEA_ISLANDS) - .Case("kaveri",GK_SEA_ISLANDS) - .Case("hawaii",GK_SEA_ISLANDS) - .Case("mullins", GK_SEA_ISLANDS) - .Case("tonga", GK_VOLCANIC_ISLANDS) - .Case("iceland", GK_VOLCANIC_ISLANDS) - .Case("carrizo", GK_VOLCANIC_ISLANDS) - .Case("fiji", GK_VOLCANIC_ISLANDS) - .Case("stoney",GK_VOLCANIC_ISLANDS) - .Case("polaris10", GK_VOLCANIC_ISLANDS) - .Case("polaris11", GK_VOLCANIC_ISLANDS) + .Case("tahiti",GK_GFX6) + .Case("pitcairn", GK_GFX6) + .Case("verde", GK_GFX6) + .Case("oland", GK_GFX6) + .Case("hainan",GK_GFX6) + .Case("bonaire", GK_GFX7) + .Case("kabini",GK_GFX7) + .Case("kaveri",GK_GFX7) + .Case("hawaii",GK_GFX7) + .Case("mullins", GK_GFX7) +
[PATCH] D23959: cmake: Support building unittests against installed LLVM gtest
mgorny created this revision. mgorny added reviewers: chapuni, delcypher, vsk, Bigcheese. mgorny added a subscriber: cfe-commits. Support using gtest library & headers installed by LLVM to make it possible to build unittests without LLVM sources. Depends on LLVM patch https://reviews.llvm.org/D23958 https://reviews.llvm.org/D23959 Files: CMakeLists.txt Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -419,7 +419,14 @@ add_subdirectory(examples) if( CLANG_INCLUDE_TESTS ) - if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) + if(TARGET gtest) +if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) + # add include directories for installed llvm-gtest + foreach(incdir ${LLVM_INCLUDE_DIRS}) +include_directories("${incdir}/llvm-gtest") + endforeach() +endif() + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS Index: CMakeLists.txt === --- CMakeLists.txt +++ CMakeLists.txt @@ -419,7 +419,14 @@ add_subdirectory(examples) if( CLANG_INCLUDE_TESTS ) - if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) + if(TARGET gtest) +if(NOT EXISTS ${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include/gtest/gtest.h) + # add include directories for installed llvm-gtest + foreach(incdir ${LLVM_INCLUDE_DIRS}) +include_directories("${incdir}/llvm-gtest") + endforeach() +endif() + add_subdirectory(unittests) list(APPEND CLANG_TEST_DEPS ClangUnitTests) list(APPEND CLANG_TEST_PARAMS ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23960: Avoid narrowing warnings in __bitset constructor
dim created this revision. dim added reviewers: mclow.lists, EricWF. dim added subscribers: emaste, cfe-commits. When I compile is compiled with warnings enabled, I get the following error (which is interesting in itself, it should only be a warning): /usr/include/c++/v1/bitset:265:16: error: non-constant-expression cannot be narrowed from type 'unsigned long long' to '__storage_type' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] : __first_{__v, __v >> __bits_per_word} ^~~ /usr/include/c++/v1/bitset:676:52: note: in instantiation of member function 'std::__1::__bitset<2, 53>::__bitset' requested here bitset(unsigned long long __v) _NOEXCEPT : base(__v) {} ^ /home/dim/src/llvm/trunk/include/llvm/IR/Attributes.h:455:9: note: in instantiation of member function 'std::__1::bitset<53>::bitset' requested here : Attrs(0), Alignment(0), StackAlignment(0), DerefBytes(0), ^ /usr/include/c++/v1/bitset:265:16: note: insert an explicit cast to silence this issue : __first_{__v, __v >> __bits_per_word} ^~~ Note that this is on i386, so this uses the `#elif` part of the `__bitset` constructor: __bitset<_N_words, _Size>::__bitset(unsigned long long __v) _NOEXCEPT #ifndef _LIBCPP_HAS_NO_CONSTEXPR #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 : __first_{__v, __v >> __bits_per_word} #else #error This constructor has not been ported to this platform #endif #endif Indeed, `__first_` has type `__storage_type`, which is 32 bits on this platform, so I think an explicit static_cast is required here. https://reviews.llvm.org/D23960 Files: include/bitset Index: include/bitset === --- include/bitset +++ include/bitset @@ -259,7 +259,7 @@ #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 -: __first_{__v, __v >> __bits_per_word} +: __first_{static_cast<__storage_type>(__v), static_cast<__storage_type>(__v >> __bits_per_word)} #else #error This constructor has not been ported to this platform #endif Index: include/bitset === --- include/bitset +++ include/bitset @@ -259,7 +259,7 @@ #if __SIZEOF_SIZE_T__ == 8 : __first_{__v} #elif __SIZEOF_SIZE_T__ == 4 -: __first_{__v, __v >> __bits_per_word} +: __first_{static_cast<__storage_type>(__v), static_cast<__storage_type>(__v >> __bits_per_word)} #else #error This constructor has not been ported to this platform #endif ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23961: Avoid embedded preprocessor directives in __tree
dim created this revision. dim added reviewers: mclow.lists, EricWF. dim added subscribers: emaste, cfe-commits. When I compile as part of clang, with -pedantic enabled, I get the following warnings: In file included from /usr/include/c++/v1/map:442: /usr/include/c++/v1/__tree:874:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #if _LIBCPP_STD_VER <= 11 ^ /usr/include/c++/v1/__tree:877:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #endif ^ /usr/include/c++/v1/__tree:1392:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #if _LIBCPP_STD_VER <= 11 ^ /usr/include/c++/v1/__tree:1395:2: warning: embedding a directive within macro arguments has undefined behavior [-Wembedded-directive] #endif ^ This is because the `#if`s are within the parameter list of a `_NOEXCEPT_()` macro invocation. EricWF fixed something similar in rL242623, by moving the `#if` outside the macro invocation. https://reviews.llvm.org/D23961 Files: include/__tree Index: include/__tree === --- include/__tree +++ include/__tree @@ -,14 +,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else +_NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else +_NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); Index: include/__tree === --- include/__tree +++ include/__tree @@ -,14 +,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else +_NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else +_NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D12407: [clang-format-vs] Add an option to reformat source code when file is saved to disk
jasjuang added a comment. Just in case someone is interested. I figured out a hack with VCMD that actually does the job. using EnvDTE; using EnvDTE80; public class E : VisualCommanderExt.IExtension { public void SetSite(EnvDTE80.DTE2 DTE_, Microsoft.VisualStudio.Shell.Package package) { DTE = DTE_; events = DTE.Events; documentEvents = events.DocumentEvents; documentEvents.DocumentSaved += OnDocumentSaved; } public void Close() { documentEvents.DocumentSaved -= OnDocumentSaved; } private void OnDocumentSaved(EnvDTE.Document doc) { if(doc.Language == "C/C++") { DTE.ExecuteCommand("Edit.SelectAll"); DTE.ExecuteCommand("Tools.ClangFormat"); DTE.ExecuteCommand("View.NavigateBackward"); } } private EnvDTE80.DTE2 DTE; private EnvDTE.Events events; private EnvDTE.DocumentEvents documentEvents; } This will invoke clang format whenever a c++ related file is saved https://reviews.llvm.org/D12407 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23961: Avoid embedded preprocessor directives in __tree
EricWF accepted this revision. EricWF added a comment. This revision is now accepted and ready to land. LGTM. Thanks https://reviews.llvm.org/D23961 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23831: [libcxx] Fix gcc 4.9 -Wcast-qual warning.
halyavin added a comment. ping. https://reviews.llvm.org/D23831 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23871: [Modules] Add 'freestanding' to the 'requires-declaration' feature-list.
eladcohen added inline comments. Comment at: lib/Headers/module.modulemap:66 @@ -65,2 +65,3 @@ explicit module mm_malloc { + requires !freestanding header "mm_malloc.h" rsmith wrote: > Are there more parts of the intrinsics modules to which this should be > applied? Not that I'm aware of. A "STDC_HOSTED" grep on the intrinsics modules header files didn't find anything other than mm_malloc.h. https://reviews.llvm.org/D23871 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[libcxx] r279926 - Avoid embedded preprocessor directives in __tree
Author: dim Date: Sat Aug 27 14:32:03 2016 New Revision: 279926 URL: http://llvm.org/viewvc/llvm-project?rev=279926&view=rev Log: Avoid embedded preprocessor directives in __tree Similar to rL242623, move C++ version checks outside of _NOEXCEPT_() macro invocation argument lists, to avoid "embedding a directive within macro arguments has undefined behavior" warnings. Differential Revision: https://reviews.llvm.org/D23961 Modified: libcxx/trunk/include/__tree Modified: libcxx/trunk/include/__tree URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/__tree?rev=279926&r1=279925&r2=279926&view=diff == --- libcxx/trunk/include/__tree (original) +++ libcxx/trunk/include/__tree Sat Aug 27 14:32:03 2016 @@ -,14 +,15 @@ public: void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else +_NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ __tree<_Tp, _Compare, _Allocator>::destr template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else +_NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23961: Avoid embedded preprocessor directives in __tree
This revision was automatically updated to reflect the committed changes. Closed by commit rL279926: Avoid embedded preprocessor directives in __tree (authored by dim). Changed prior to commit: https://reviews.llvm.org/D23961?vs=69492&id=69496#toc Repository: rL LLVM https://reviews.llvm.org/D23961 Files: libcxx/trunk/include/__tree Index: libcxx/trunk/include/__tree === --- libcxx/trunk/include/__tree +++ libcxx/trunk/include/__tree @@ -,14 +,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else +_NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else +_NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); Index: libcxx/trunk/include/__tree === --- libcxx/trunk/include/__tree +++ libcxx/trunk/include/__tree @@ -,14 +,15 @@ void clear() _NOEXCEPT; void swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ); - +#else +_NOEXCEPT_(__is_nothrow_swappable::value); +#endif #ifndef _LIBCPP_CXX03_LANG template @@ -1797,13 +1798,15 @@ template void __tree<_Tp, _Compare, _Allocator>::swap(__tree& __t) +#if _LIBCPP_STD_VER <= 11 _NOEXCEPT_( __is_nothrow_swappable::value -#if _LIBCPP_STD_VER <= 11 && (!__node_traits::propagate_on_container_swap::value || __is_nothrow_swappable<__node_allocator>::value) -#endif ) +#else +_NOEXCEPT_(__is_nothrow_swappable::value) +#endif { using _VSTD::swap; swap(__begin_node_, __t.__begin_node_); ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D23963: [analyzer] pr28449 - Move literal rvalue construction away from RegionStore.
NoQ created this revision. NoQ added reviewers: zaks.anna, dcoughlin, xazax.hun, a.sidorin. NoQ added a subscriber: cfe-commits. When binding string literal regions to `char` arrays, `RegionStore`'s `bindArray()` method converts the string literals to their lazy compound values before binding. Bug https://llvm.org/bugs/show_bug.cgi?id=28449 shows that similar behavior is required for handling compound literals (brace initializers). However, it seems illogical to me that `RegionStore` modifies the value it was asked to bind - it should be handled by the external code, and `RegionStore`'s `bind...()` interface should perhaps only bind the given value to the given location, without improvising. This patch conducts the necessary refactoring to avoid the issue. Now all compound values should be correct to begin with. The patch accidentally fixes the bug. Additionally, this patch enables loading values from compound-literal regions - it was explicitly disabled, but the problem due to which it was disabled seems already resolved; made the respective tests stronger to see that it's actually working correctly. Additionally, this patch tweaks the dump method of compound literal regions, addressing a FIXME there and making things prettier. Didn't notice significant changes on large codebase runs - no new crashes, no changes in positives. https://reviews.llvm.org/D23963 Files: lib/StaticAnalyzer/Core/ExprEngine.cpp lib/StaticAnalyzer/Core/ExprEngineC.cpp lib/StaticAnalyzer/Core/MemRegion.cpp lib/StaticAnalyzer/Core/RegionStore.cpp test/Analysis/compound-literals.c test/Analysis/region-store.c Index: test/Analysis/region-store.c === --- test/Analysis/region-store.c +++ test/Analysis/region-store.c @@ -1,14 +1,16 @@ // RUN: %clang_cc1 -analyze -analyzer-checker=core,unix,debug.ExprInspection -verify %s int printf(const char *restrict,...); +void clang_analyzer_eval(); // Testing core functionality of the region store. // radar://10127782 int compoundLiteralTest() { int index = 0; for (index = 0; index < 2; index++) { int thing = (int []){0, 1}[index]; printf("thing: %i\n", thing); +clang_analyzer_eval(thing == index); // expected-warning{{TRUE}} } return 0; } @@ -18,6 +20,7 @@ for (index = 0; index < 3; index++) { int thing = (int [][3]){{0,0,0}, {1,1,1}, {2,2,2}}[index][index]; printf("thing: %i\n", thing); +clang_analyzer_eval(thing == index); // expected-warning{{TRUE}} } return 0; } Index: test/Analysis/compound-literals.c === --- /dev/null +++ test/Analysis/compound-literals.c @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple=i386-apple-darwin10 -analyze -analyzer-checker=debug.ExprInspection -verify %s +void clang_analyzer_eval(int); + +// pr28449: Used to crash. +void foo(void) { + static const unsigned short array[] = (const unsigned short[]){0x0F00}; + clang_analyzer_eval(array[0] == 0x0F00); // expected-warning{{TRUE}} +} Index: lib/StaticAnalyzer/Core/RegionStore.cpp === --- lib/StaticAnalyzer/Core/RegionStore.cpp +++ lib/StaticAnalyzer/Core/RegionStore.cpp @@ -1568,10 +1568,6 @@ SVal RegionStoreManager::getBindingForElement(RegionBindingsConstRef B, const ElementRegion* R) { - // We do not currently model bindings of the CompoundLiteralregion. - if (isa(R->getBaseRegion())) -return UnknownVal(); - // Check if the region has a binding. if (const Optional &V = B.getDirectBinding(R)) return *V; @@ -2057,17 +2053,6 @@ if (const ConstantArrayType* CAT = dyn_cast(AT)) Size = CAT->getSize().getZExtValue(); - // Check if the init expr is a string literal. - if (Optional MRV = Init.getAs()) { -const StringRegion *S = cast(MRV->getRegion()); - -// Treat the string as a lazy compound value. -StoreRef store(B.asStore(), *this); -nonloc::LazyCompoundVal LCV = svalBuilder.makeLazyCompoundVal(store, S) -.castAs(); -return bindAggregate(B, R, LCV); - } - // Handle lazy compound values. if (Init.getAs()) return bindAggregate(B, R, Init); Index: lib/StaticAnalyzer/Core/MemRegion.cpp === --- lib/StaticAnalyzer/Core/MemRegion.cpp +++ lib/StaticAnalyzer/Core/MemRegion.cpp @@ -431,8 +431,9 @@ } void CompoundLiteralRegion::dumpToStream(raw_ostream &os) const { - // FIXME: More elaborate pretty-printing. - os << "{ " << static_cast(CL) << " }"; + os << "{ "; + CL->printPretty(os, nullptr, PrintingPolicy(getContext().getLangOpts())); + os << " }"; } void CXXTempObjectRegion::dumpToStream(raw_ostream &os) const { Index: lib/StaticAnalyzer/Core/ExprEngineC.cpp ===
Re: [PATCH] D23963: [analyzer] pr28449 - Move literal rvalue construction away from RegionStore.
NoQ added inline comments. Comment at: lib/StaticAnalyzer/Core/ExprEngineC.cpp:669 @@ +668,3 @@ + // For structures, check if the respective field is a reference. + // FIXME: What if fields mismatch? + const RecordDecl *RD = RT->getDecl(); Whoops, was a note to myself, didn't mean to leave it here, sorry. Will actually have a look and update. https://reviews.llvm.org/D23963 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23961: Avoid embedded preprocessor directives in __tree
vitalybuka added a subscriber: vitalybuka. vitalybuka added a comment. PPC bots are broken by this patch http://lab.llvm.org:8011/builders/sanitizer-ppc64be-linux/builds/3547 http://lab.llvm.org:8011/builders/sanitizer-ppc64le-linux/builds/2353 Repository: rL LLVM https://reviews.llvm.org/D23961 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D18639: Use __builtin_isnan/isinf/isfinite in complex
hfinkel added a comment. In https://reviews.llvm.org/D18639#515000, @hfinkel wrote: > Updated to use scheme suggested by Marshall. Ping. https://reviews.llvm.org/D18639 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
Re: [PATCH] D23375: Add kfree( ) to MallocChecker.cpp
andrewmw94 added a comment. One more thing, obviously it should mimic malloc/free's behavior in complaining about delete/new being used. Should it also complain about free/malloc being used? I can't imagine that would be something people would usually intend to do, but I don't think it's really "incorrect." Thought? https://reviews.llvm.org/D23375 ___ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits