r222797 - Ensure that any TypoExprs in the arguments to bultins with custom type
Kaelyn Takata
rikka at google.com
Tue Nov 25 15:04:10 PST 2014
Author: rikka
Date: Tue Nov 25 17:04:09 2014
New Revision: 222797
URL: http://llvm.org/viewvc/llvm-project?rev=222797&view=rev
Log:
Ensure that any TypoExprs in the arguments to bultins with custom type
checking are handled before the custom type checking is performed.
Fixes PR21669.
Modified:
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=222797&r1=222796&r2=222797&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Nov 25 17:04:09 2014
@@ -4752,8 +4752,12 @@ Sema::BuildResolvedCallExpr(Expr *Fn, Na
VK_RValue, RParenLoc);
// Bail out early if calling a builtin with custom typechecking.
- if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID))
- return CheckBuiltinFunctionCall(FDecl, BuiltinID, TheCall);
+ if (BuiltinID && Context.BuiltinInfo.hasCustomTypechecking(BuiltinID)) {
+ ExprResult Res = CorrectDelayedTyposInExpr(TheCall);
+ if (!Res.isUsable() || !isa<CallExpr>(Res.get()))
+ return Res;
+ return CheckBuiltinFunctionCall(FDecl, BuiltinID, cast<CallExpr>(Res.get()));
+ }
retry:
const FunctionType *FuncT;
Modified: cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp?rev=222797&r1=222796&r2=222797&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp (original)
+++ cfe/trunk/test/SemaCXX/typo-correction-delayed.cpp Tue Nov 25 17:04:09 2014
@@ -93,3 +93,12 @@ void f(NestedNode *node) {
NestedNode *next = node->Next(); // expected-error-re {{no member named 'Next' in 'initializerCorrections::NestedNode'{{$}}}}
}
}
+
+namespace PR21669 {
+void f(int *i) {
+ // Check that arguments to a builtin with custom type checking are corrected
+ // properly, since calls to such builtins bypass much of the normal code path
+ // for building and checking the call.
+ __atomic_load(i, i, something_something); // expected-error-re {{use of undeclared identifier 'something_something'{{$}}}}
+}
+}
More information about the cfe-commits
mailing list