[LLVMdev] PareAssemblyFile returning "expected top-level entity" error message

z_alk at live.concordia.ca z_alk at live.concordia.ca
Fri Feb 4 12:09:50 PST 2011


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>


More information about the llvm-dev mailing list