Merge pull request #228 from bkryza/add-coroutine-testcase

Add coroutine testcase
This commit is contained in:
Bartek Kryza
2024-01-11 17:10:25 +01:00
committed by GitHub
730 changed files with 20748 additions and 7689 deletions

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/ast_id_mapper.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/ast_id_mapper.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -40,7 +40,7 @@ namespace clanguml::common::visitor {
*/
class ast_id_mapper {
public:
using id_t = common::model::diagram_element::id_t;
using id_t = common::id_t;
ast_id_mapper() = default;

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/clang_visitor.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/clang_visitor.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/comment_visitor.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/comment_visitor.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/plain_visitor.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/comment/plain_visitor.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/translation_unit_visitor.cc
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,6 +20,10 @@
#include "comment/clang_visitor.h"
#include "comment/plain_visitor.h"
#include "common/clang_utils.h"
#include <clang/AST/Expr.h>
#include <clang/Basic/Module.h>
namespace clanguml::common::visitor {
@@ -161,4 +165,25 @@ void translation_unit_visitor::set_source_location(
element.set_location_id(location.getHashValue());
}
void translation_unit_visitor::set_owning_module(
const clang::Decl &decl, clanguml::common::model::element &element)
{
if (const clang::Module *module = decl.getOwningModule();
module != nullptr) {
std::string module_name = module->Name;
bool is_private{false};
#if LLVM_VERSION_MAJOR < 15
is_private =
module->Kind == clang::Module::ModuleKind::PrivateModuleFragment;
#else
is_private = module->isPrivateModule();
#endif
if (is_private) {
// Clang just maps private modules names to "<private>"
module_name = module->getTopLevelModule()->Name;
}
element.set_module(module_name);
element.set_module_private(is_private);
}
}
} // namespace clanguml::common::visitor

View File

@@ -1,7 +1,7 @@
/**
* @file src/common/visitor/translation_unit_visitor.h
*
* Copyright (c) 2021-2023 Bartek Kryza <bkryza@gmail.com>
* Copyright (c) 2021-2024 Bartek Kryza <bkryza@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,9 +18,12 @@
#pragma once
#include "comment/comment_visitor.h"
#include "common/model/element.h"
#include "common/model/source_location.h"
#include "config/config.h"
#include <clang/AST/Comment.h>
#include <clang/AST/RawCommentList.h>
#include <clang/Basic/SourceManager.h>
#include <deque>
@@ -31,9 +34,8 @@
namespace clanguml::common::visitor {
using found_relationships_t =
std::vector<std::pair<clanguml::common::model::diagram_element::id_t,
common::model::relationship_t>>;
using found_relationships_t = std::vector<
std::pair<clanguml::common::id_t, common::model::relationship_t>>;
/**
* @brief Diagram translation unit visitor base class
@@ -100,6 +102,9 @@ public:
void set_source_location(const clang::SourceLocation &location,
clanguml::common::model::source_location &element);
void set_owning_module(
const clang::Decl &decl, clanguml::common::model::element &element);
protected:
/**
* @brief Process comment directives in comment attached to a declaration