Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
------------------------------------------------------------------------ r345497 | asavonic | 2018-10-29 04:14:01 -0700 (Mon, 29 Oct 2018) | 29 lines [OpenCL] Fix serialization of OpenCLExtensionDecls Summary: I recently discovered that adding the following code into `opencl-c.h` causes failure of `test/Headers/opencl-c-header.cl`: ``` #pragma OPENCL EXTENSION cl_my_ext : begin void cl_my_ext_foobarbaz(); #pragma OPENCL EXTENSIOn cl_my_ext : end ``` Clang crashes at the assertion is `ASTReader::getGlobalSubmoduleID()`: ``` assert(I != M.SubmoduleRemap.end() && "Invalid index into submodule index remap"); ``` The root cause of the problem that to deserialize `OPENCL_EXTENSION_DECLS` section `ASTReader` needs to deserialize a Decl contained in it. In turn, deserializing a Decl requires information about whether this declaration is part of a (sub)module, but this information is not read yet because it is located further in a module file. Reviewers: Anastasia, yaxunl, JDevlieghere Reviewed By: Anastasia Subscribers: sidorovd, cfe-commits, asavonic Differential Revision: https://reviews.llvm.org/D53200 ------------------------------------------------------------------------ llvm-svn: 347834
- Loading branch information
Showing
3 changed files
with
55 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#ifndef INCLUDED | ||
#define INCLUDED | ||
|
||
#pragma OPENCL EXTENSION all : begin | ||
#pragma OPENCL EXTENSION all : end | ||
|
||
#pragma OPENCL EXTENSION my_ext : begin | ||
|
||
struct A { | ||
int a; | ||
}; | ||
|
||
typedef struct A TypedefOfA; | ||
typedef const __private TypedefOfA* PointerOfA; | ||
|
||
void f(void); | ||
|
||
__attribute__((overloadable)) void g(long x); | ||
|
||
#pragma OPENCL EXTENSION my_ext : end | ||
#pragma OPENCL EXTENSION my_ext : end | ||
|
||
__attribute__((overloadable)) void g(void); | ||
|
||
#endif // INCLUDED | ||
|