[llvm-branch-commits] [cfe-branch] r197463 - Merging r197409:

Bill Wendling isanbard at gmail.com
Mon Dec 16 20:29:28 PST 2013


Author: void
Date: Mon Dec 16 22:29:27 2013
New Revision: 197463

URL: http://llvm.org/viewvc/llvm-project?rev=197463&view=rev
Log:
Merging r197409:
------------------------------------------------------------------------
r197409 | rikka | 2013-12-16 11:19:18 -0800 (Mon, 16 Dec 2013) | 4 lines

Make Sema::BuildCXXNestedNameSpecifier correctly clear the previous
CXXScopeSpec when necessary while performing typo correction. This fixes
the crash reported in PR18213 (the problem existed since r185487, and
r193020 made it easier to hit).
------------------------------------------------------------------------

Modified:
    cfe/branches/release_34/   (props changed)
    cfe/branches/release_34/lib/Sema/SemaCXXScopeSpec.cpp
    cfe/branches/release_34/test/SemaCXX/typo-correction-pt2.cpp

Propchange: cfe/branches/release_34/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Mon Dec 16 22:29:27 2013
@@ -1,4 +1,4 @@
 /cfe/branches/type-system-rewrite:134693-134817
-/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195495,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196143,196145,196153,196189-196192,196198-196199,196206,196208-196209,196211-196212,196215,196359-196362,196370,196387,196423,196454,196456,196459,196488,196532-196533,196535,196538,196588,196593,196599,196612,196630,196658,196712,196720,196724,196771,196852,196957,196995,197022,197120,197298,197305
+/cfe/trunk:195126,195128,195135-195136,195146,195149,195154,195158,195163,195168,195174,195249,195268,195283,195303,195326,195329,195367,195384,195409,195420,195422,195495,195501,195547,195556,195558,195587,195620,195635,195669,195687,195693,195710,195713,195716,195756,195760,195768,195777,195789,195792,195804,195827,195843-195844,195877,195887-195888,195897,195903,195905-195906,195932,195936-195943,195970,195983,196045,196048,196050,196058,196114-196115,196143,196145,196153,196189-196192,196198-196199,196206,196208-196209,196211-196212,196215,196359-196362,196370,196387,196423,196454,196456,196459,196488,196532-196533,196535,196538,196588,196593,196599,196612,196630,196658,196712,196720,196724,196771,196852,196957,196995,197022,197120,197298,197305,197409
 /cfe/trunk/test:170344
 /cfe/trunk/test/SemaTemplate:126920

Modified: cfe/branches/release_34/lib/Sema/SemaCXXScopeSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/lib/Sema/SemaCXXScopeSpec.cpp?rev=197463&r1=197462&r2=197463&view=diff
==============================================================================
--- cfe/branches/release_34/lib/Sema/SemaCXXScopeSpec.cpp (original)
+++ cfe/branches/release_34/lib/Sema/SemaCXXScopeSpec.cpp Mon Dec 16 22:29:27 2013
@@ -497,6 +497,8 @@ bool Sema::BuildCXXNestedNameSpecifier(S
         bool DroppedSpecifier =
             Corrected.WillReplaceSpecifier() &&
             Name.getAsString() == Corrected.getAsString(getLangOpts());
+        if (DroppedSpecifier)
+          SS.clear();
         diagnoseTypo(Corrected, PDiag(diag::err_no_member_suggest)
                                   << Name << LookupCtx << DroppedSpecifier
                                   << SS.getRange());

Modified: cfe/branches/release_34/test/SemaCXX/typo-correction-pt2.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_34/test/SemaCXX/typo-correction-pt2.cpp?rev=197463&r1=197462&r2=197463&view=diff
==============================================================================
--- cfe/branches/release_34/test/SemaCXX/typo-correction-pt2.cpp (original)
+++ cfe/branches/release_34/test/SemaCXX/typo-correction-pt2.cpp Mon Dec 16 22:29:27 2013
@@ -181,3 +181,21 @@ void test() {
   MessageHeaders::ParseMessageHeaders(5, 4); // expected-error {{no member named 'ParseMessageHeaders' in 'fix_class_name_qualifier::MessageHeaders'; did you mean 'MessageUtils::ParseMessageHeaders'?}}
 }
 }
+
+namespace PR18213 {  // expected-note {{'PR18213' declared here}}
+struct WrapperInfo {
+  int i;
+};
+
+template <typename T> struct Wrappable {
+  static WrapperInfo kWrapperInfo;
+};
+
+// Note the space before "::PR18213" is intended and needed, as it highlights
+// the actual typo, which is the leading "::".
+// TODO: Suggest removing the "::" from "::PR18213" (the right correction)
+// instead of incorrectly suggesting dropping "PR18213::WrapperInfo::".
+template <>
+PR18213::WrapperInfo ::PR18213::Wrappable<int>::kWrapperInfo = { 0 };  // expected-error {{no member named 'PR18213' in 'PR18213::WrapperInfo'; did you mean simply 'PR18213'?}} \
+                                                                       // expected-error {{C++ requires a type specifier for all declarations}}
+}





More information about the llvm-branch-commits mailing list