Displaying 10 results from an estimated 10 matches for "addnul".
Did you mean:
addnull
2012 Jul 23
0
[LLVMdev] static constant structs
...ed until I tried with a
> build of llvm that had assertions turned on. Even without that, I am
> hoping there is a better way to do this that I have managed to overlook.
>
I'm not sure I understood your question, but it sounds like you may want to call
this ConstantArray method (with AddNull = false).
/// This method constructs a ConstantArray and initializes it with a text
/// string. The default behavior (AddNull==true) causes a null terminator to
/// be placed at the end of the array. This effectively increases the length
/// of the array by one (you've been warned...
2010 Jul 28
1
[LLVMdev] Strange behavior when converting arrays to strings
...gthBefore = Text.length();
>
> ConstantArray *pArray =
> dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(),
> Text, true));
from Constants.h:
/// This method constructs a ConstantArray and initializes it with a text
/// string. The default behavior (AddNull==true) causes a null terminator to
/// be placed at the end of the array. This effectively increases the length
/// of the array by one (you've been warned). However, in some situations
/// this is not desired so if AddNull==false then the string is copied without
/// null termina...
2012 Jul 23
2
[LLVMdev] static constant structs
I hope this is the correct forum in which to ask this question.
Currently I am writing code meant to compile with LLVM 3.0. I am trying
to figure out, using the C++ API, how to create a constant static
struct, or the equivalent. Since I am copying data from existing C
structs, I am currently I am using a ConstantArray global variable, and
then pointer casting it to the appropriate type when I
2002 Apr 10
1
openssh-3.1p1 on GNU/Hurd
...d)
+ string containing the host name is returned. On failure, NULL
+ is returned and errno is set.
+ */
+
+#include <sys/param.h> /* For MAXHOSTNAMELEN */
+#include <stdlib.h>
+#include <errno.h>
+#include <unistd.h>
+
+char *
+xgethostname (void)
+{
+ int size = 0;
+ int addnull = 0;
+ char *buf;
+ int err;
+ char *tmp;
+
+#ifdef MAXHOSTNAMELEN
+ size = MAXHOSTNAMELEN;
+ addnull = 1;
+#else /* MAXHOSTNAMELEN */
+#ifdef _SC_HOST_NAME_MAX
+ size = sysconf (_SC_HOST_NAME_MAX);
+ addnull = 1;
+#endif /* _SC_HOST_NAME_MAX */
+ if (size <= 0)
+ size = 256;
+#endif...
2011 May 18
2
[LLVMdev] string to value
Hi All,
Is there a way to convert a const char * to a Value type?
Thanks.
George
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110517/0077b44c/attachment.html>
2010 Jul 28
0
[LLVMdev] Strange behavior when converting arrays to strings
Hi,
I haven't seen a response and I'm curious if I should submit a patch for this.
Thanks,
Javier
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Martinez, Javier E
Sent: Friday, July 16, 2010 3:20 PM
To: llvmdev at cs.uiuc.edu
Subject: [LLVMdev] Strange behavior when converting arrays to strings
Hello,
I found saw some strange behavior (to
2010 Jul 16
2
[LLVMdev] Strange behavior when converting arrays to strings
Hello,
I found saw some strange behavior (to me) when converting constant arrays to strings. Consider the following example:
std::string Text = "HelloWorld";
unsigned TextLengthBefore = Text.length();
ConstantArray *pArray = dyn_cast<ConstantArray>(llvm::ConstantArray::get(pModule->getContext(), Text, true));
unsigned NumElements = pArray->getNumOperands();
Text =
2011 Sep 22
0
[LLVMdev] How to const char* Value for function argument
...at runtime, and so can't use a const char * from compile time.
You need to make the string visible in the compiled image, and use that as the argument. A string is an array of 8-bit integers, so you need to create a ConstantArray.
Value *v = ConstantArray::get(Context, callee->getName(), /*AddNull=*/true);
Cheers,
James
-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Dmitry N. Mikushin
Sent: 22 September 2011 11:06
To: LLVM-Dev
Subject: [LLVMdev] How to const char* Value for function argument
Hi,
I'm trying to rep...
2011 Sep 22
2
[LLVMdev] How to const char* Value for function argument
Hi,
I'm trying to replace function call with call to
wrapper(function_name, num_args, ...), where varargs hold args of
original call.
Function* launch = Function::Create(
TypeBuilder<int(const char*, int, ...), false>::get(context),
GlobalValue::ExternalLinkage, "kernelgen_launch_", m2);
{
CallInst* call = dyn_cast<CallInst>(cast<Value>(I));
if
2012 Jul 23
1
[LLVMdev] static constant structs
...t;> build of llvm that had assertions turned on. Even without that, I am
>> hoping there is a better way to do this that I have managed to overlook.
>>
>
> I'm not sure I understood your question, but it sounds like you may
> want to call this ConstantArray method (with AddNull = false).
Um... That's exactly what the example above demonstrates. But maybe I
did not explain my problem well enough. If I have a type like, for
example:
{ i32, [ 4 x i8 ] }
How can I create a constant of this type like this:
{ i32 0x1ffff, [ i8 0, i8 4, i8 10, i8 8 ] }
from the C++...