kadircet added inline comments.

================
Comment at: lib/Sema/SemaCodeComplete.cpp:5136
+  auto AddDefaultCtorInit = [&](const char *TypedName,
+                                const char *TypeName,
+                                const NamedDecl* ND) {
----------------
ilya-biryukov wrote:
> kadircet wrote:
> > 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`.
> `char*` and `StringRef` have equivalent lifetime properties, so the set of 
> cases you need to do extra copies is equivalent. Am I missing something?
> But yeah, since AddChunk methods accept a `char*`,  `StringRef` is not 
> suitable because it's not guaranteed to be null-terminated. LG
Yes, but I store those strings inside allocator and pass pointers of those 
stored ones. If I were to defer the allocation, I would need to keep copies of 
the strings myself until I call allocate on them.


================
Comment at: test/CodeCompletion/ctor-initializer.cpp:69
 struct Base2 {
-  Base2(int);
+  Base2(int, float x = 3);
 };
----------------
ilya-biryukov wrote:
> Why do we want to change this test?
This was for something else I've been testing, nvm.

The change below is however, to get rid of the compile error.


Repository:
  rC Clang

https://reviews.llvm.org/D53654



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to