Error for AllocaInst and Instruction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Error for AllocaInst and Instruction

Rasha Omar
Hi,
For the following code
        const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext());
        AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);
        Bb->getInstList().push_back(newInst);

It gives me the error
"  error: no matching constructor for initialization of 'llvm::AllocaInst'
            AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);"


By using Instruction

        const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext());
        Instruction* newInst = new Instruction(Int32Type, 0, "flag", Bb);
        Bb->getInstList().push_back(newInst);


error: allocating an object of abstract class type 'llvm::Instruction'
            Instruction* newInst = new Instruction(Int32Type, 0, "flag", Bb);


--
Rasha Salah Omar
Msc Student at E-JUST
Demonestrator  at Faculty of Computers and Informatics
Benha University

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Error for AllocaInst and Instruction

Rasha Omar
Bb >> BasicBlock*


On 25 July 2013 14:12, Rasha Omar <[hidden email]> wrote:
Hi,
For the following code
        const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext());
        AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);
        Bb->getInstList().push_back(newInst);

It gives me the error
"  error: no matching constructor for initialization of 'llvm::AllocaInst'
            AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);"


By using Instruction

        const Type * Int32Type = IntegerType::getInt32Ty(getGlobalContext());
        Instruction* newInst = new Instruction(Int32Type, 0, "flag", Bb);
        Bb->getInstList().push_back(newInst);


error: allocating an object of abstract class type 'llvm::Instruction'
            Instruction* newInst = new Instruction(Int32Type, 0, "flag", Bb);


--
Rasha Salah Omar
Msc Student at E-JUST
Demonestrator  at Faculty of Computers and Informatics
Benha University



--
Rasha Salah Omar
Msc Student at E-JUST
Demonestrator  at Faculty of Computers and Informatics
Benha University

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
Reply | Threaded
Open this post in threaded view
|

Re: Error for AllocaInst and Instruction

Nick Lewycky
In reply to this post by Rasha Omar
Rasha Omar wrote:
> Hi,
> For the following code
>          const Type * Int32Type =
> IntegerType::getInt32Ty(getGlobalContext());

Don't use const types any more. Since llvm 3.0, nothing takes a const Type*.

Nick

>          AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag", Bb);
>          Bb->getInstList().push_back(newInst);
>
> It gives me the error
> "  error: no matching constructor for initialization of 'llvm::AllocaInst'
>              AllocaInst* newInst = new AllocaInst(Int32Type, 0, "flag",
> Bb);"
>
>
> By using Instruction
>
>          const Type * Int32Type =
> IntegerType::getInt32Ty(getGlobalContext());
>          Instruction* newInst = new Instruction(Int32Type, 0, "flag", Bb);
>          Bb->getInstList().push_back(newInst);
>
>
> error: allocating an object of abstract class type 'llvm::Instruction'
>              Instruction* newInst = new Instruction(Int32Type, 0,
> "flag", Bb);
>
>
> --
> *Rasha Salah Omar
> Msc Student at E-JUST
> Demonestrator  at Faculty of Computers and Informatics
> Benha University
> *
>
>
> _______________________________________________
> LLVM Developers mailing list
> [hidden email]         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev

_______________________________________________
LLVM Developers mailing list
[hidden email]         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev