Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Program does not compile when using LLVM 11. #371

Closed
jpollack opened this issue Dec 19, 2020 · 2 comments
Closed

Program does not compile when using LLVM 11. #371

jpollack opened this issue Dec 19, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@jpollack
Copy link

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.

@andreasfertig
Copy link
Owner

Hello @jpollack,

I'm a little behind with the LLVM 11 support. Thanks for reporting this. A patch would be great. However, it needs to be backwards compatible with LLVM10. Here is an example

#if IS_CLANG_NEWER_THAN(8)

Andreas

@inhzus
Copy link

inhzus commented Jan 12, 2021

Really look forward for your patch! Now I have to merge your repo, jpollack/cppinsights before building.

@andreasfertig andreasfertig added the bug Something isn't working label Jan 30, 2021
andreasfertig added a commit that referenced this issue Jan 30, 2021
Fixed #371: Added compile support for Clang 11.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants