[libc-commits] [PATCH] D79192: [libc] Add integration tests.

Paula Toth via Phabricator via libc-commits libc-commits at lists.llvm.org
Thu May 7 20:04:46 PDT 2020


PaulkaToast added inline comments.


================
Comment at: libc/utils/HdrGen/PrototypeTestGen/PrototypeTestGen.cpp:45-48
+    // _Noreturn is an indication for the compiler that a function
+    // doesn't return, and isn't a type understood by c++ templates.
+    if (returnType.contains("_Noreturn"))
+      returnType = "void";
----------------
abrachet wrote:
> `_Noreturn` isn't a C++ keyword, otherwise the type system shouldn't care about attributes no matter where they show up. I think instead of removing these manually we should just include `__llvm-libc-common.h` which will define this as `[[noreturn]]` we might in the future use other macros in type names. 
We are already expanding this 
```
projects/libc/lib/public_integration_test.cpp:23:42: error: expected variable name or 'this' in lambda capture list
  static_assert(__llvm_libc::cpp::IsSame<_Noreturn void(void), decltype(abort)>::Value, "abort prototype in TableGen does not match public header");
                                         ^
projects/libc/include/__llvm-libc-common.h:21:20: note: expanded from macro '_Noreturn'
#define _Noreturn [[noreturn]]
```

It seems square bracket `[[attributes]]` cannot be used on plain types/templates/outside definitions, the compiler thinks we are trying to define a lambda function. 
https://godbolt.org/z/bMFzfy

Trying to use `[[attributes]]` in a `using` statement results in a similar error.



================
Comment at: libc/utils/HdrGen/PublicAPICommand.cpp:280-282
+std::unique_ptr<APIReader> makeAPIReader(llvm::RecordKeeper &Records) {
+  return std::make_unique<APIGenerator>(Records);
+}
----------------
abrachet wrote:
> Is this simpler than just using `std::make_unique<APIGenerator>(Records);` wherever it would be used?
I didn't want to take the whole class and expose it, just the parts I needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D79192





More information about the libc-commits mailing list