From 6623e1f10f9546cfe68268ca6724a6fc187b3c1d Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Tue, 3 Nov 2015 18:33:07 +0000 Subject: Introduce module file extensions to piggy-back data onto module files. Introduce the notion of a module file extension, which introduces additional information into a module file at the time it is built that can then be queried when the module file is read. Module file extensions are identified by a block name (which must be unique to the extension) and can write any bitstream records into their own extension block within the module file. When a module file is loaded, any extension blocks are matched up with module file extension readers, that are per-module-file and are given access to the input bitstream. Note that module file extensions can only be introduced by programmatic clients that have access to the CompilerInvocation. There is only one such extension at the moment, which is used for testing the module file extension harness. As a future direction, one could imagine allowing the plugin mechanism to introduce new module file extensions. llvm-svn: 251955 --- clang/lib/Serialization/ModuleFileExtension.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 clang/lib/Serialization/ModuleFileExtension.cpp (limited to 'clang/lib/Serialization/ModuleFileExtension.cpp') diff --git a/clang/lib/Serialization/ModuleFileExtension.cpp b/clang/lib/Serialization/ModuleFileExtension.cpp new file mode 100644 index 00000000000..81dcfd60ce8 --- /dev/null +++ b/clang/lib/Serialization/ModuleFileExtension.cpp @@ -0,0 +1,22 @@ +//===-- ModuleFileExtension.cpp - Module File Extensions ------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +#include "clang/Serialization/ModuleFileExtension.h" +#include "llvm/ADT/Hashing.h" +#include "llvm/Support/raw_ostream.h" +using namespace clang; + +ModuleFileExtension::~ModuleFileExtension() { } + +llvm::hash_code ModuleFileExtension::hashExtension(llvm::hash_code Code) const { + return Code; +} + +ModuleFileExtensionWriter::~ModuleFileExtensionWriter() { } + +ModuleFileExtensionReader::~ModuleFileExtensionReader() { } -- cgit v1.2.3