File tree Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Expand file tree Collapse file tree 3 files changed +32
-3
lines changed Original file line number Diff line number Diff line change @@ -800,6 +800,8 @@ Bug Fixes in This Version
800800 declaration statements. Clang now emits a warning for these patterns. (#GH141659)
801801- Fixed false positives for redeclaration errors of using enum in
802802 nested scopes. (#GH147495)
803+ - Fixed a failed assertion with an operator call expression which comes from a
804+ macro expansion when performing analysis for nullability attributes. (#GH138371)
803805
804806Bug Fixes to Compiler Builtins
805807^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change @@ -14034,9 +14034,14 @@ TreeTransform<Derived>::TransformCXXOperatorCallExpr(CXXOperatorCallExpr *E) {
1403414034 if (Object.isInvalid())
1403514035 return ExprError();
1403614036
14037- // FIXME: Poor location information
14038- SourceLocation FakeLParenLoc = SemaRef.getLocForEndOfToken(
14039- static_cast<Expr *>(Object.get())->getEndLoc());
14037+ // FIXME: Poor location information. Also, if the location for the end of
14038+ // the token is within a macro expansion, getLocForEndOfToken() will return
14039+ // an invalid source location. If that happens and we have an otherwise
14040+ // valid end location, use the valid one instead of the invalid one.
14041+ SourceLocation EndLoc = static_cast<Expr *>(Object.get())->getEndLoc();
14042+ SourceLocation FakeLParenLoc = SemaRef.getLocForEndOfToken(EndLoc);
14043+ if (FakeLParenLoc.isInvalid() && EndLoc.isValid())
14044+ FakeLParenLoc = EndLoc;
1404014045
1404114046 // Transform the call arguments.
1404214047 SmallVector<Expr*, 8> Args;
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 -fsyntax-only -verify %s
2+ // expected-no-diagnostics
3+
4+ // This would previously trigger a failed assertion when instantiating the
5+ // template which uses an overloaded call operator because the end location
6+ // for the expression came from a macro expansion.
7+
8+ #define ASSIGN_OR_RETURN (...) (__VA_ARGS__)
9+
10+ struct Loc {
11+ int operator ()(const char * _Nonnull f = __builtin_FILE()) const ;
12+ };
13+
14+ template <typename Ty>
15+ void f () {
16+ ASSIGN_OR_RETURN (Loc ()());
17+ }
18+
19+ void test () {
20+ f<int >();
21+ }
22+
You can’t perform that action at this time.
0 commit comments