[clang] c5cf4f7 - [clang][doc] Don't escape _ in .rst files. (#65277)

via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 5 08:54:50 PDT 2023


Author: Mark de Wever
Date: 2023-09-05T17:54:46+02:00
New Revision: c5cf4f7e4f76abbee0cceaacb708d56b0dcb750d

URL: https://github.com/llvm/llvm-project/commit/c5cf4f7e4f76abbee0cceaacb708d56b0dcb750d
DIFF: https://github.com/llvm/llvm-project/commit/c5cf4f7e4f76abbee0cceaacb708d56b0dcb750d.diff

LOG: [clang][doc] Don't escape _ in .rst files. (#65277)

The current generated ClangCommandLineReference.rst unconditionally
escapes underscores. This leads odd output on the website
https://clang.llvm.org/docs/ClangCommandLineReference.html

For example

   -fchar8\_t, -fno-char8\_t

Whether an underscore should be escaped depends on the state. Currently
the escape routine doesn't keep track of the state and currently
underscores are not used in places where they need to be escaped.
Therefore remove the underscore from the list of escaped characters.

Added: 
    

Modified: 
    clang/utils/TableGen/ClangOptionDocEmitter.cpp

Removed: 
    


################################################################################
diff  --git a/clang/utils/TableGen/ClangOptionDocEmitter.cpp b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
index 242f0324c81aa6b..a4095950ca975f9 100644
--- a/clang/utils/TableGen/ClangOptionDocEmitter.cpp
+++ b/clang/utils/TableGen/ClangOptionDocEmitter.cpp
@@ -194,7 +194,7 @@ unsigned getNumArgsForKind(Record *OptionKind, const Record *Option) {
 std::string escapeRST(StringRef Str) {
   std::string Out;
   for (auto K : Str) {
-    if (StringRef("`*|_[]\\").count(K))
+    if (StringRef("`*|[]\\").count(K))
       Out.push_back('\\');
     Out.push_back(K);
   }


        


More information about the cfe-commits mailing list