diff --git a/ACSLLexer.cpp b/ACSLLexer.cpp index 60f716859a79e098f5827773782acd6dd013c16f..eaea59cf2fa4b0f9845f80b9d5998a3e97bbe35c 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 a56c9223a8cae6004e5dc6988ae6653b7775a87e..39eb1b4408329d0ab31686125f0ad92142907943 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 127e3bb6583796048262e87c9aeffe285dd15167..e08eea7f8285d6f82e1b93ad57cd7ca159057e8b 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