[PATCH] D53654: [clang] Improve ctor initializer completions.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 30 08:07:17 PDT 2018


kadircet added inline comments.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:821
+
+DeclContext::lookup_result getConstructorResults(ASTContext &Context,
+                                                 const CXXRecordDecl *Record,
----------------
ilya-biryukov wrote:
> There's a function that does the same thing and also does some extra lifting to make sure implicit members are properly generated -  `Sema::LookupConstructors`. Maybe use it instead?
As talked offline we don't want this behavior.


================
Comment at: lib/Sema/SemaCodeComplete.cpp:831
+  // template args and one parameter with type's name.
+  /*
+  if (Ctors.begin() == Ctors.end()) {
----------------
ilya-biryukov wrote:
> Remove this code instead of commenting it out?
Ah, sorry for the mess :(


================
Comment at: lib/Sema/SemaCodeComplete.cpp:5136
+  auto AddDefaultCtorInit = [&](const char *TypedName,
+                                const char *TypeName,
+                                const NamedDecl* ND) {
----------------
ilya-biryukov wrote:
> Maybe use StringRef?
Don't think this looks any better, since we need to use `.data()` at chunk additions than.

Even if we try to push allocations all the way down until we add those chunks, we still get bad looking code since types are returned as `std::string` and we need to make a copy in the stack to be able to pass it as `StringRef`.


Repository:
  rC Clang

https://reviews.llvm.org/D53654





More information about the cfe-commits mailing list