From 96999dc0b8a2034c49452c9449c7731f809af159 Mon Sep 17 00:00:00 2001 From: Franck Vedrine <franck.vedrine@cea.fr> Date: Tue, 3 Nov 2020 16:08:48 +0100 Subject: [PATCH] update to llvm-11 --- ACSLLexer.cpp | 7 +++---- ClangVisitor.cpp | 16 ++++++++++++++++ Clang_utils.h | 2 ++ 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ACSLLexer.cpp b/ACSLLexer.cpp index 60f71685..eaea59cf 100644 --- a/ACSLLexer.cpp +++ b/ACSLLexer.cpp @@ -2088,8 +2088,7 @@ Lexer::convertClangTokenToACSLToken(const clang::Token& source) const { }; case clang::tok::raw_identifier: // Used only in raw lexing mode. { DLexer::IdentifierToken* result = new DLexer::IdentifierToken; - result->content() = - std::string(source.getRawIdentifier(), source.getLength()); + result->content() = source.getRawIdentifier().str(); return DLexer::Token(result); }; @@ -2102,7 +2101,7 @@ Lexer::convertClangTokenToACSLToken(const clang::Token& source) const { spellingBuffer.resize(source.getLength() + 1); bool isInvalid = false; std::string tokSpelling = _clangSema->getPreprocessor() - .getSpelling(source, spellingBuffer, &isInvalid); + .getSpelling(source, spellingBuffer, &isInvalid).str(); if (isInvalid) return DLexer::Token(); @@ -2126,7 +2125,7 @@ Lexer::convertClangTokenToACSLToken(const clang::Token& source) const { { llvm::SmallString<16> charBuffer; bool isInvalid = false; std::string thisTok = _clangSema->getPreprocessor().getSpelling(source, - charBuffer, &isInvalid); + charBuffer, &isInvalid).str(); if (isInvalid) return DLexer::Token(); ReadResult readResult; diff --git a/ClangVisitor.cpp b/ClangVisitor.cpp index a56c9223..39eb1b44 100644 --- a/ClangVisitor.cpp +++ b/ClangVisitor.cpp @@ -3712,7 +3712,11 @@ statement FramacVisitor::makeExprWithCleanupsStmt( forwardStmts.insertContainer(body); forwardStmts.advanceToEnd(); for (unsigned declIndex = 0; declIndex < numDecls; ++declIndex) { +#if CLANG_VERSION_MAJOR >= 11 + clang::BlockDecl* decl = cleanups->getObject(declIndex).get<clang::BlockDecl*>(); +#else clang::BlockDecl* decl = cleanups->getObject(declIndex); +#endif statement body = makeStmt(decl->getBody(), &forwardStmts, context, shouldDelay); forwardStmts.insertContainer(body); @@ -3734,7 +3738,11 @@ void FramacVisitor::makeCleanupsStmts( const clang::ExprWithCleanups& cleanup = **iter; unsigned numDecls = cleanup.getNumObjects(); for (unsigned declIndex = 0; declIndex < numDecls; ++declIndex) { +#if CLANG_VERSION_MAJOR >= 11 + clang::BlockDecl* decl = cleanup.getObject(declIndex).get<clang::BlockDecl*>(); +#else clang::BlockDecl* decl = cleanup.getObject(declIndex); +#endif statement body = makeStmt(decl->getBody(), &forwardStmts, context, shouldDelay); forwardStmts.insertContainer(body); @@ -3756,7 +3764,11 @@ void FramacVisitor::makeCleanupsStmts( const clang::ExprWithCleanups& cleanup = **iter; unsigned numDecls = cleanup.getNumObjects(); for (unsigned declIndex = 0; declIndex < numDecls; ++declIndex) { +#if CLANG_VERSION_MAJOR >= 11 + clang::BlockDecl* decl = cleanup.getObject(declIndex).get<clang::BlockDecl*>(); +#else clang::BlockDecl* decl = cleanup.getObject(declIndex); +#endif statement body = makeStmt(decl->getBody(), &forwardStmts, context, shouldDelay); forwardStmts.insertContainer(body); @@ -3780,7 +3792,11 @@ void FramacVisitor::makeCleanupsStmts( const clang::ExprWithCleanups& cleanup = **iter; unsigned numDecls = cleanup.getNumObjects(); for (unsigned declIndex = 0; declIndex < numDecls; ++declIndex) { +#if CLANG_VERSION_MAJOR >= 11 + clang::BlockDecl* decl = cleanup.getObject(declIndex).get<clang::BlockDecl*>(); +#else clang::BlockDecl* decl = cleanup.getObject(declIndex); +#endif statement body = makeStmt(decl->getBody(), &forwardStmts, context, shouldDelay); forwardStmts.insertContainer(body); diff --git a/Clang_utils.h b/Clang_utils.h index 127e3bb6..e08eea7f 100644 --- a/Clang_utils.h +++ b/Clang_utils.h @@ -44,6 +44,8 @@ #include "clang/AST/ASTContext.h" #include "clang/AST/DeclCXX.h" #include "clang/AST/DeclTemplate.h" +#include "clang/Basic/SourceManager.h" +#include "clang/Basic/FileManager.h" #ifdef __GNUC__ #pragma GCC diagnostic pop #endif -- GitLab