[LLVMbugs] [Bug 4992] New: Tutorial examples are broken

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Wed Sep 16 07:10:05 PDT 2009


           Summary: Tutorial examples are broken
           Product: Documentation
           Version: trunk
          Platform: Macintosh
        OS/Version: MacOS X
            Status: NEW
          Severity: minor
          Priority: P2
         Component: General docs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: graham.hemingway at gmail.com
                CC: llvmbugs at cs.uiuc.edu

I am just working my way through the tutorial (Parts 1 and 2 at
http://llvm.org/docs/tutorial) using TOT, and I am having to make a number of
corrections for proper compilation.  For example in Part 1 there is the line:

  Constant* c = mod->getOrInsertFunction("mul_add",
  /*ret type*/                                                      
  /*varargs terminated with null*/                  NULL);

This gave me a number of errors.  After changing IntegerType::get(32) to
IntegerType::get(getGlobalContext(), 32) things worked better.

Another example is in Part 2 (A more complicated function) there are the lines:

  BasicBlock* entry = BasicBlock::Create(getGlobalContext(), ("entry", gcd);
  BasicBlock* ret = BasicBlock::Create(getGlobalContext(), ("return", gcd);
  BasicBlock* cond_false = BasicBlock::Create(getGlobalContext(),
("cond_false", gcd);
  BasicBlock* cond_true = BasicBlock::Create(getGlobalContext(), ("cond_true",
  BasicBlock* cond_false_2 = BasicBlock::Create(getGlobalContext(),
("cond_false", gcd);

The '(' and ')' on each line don't match.  I removed the '(' after each
getGlobalContext() and things seemed to work better.

I admit that I am very new to llvm, but I think that the tutorial is out of
sync with the current state of the API.  If my assessment is correct, and you
are OK with it, I am happy to make the necessary changes to the tutorials as I
go along.


Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list