llvm-project/clang/lib
James Y Knight b92d290e48 [opaque pointer types] Fix the CallInfo passed to EmitCall in some
edge cases.

Currently, EmitCall emits a call instruction with a function type
derived from the pointee-type of the callee. This *should* be the same
as the type created from the CallInfo parameter, but in some cases an
incorrect CallInfo was being passed.

All of these fixes were discovered by the addition of the assert in
EmitCall which verifies that the passed-in CallInfo matches the
Callee's function type.

As far as I know, these issues caused no bugs at the moment, as the
correct types were ultimately being emitted. But, some would become
problematic when pointee types are removed.

List of fixes:

* arrangeCXXConstructorCall was passing an incorrect value for the
  number of Required args, when calling an inheriting constructor
  where the inherited constructor is variadic. (The inheriting
  constructor doesn't actually get passed any of the user's args, but
  the code was calculating it as if it did).

* arrangeFreeFunctionLikeCall was not including the count of the
  pass_object_size arguments in the count of required args.

* OpenCL uses other address spaces for the "this" pointer. However,
  commonEmitCXXMemberOrOperatorCall was not annotating the address
  space on the "this" argument of the call.

* Destructor calls were being created with EmitCXXMemberOrOperatorCall
  instead of EmitCXXDestructorCall in a few places. This was a problem
  because the calling convention sometimes has destructors returning
  "this" rather than void, and the latter function knows about that,
  and sets up the types properly (through calling
  arrangeCXXStructorDeclaration), while the former does not.

* generateObjCGetterBody: the 'objc_getProperty' function returns type
  'id', but was being called as if it returned the particular
  property's type. (That is of course the *dynamic* return type, and
  there's a downcast immediately after.)

* OpenMP user-defined reduction functions (#pragma omp declare
  reduction) can be called with a subclass of the declared type. In
  such case, the call was being setup as if the function had been
  actually declared to take the subtype, rather than the base type.

Differential Revision: https://reviews.llvm.org/D57664

llvm-svn: 353181
2019-02-05 16:05:50 +00:00
..
ARCMigrate [AST] Update the comments of the various Expr::Ignore* + Related cleanups 2019-02-03 19:50:56 +00:00
AST [AST] Update the comments of the various Expr::Ignore* + Related cleanups 2019-02-03 19:50:56 +00:00
ASTMatchers Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Analysis [AST] Update the comments of the various Expr::Ignore* + Related cleanups 2019-02-03 19:50:56 +00:00
Basic [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive. 2019-02-01 20:25:04 +00:00
CodeGen [opaque pointer types] Fix the CallInfo passed to EmitCall in some 2019-02-05 16:05:50 +00:00
CrossTU Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Driver [NewPM] Add support for new-PM plugins to clang 2019-02-02 23:19:32 +00:00
Edit Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Format [clang-format] Fix breaking of qualified operator 2019-02-04 09:56:16 +00:00
Frontend [clang] Add getCommentHandler to PreambleCallbacks 2019-02-04 09:42:33 +00:00
FrontendTool [analyzer][NFC] Supply CheckerRegistry with AnalyzerOptions 2019-01-26 15:59:21 +00:00
Headers [CUDA] add support for the new kernel launch API in CUDA-9.2+. 2019-01-31 21:34:03 +00:00
Index Rename getTypeQualifiers to getMethodQualifiers. 2019-01-28 11:37:49 +00:00
Lex [CUDA][HIP] Do not diagnose use of _Float16 2019-01-29 13:20:23 +00:00
Parse [X86] Change MS inline asm clobber list filter to check for 'fpsr' instead of 'fpsw' after D57641. 2019-02-05 06:13:14 +00:00
Rewrite Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Sema [opaque pointer types] Fix the CallInfo passed to EmitCall in some 2019-02-05 16:05:50 +00:00
Serialization [OpenMP 5.0] Parsing/sema support for "omp declare mapper" directive. 2019-02-01 20:25:04 +00:00
StaticAnalyzer [analyzer][UninitializedObjectChecker] New flag to ignore guarded uninitialized fields 2019-02-02 14:50:04 +00:00
Tooling [AST] Update the comments of the various Expr::Ignore* + Related cleanups 2019-02-03 19:50:56 +00:00
CMakeLists.txt