summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorYonghong Song <yhs@fb.com>2019-09-22 17:33:48 +0000
committerYonghong Song <yhs@fb.com>2019-09-22 17:33:48 +0000
commit91d5c2a035585ebfb1215237115ab439836fe54c (patch)
treeba8804b9e2b7dc24c5786b6595158348765a9817 /clang/lib/Sema/SemaChecking.cpp
parentf7d5f90c333610b3b292738110685a47971c0c29 (diff)
downloadbcm5719-llvm-91d5c2a035585ebfb1215237115ab439836fe54c.tar.gz
bcm5719-llvm-91d5c2a035585ebfb1215237115ab439836fe54c.zip
[CLANG][BPF] permit any argument type for __builtin_preserve_access_index()
Commit c15aa241f821 ("[CLANG][BPF] change __builtin_preserve_access_index() signature") changed the builtin function signature to PointerT __builtin_preserve_access_index(PointerT ptr) with a pointer type as the argument/return type, where argument and return types must be the same. There is really no reason for this constraint. The builtin just presented a code region so that IR builtins __builtin_{array, struct, union}_preserve_access_index can be applied. This patch removed the pointer type restriction to permit any argument type as long as it is permitted by the compiler. Differential Revision: https://reviews.llvm.org/D67883 llvm-svn: 372516
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index fb66bc7db34..ddf58aba1eb 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -191,22 +191,12 @@ static bool SemaBuiltinAddressof(Sema &S, CallExpr *TheCall) {
return false;
}
-/// Check the number of arguments and arg type, and set the result type to
+/// Check the number of arguments and set the result type to
/// the argument type.
static bool SemaBuiltinPreserveAI(Sema &S, CallExpr *TheCall) {
if (checkArgCount(S, TheCall, 1))
return true;
- // The argument type must be a pointer
- ExprResult Arg = TheCall->getArg(0);
- QualType Ty = Arg.get()->getType();
- if (!Ty->isPointerType()) {
- S.Diag(Arg.get()->getBeginLoc(),
- diag::err_builtin_preserve_access_index_invalid_arg)
- << Ty << Arg.get()->getSourceRange();
- return true;
- }
-
TheCall->setType(TheCall->getArg(0)->getType());
return false;
}
OpenPOWER on IntegriCloud