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

Paul Robinson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 10:05:55 PDT 2018


probinson added a comment.

A bunch of style comments.  Maybe try clang-format-diff.



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


================
Comment at: lib/Sema/SemaDeclCXX.cpp:15549
+  R.setAddUsingDirectives();
+  LookupName(R,getCurScope());
+
----------------
Space after the comma.


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


================
Comment at: lib/Sema/SemaDeclCXX.cpp:15566
+    // Check if the declaration was introduced by a 'using-directive'.
+    if (auto *UDir = dyn_cast<UsingDirectiveDecl>(D))
+      if (UDir->getNominatedNamespace() == Target) {
----------------
else if


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


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


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


================
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));
----------------
Can this be a range-based for loop?


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


================
Comment at: lib/Sema/SemaLookup.cpp:1236
             UDirs.done();
+            AddUsingDirectives(R,UDirs);
 
----------------
Space after the comma.


================
Comment at: lib/Sema/SemaLookup.cpp:1277
     UDirs.done();
+    AddUsingDirectives(R,UDirs);
   }
----------------
Space after the comma.


https://reviews.llvm.org/D46190





More information about the cfe-commits mailing list