[PATCH] D46190: For a used declaration, mark any associated usings as referenced.

Carlos Alberto Enciso via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 19 04:49:50 PDT 2018


CarlosAlbertoEnciso added inline comments.


================
Comment at: include/clang/Sema/SemaInternal.h:91
   Var->markUsed(SemaRef.Context);
+  SemaRef.MarkUsingReferenced(Var, Loc, /*CXXScopeSpec*=*/nullptr, RefExpr);
 }
----------------
probinson wrote:
> The comments on a nullptr parameter usually use the formal parameter name, not its type.
Replaced the type name with the formal parameter name.


================
Comment at: lib/Sema/SemaDeclCXX.cpp:15554
+
+  for (LookupResult::iterator I = R.begin(), E = R.end(); I != E; ++I) {
+    NamedDecl *D = (*I)->getUnderlyingDecl();
----------------
probinson wrote:
> Could this be a range-based for loop?
Replaced by a range-based for loop.


================
Comment at: lib/Sema/SemaExpr.cpp:14460
   Func->markUsed(Context);
+  MarkUsingReferenced(Func, Loc, /*CXXScopeSpec*=*/nullptr, E);
 }
----------------
probinson wrote:
> Parameter comments usually use the formal parameter name, not its type.
Replaced the type name with the formal parameter name.


================
Comment at: lib/Sema/SemaExpr.cpp:15374
+  SemaRef.MarkAnyDeclReferenced(Loc, D, MightBeOdrUse,
+                                /*CXXScopeSpec*=*/nullptr, E);
 
----------------
probinson wrote:
> Parameter comments usually use the formal parameter name, not its type.
Replaced the type name with the formal parameter name.


================
Comment at: lib/Sema/SemaExpr.cpp:15396
+    SemaRef.MarkAnyDeclReferenced(Loc, DM, MightBeOdrUse,
+                                  /*CXXScopeSpec*=*/nullptr, E);
 }
----------------
probinson wrote:
> Parameter comments usually use the formal parameter name, not its type.
Replaced the type name with the formal parameter name.


================
Comment at: lib/Sema/SemaLookup.cpp:98
 
+    using UDirs = llvm::SmallPtrSet<UsingDirectiveDecl*, 8>;
+    UDirs usings;
----------------
As `UDirs` is used to reference an instance of `UnqualUsingDirectiveSet`, I have changed `UDirs` to `UsingDirs`.


================
Comment at: lib/Sema/SemaLookup.cpp:196
+    void addUsingDirective(LookupResult &R) {
+      for (auto I = usings.begin(), E = usings.end(); I != E; ++I)
+        R.addDecl((*I));
----------------
probinson wrote:
> Can this be a range-based for loop?
Replaced with a range-based for loop.


================
Comment at: lib/Sema/SemaLookup.cpp:1064
+static void
+AddUsingDirectives(LookupResult &R,UnqualUsingDirectiveSet &UDirs) {
+  if (R.isAddUsingDirectives())
----------------
probinson wrote:
> Space after the comma.
> `UDirs` has a different meaning elsewhere in this file, maybe `UsingDirs` instead?
Preserved 'UDirs' in this function, but changed the 'UDirs' typedef into 'UsingDirs'.


https://reviews.llvm.org/D46190





More information about the cfe-commits mailing list