z_alk at live.concordia.ca
2011-Feb-04 20:09 UTC
[LLVMdev] PareAssemblyFile returning "expected top-level entity" error message
Hello all, I am trying to generate a module object using something like this: (to use for code analysis) Module *topModule; SMDiagnostic error; topModule = ParseAssemblyFile("code.s", error, getGlobalContext()); displayErrorInfo(error); void displayErrorInfo(SMDiagnostic& err) { std::string errFileName = err.getFilename(); std::string errMsg = err.getMessage(); std::string errLineContents = err.getLineContents(); int errLineNo = err.getLineNo(), errColNo = err.getColumnNo(); std::cout << "Error File Name: "<< errFileName << std::endl; std::cout << "Error Message: " << errMsg << std::endl; std::cout << "Error Line number: " << errLineNo << ". Column number: "<< errColNo << std::endl; } and I've been getting the following output: Error File Name: code.s Error Message: error: expected top-level entity Error Line number: 1. Column number: 1 code.s is generated manually using llvm-g++ -S code.cpp where code.cpp is just a hello world application. Any ideas as to the reason for the error ? Thanks !! Zaid -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110204/fb271f10/attachment.html>
Frits van Bommel
2011-Feb-04 22:22 UTC
[LLVMdev] PareAssemblyFile returning "expected top-level entity" error message
On Fri, Feb 4, 2011 at 9:09 PM, z_alk at live.concordia.ca <z_alk at live.concordia.ca> wrote:> I am trying to generate a module object using something like this: (to use > for code analysis) > > Module *topModule; > SMDiagnostic error; > topModule = ParseAssemblyFile("code.s", error, getGlobalContext());...> and I've been getting the following output: > > Error File Name: code.s > Error Message: error: expected top-level entity > Error Line number: 1. Column number: 1 > > code.s is generated manually using > llvm-g++ -S code.cpp > > where code.cpp is just a hello world application. > > Any ideas as to the reason for the error ?'llvm-g++ -S' generates machine-level asm (for example, x86 asm). Adding '-emit-llvm' should tell it to generate LLVM asm instead.
Reasonably Related Threads
- [LLVMdev] Problem linking and JITing code through C++-API
- [LLVMdev] Problem linking and JITing code through C++-API
- [LLVMdev] Problem linking and JITing code through C++-API
- IE SlidingUp/Down Flicker Bug... Still not solved!
- Form Entity Names for Child Objects