diff options
author | Marco Antognini <marco.antognini@arm.com> | 2019-07-09 15:04:23 +0000 |
---|---|---|
committer | Marco Antognini <marco.antognini@arm.com> | 2019-07-09 15:04:23 +0000 |
commit | b00d5f732cd3f6f8bd86d2c5f7ddb2ce5bca8740 (patch) | |
tree | d961eb68d73a0199f8fce88ea57a5848fdbd4287 /clang/lib | |
parent | b1e511bf5a4c702ace445848b30070ac2e021241 (diff) | |
download | bcm5719-llvm-b00d5f732cd3f6f8bd86d2c5f7ddb2ce5bca8740.tar.gz bcm5719-llvm-b00d5f732cd3f6f8bd86d2c5f7ddb2ce5bca8740.zip |
[OpenCL][Sema] Fix builtin rewriting
This patch ensures built-in functions are rewritten using the proper
parent declaration.
Existing tests are modified to run in C++ mode to ensure the
functionality works also with C++ for OpenCL while not increasing the
testing runtime.
llvm-svn: 365499
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Sema/SemaExpr.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp index 668abd2bec2..746d3e7e119 100644 --- a/clang/lib/Sema/SemaExpr.cpp +++ b/clang/lib/Sema/SemaExpr.cpp @@ -5360,7 +5360,7 @@ static bool checkArgsForPlaceholders(Sema &S, MultiExprArg args) { /// FunctionDecl is returned. /// TODO: Handle pointer return types. static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context, - const FunctionDecl *FDecl, + FunctionDecl *FDecl, MultiExprArg ArgExprs) { QualType DeclType = FDecl->getType(); @@ -5408,7 +5408,7 @@ static FunctionDecl *rewriteBuiltinFunctionDecl(Sema *Sema, ASTContext &Context, FunctionProtoType::ExtProtoInfo EPI; QualType OverloadTy = Context.getFunctionType(FT->getReturnType(), OverloadParams, EPI); - DeclContext *Parent = Context.getTranslationUnitDecl(); + DeclContext *Parent = FDecl->getParent(); FunctionDecl *OverloadDecl = FunctionDecl::Create(Context, Parent, FDecl->getLocation(), FDecl->getLocation(), |