Implement the autoloading for ROOT_MODULES.
git-svn-id: http://root.cern.ch/svn/root/trunk@48385 27541ba8-7e3a-0410-8455-c3a389f83636
This commit is contained in:
parent
dd845ce3d9
commit
5bbb8c2aba
@ -449,6 +449,16 @@ namespace cling {
|
||||
///
|
||||
CompilationResult parse(const std::string& input);
|
||||
|
||||
///\brief Looks for a already generated PCM for the given header file and
|
||||
/// loads it.
|
||||
///
|
||||
///\param[in] headerFile - The header file for which a module should be
|
||||
/// loaded.
|
||||
///
|
||||
///\returns Whether the operation was fully successful.
|
||||
///
|
||||
CompilationResult loadModuleForHeader(const std::string& headerFile);
|
||||
|
||||
///\brief Parses input line, which doesn't contain statements. Code
|
||||
/// generation needed to make the module functional.
|
||||
///
|
||||
|
@ -402,6 +402,38 @@ namespace cling {
|
||||
return DeclareInternal(input, CO);
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::loadModuleForHeader(const std::string& headerFile) {
|
||||
Preprocessor& PP = getCI()->getPreprocessor();
|
||||
//Copied from clang's PPDirectives.cpp
|
||||
bool isAngled = false;
|
||||
// Clang doc says:
|
||||
// "LookupFrom is set when this is a \#include_next directive, it specifies
|
||||
// the file to start searching from."
|
||||
const DirectoryLookup* LookupFrom = 0;
|
||||
const DirectoryLookup* CurDir = 0;
|
||||
|
||||
Module* module = 0;
|
||||
const FileEntry *file = PP.LookupFile(headerFile, isAngled, LookupFrom,
|
||||
CurDir, /*SearchPath*/0,
|
||||
/*RelativePath*/ 0, &module,
|
||||
/*SkipCache*/false);
|
||||
if (!module)
|
||||
return Interpreter::kFailure;
|
||||
|
||||
SourceLocation fileNameLoc;
|
||||
ModuleIdPath path = std::make_pair(PP.getIdentifierInfo(module->Name),
|
||||
fileNameLoc);
|
||||
|
||||
SourceLocation includeLoc;
|
||||
Module* imported = getCI()->loadModule(includeLoc, path, Module::AllVisible,
|
||||
/*isIncludeDirective*/true);
|
||||
if (imported)
|
||||
return Interpreter::kSuccess;
|
||||
|
||||
return Interpreter::kFailure;
|
||||
}
|
||||
|
||||
Interpreter::CompilationResult
|
||||
Interpreter::parseForModule(const std::string& input) {
|
||||
CompilationOptions CO;
|
||||
|
Loading…
Reference in New Issue
Block a user