Skip to content

Program does not compile when using LLVM 11. #371

@jpollack

Description

@jpollack

CodeGenerator.cpp:1611 reads:

auto* whileStmt = WhileStmt::Create(ctx, nullptr, condition, outerBody, stmt->getBeginLoc());

Which gives me the build error: error: too few arguments to function call, expected 7, have 5.

I dug through the LLVM source (as well as another tool which manipulates the AST by linking with LLVM :)) and found the change:

/usr/lib/llvm-11/include/clang/AST/Stmt.h:2300:21: note: 'Create' declared here
static WhileStmt *Create(const ASTContext &Ctx, VarDecl *Var, Expr *Cond, Stmt *Body, SourceLocation WL, SourceLocation LParenLoc, SourceLocation RParenLoc);

So it appears that the newer LLVM wants the locations of the left and right parens. (?)

I made a fix adding clang::SourceLocation() for both arguments, as I saw that's what another similar tool does. (in other words, random guess) But it now compiles and works! I'll commit the fix to a fork should you wish to pull it in.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions