]> granicus.if.org Git - clang/commit
Merging r345497:
authorTom Stellard <tstellar@redhat.com>
Thu, 29 Nov 2018 04:37:25 +0000 (04:37 +0000)
committerTom Stellard <tstellar@redhat.com>
Thu, 29 Nov 2018 04:37:25 +0000 (04:37 +0000)
commit6655e514ce4f9dbf2bd6689007308a72b5bda8d7
tree99e25490b16e2dfaf046531727c45893f1029a41
parent3319d936c8a98af2e7678ad050528256fe7a832e
Merging r345497:

------------------------------------------------------------------------
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
------------------------------------------------------------------------

git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/release_70@347834 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Serialization/ASTWriter.cpp
test/SemaOpenCL/extension-begin.cl
test/SemaOpenCL/extension-begin.h [new file with mode: 0644]