HomePhabricator

[OpenCL] Fix serialization of OpenCLExtensionDecls

Description

[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

Details

Committed
asavonicOct 29 2018, 4:14 AM
Reviewer
Anastasia
Differential Revision
D53200: [OpenCL] Fix serialization of OpenCLExtensionDecls
Parents
rL345496: [ASTImporter] Import overrides before importing the rest of the chain
Branches
Unknown
Tags
Unknown