[libc-commits] [PATCH] D70197: [libc] Add a TableGen based header generator.

Siva Chandra via Phabricator via libc-commits libc-commits at lists.llvm.org
Fri Nov 22 10:09:25 PST 2019


sivachandra marked an inline comment as done.
sivachandra added inline comments.


================
Comment at: libc/utils/HdrGen/Generator.cpp:61
+    A = A.trim(' ');
+    if (A.startswith(ParamNamePrefix) and A.endswith(ParamNameSuffix)) {
+      A = A.drop_front(ParamNamePrefixSize).drop_back(ParamNameSuffixSize);
----------------
phosek wrote:
> Should this use `&&` rather than `and`?
Ah, sorry!! Effects of context switching between Python and C++.


================
Comment at: libc/utils/HdrGen/Generator.cpp:63
+      A = A.drop_front(ParamNamePrefixSize).drop_back(ParamNameSuffixSize);
+      A = ArgMap[A];
+    }
----------------
phosek wrote:
> `A` doesn't seem to be used anywhere after this line?
`A` is a reference getting changed in place.


================
Comment at: libc/utils/HdrGen/PublicAPICommand.cpp:43
+  llvm::SmallVector<llvm::StringRef, 10> Lines;
+  llvm::SplitString(Text, Lines, "\n\r");
+  size_t shortest_indent = 1024;
----------------
abrachet wrote:
> is '\r' a Windows thing? Is this necessary?
Yes. But I did not test this on Windows so removed it now.


================
Comment at: libc/utils/HdrGen/PublicAPICommand.cpp:265
+  if (Args.size() != 0) {
+    Reporter.printFatalError("public_api command does not take any arguments.");
+  }
----------------
abrachet wrote:
> Will `llvm::SourceMgr::printMessage` print a newline? Some `llvm::PrintFatalError` calls have a newline at the end, would be good to have consistency, even if this isn't a user facing tool.
This is just forwarded to `SourceMgr`'s `PrintMessage`. `SourceMgr` does its own pretty formatting so I think we should leave it as is.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70197/new/

https://reviews.llvm.org/D70197





More information about the libc-commits mailing list