krasimir added inline comments.

================
Comment at: clangd/ClangdUnit.cpp:302
                                   unsigned NumResults) override {
-    for (unsigned I = 0; I != NumResults; ++I) {
-      CodeCompletionResult &Result = Results[I];
-      CodeCompletionString *CCS = Result.CreateCodeCompletionString(
+    assert(Items && "We need a non-null items container here");
+    Items->reserve(NumResults);
----------------
Move this assert in the `CompletionItemsCollector` constructor.


================
Comment at: clangd/ClangdUnit.cpp:322
+                            const CodeCompletionString &CCS) const {
+    // The object that we'll return.
+    CompletionItem Item;
----------------
This comment is unnecessary.


================
Comment at: clangd/ClangdUnit.cpp:339
+      }
+      for (unsigned j = 0; j < CCS.getAnnotationCount(); ++j) {
+        Item.documentation += CCS.getAnnotation(j);
----------------
In LLVM, prefer using an explicit variable for the limit of iteration. In this 
case, since you're using `getAnnotationCount` before, you could directly put it 
into a variable above.


https://reviews.llvm.org/D37101



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

Reply via email to