search for: initializer_list

Displaying 20 results from an estimated 21 matches for "initializer_list".

2016 Aug 24
2
Pointer to temporary issue in ArrayRefTest.InitializerList
...nitializerList constructor of ArrayRef (under normal use-case) hit undefined behavior. The test does the following: ArrayRef<int> A = { 0, 1, 2, 3, 4 }; for (int i = 0; i < 5; ++i) EXPECT_EQ(i, A[i]); For those unfamiliar, ArrayRef is a T* Data/size_t Length pair-type with a std::initializer_list Ctor that simply copies the initializer_list::begin into Data. The issue is that after the assignment, the initializer-list temporary goes out of scope (since it is a temporary), creating a dangling pointer. This doesn't seem to be an issue for the most part, however compiling the test with -...
2019 Jul 18
4
Question about GCC warnings
Hi, Building LLVM with a newer GCC version seems to generate several compiler warnings, some of which look like false positives. For example, the '-Winit-list-lifetime' warning added in GCC9 triggers for one of the constructors for ArrayRef, the one taking an initializer_list. How are false positive warnings dealt with in LLVM in general? It's of course possible to just ignore them or use compiler flags to disable them, but with that I think you would risk missing other actual meaningful warnings. Would it make sense to add explicit diagnostic pragmas in the code f...
2016 Aug 24
2
Pointer to temporary issue in ArrayRefTest.InitializerList
...ctor of ArrayRef (under normal use-case) hit undefined behavior. The test does the following: > ArrayRef<int> A = { 0, 1, 2, 3, 4 }; > for (int i = 0; i < 5; ++i) > EXPECT_EQ(i, A[i]); > > For those unfamiliar, ArrayRef is a T* Data/size_t Length pair-type with a std::initializer_list Ctor that simply copies the initializer_list::begin into Data. > > The issue is that after the assignment, the initializer-list temporary goes out of scope (since it is a temporary), creating a dangling pointer. This doesn't seem to be an issue for the most part, however compiling the t...
2018 Sep 13
2
New warnings when building trunk with GCC 9
.../home/davidbolvansky/trunk/llvm/include/llvm/Analysis/LazyCallGraph.h:38, from /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:10: /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h: In instantiation of ‘llvm::ArrayRef<T>::ArrayRef(const std::initializer_list<_Tp>&) [with T = llvm::LazyCallGraph::Node*]’: /home/davidbolvansky/trunk/llvm/unittests/Analysis/LazyCallGraphTest.cpp:1169:52: required from here /home/davidbolvansky/trunk/llvm/include/llvm/ADT/ArrayRef.h:102:37: warning: initializing ‘llvm::ArrayRef<llvm::LazyCallGraph::Node*>:...
2018 Feb 23
1
StringRef hasAnyOf/hasAllOf
Hi, a downstream consumer of llvm I'm currently working provides the following two functions: static bool StringHasAllOf(const llvm::StringRef &s, const char *which); static bool StringHasAnyOf(const llvm::StringRef &s, std::initializer_list<const char *> which, size_t &where); https://github.com/apple/swift-lldb/blob/stable/source/Target/SwiftLanguageRuntime.cpp#L691 https://github.com/apple/swift-lldb/blob/stable/source/Target/SwiftLanguageRuntime.cpp#L699 I'm under the impression these could be member functions of St...
2016 Dec 30
0
[cfe-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy
...interesting logic in the constructor, it takes an initializer list. - This should work with 'v.push_back({a, b, c})' - If it doesn't today, we can fix the type's constructors so that it does. - Using 'emplace_back' doesn't help much -- you still need {}s to form the std::initializer_list in many cases. Pair and tuple are somewhat unusual in not requiring them. Case 2b: A specific constructor needs to be called with an argument list. These arguments are not merely being aggregated but are inputs to a constructor that contains logic. - This is analogous to a case called out w.r.t. &...
2019 Apr 11
2
128 bit float constant
Hi Tim, Thanks for the hint. I tried the following, (it's a C interface since that's what I need it for) where a and b are the top and bottom halves of the 128 bit value, LLVMValueRef TestConst(LLVMContextRef C, uint64_t a, uint64_t b) { Type *ty = Type::getFP128Ty(*unwrap(C)); ArrayRef<uint64_t> ar[2] = {a,b}; APInt ai(128,*ar); APFloat quad(APFloat::IEEEquad(), ai);
2019 Feb 07
9
[8.0.0 Release] rc2 has been tagged
Dear testers, 8.0.0-rc2 has been tagged from the release_80 branch at r353413. Please run the test script, share your results, and upload binaries. I'll get the source tarballs and docs published as soon as possible, and binaries as they become available. Thanks, Hans
2016 Dec 30
3
[cfe-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy
...constructor, it takes > an initializer list. > - This should work with 'v.push_back({a, b, c})' > - If it doesn't today, we can fix the type's constructors so that it does. > - Using 'emplace_back' doesn't help much -- you still need {}s to form the > std::initializer_list in many cases. Pair and tuple are somewhat unusual in > not requiring them. > > This sounds extremely reasonable. > Case 2b: A specific constructor needs to be called with an argument list. > These arguments are not merely being aggregated but are inputs to a > constructor that...
2017 Jan 09
2
[cfe-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy
...constructor, it takes > an initializer list. > - This should work with 'v.push_back({a, b, c})' > - If it doesn't today, we can fix the type's constructors so that it does. > - Using 'emplace_back' doesn't help much -- you still need {}s to form the > std::initializer_list in many cases. Pair and tuple are somewhat unusual in > not requiring them. > > This sounds extremely reasonable. > > Case 2b: A specific constructor needs to be called with an argument list. > These arguments are not merely being aggregated but are inputs to a > constructor t...
2019 Feb 11
2
[cfe-dev] [8.0.0 Release] rc2 has been tagged
...e/c++/v1/string_view:176: > In file included from > (...)/sysroot-x86_64-linux-gnu/usr/include/c++/v1/__string:56: > In file included from > (...)/sysroot-x86_64-linux-gnu/usr/include/c++/v1/algorithm:640: > In file included from > (...)/sysroot-x86_64-linux-gnu/usr/include/c++/v1/initializer_list:47: > In file included from > (...)/sysroot-x86_64-linux-gnu/usr/include/c++/v1/cstddef:110: > > (...)/sysroot-x86_64-linux-gnu/usr/include/c++/v1/type_traits:740:56: > error: _Float16 is not supported on this target > template <> struct __libcpp_is_floating_point&l...
2016 Dec 30
2
[cfe-dev] Modernizing LLVM Coding Style Guide and enforcing Clang-tidy
Thanks for very accurate responses. - I totally agree what Dave and Chandler said about explicit and implicit operations, this is what I meant my first email. I believe there are places like v.emplace_back(A, B); istead of v.push_back(make_pair(A, B));b That can make code simpler. I think in cases like this we can leave it for judgement of contributor. Having said that I think the
2016 Oct 14
2
RFC: Reducing the number of set classes in ADT
tl;dr: I think we have too many different set classes. They have incompatible APIs and surprising behavior. I think we can reduce their number substantially. Dear all, The following is a subset of the set classes we have in ADT: * DenseSet * SmallDenseSet (https://reviews.llvm.org/D25628) * SetVector * SmallSetVector * SmallSet * SmallPtrSet * StringSet * FoldingSet *
2016 Oct 10
4
Pacaging/build issues with AIX and vac (dovecot-2.2.25)
On 10-Oct-16 06:45, Aki Tuomi wrote: > Does your build end at some particular point? See **** DETAILS **** for in depth (I hope enough!) study/report. > > Aki I would guess this is not "c99" way... Making all in lib-http source='test-http-auth.c' object='test-http-auth.o' libtool=no DEPDIR=.deps depmode=xlc /bin/sh ../../depcomp xlc_r
2020 Apr 30
2
Discrepancy between Debug and Release+Asserts versions of Clang/LLVM
I agree that the ArrayRef is likely the issue. I've debugged a crash caused by a temporary ArrayRef like that a couple times. Either do what David suggested or use a normal array: Metadata *mdArray[] = {ConstantInt::get(Int64Ty, 0), newMD}; ~Craig On Thu, Apr 30, 2020 at 9:56 AM David Blaikie via llvm-dev < llvm-dev at lists.llvm.org> wrote: > > > On Thu, Apr 30, 2020 at
2019 Sep 03
2
SourceMgr vs EXPENSIVE_CHECKS
...> > $ g++-8 test.cpp -std=c++2a -fsyntax-only > $ g++-8 test.cpp -std=c++2a -fsyntax-only -D_GLIBCXX_CONCEPT_CHECKS > In file included from /usr/include/c++/8/algorithm:62, > from test.cpp:1: > test.cpp:3:27: in ‘constexpr’ expansion of ‘std::min<int>(std::initializer_list<int>{((const int*)(& ._61)), 6})’ > /usr/include/c++/8/bits/stl_algo.h:3451:31: error: ‘constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = const int*]’ called in a constant expression > { return *std::min_element(__l.begin(), __l.end()); } > ~~~~...
2019 Oct 02
2
SourceMgr vs EXPENSIVE_CHECKS
...a -fsyntax-only >> > $ g++-8 test.cpp -std=c++2a -fsyntax-only -D_GLIBCXX_CONCEPT_CHECKS >> > In file included from /usr/include/c++/8/algorithm:62, >> > from test.cpp:1: >> > test.cpp:3:27: in ‘constexpr’ expansion of ‘std::min<int>(std::initializer_list<int>{((const int*)(& ._61)), 6})’ >> > /usr/include/c++/8/bits/stl_algo.h:3451:31: error: ‘constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = const int*]’ called in a constant expression >> > { return *std::min_element(__l.begin(), __l.end()); } >&g...
2019 Sep 03
2
SourceMgr vs EXPENSIVE_CHECKS
...ebug::vector<unsigned int, std::allocator<unsigned int> >*, std::__debug::vector<long unsigned int, std::allocator<long unsigned int> >*>()’ /home/jayfoad2/git/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:64:25: in ‘constexpr’ expansion of ‘std::min<int>(std::initializer_list<int>{((const int*)(& ._125)), 4})’ /usr/include/c++/8/bits/stl_algo.h:3451:31: error: ‘constexpr _FIter std::min_element(_FIter, _FIter) [with _FIter = const int*]’ called in a constant expression { return *std::min_element(__l.begin(), __l.end()); } ~~~~~~~~~~~~~~~~^~...
2014 Oct 07
2
[LLVMdev] Can libc++ build for arm cross compiler?
...s/out-arm/include/c++/v1/./cstring > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./ctgmath > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./csetjmp > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./initializer_list > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./__functional_base_03 > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./new > -- Installing: > /home/cschen/test/libcxx-scripts/out-arm/include/c++/v1/./__functional_base > --...
2014 Oct 03
3
[LLVMdev] Can libc++ build for arm cross compiler?
On 10/3/14 10:16 AM, Dan Albert wrote: >> >> I try to build libc++ and libc++abi for host x86_64(linux) and target >> arm(linux) but fail. >> > > Failing in what way? If this isn't working out of the box, we've done > something wrong. Yeah, it would help to know more specifics about where you're getting stuck. > > jroelofs might know more... For