r197409 - Make Sema::BuildCXXNestedNameSpecifier correctly clear the previous

Kaelyn Takata rikka at google.com
Mon Dec 16 11:34:12 PST 2013


Bill,

I'm fairly certain this is a candidate for the 3.4 release branch as it is
a 2-line/1-statement fix for the crasher reported in PR18213.

Cheers,
Kaelyn


On Mon, Dec 16, 2013 at 11:19 AM, Kaelyn Uhrain <rikka at google.com> wrote:

> Author: rikka
> Date: Mon Dec 16 13:19:18 2013
> New Revision: 197409
>
> URL: http://llvm.org/viewvc/llvm-project?rev=197409&view=rev
> Log:
> 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/trunk/lib/Sema/SemaCXXScopeSpec.cpp
>     cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp?rev=197409&r1=197408&r2=197409&view=diff
>
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaCXXScopeSpec.cpp Mon Dec 16 13:19:18 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/trunk/test/SemaCXX/typo-correction-pt2.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp?rev=197409&r1=197408&r2=197409&view=diff
>
> ==============================================================================
> --- cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp (original)
> +++ cfe/trunk/test/SemaCXX/typo-correction-pt2.cpp Mon Dec 16 13:19:18 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}}
> +}
>
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20131216/c77fc199/attachment.html>


More information about the cfe-commits mailing list