Skip to content

Commit ed7995a

Browse files
fabianbs96mxHuber
andauthored
Improved Code Documentation (#771)
* comments to doxygen * some more descriptions * Overhauled README.dox * Added texts + fixed typos * More descriptions and typo fixes * Revert change in LLVM code * Fix existing docs * Some more comments + update Doxyfile.in * Add gh-pages deploy script * pre-commit * Small compiler fix * pre-commit with newer clang version * install Doxygen in CI * test * add token * Remove gh-pages deploy trigger on pull-request * install graphviz in CI to draw pretty class diagrams * update website * Remove gh-pages deploy trigger on pull-request * Apply review comments --------- Co-authored-by: mxHuber <[email protected]>
1 parent b56205d commit ed7995a

File tree

71 files changed

+1014
-628
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1014
-628
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Deploy Doxygen Docs
2+
on:
3+
push:
4+
branches: [ development ]
5+
# pull_request: # For testing only. Remove before merge!
6+
# branches: [ development ]
7+
permissions:
8+
contents: write
9+
jobs:
10+
build-and-deploy:
11+
runs-on: ubuntu-24.04
12+
strategy:
13+
fail-fast: true
14+
continue-on-error: false
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
submodules: recursive
22+
23+
- name: Install Phasar Dependencies
24+
shell: bash
25+
run: |
26+
./utils/InstallAptDependencies.sh --noninteractive tzdata doxygen graphviz
27+
28+
- name: Build Doxygen Docs
29+
shell: bash
30+
env:
31+
CXX: clang++-15
32+
CC: clang-15
33+
run: |
34+
cmake -S . -B build -DPHASAR_BUILD_DOC=ON
35+
cmake --build ./build --target doc_doxygen
36+
37+
- name: Deploy Doxygen Docs on GitHub Pages
38+
uses: JamesIves/github-pages-deploy-action@v4
39+
with:
40+
folder: build/docs/html
41+
token: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Currently, PhASAR is maintained by
2525
PhASAR requires at least C++-17.
2626

2727
However, building in C++20 mode is supported. You may enable this setting the cmake variable `CMAKE_CXX_STANDARD` to `20`.
28-
Although phasar currently does not make use of C++-20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 ealier.
28+
Although phasar currently does not make use of C++-20 features (except for some `concept`s behind an #ifdef border), your client application that just *uses* phasar as a library may want to use C++20 earlier.
2929

3030
## Currently Supported Version of LLVM
3131

docs/Doxyfile.in

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ DOXYFILE_ENCODING = UTF-8
3232
# title of most generated pages and in a few other places.
3333
# The default value is: My Project.
3434

35-
PROJECT_NAME = "PhASAR"
35+
PROJECT_NAME = PhASAR
3636

3737
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
3838
# could be handy for archiving the generated documentation or if some version
3939
# control system is used.
4040

41-
PROJECT_NUMBER = @PHASAR_VERSION@
41+
PROJECT_NUMBER = @PHASAR_VERSION@@development
4242

4343
# Using the PROJECT_BRIEF tag one can provide an optional one line description
4444
# for a project that appears at the top of each page and should give viewer a
4545
# quick idea about the purpose of the project. Keep the description short.
4646

47-
PROJECT_BRIEF = "PhASAR a LLVM-based Static Analysis Framework"
47+
PROJECT_BRIEF = "A LLVM-based Static Analysis Framework"
4848

4949
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
5050
# the documentation. The maximum height of the logo should not exceed 55 pixels
@@ -144,7 +144,7 @@ FULL_PATH_NAMES = YES
144144
# will be relative from the directory where doxygen is started.
145145
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
146146

147-
STRIP_FROM_PATH =
147+
STRIP_FROM_PATH = @PHASAR_SRC_DIR@
148148

149149
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
150150
# path mentioned in the documentation of a class, which tells the reader which
@@ -153,8 +153,7 @@ STRIP_FROM_PATH =
153153
# specify the list of include paths that are normally passed to the compiler
154154
# using the -I flag.
155155

156-
STRIP_FROM_INC_PATH =
157-
156+
STRIP_FROM_INC_PATH = @PHASAR_SRC_DIR@/include
158157
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
159158
# less readable) file names. This can be useful is your file systems doesn't
160159
# support long names like on DOS, Mac, or CD-ROM.
@@ -398,7 +397,7 @@ LOOKUP_CACHE_SIZE = 0
398397
# normally produced when WARNINGS is set to YES.
399398
# The default value is: NO.
400399

401-
EXTRACT_ALL = NO
400+
EXTRACT_ALL = YES
402401

403402
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
404403
# be included in the documentation.
@@ -743,7 +742,8 @@ WARN_LOGFILE =
743742
# spaces.
744743
# Note: If this tag is empty the current directory is searched.
745744

746-
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include/ @CMAKE_CURRENT_SOURCE_DIR@/lib/ @CMAKE_CURRENT_SOURCE_DIR@/docs
745+
INPUT = @CMAKE_CURRENT_SOURCE_DIR@/include/ \
746+
@CMAKE_CURRENT_SOURCE_DIR@/docs
747747

748748
# This tag can be used to specify the character encoding of the source files
749749
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
@@ -794,7 +794,7 @@ EXCLUDE_SYMLINKS = NO
794794
# Note that the wildcards are matched against the file with absolute path, so to
795795
# exclude all test directories for example use the pattern */test/*
796796

797-
EXCLUDE_PATTERNS =
797+
EXCLUDE_PATTERNS = */external/*
798798

799799
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
800800
# (namespaces, classes, functions, etc.) that should be excluded from the
@@ -805,7 +805,7 @@ EXCLUDE_PATTERNS =
805805
# Note that the wildcards are matched against the file with absolute path, so to
806806
# exclude all test directories use the pattern */test/*
807807

808-
EXCLUDE_SYMBOLS =
808+
EXCLUDE_SYMBOLS = *::detail::*
809809

810810
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
811811
# that contain example code fragments that are included (see the \include
@@ -905,7 +905,7 @@ INLINE_SOURCES = NO
905905
# Fortran comments will always remain visible.
906906
# The default value is: YES.
907907

908-
STRIP_CODE_COMMENTS = YES
908+
STRIP_CODE_COMMENTS = NO
909909

910910
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
911911
# function all documented functions referencing it will be listed.
@@ -917,7 +917,7 @@ REFERENCED_BY_RELATION = YES
917917
# all documented entities called/used by that function will be listed.
918918
# The default value is: NO.
919919

920-
REFERENCES_RELATION = NO
920+
REFERENCES_RELATION = YES
921921

922922
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
923923
# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
@@ -1407,7 +1407,7 @@ FORMULA_TRANSPARENT = YES
14071407
# The default value is: NO.
14081408
# This tag requires that the tag GENERATE_HTML is set to YES.
14091409

1410-
USE_MATHJAX = NO
1410+
USE_MATHJAX = YES
14111411

14121412
# When MathJax is enabled you can set the default output format to be used for
14131413
# the MathJax output. See the MathJax site (see:
@@ -1521,7 +1521,7 @@ SEARCHDATA_FILE = searchdata.xml
15211521
# projects and redirect the results back to the right project.
15221522
# This tag requires that the tag SEARCHENGINE is set to YES.
15231523

1524-
EXTERNAL_SEARCH_ID =
1524+
EXTERNAL_SEARCH_ID = phasar
15251525

15261526
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
15271527
# projects other than the one defined by this configuration file, but that are
@@ -1540,7 +1540,7 @@ EXTRA_SEARCH_MAPPINGS =
15401540
# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
15411541
# The default value is: YES.
15421542

1543-
GENERATE_LATEX = YES
1543+
GENERATE_LATEX = NO
15441544

15451545
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
15461546
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
@@ -1917,7 +1917,7 @@ SEARCH_INCLUDES = YES
19171917
# preprocessor.
19181918
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
19191919

1920-
INCLUDE_PATH =
1920+
INCLUDE_PATH = @PHASAR_BINARY_DIR@/include
19211921

19221922
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
19231923
# patterns (like *.h and *.hpp) to filter out the header-files in the
@@ -2040,7 +2040,7 @@ DIA_PATH =
20402040
# and usage relations if the target is undocumented or is not a class.
20412041
# The default value is: YES.
20422042

2043-
HIDE_UNDOC_RELATIONS = YES
2043+
HIDE_UNDOC_RELATIONS = NO
20442044

20452045
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
20462046
# available from the path. This tool is part of Graphviz (see:
@@ -2100,7 +2100,7 @@ CLASS_GRAPH = YES
21002100
# The default value is: YES.
21012101
# This tag requires that the tag HAVE_DOT is set to YES.
21022102

2103-
COLLABORATION_GRAPH = YES
2103+
COLLABORATION_GRAPH = NO
21042104

21052105
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
21062106
# groups, showing the direct groups dependencies.
@@ -2136,7 +2136,7 @@ UML_LIMIT_NUM_FIELDS = 10
21362136
# The default value is: NO.
21372137
# This tag requires that the tag HAVE_DOT is set to YES.
21382138

2139-
TEMPLATE_RELATIONS = NO
2139+
TEMPLATE_RELATIONS = YES
21402140

21412141
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
21422142
# YES then doxygen will generate a graph for each documented file showing the
@@ -2145,7 +2145,7 @@ TEMPLATE_RELATIONS = NO
21452145
# The default value is: YES.
21462146
# This tag requires that the tag HAVE_DOT is set to YES.
21472147

2148-
INCLUDE_GRAPH = YES
2148+
INCLUDE_GRAPH = NO
21492149

21502150
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
21512151
# set to YES then doxygen will generate a graph for each documented file showing
@@ -2154,7 +2154,7 @@ INCLUDE_GRAPH = YES
21542154
# The default value is: YES.
21552155
# This tag requires that the tag HAVE_DOT is set to YES.
21562156

2157-
INCLUDED_BY_GRAPH = YES
2157+
INCLUDED_BY_GRAPH = NO
21582158

21592159
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
21602160
# dependency graph for every global function or class method.
@@ -2203,7 +2203,7 @@ DIRECTORY_GRAPH = YES
22032203
# The default value is: png.
22042204
# This tag requires that the tag HAVE_DOT is set to YES.
22052205

2206-
DOT_IMAGE_FORMAT = png
2206+
DOT_IMAGE_FORMAT = svg
22072207

22082208
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
22092209
# enable generation of interactive SVG images that allow zooming and panning.
@@ -2276,7 +2276,7 @@ MAX_DOT_GRAPH_DEPTH = 0
22762276
# The default value is: NO.
22772277
# This tag requires that the tag HAVE_DOT is set to YES.
22782278

2279-
DOT_TRANSPARENT = NO
2279+
DOT_TRANSPARENT = YES
22802280

22812281
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
22822282
# files in one run (i.e. multiple -o and -T options on the command line). This

docs/README.dox

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,27 @@
22

33
@mainpage PhASAR: A LLVM-based Static Analysis Framework
44

5-
@author Philipp Schubert (E-Mail: [email protected]) and others
5+
PhASAR is a LLVM-based static analysis framework written in C++. It allows users to specify arbitrary data-flow problems which are then solved in a fully-automated manner on the specified LLVM IR target code. Computing points-to information, call-graph(s), etc. is done by the framework, thus you can focus on what matters.
66

7-
\b Copyright \n
8-
Copyright 2017 Philipp Schubert. All rights reserved.
7+
This page contains the generated code documentation of PhASAR.
8+
You can find the original source on GitHub: <https://github.com/secure-software-engineering/phasar>. The README should already give you a good first overview.
99

10-
\b License \n
11-
See LICENSE.txt
10+
For further information, please checkout PhASAR's [Wiki](https://github.com/secure-software-engineering/phasar/wiki).
11+
12+
@subsubsection SSEG Secure Software Engineering Group
13+
14+
PhASAR is primarily developed and maintained by the [Secure Software Engineering Group](https://www.hni.uni-paderborn.de/sse) at Heinz Nixdorf Institute (University of Paderborn) and [Fraunhofer IEM](https://www.iem.fraunhofer.de/).
1215

13-
TODO: add detailed description.
16+
PhASAR was initially developed by Philipp Dominik Schubert (<a href="https://github.com/pdschubert">@pdschubert</a>)(<[email protected]>).
17+
18+
\b Currently, PhASAR is maintained by
19+
- Fabian Schiebel (<a href="https://github.com/fabianbs96">@fabianbs96</a>)([email protected])
20+
- Sriteja Kummita (<a href="https://github.com/sritejakv">@sritejakv</a>)
21+
- Lucas Briese (<a href="https://github.com/jusito">@jusito</a>)
22+
- Martin Mory (<a href="https://github.com/MMory">@MMory</a>)([email protected])
23+
- *others*
24+
25+
\b License \n
26+
PhASAR is made available under the permissive MIT License. See <a href="https://github.com/secure-software-engineering/phasar/blob/development/LICENSE.txt">LICENSE.txt</a>
1427

1528
*/

include/phasar/AnalysisStrategy/AnalysisSetup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
namespace psr {
1818

19-
// Indicates that an analysis does not need a special configuration (file).
19+
/// Indicates that an analysis does not need a special configuration (file).
2020
struct HasNoConfigurationType {};
2121

2222
struct AnalysisSetup {

include/phasar/ControlFlow/CallGraphData.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
#include <vector>
1919

2020
namespace psr {
21+
22+
/// A data structure used for storing, serializing and deserializing call-graph
23+
/// information.
2124
struct CallGraphData {
22-
// Mangled FunName --> [CS-IDs]
25+
26+
/// Mangled FunName --> [CS-IDs]
2327
std::unordered_map<std::string, std::vector<uint32_t>> FToFunctionVertexTy{};
2428

2529
CallGraphData() noexcept = default;

include/phasar/ControlFlow/ICFGBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ template <typename Derived> class ICFGBase : public CRTPBase<Derived> {
3636
}
3737

3838
/// returns the function definition or declaration with the given name. If
39-
/// ther eis no such function, returns a default constructed f_t (nullptr for
39+
/// there is no such function, returns a default constructed f_t (nullptr for
4040
/// pointers).
4141
[[nodiscard]] f_t getFunction(llvm::StringRef Fun) const {
4242
return self().getFunctionImpl(Fun);

include/phasar/DB/ProjectIRDBBase.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ template <typename DB> struct ProjectIRDBTraits {
2424
// using g_t
2525
};
2626

27-
/// This class owns the IR code of the project under analysis and some
27+
/// This class owns the IR code of the target being analyzed and some
2828
/// very important information associated with the IR.
2929
/// When an object of this class is destroyed it will clean up all IR related
3030
/// stuff that is stored in it.

include/phasar/DataFlow/IfdsIde/EdgeFunction.h

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ concept IsEdgeFunction = requires(const T &EF, const EdgeFunction<typename T::l_
6565
{T::compose(CEF, TEEF)} -> std::same_as<EdgeFunction<typename T::l_t>>;
6666
{T::join(CEF, TEEF)} -> std::same_as<EdgeFunction<typename T::l_t>>;
6767
};
68-
// clang-format on
68+
// clang-format on
6969

7070
#endif
7171

@@ -78,18 +78,20 @@ enum class EdgeFunctionAllocationPolicy {
7878
class EdgeFunctionBase {
7979
public:
8080
template <typename ConcreteEF>
81-
static constexpr bool
82-
IsSOOCandidate = sizeof(ConcreteEF) <= sizeof(void *) && // NOLINT
83-
alignof(ConcreteEF) <= alignof(void *) &&
84-
std::is_trivially_copyable_v<ConcreteEF>;
81+
static constexpr bool IsSOOCandidate =
82+
sizeof(ConcreteEF) <= sizeof(void *) && // NOLINT
83+
alignof(ConcreteEF) <= alignof(void *) &&
84+
std::is_trivially_copyable_v<ConcreteEF>;
8585

8686
using AllocationPolicy = EdgeFunctionAllocationPolicy;
8787

8888
protected:
8989
struct RefCountedBase {
9090
mutable std::atomic_size_t Rc = 0;
9191
};
92-
template <typename T> struct RefCounted : RefCountedBase { T Value; };
92+
template <typename T> struct RefCounted : RefCountedBase {
93+
T Value;
94+
};
9395

9496
template <typename T> struct CachedRefCounted : RefCounted<T> {
9597
EdgeFunctionSingletonCache<T> *Cache{};
@@ -118,8 +120,8 @@ class EdgeFunctionBase {
118120
: AllocationPolicy::CustomHeapAllocated;
119121
};
120122

121-
/// Non-null reference to an edge function that is guarenteed to be managed by
122-
/// an EdgeFunction object.
123+
/// \brief Non-null reference to an edge function that is guarenteed to be
124+
/// managed by an EdgeFunction object.
123125
template <typename EF>
124126
class [[clang::trivial_abi]] EdgeFunctionRef final : EdgeFunctionBase {
125127
template <typename L> friend class EdgeFunction;
@@ -164,8 +166,8 @@ class [[clang::trivial_abi]] EdgeFunctionRef final : EdgeFunctionBase {
164166
IsCached{};
165167
};
166168

167-
/// Ref-counted and type-erased edge function with small-object optimization.
168-
/// Supports caching.
169+
/// \brief Ref-counted and type-erased edge function with small-object
170+
/// optimization. Supports caching.
169171
template <typename L>
170172
// -- combined copy and move assignment
171173
// NOLINTNEXTLINE(cppcoreguidelines-special-member-functions)
@@ -265,8 +267,8 @@ class [[clang::trivial_abi]] EdgeFunction final : EdgeFunctionBase {
265267
explicit EdgeFunction(
266268
std::in_place_type_t<ConcreteEF> /*unused*/,
267269
ArgTys &&...Args) noexcept(IsSOOCandidate<std::decay_t<ConcreteEF>> &&
268-
std::is_nothrow_constructible_v<ConcreteEF,
269-
ArgTys...>)
270+
std::is_nothrow_constructible_v<ConcreteEF,
271+
ArgTys...>)
270272
: EdgeFunction(
271273
[](auto &&...Args) {
272274
if constexpr (IsSOOCandidate<std::decay_t<ConcreteEF>>) {

0 commit comments

Comments
 (0)