r227278 - Use the real CXXScopeSpec when setting the correction SourceRange.

Hans Wennborg hans at chromium.org
Tue Jan 27 17:10:12 PST 2015


On Tue, Jan 27, 2015 at 4:50 PM, Kaelyn Takata <rikka at google.com> wrote:
> This is a trivial enough fix it should probably be merged into the release
> branch to avoid spurious bug reports. ;)

Merged in r227280.

Thanks,
Hans

> On Tue, Jan 27, 2015 at 4:46 PM, Kaelyn Takata <rikka at google.com> wrote:
>>
>> Author: rikka
>> Date: Tue Jan 27 18:46:09 2015
>> New Revision: 227278
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=227278&view=rev
>> Log:
>> Use the real CXXScopeSpec when setting the correction SourceRange.
>>
>> Otherwise, in the most important case and the only case where SS and
>> TempSS are different (which is when the CXXScopeSpec should be dropped,
>> and TempSS is NULL) the wrong SourceRange will be used in the fixit for
>> the typo correction. Fixes the remaining issue in PR20626.
>>
>> Modified:
>>     cfe/trunk/lib/Sema/SemaLookup.cpp
>>     cfe/trunk/test/FixIt/typo-location-bugs.cpp
>>
>> Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=227278&r1=227277&r2=227278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
>> +++ cfe/trunk/lib/Sema/SemaLookup.cpp Tue Jan 27 18:46:09 2015
>> @@ -3587,7 +3587,7 @@ retry_lookup:
>>          QualifiedResults.push_back(Candidate);
>>        break;
>>      }
>> -    Candidate.setCorrectionRange(TempSS, Result.getLookupNameInfo());
>> +    Candidate.setCorrectionRange(SS.get(), Result.getLookupNameInfo());
>>      return true;
>>    }
>>    return false;
>>
>> Modified: cfe/trunk/test/FixIt/typo-location-bugs.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/FixIt/typo-location-bugs.cpp?rev=227278&r1=227277&r2=227278&view=diff
>>
>> ==============================================================================
>> --- cfe/trunk/test/FixIt/typo-location-bugs.cpp (original)
>> +++ cfe/trunk/test/FixIt/typo-location-bugs.cpp Tue Jan 27 18:46:09 2015
>> @@ -34,3 +34,16 @@ void test(B b) {
>>    b.f(1);  // expected-error{{too many arguments to function call,
>> expected 0, have 1; did you mean 'A::f'?}}
>>  }
>>  }
>> +
>> +namespace PR20626 {
>> +class A {
>> +public:
>> +  void Foo(){};  // expected-note{{'Foo' declared here}}
>> +};
>> +class B {};
>> +class C : public A, public B {
>> +  void Run() {
>> +    B::Foo();  // expected-error{{no member named 'Foo' in 'PR20626::B';
>> did you mean simply 'Foo'?}}
>> +  }
>> +};
>> +}
>>
>>
>> _______________________________________________
>> cfe-commits mailing list
>> cfe-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
>
>



More information about the cfe-commits mailing list