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"
83 llvm::sys::fs::createUniqueFile(pattern,
resultPath);
117 clang::Preprocessor &
PP =
fCI->getPreprocessor();
118 clang::HeaderSearch &
HdrSearch =
PP.getHeaderSearchInfo();
119 clang::ConstSearchDirIterator *
CurDir =
nullptr;
123 clang::ArrayRef<std::pair<clang::OptionalFileEntryRef,
124 clang::DirectoryEntryRef>>(),
153 if ((last ==
'x' || last ==
'p')
168 std::string::size_type
posEq = in.find(
'=');
170 if (
posEq == std::string::npos)
171 return std::make_pair(in,
"1");
174 return std::pair<std::string, std::string>
175 (in.substr(0,
posEq), in.substr(
posEq + 1, std::string::npos));
194 if (args[
iPcmArg].find(
"-isystem") != std::string::npos) {
199 while (args[
iPcmArg][pos] ==
' ')
211 if (args[
iPcmArg] !=
"-DTRUE=1" && args[
iPcmArg] !=
"-DFALSE=0" && args[
iPcmArg] !=
"-DG__NOCINTDLL") {
215 case 'U':
fCompU.push_back(args[
iPcmArg].c_str() + 2);
break;
235 size_t pos =
cppname.find(
'(');
236 if (pos != std::string::npos)
cppname.erase(pos);
237 out <<
"#ifndef " <<
cppname <<
"\n"
256 out <<
"#ifdef " <<
undef <<
"\n"
257 " #undef " <<
undef <<
"\n"
277 std::cerr <<
"Error: #pragma once directive detected in header file "
279 <<
" which was requested to be inlined.\n";
291 bufferContent = std::string((std::istreambuf_iterator<char>(buffer)),
292 std::istreambuf_iterator<char>());
319 out <<
"#include \"" <<
incl <<
"\"\n";
329 std::ostream &out)
const
332 out <<
"\"" <<
theStr <<
"\",\n";
334 out <<
"nullptr" << std::endl;
341 std::ostream &out)
const
348 for (
const char *
c =
strPair.second.c_str(); *
c !=
'\0'; ++
c) {
358 out <<
"nullptr" << std::endl;
376 out <<
"namespace {\n"
377 " void TriggerDictionaryInitialization_" <<
dictName <<
"_Impl() {\n"
378 " static const char* headers[] = {\n";
380 out <<
" static const char* includePaths[] = {\n";
387 out <<
" static const char* classesHeaders[] = {\n"
390 out <<
" static bool isInitialized = false;\n"
391 " if (!isInitialized) {\n"
393 " headers, includePaths, payloadCode, fwdDeclCode,\n"
394 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl, "
396 << (
hasCxxModule ?
"/*hasCxxModule*/true" :
"/*hasCxxModule*/false")
398 " isInitialized = true;\n"
401 " static struct DictInit {\n"
403 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl();\n"
405 " } __TheDictionaryInitializer;\n"
407 "void TriggerDictionaryInitialization_" <<
dictName <<
"() {\n"
408 " TriggerDictionaryInitialization_" <<
dictName <<
"_Impl();\n"
430 constexpr char from[] =
"\n";
431 constexpr char to[] =
"\n)DICTFWDDCLS\"\nR\"DICTFWDDCLS(";
491 std::istreambuf_iterator<char>());
520 payloadCode +=
"#define _BACKWARD_BACKWARD_WARNING_H\n"
521 "// Inline headers\n"+
524 "#undef _BACKWARD_BACKWARD_WARNING_H\n";
559 out <<
"namespace ROOT { namespace Dict { namespace _"
562 out <<
"const char* arrIncludes[] = {\n";
565 out <<
"const char* arrIncludePaths[] = {\n";
574 out <<
"} } }" << std::endl;
592 clang::Preprocessor &
PP =
fCI->getPreprocessor();
593 clang::HeaderSearch &
HdrSearch =
PP.getHeaderSearchInfo();
594 clang::ConstSearchDirIterator *
CurDir =
nullptr;
598 clang::ArrayRef<std::pair<clang::OptionalFileEntryRef,
599 clang::DirectoryEntryRef>>(),
602 nullptr ,
nullptr )) {
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
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)
const_iterator begin() const
const_iterator end() const
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
Namespace for new ROOT classes and functions.