llvm-project/clang/lib
Yaxun Liu 99a9f75948 Sema: Fix explicit address space cast in C++
Currently clang does not allow implicit cast of a pointer to a pointer type
in different address space but allows C-style cast of a pointer to a pointer
type in different address space. However, there is a bug in Sema causing
incorrect Cast Expr in AST for the latter case, which in turn results in
invalid LLVM IR in codegen.

This is because Sema::IsQualificationConversion returns true for a cast of
pointer to a pointer type in different address space, which in turn allows
a standard conversion and results in a cast expression with no op in AST.

This patch fixes that by let Sema::IsQualificationConversion returns false
for a cast of pointer to a pointer type in different address space, which
in turn disallows standard conversion, implicit cast, and static cast.
Finally it results in an reinterpret cast and correct conversion kind is set.

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

llvm-svn: 337540
2018-07-20 11:32:51 +00:00
..
ARCMigrate Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
AST Change \t to spaces 2018-07-20 08:19:20 +00:00
ASTMatchers [ASTMatchers] Introduce Objective-C matchers `hasReceiver` and `isInstanceMessage` for ObjCMessageExpr 2018-07-16 20:22:12 +00:00
Analysis [CFG] [analyzer] Allow elidable copies to have more than one arguments. 2018-07-17 00:57:57 +00:00
Basic [AArch64] Define TARGET_HEADER_BUILTIN 2018-07-18 06:15:09 +00:00
CodeGen Change \t to spaces 2018-07-20 08:19:20 +00:00
CrossTU [CrossTU] Fix handling of Cross Translation Unit directory path 2017-10-27 12:53:37 +00:00
Driver Change \t to spaces 2018-07-20 08:19:20 +00:00
Edit Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Format [clang-format/ObjC] Put ObjC method arguments into one line when they fit 2018-07-09 07:08:45 +00:00
Frontend Change \t to spaces 2018-07-20 08:19:20 +00:00
FrontendTool Add a new driver mode to dump compiler feature and extension options. 2018-05-31 13:57:09 +00:00
Headers [COFF] Add more missing MSVC ARM64 intrinsics 2018-07-17 22:03:24 +00:00
Index [Index] Set OrigD before D is changed. 2018-07-20 08:08:56 +00:00
Lex Enable C++2a Chrono Literals 2018-07-19 13:36:57 +00:00
Parse [Sema] Add fixit for unused lambda captures 2018-07-16 07:23:47 +00:00
Rewrite Remove \brief commands from doxygen comments. 2018-05-09 01:00:01 +00:00
Sema Sema: Fix explicit address space cast in C++ 2018-07-20 11:32:51 +00:00
Serialization Reapply r336660: [Modules] Autoload subdirectory modulemaps with specific LangOpts 2018-07-18 23:21:19 +00:00
StaticAnalyzer Change \t to spaces 2018-07-20 08:19:20 +00:00
Tooling [Tooling] Make standalone executor support user-provided vfs. 2018-07-12 18:32:11 +00:00
CMakeLists.txt Add Cross Translation Unit support library 2017-09-22 11:11:01 +00:00