Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue in typo handling which could lead clang to hang
Summary: We need to detect when certain TypoExprs are not being transformed due to invalid trees, otherwise we risk endlessly trying to fix it. Reviewers: rsmith Subscribers: cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D84067
- Loading branch information
1 parent
21ef01b
commit dde98c8
Showing
4 changed files
with
73 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// RUN: %clang_cc1 -fsyntax-only -verify %s | ||
|
||
// From `test/Sema/typo-correction.c` but for C++ since the behavior varies | ||
// between the two languages. | ||
struct rdar38642201 { | ||
int fieldName; | ||
}; | ||
|
||
void rdar38642201_callee(int x, int y); | ||
void rdar38642201_caller() { | ||
struct rdar38642201 structVar; | ||
rdar38642201_callee( | ||
structVar1.fieldName1.member1, //expected-error{{use of undeclared identifier 'structVar1'}} | ||
structVar2.fieldName2.member2); //expected-error{{use of undeclared identifier 'structVar2'}} | ||
} | ||
|
||
// Similar reproducer. | ||
class A { | ||
public: | ||
int minut() const = delete; | ||
int hour() const = delete; | ||
|
||
int longit() const; //expected-note{{'longit' declared here}} | ||
int latit() const; | ||
}; | ||
|
||
class B { | ||
public: | ||
A depar() const { return A(); } | ||
}; | ||
|
||
int Foo(const B &b) { | ||
return b.deparT().hours() * 60 + //expected-error{{no member named 'deparT' in 'B'}} | ||
b.deparT().minutes(); //expected-error{{no member named 'deparT' in 'B'}} | ||
} | ||
|
||
int Bar(const B &b) { | ||
return b.depar().longitude() + //expected-error{{no member named 'longitude' in 'A'; did you mean 'longit'?}} | ||
b.depar().latitude(); //expected-error{{no member named 'latitude' in 'A'}} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters