22#include "RConfigure.h"
25#include "cling/Interpreter/CIFactory.h"
26#include "clang/Basic/SourceManager.h"
27#include "clang/Frontend/CompilerInstance.h"
28#include "clang/Lex/HeaderSearch.h"
29#include "clang/Lex/Preprocessor.h"
30#include "llvm/Support/Path.h"
82 llvm::sys::fs::createUniqueFile(pattern,
resultPath);
116 clang::Preprocessor &
PP =
fCI->getPreprocessor();
117 clang::HeaderSearch &
HdrSearch =
PP.getHeaderSearchInfo();
118 clang::ConstSearchDirIterator *
CurDir =
nullptr;
122 clang::ArrayRef<std::pair<
const clang::FileEntry*,
123 const clang::DirectoryEntry*>>(),
152 if ((last ==
'x' || last ==
'p')
167 std::string::size_type
posEq = in.find(
'=');
169 if (
posEq == std::string::npos)
170 return std::make_pair(in,
"1");
173 return std::pair<std::string, std::string>
174 (in.substr(0,
posEq), in.substr(
posEq + 1, std::string::npos));
198 && args[
iPcmArg] !=
"-DG__NOCINTDLL") {
220 size_t pos =
cppname.find(
'(');
221 if (pos != std::string::npos)
cppname.erase(pos);
222 out <<
"#ifndef " <<
cppname <<
"\n"
241 out <<
"#ifdef " <<
undef <<
"\n"
242 " #undef " <<
undef <<
"\n"
262 std::cerr <<
"Error: #pragma once directive detected in header file "
264 <<
" which was requested to be inlined.\n";
276 bufferContent = std::string((std::istreambuf_iterator<char>(buffer)),
277 std::istreambuf_iterator<char>());
304 out <<
"#include \"" <<
incl <<
"\"\n";
314 std::ostream &out)
const
317 out <<
"\"" <<
theStr <<
"\",\n";
319 out <<
"nullptr" << std::endl;
326 std::ostream &out)
const
333 for (
const char *
c =
strPair.second.c_str(); *
c !=
'\0'; ++
c) {
343 out <<
"nullptr" << std::endl;
361 out <<
"namespace {\n"
362 " void TriggerDictionaryInitialization_" <<
dictName <<
"_Impl() {\n"
363 " static const char* headers[] = {\n";
365 out <<
" static const char* includePaths[] = {\n";
372 out <<
" static const char* classesHeaders[] = {\n"
375 out <<
" static bool isInitialized = false;\n"
376 " if (!isInitialized) {\n"
378 " headers, includePaths, payloadCode, fwdDeclCode,\n"
379 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl, "
381 << (
hasCxxModule ?
"/*hasCxxModule*/true" :
"/*hasCxxModule*/false")
383 " isInitialized = true;\n"
386 " static struct DictInit {\n"
388 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl();\n"
390 " } __TheDictionaryInitializer;\n"
392 "void TriggerDictionaryInitialization_" <<
dictName <<
"() {\n"
393 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl();\n"
416 constexpr char from[] =
"\n";
417 constexpr char to[] =
"\n)DICTFWDDCLS\"\nR\"DICTFWDDCLS(";
477 std::istreambuf_iterator<char>());
506 payloadCode +=
"#define _BACKWARD_BACKWARD_WARNING_H\n"
507 "// Inline headers\n"+
510 "#undef _BACKWARD_BACKWARD_WARNING_H\n";
545 out <<
"namespace ROOT { namespace Dict { namespace _"
548 out <<
"const char* arrIncludes[] = {\n";
551 out <<
"const char* arrIncludePaths[] = {\n";
560 out <<
"} } }" << std::endl;
578 clang::Preprocessor &
PP =
fCI->getPreprocessor();
579 clang::HeaderSearch &
HdrSearch =
PP.getHeaderSearchInfo();
580 clang::ConstSearchDirIterator *
CurDir =
nullptr;
584 clang::ArrayRef<std::pair<
const clang::FileEntry*,
585 const clang::DirectoryEntry*>>(),
588 nullptr ,
nullptr )) {
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
int ExtractBufferContent(const std::string &fullHeaderPath, std::string &bufferContent)
int WarnIfPragmaOnceDetected(const std::string &fullHeaderPath, const std::string &headerFileContent)
To be replaced with proper pragma handlers.
static std::pair< std::string, std::string > SplitPPDefine(const std::string &in)
std::vector< std::string > fCompU
void WriteUmbrellaHeader(std::ostream &out) const
Write a header file pulling in the content of this module through a series of #defined,...
std::ostream & WriteHeaderArray(std::ostream &out) const
std::vector< std::pair< std::string, std::string > > StringPairVec_t
std::ostream & WriteStringVec(const std::vector< std::string > &vec, std::ostream &out) const
std::ostream & WriteStringPairVec(const StringPairVec_t &vecP, std::ostream &out) const
std::string fUmbrellaName
std::string fDictionaryName
void WriteRegistrationSource(std::ostream &out, const std::string &fwdDeclnArgsToKeepString, const std::string &headersClassesMapString, const std::string &fwdDeclsString, const std::string &extraIncludes, bool hasCxxModule) const
ESourceFileKind GetSourceFileKind(const char *filename) const
Check whether the file's extension is compatible with C or C++.
std::ostream & WritePPIncludes(std::ostream &out) const
Write #include "header1.h" #include "header2.h" or, if inlining of headers is requested,...
TModuleGenerator(clang::CompilerInstance *CI, bool inlineHeader, const std::string &shLibFileName, bool isInPCH)
std::string fModuleFileName
std::ostream & WriteIncludePathArray(std::ostream &out) const
void WriteContentHeader(std::ostream &out) const
Write a header file describing the content of this module through a series of variables inside the na...
std::vector< std::string > fCompI
std::vector< std::string > fHeaders
std::ostream & WritePPUndefines(std::ostream &out) const
Write #ifdef FOO # undef FOO #endif
void WriteRegistrationSourceImpl(std::ostream &out, const std::string &dictName, const std::string &demangledDictName, const std::vector< std::string > &headerArray, const std::vector< std::string > &includePathArray, const std::string &fwdDeclStringRAW, const std::string &fwdDeclnArgsToKeepString, const std::string &payloadCodeWrapped, const std::string &headersClassesMapString, const std::string &extraIncludes, bool hasCxxModule) const
const std::string & GetDictionaryName() const
clang::CompilerInstance * fCI
bool FindHeader(const std::string &hdrName, std::string &hdrFullPath) const
Return true if the header is found in the include paths in this case also fill the full path variable...
const std::string & GetDemangledDictionaryName() const
void ParseArgs(const std::vector< std::string > &args)
Parse -I -D -U headers.h SomethingLinkdef.h.
std::string fModuleDirName
std::ostream & WritePPDefines(std::ostream &out) const
Write #ifndef FOO # define FOO=bar #endif
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...