search for: getlinenumber

Displaying 20 results from an estimated 29 matches for "getlinenumber".

2013 Feb 18
1
[LLVMdev] llvm line number of an instruction
Hello everybody, I want to get the line number of an instruction (and also of a variable declaration - alloca and global). The instruction is saved in an array of instructions. I have the function:     Constant* metadata::getLineNumber(Instruction* I){         if (MDNode *N = I->getMetadata("dbg")) { // this if is never executed             DILocation Loc(N);             unsigned Line = Loc.getLineNumber();             return ConstantInt::get(Type::getInt32Ty(I->getContext()), Line);         }   // else {         ...
2010 Jul 07
2
[LLVMdev] source line number for instruction
Hi, I found the following at http://llvm.org/docs/SourceLevelDebugging.html#ccxx_frontend: if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction DILocation Loc(N); // DILocation is in DebugInfo.h unsigned Line = Loc.getLineNumber(); StringRef File = Loc.getFilename(); StringRef Dir = Loc.getDirectory(); } Does this also work for release 2.7? I did not see the same thing at the documentation for release 2.7. Thanks, Guoliang -------------- next part -------------- An HTML attachment was scrubbed... URL: <http...
2015 Aug 06
2
[LLVMdev] DebugInfo from LLVM Instruction
Hi all, I used to extract the debug information from an LLVM Instruction in the following way: if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM instruction DILocation Loc(N); // DILocation is in DebugInfo.h unsigned Line = Loc.getLineNumber(); StringRef File = Loc.getFilename(); StringRef Dir = Loc.getDirectory(); } As specified also at http://llvm.org/docs/SourceLevelDebugging.html <http://llvm.org/docs/SourceLevelDebugging.html> However, looks like that the instruction " DILocation Loc(N);” is not valid anymore, Sin...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...*TheMetadata = M->getContext().getMetadata(); > MDDbgKind = TheMetadata->getMDKind("dbg"); > if (MDDbgKind) { > if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) { > DILocation Loc(Dbg); > ... > Loc.getDirectory() > Loc.getFilename() > Loc.getLineNumber() > Loc.getColumnNumber() > .... > } > A grep through my LLVM 2.7 source tree does not find MetadataContext anywhere. Is this something that was added to LLVM mainline after the LLVM 2.7 branch was created? I'm using the release_27 branch of LLVM, so I'm limit...
2011 Mar 14
2
[LLVMdev] set line number debug info
...uction. Can anyone please show how to do that? I think that setMetadata method in Instruction class is to be used. But how do I create MDNode* consisting of desired source line number. Source line number can be extracted from the instruction-debug-info using getMetadata method and then using getLineNumber method from DILocation class. Unfortunately DILocation class does not have any function like setLinenumber. Abhirup Ghosh M. Tech Department of Computer Science & Engg. IIT, Bombay email - abhirupju at gmail.com , abhirup at cse.iitb.ac.in Contact - 9920735181 -------------- next part -------...
2013 Apr 12
3
[LLVMdev] The line number range of a function in source code level
Hi all, I need to know the line number range of a function. The start of the function line number can be found by the definition point, which is stored at the subprogram metadata: DISubprogram::getLineNumber(). However, there is no API (or the metadata in the first place) to know the end of the function. I have to visit all the instructions of the function and maintain the *max*line number of the instructions. I use the inst_begin(func): inst_end(func) as the iterator. But I don't think it's...
2019 Sep 03
2
SourceMgr vs EXPENSIVE_CHECKS
...for call to 'get' Offsets = OffsetCache.get<std::vector<T> *>(); ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ /home/jayfoad2/git/llvm-project/llvm/lib/Support/SourceMgr.cpp:136:17: note: in instantiation of function template specialization 'llvm::SourceMgr::SrcBuffer::getLineNumber<unsigned char>' requested here LineNo = SB.getLineNumber<uint8_t>(Ptr); ^ /home/jayfoad2/git/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:194:27: note: candidate template ignored: substitution failure [with T = std::__debug::vector<unsigned char, std::all...
2019 Sep 03
2
SourceMgr vs EXPENSIVE_CHECKS
...s = OffsetCache.get<std::vector<T> *>(); >> ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ >> /home/jayfoad2/git/llvm-project/llvm/lib/Support/SourceMgr.cpp:136:17: >> note: in instantiation of function template specialization >> 'llvm::SourceMgr::SrcBuffer::getLineNumber<unsigned char>' requested >> here >> LineNo = SB.getLineNumber<uint8_t>(Ptr); >> ^ >> /home/jayfoad2/git/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:194:27: >> note: candidate template ignored: substitution failure [with T = &g...
2019 Oct 02
2
SourceMgr vs EXPENSIVE_CHECKS
...t;T> *>(); >> >> ~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~ >> >> /home/jayfoad2/git/llvm-project/llvm/lib/Support/SourceMgr.cpp:136:17: >> >> note: in instantiation of function template specialization >> >> 'llvm::SourceMgr::SrcBuffer::getLineNumber<unsigned char>' requested >> >> here >> >> LineNo = SB.getLineNumber<uint8_t>(Ptr); >> >> ^ >> >> /home/jayfoad2/git/llvm-project/llvm/include/llvm/ADT/PointerUnion.h:194:27: >> >> note: candidate templa...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
Dear LLVMers, I'm updating some code to use the new LLVM 2.7 API. One piece of this code uses the findStopPoint() function to find the source filename and line number information of an instruction. What is the best way to do this under LLVM 2.7 now that the stop point intrinsic has been removed? It appears that the debug information is attached as metadata, but what is the easiest way
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...ta and MDDbgKind) llvm::MetadataContext *TheMetadata = M->getContext().getMetadata(); MDDbgKind = TheMetadata->getMDKind("dbg"); if (MDDbgKind) { if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) { DILocation Loc(Dbg); ... Loc.getDirectory() Loc.getFilename() Loc.getLineNumber() Loc.getColumnNumber() .... } } Best regards, --Edwin
2010 Mar 16
0
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...ta(); >> MDDbgKind = TheMetadata->getMDKind("dbg"); >> if (MDDbgKind) { >> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) { >> DILocation Loc(Dbg); >> ... >> Loc.getDirectory() >> Loc.getFilename() >> Loc.getLineNumber() >> Loc.getColumnNumber() >> .... >> } >> > > A grep through my LLVM 2.7 source tree does not find MetadataContext > anywhere. Is this something that was added to LLVM mainline after the > LLVM 2.7 branch was created? It should be there, incl...
2010 Mar 16
2
[LLVMdev] Replacement for findStopPoint() in LLVM 2.7
...heMetadata->getMDKind("dbg"); >>> if (MDDbgKind) { >>> if (MDNode *Dbg = TheMetadata->getMD(MDDbgKind, I)) { >>> DILocation Loc(Dbg); >>> ... >>> Loc.getDirectory() >>> Loc.getFilename() >>> Loc.getLineNumber() >>> Loc.getColumnNumber() >>> .... >>> } >>> >>> >> A grep through my LLVM 2.7 source tree does not find MetadataContext >> anywhere. Is this something that was added to LLVM mainline after the >> LLVM 2.7 bra...
2010 Jul 07
0
[LLVMdev] source line number for instruction
...e following at http://llvm.org/docs/SourceLevelDebugging.html#ccxx_frontend > : > if (MDNode *N = I->getMetadata("dbg")) { // Here I is an LLVM > instruction > DILocation Loc(N); // DILocation is in > DebugInfo.h > unsigned Line = Loc.getLineNumber(); > StringRef File = Loc.getFilename(); > StringRef Dir = Loc.getDirectory(); > } > Does this also work for release 2.7? Yes. > I did not see the same thing at the documentation for release 2.7. The link you cited is the documentation for release 2.7. Trevor
2011 Mar 14
0
[LLVMdev] set line number debug info
...lease show how to do that? >       I think  that setMetadata method in Instruction class is to be used. > But how do I create MDNode* consisting of desired source line number. Source > line number can be extracted from the instruction-debug-info using > getMetadata method and then using getLineNumber method from DILocation > class. Unfortunately DILocation class does not have any function like > setLinenumber. You may want to check out Instruction::setDebugLoc(). llvm/Support/DebugLoc.h and llvm/Analysis/DIBuilder.h will likely be helpful as well.
2014 Jan 23
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
...es [0] llvm::LLVMContext llvmContext; unsigned dbgKind = llvmContext.getMDKindID("dbg"); if (MDNode *N = instruction.getMetadata(dbgKind)){ DILocation location(N); fileDirectoryName = location.getDirectory(); fileName = location.getFilename(); lineNumber = location.getLineNumber(); columnNumber = location.getColumnNumber(); } [1] int main(int argc, char **argv){ return 0; } [2] define i32 @main(i32 %argc, i8** %argv) #0 { entry: %retval = alloca i32, align 4 %argc.addr = alloca i32, align 4 %argv.addr = alloca i8**, align 8 store i32 0, i32* %ret...
2013 Apr 12
0
[LLVMdev] The line number range of a function in source code level
On 4/12/13 4:31 AM, Mingliang LIU wrote: > Hi all, > > I need to know the line number range of a function. The start of the > function line number can be found by the definition point, which is > stored at the subprogram metadata: DISubprogram::getLineNumber(). > > However, there is no API (or the metadata in the first place) to know > the end of the function. > > I have to visit all the instructions of the function and maintain the > /max/ line number of the instructions. I use the inst_begin(func): > inst_end(func) as the iter...
2014 Jan 24
2
[LLVMdev] How to read v3.3 dbg metadata using v3.4 LLVM
...quot;dbg"); >> >> if (MDNode *N = instruction.getMetadata(dbgKind)){ >> >> DILocation location(N); >> >> fileDirectoryName = location.getDirectory(); >> >> fileName = location.getFilename(); >> >> lineNumber = location.getLineNumber(); >> >> columnNumber = location.getColumnNumber(); >> >> } >> [1] >> >> int main(int argc, char **argv){ >> >> return 0; >> >> } >> >> [2] >> >> define i32 @main(i32 %argc, i8** %argv) #0 { >> &g...
2011 Mar 25
2
[LLVMdev] set line number debug info
...; > I think that setMetadata method in Instruction class is to be > used. > > But how do I create MDNode* consisting of desired source line number. > Source > > line number can be extracted from the instruction-debug-info using > > getMetadata method and then using getLineNumber method from DILocation > > class. Unfortunately DILocation class does not have any function like > > setLinenumber. > > You may want to check out Instruction::setDebugLoc(). > llvm/Support/DebugLoc.h and llvm/Analysis/DIBuilder.h will likely be > helpful as well. > ------...
2011 Jul 08
0
[LLVMdev] How to get line number of a function in a bitcode file?
Hi Chen, On Jul 8, 2011, at 11:56 AM, kobe James wrote: > Hi All, > > I hope to get some information about functions in a bitcode file. Say, if we have a function foo(), and the bitcode file is generated by a single source file, then I want to get the line number foo() locates in that source file. > If the bitcode file is linked by multiple bitcode files, is it possible to also get