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

LLVM 19 migration #775

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ set(ODBFLAGS
--default-pointer "std::shared_ptr")

# Set CXX standard
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

Expand Down
4 changes: 2 additions & 2 deletions parser/src/pluginhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void PluginHandler::loadPlugins(std::vector<std::string>& skipParserList_)
++dirIter)
{
if (fs::is_regular_file(dirIter->status()) &&
fs::extension(*dirIter) == util::DynamicLibrary::extension())
fs::path(*dirIter).extension() == util::DynamicLibrary::extension())
{
std::string filename = getPluginName(dirIter->path());

Expand Down Expand Up @@ -85,7 +85,7 @@ std::vector<std::string> PluginHandler::getPluginNames() const
++dirIter)
{
if (fs::is_regular_file(dirIter->status()) &&
fs::extension(*dirIter) == util::DynamicLibrary::extension())
fs::path(*dirIter).extension() == util::DynamicLibrary::extension())
{
plugins.push_back(getPluginName(dirIter->path()));
}
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/parser/include/cppparser/filelocutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class FileLocUtil
if (fid.isInvalid())
return std::string();

const clang::FileEntry* fileEntry = _clangSrcMan.getFileEntryForID(fid);
const clang::OptionalFileEntryRef fileEntry = _clangSrcMan.getFileEntryRefForID(fid);
if (!fileEntry)
return std::string();

Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/parser/src/clangastvisitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -1735,7 +1735,7 @@ class ClangASTVisitor : public clang::RecursiveASTVisitor<ClangASTVisitor>
clang::DynTypedNodeList parents
= _astContext.getParents(*expr_);

const clang::ast_type_traits::DynTypedNode& parent = parents[0];
const clang::DynTypedNode& parent = parents[0];

if (const clang::BinaryOperator* op = parent.get<clang::BinaryOperator>())
{
Expand Down
6 changes: 3 additions & 3 deletions plugins/cpp/parser/src/cppparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ bool CppParser::isSourceFile(const std::string& file_) const
const std::vector<std::string> cppExts{
".c", ".cc", ".cpp", ".cxx", ".o", ".so", ".a"};

std::string ext = fs::extension(file_);
std::string ext = fs::path(file_).extension().string();
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);

return std::find(cppExts.begin(), cppExts.end(), ext) != cppExts.end();
Expand Down Expand Up @@ -209,7 +209,7 @@ std::map<std::string, std::string> CppParser::extractInputOutputs(
{
for (const std::string& src : sources)
{
std::string extension = fs::extension(src);
std::string extension = fs::path(src).extension().string();
inToOut[src] = src.substr(0, src.size() - extension.size() - 1) + ".o";
}
}
Expand All @@ -232,7 +232,7 @@ model::BuildActionPtr CppParser::addBuildAction(

model::BuildActionPtr buildAction(new model::BuildAction);

std::string extension = fs::extension(command_.Filename);
std::string extension = fs::path(command_.Filename).extension().string();

buildAction->command = boost::algorithm::join(command_.CommandLine, " ");
buildAction->type
Expand Down
28 changes: 14 additions & 14 deletions plugins/cpp/parser/src/doccommentformatter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ FullCommentParts::FullCommentParts(

switch (child->getCommentKind())
{
case Comment::NoCommentKind:
case CommentKind::None:
continue;

case Comment::ParagraphCommentKind:
case CommentKind::ParagraphComment:
{
const ParagraphComment* pc = llvm::cast<ParagraphComment>(child);

Expand All @@ -75,7 +75,7 @@ FullCommentParts::FullCommentParts(
break;
}

case Comment::BlockCommandCommentKind:
case CommentKind::BlockCommandComment:
{
const BlockCommandComment* bcc = llvm::cast<BlockCommandComment>(child);
const CommandInfo* Info = traits_.getCommandInfo(bcc->getCommandID());
Expand All @@ -94,7 +94,7 @@ FullCommentParts::FullCommentParts(
break;
}

case Comment::ParamCommandCommentKind:
case CommentKind::ParamCommandComment:
{
const ParamCommandComment* pcc = llvm::cast<ParamCommandComment>(child);

Expand All @@ -108,7 +108,7 @@ FullCommentParts::FullCommentParts(
break;
}

case Comment::TParamCommandCommentKind:
case CommentKind::TParamCommandComment:
{
const TParamCommandComment* tpcc
= llvm::cast<TParamCommandComment>(child);
Expand All @@ -123,11 +123,11 @@ FullCommentParts::FullCommentParts(
break;
}

case Comment::VerbatimBlockCommentKind:
case CommentKind::VerbatimBlockComment:
_miscBlocks.push_back(cast<BlockCommandComment>(child));
break;

case Comment::VerbatimLineCommentKind:
case CommentKind::VerbatimLineComment:
{
const VerbatimLineComment* vlc = llvm::cast<VerbatimLineComment>(child);
const CommandInfo* Info = traits_.getCommandInfo(vlc->getCommandID());
Expand Down Expand Up @@ -251,22 +251,22 @@ void CommentToMarkdownConverter::visitInlineCommandComment(

switch (c_->getRenderKind())
{
case InlineCommandComment::RenderNormal:
case InlineCommandRenderKind::Normal:
for (unsigned i = 0, e = c_->getNumArgs(); i != e; ++i)
_res << c_->getArgText(i).str() << ' ';
return;

case InlineCommandComment::RenderBold:
case InlineCommandRenderKind::Bold:
assert(c_->getNumArgs() == 1);
_res << "**" << arg0.str() << "**";
return;

case InlineCommandComment::RenderMonospaced:
case InlineCommandRenderKind::Monospaced:
assert(c_->getNumArgs() == 1);
_res << '`' << arg0.str() << '`';
return;

case InlineCommandComment::RenderEmphasized:
case InlineCommandRenderKind::Emphasized:
assert(c_->getNumArgs() == 1);
_res << '*' << arg0.str() << '*';
return;
Expand Down Expand Up @@ -336,9 +336,9 @@ void CommentToMarkdownConverter::visitParamCommandComment(
{
switch (c_->getDirection())
{
case ParamCommandComment::In: _res << "- *in*: "; break;
case ParamCommandComment::Out: _res << "- *out*: "; break;
case ParamCommandComment::InOut: _res << "- *in,out*: "; break;
case ParamCommandPassDirection::In: _res << "- *in*: "; break;
case ParamCommandPassDirection::Out: _res << "- *out*: "; break;
case ParamCommandPassDirection::InOut: _res << "- *in,out*: "; break;
}

_res << "**" << (c_->isParamIndexValid()
Expand Down
3 changes: 2 additions & 1 deletion plugins/cpp/parser/src/ppincludecallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,11 @@ void PPIncludeCallback::InclusionDirective(
clang::StringRef fileName_,
bool,
clang::CharSourceRange filenameRange_,
const clang::FileEntry*,
clang::OptionalFileEntryRef,
clang::StringRef searchPath_,
clang::StringRef,
const clang::Module*,
bool,
clang::SrcMgr::CharacteristicKind)
{
if (searchPath_.empty())
Expand Down
3 changes: 2 additions & 1 deletion plugins/cpp/parser/src/ppincludecallback.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ class PPIncludeCallback : public clang::PPCallbacks
clang::StringRef FileName,
bool IsAngled,
clang::CharSourceRange FilenameRange,
const clang::FileEntry *File,
clang::OptionalFileEntryRef File,
clang::StringRef SearchPath,
clang::StringRef RelativePath,
const clang::Module *Imported,
bool ModuleImported,
clang::SrcMgr::CharacteristicKind FileType) override;

private:
Expand Down
2 changes: 1 addition & 1 deletion plugins/cpp/service/src/filediagram.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ util::Graph::Node FileDiagram::addNode(
}
else if (fileInfo_.type == "CPP")
{
std::string ext = boost::filesystem::extension(fileInfo_.path);
std::string ext = boost::filesystem::path(fileInfo_.path).extension().string();
std::transform(ext.begin(), ext.end(), ext.begin(), ::tolower);

if (ext == ".cpp" || ext == ".cxx" || ext == ".cc" || ext == ".c")
Expand Down
2 changes: 1 addition & 1 deletion plugins/dummy/parser/src/dummyparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ DummyParser::DummyParser(ParserContext& ctx_): AbstractParser(ctx_)

bool DummyParser::accept(const std::string& path_)
{
std::string ext = boost::filesystem::extension(path_);
std::string ext = boost::filesystem::path(path_).string();
return ext == ".dummy";
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/git/parser/src/gitparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ util::DirIterCallback GitParser::getParserCallback()
boost::property_tree::ptree pt;
std::string repoFile(versionDataDir + "/repositories.txt");

if (boost::filesystem::is_regular(repoFile))
if (boost::filesystem::is_regular_file(repoFile))
boost::property_tree::read_ini(repoFile, pt);

pt.put(repoId + ".name", path.filename().string());
Expand Down
2 changes: 1 addition & 1 deletion plugins/git/service/src/gitservice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void GitServiceHandler::getRepositoryList(std::vector<GitRepository>& return_)
std::string repoFile(versionDataDir.string() + "/repositories.txt");
boost::property_tree::ptree pt;

if (!fs::is_regular(repoFile))
if (!fs::is_regular_file(repoFile))
{
LOG(warning) << "Repository file not found in data directory: " << repoFile;
return;
Expand Down
2 changes: 1 addition & 1 deletion plugins/search/parser/src/searchparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ bool SearchParser::shouldHandle(const std::string& path_)
{
//--- The file is not regular. ---//

if (!fs::is_regular(path_))
if (!fs::is_regular_file(path_))
return false;

//--- The file is excluded by suffix. ---//
Expand Down
1 change: 1 addition & 0 deletions service/workspace/src/workspaceservice.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <boost/filesystem.hpp>
#include <workspaceservice/workspaceservice.h>
#include <algorithm>

namespace cc
{
Expand Down
8 changes: 4 additions & 4 deletions util/include/util/hash.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,18 @@ inline std::string sha1Hash(const std::string& data_)
using namespace boost::uuids::detail;

sha1 hasher;
unsigned int digest[5];
unsigned char digest[20];

hasher.process_bytes(data_.c_str(), data_.size());
hasher.get_digest(digest);

std::stringstream ss;
ss.setf(std::ios::hex, std::ios::basefield);
ss.width(8);
ss.width(2);
ss.fill('0');

for (int i = 0; i < 5; ++i)
ss << digest[i];
for (int i = 0; i < 20; ++i)
ss << (int)digest[i];

return ss.str();
}
Expand Down
2 changes: 1 addition & 1 deletion webserver/include/webserver/pluginhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class PluginHandler
for (fs::directory_iterator dirIter(path_); dirIter != endIter; ++dirIter)
{
if (fs::is_regular_file(dirIter->status())
&& fs::extension(*dirIter) == util::DynamicLibrary::extension())
&& fs::path(*dirIter).extension() == util::DynamicLibrary::extension())
{
_dynamicLibraries.emplace_back(util::DynamicLibraryPtr(
new util::DynamicLibrary(dirIter->path().string())));
Expand Down
Loading