[PATCH] D27686: Add llvm::StringLiteral

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 20 10:16:51 PST 2016


And, reverted in r290189 as it ICEs GCC 4.8

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost/builds/602/steps/build%20stage%201/logs/stdio

[4/2173] Building CXX object
lib/Support/CMakeFiles/LLVMSupport.dir/APFloat.cpp.o
FAILED: /usr/lib/ccache/c++   -DGTEST_HAS_RTTI=0 -D_DEBUG
-D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -Ilib/Support
-I/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/lib/Support
-Iinclude -I/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include
-mcpu=cortex-a15 -mfpu=vfpv3 -fPIC -fvisibility-inlines-hidden -Wall
-W -Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-std=c++11 -ffunction-sections -fdata-sections -O3    -UNDEBUG
-fno-exceptions -fno-rtti -MMD -MT
lib/Support/CMakeFiles/LLVMSupport.dir/MD5.cpp.o -MF
lib/Support/CMakeFiles/LLVMSupport.dir/MD5.cpp.o.d -o
lib/Support/CMakeFiles/LLVMSupport.dir/MD5.cpp.o -c
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/lib/Support/MD5.cpp
In file included from
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/ADT/StringMap.h:17:0,
                 from
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/Support/Host.h:17,
                 from
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/ADT/Hashing.h:49,
                 from
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/ADT/ArrayRef.h:13,
                 from
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/lib/Support/MD5.cpp:40:
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/ADT/StringRef.h:
In constructor ‘constexpr llvm::StringRef::StringRef(const char*,
size_t)’:
/home/linaro/buildbot/clang-cmake-armv7-a15-selfhost/llvm/include/llvm/ADT/StringRef.h:90:62:
internal compiler error: Segmentation fault
                                                    length)) {}
                                                              ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.


On Tue, Dec 20, 2016 at 10:08 AM Zachary Turner <zturner at google.com> wrote:

> Appears to work fine, submitted in r290188.
>
>
> On Mon, Dec 19, 2016 at 8:41 PM David Blaikie <dblaikie at gmail.com> wrote:
>
> Ping on Eli's feedback - it sounds plausible to me.
>
> On Tue, Dec 13, 2016 at 10:38 AM Eli Friedman via Phabricator via
> llvm-commits <llvm-commits at lists.llvm.org> wrote:
>
> efriedma added inline comments.
>
>
> ================
> Comment at: include/llvm/ADT/StringRef.h:90
> -        assert((data || length == 0) &&
> -        "StringRef cannot be built from a NULL argument with non-null
> length");
> -      }
> ----------------
> zturner wrote:
> > efriedma wrote:
> > > mehdi_amini wrote:
> > > > Too bad we're losing the assert, but I see why. An alternative is
> another (possibly protected) ctor that would be constexpr and used by
> `StringLiteral`
> > > Stupid trick to save the assert:
> > >
> > >     /*implicit*/ constexpr StringRef(const char *data, long length)
> > >         : Data(data), Length((data || length == 0) ? length :
> (assert(0 && "Bad StringRef"), 0)) { }
> > >
> > >
> > Won't this still complain that `assert` is not a constant expression and
> thus can't be used in a `constexpr` function?
> No... formally, [expr.const] in the C++11 standard says that when checking
> whether an expression is a constant expression, "conditional operations
> that are not evaluated are not considered".  In practice, this means you'll
> get an error at compile time only if the condition is false, which is
> exactly the behavior you want.
>
> I actually screwed up the implementation slightly; it's not a no-op if
> assertions are turned off, but that's easy to fix:
>
>     /*implicit*/ constexpr StringRef(const char *data, long length)
>         : Data(data), Length((data || length == 0) ? length : (assert(0 &&
> "Bad StringRef"), length)) { }
>
>
> Repository:
>   rL LLVM
>
> https://reviews.llvm.org/D27686
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161220/7a8cc908/attachment.html>


More information about the llvm-commits mailing list