[PATCH] D25796: [CUDA] Create __host__ and device variants of standard allocator declarations.

Justin Lebar via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 21 09:30:36 PDT 2016


jlebar added inline comments.


================
Comment at: lib/Sema/SemaExprCXX.cpp:2596
 
-  QualType FnType = Context.getFunctionType(Return, Params, EPI);
-  FunctionDecl *Alloc =
-    FunctionDecl::Create(Context, GlobalCtx, SourceLocation(),
-                         SourceLocation(), Name,
-                         FnType, /*TInfo=*/nullptr, SC_None, false, true);
-  Alloc->setImplicit();
+  auto CreateAllocationFunctionDecl = [&]() {
+    QualType FnType = Context.getFunctionType(Return, Params, EPI);
----------------
Nit, no need for empty parens.


================
Comment at: lib/Sema/SemaExprCXX.cpp:2622
   Context.getTranslationUnitDecl()->addDecl(Alloc);
   IdResolver.tryAddTopLevelDecl(Alloc, Name);
+
----------------
I kind of feel like it would be easier to add a boolean parameter to CreateAllocationFunctionDecl, then you don't need to repeat these two lines.


https://reviews.llvm.org/D25796





More information about the cfe-commits mailing list