[PATCH] Allow lookup into dependent bases in static methods under -fms-compatibility

Richard Smith richard at metafoo.co.uk
Tue Jun 10 16:38:24 PDT 2014


Looks fine with some minor tweaks.

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:3661
@@ -3660,1 +3660,3 @@
 def err_undeclared_var_use : Error<"use of undeclared identifier %0">;
+def warn_undeclared_unqual_id_with_dependent_base : ExtWarn<
+  "use of undeclared identifier %0; "
----------------
Should be `ext_...`

================
Comment at: include/clang/Basic/DiagnosticSemaKinds.td:3665
@@ -3661,1 +3664,3 @@
+  InGroup<Microsoft>;
 def warn_found_via_dependent_bases_lookup : ExtWarn<"use of identifier %0 "
+  "found via unqualified lookup into dependent bases of class templates is a "
----------------
Hmm, this one too =)

================
Comment at: lib/Sema/SemaExpr.cpp:1952
@@ +1951,3 @@
+  // Diagnose this as unqualified lookup into a dependent base class.  If this
+  // is an instance method, we suggest inserting this-> as a fixit.
+  SourceLocation Loc = NameInfo.getLoc();
----------------
This comment is out of date.

================
Comment at: lib/Sema/SemaExpr.cpp:1954
@@ +1953,3 @@
+  SourceLocation Loc = NameInfo.getLoc();
+  unsigned DI = diag::warn_undeclared_unqual_id_with_dependent_base;
+  DiagnosticBuilder DB = S.Diag(Loc, DI) << NameInfo.getName() << RD;
----------------
Maybe fold this into the `S.Diag` call below?

================
Comment at: lib/Sema/SemaExpr.cpp:1960-1961
@@ +1959,4 @@
+
+    // Since the 'this' expression is synthesized, we don't need to
+    // perform the double-lookup check.
+    NamedDecl *FirstQualifierInScope = nullptr;
----------------
I don't think this comment makes much sense in its new context; maybe just remove it?

http://reviews.llvm.org/D4079






More information about the cfe-commits mailing list