Skip to content

Commit

Permalink
Add a mode to clang-tblgen to generate reference documentation for wa…
Browse files Browse the repository at this point in the history
…rning and

remark flags. For now I'm checking in a copy of the built documentation, but we
can replace this with a placeholder (as we do for the attributes reference
documentation) once we enable building this server-side.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@281192 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
zygoloid committed Sep 12, 2016
1 parent c5d3857 commit 89f2f0d
Show file tree
Hide file tree
Showing 10 changed files with 11,061 additions and 4 deletions.
10,538 changes: 10,538 additions & 0 deletions docs/DiagnosticsReference.rst

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions docs/UsersManual.rst
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Options to Control Error and Warning Messages
.. option:: -Wfoo

Enable warning "foo".
See the :doc:`diagnostics reference <DiagnosticsReference>` for a complete
list of the warning flags that can be specified in this way.

.. option:: -Wno-foo

Expand Down
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ Using Clang as a Compiler
UsersManual
LanguageExtensions
AttributeReference
DiagnosticsReference
CrossCompilation
ThreadSafetyAnalysis
AddressSanitizer
Expand Down
3 changes: 3 additions & 0 deletions include/clang/Basic/Diagnostic.td
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,13 @@ class DiagGroup<string Name, list<DiagGroup> subgroups = []> {
string GroupName = Name;
list<DiagGroup> SubGroups = subgroups;
string CategoryName = "";
code Documentation = [{}];
}
class InGroup<DiagGroup G> { DiagGroup Group = G; }
//class IsGroup<string Name> { DiagGroup Group = DiagGroup<Name>; }

// This defines documentation for diagnostic groups.
include "DiagnosticDocs.td"

// This defines all of the named diagnostic categories.
include "DiagnosticCategories.td"
Expand Down
82 changes: 82 additions & 0 deletions include/clang/Basic/DiagnosticDocs.td
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
//==--- DiagnosticDocs.td - Diagnostic documentation ---------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===---------------------------------------------------------------------===//

def GlobalDocumentation {
code Intro =[{..
-------------------------------------------------------------------
NOTE: This file is automatically generated by running clang-tblgen
-gen-diag-docs. Do not edit this file by hand!!
-------------------------------------------------------------------

.. Add custom CSS to output. FIXME: This should be put into <head> rather
than the start of <body>.
.. raw:: html

<style>
table.docutils {
width: 1px;
}
table.docutils td {
border: none;
padding: 0;
vertical-align: middle;
white-space: nowrap;
width: 1px;
}
table.docutils tr + tr {
border-top: 0.2em solid #aaa;
}
.error {
font-family: monospace;
font-weight: bold;
color: #c70;
}
.warning {
font-family: monospace;
font-weight: bold;
color: #c70;
}
.remark {
font-family: monospace;
font-weight: bold;
color: #00c;
}
.diagtext {
font-family: monospace;
font-weight: bold;
}
</style>

.. FIXME: Format this as .diagtext. rST appears to not support this. :(
.. |nbsp| unicode:: 0xA0
:trim:

.. Roles generated by clang-tblgen.
.. role:: error
.. role:: warning
.. role:: remark
.. role:: diagtext
.. role:: placeholder(emphasis)

=========================
Diagnostic flags in Clang
=========================
.. contents::
:local:

Introduction
============

This page lists the diagnostic flags currently supported by Clang.

Diagnostic flags
================
}];
}

2 changes: 1 addition & 1 deletion include/clang/Basic/DiagnosticParseKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,7 @@ def err_synthesized_property_name : Error<
"expected a property name in @synthesize">;
def warn_semicolon_before_method_body : Warning<
"semicolon before method body is ignored">,
InGroup<DiagGroup<"semicolon-before-method-body">>, DefaultIgnore;
InGroup<SemiBeforeMethodBody>, DefaultIgnore;
def note_extra_comma_message_arg : Note<
"comma separating Objective-C messaging arguments">;

Expand Down
4 changes: 2 additions & 2 deletions include/clang/Basic/DiagnosticSemaKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -5464,7 +5464,7 @@ def err_typecheck_invalid_lvalue_addrof : Error<
"cannot take the address of an rvalue of type %0">;
def ext_typecheck_addrof_temporary : ExtWarn<
"taking the address of a temporary object of type %0">,
InGroup<DiagGroup<"address-of-temporary">>, DefaultError;
InGroup<AddressOfTemporary>, DefaultError;
def err_typecheck_addrof_temporary : Error<
"taking the address of a temporary object of type %0">;
def err_typecheck_addrof_dtor : Error<
Expand Down Expand Up @@ -6821,7 +6821,7 @@ def warn_side_effects_typeid : Warning<
"operand to 'typeid'">, InGroup<PotentiallyEvaluatedExpression>;
def warn_unused_result : Warning<
"ignoring return value of function declared with %0 attribute">,
InGroup<DiagGroup<"unused-result">>;
InGroup<UnusedResult>;
def warn_unused_volatile : Warning<
"expression result unused; assign into a variable to force a volatile load">,
InGroup<DiagGroup<"unused-volatile-lvalue">>;
Expand Down
Loading

0 comments on commit 89f2f0d

Please sign in to comment.