GCC Middle and Back End API Reference
gcc-urlifier.h
Go to the documentation of this file.
1/* Automatic generation of links into GCC's documentation.
2 Copyright (C) 2023-2024 Free Software Foundation, Inc.
3 Contributed by David Malcolm <dmalcolm@redhat.com>.
4
5This file is part of GCC.
6
7GCC is free software; you can redistribute it and/or modify it
8under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 3, or (at your option)
10any later version.
11
12GCC is distributed in the hope that it will be useful, but
13WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GCC; see the file COPYING3. If not see
19<http://www.gnu.org/licenses/>. */
20
21#ifndef GCC_GCC_URLIFIER_H
22#define GCC_GCC_URLIFIER_H
23
25#include "label-text.h"
26
27extern std::unique_ptr<urlifier> make_gcc_urlifier (unsigned int lang_mask);
28extern char *make_doc_url (const char *doc_url_suffix);
29
30/* RAII class to temporarily override global_dc's urlifier
31 with another one (possibly nullptr). */
32
34{
35public:
36 auto_override_urlifier (urlifier *new_urlifier);
38
39protected:
41};
42
43/* Subclass of urlifier that attempts to add URLs to quoted strings
44 containing names of attributes. */
45
47{
48public:
50 attribute_urlifier (const char *target_docs_name);
51
52 char *
53 get_url_for_quoted_text (const char *p, size_t sz) const final override;
54
55 label_text
56 get_url_suffix_for_quoted_text (const char *p, size_t sz) const;
57
58 /* We use ATTRIBUTE_UNUSED as this helper is called only from ASSERTs. */
59 label_text
60 get_url_suffix_for_quoted_text (const char *p) const ATTRIBUTE_UNUSED;
61
62private:
63 const char *m_target_docs_name;
64};
65
66/* RAII class: during the lifetime of instances, global_dc will attempt
67 to auto-generate documentation links for any attributes mentioned in
68 quotes in diagnostics . */
69
82
83#endif /* GCC_GCC_URLIFIER_H */
Definition gcc-urlifier.h:47
const char * m_target_docs_name
Definition gcc-urlifier.h:63
char * get_url_for_quoted_text(const char *p, size_t sz) const final override
Definition gcc-attribute-urlifier.cc:120
attribute_urlifier()
Definition gcc-attribute-urlifier.cc:39
label_text get_url_suffix_for_quoted_text(const char *p, size_t sz) const
Definition gcc-attribute-urlifier.cc:130
Definition gcc-urlifier.h:34
auto_override_urlifier(urlifier *new_urlifier)
Definition gcc-urlifier.cc:223
urlifier *const m_old_urlifier
Definition gcc-urlifier.h:40
~auto_override_urlifier()
Definition gcc-urlifier.cc:229
Definition gcc-urlifier.h:71
auto_urlify_attributes()
Definition gcc-urlifier.h:73
auto_override_urlifier m_override
Definition gcc-urlifier.h:80
attribute_urlifier m_urlifier
Definition gcc-urlifier.h:79
Definition pretty-print-urlifier.h:27
std::unique_ptr< urlifier > make_gcc_urlifier(unsigned int lang_mask)
Definition gcc-urlifier.cc:216
char * make_doc_url(const char *doc_url_suffix)
Definition gcc-urlifier.cc:34