Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade llvm90 #6385

Merged
merged 120 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
5753a64
Import llvm9.
vgvassilev Sep 19, 2020
84d66a4
Disable llvm in-repo benchmarks
vgvassilev Sep 19, 2020
d86f3a0
CodeGenOptions.h moved from Frontend to Basic.
vgvassilev Mar 7, 2020
9360283
BuildDeclRefExpr returns a DeclRefExpr instead of StmtResult.
vgvassilev Mar 7, 2020
2befee8
createAddDiscriminatorsPass went into llvm/Transforms/Utils.h
vgvassilev Mar 9, 2020
29e5174
EmitSummaryIndex was renamed to PrepareForThinLTO
vgvassilev Mar 9, 2020
54905d0
CudaGpuBinaryFileNames was renamed to CudaGpuBinaryFileName.
vgvassilev Mar 9, 2020
e9bd276
ForRedeclaration is split in two: {ForVisible,ForExternal}Redeclaration.
vgvassilev Mar 9, 2020
605a946
The constructor does not take a `bool IsOutputBinary` anymore.
vgvassilev Mar 10, 2020
ad616d9
Import does not have a return result anymore.
vgvassilev Mar 10, 2020
dd4ef8e
Various ASTImporter import interfaces return llvm::Expected.
vgvassilev Mar 11, 2020
4806286
LookupFile takes an extra optional argument.
vgvassilev Mar 11, 2020
13dd291
Add support for c++2a.
vgvassilev Mar 11, 2020
19f445e
clang::vfs::getVFSFromYAML moved to llvm.
vgvassilev Mar 11, 2020
d4685a5
driver::ArgStringList moved to llvm::opt.
vgvassilev Mar 11, 2020
4a70ab1
CompoundStmt::setStmts was reimplemented to save a pointer.
vgvassilev Mar 15, 2020
b573463
Replace the statements only if they differ.
vgvassilev Apr 5, 2020
40299e5
getLocStart was renamed to getBeginLoc and getLocEnd to getEndLoc.
vgvassilev Mar 15, 2020
9b3796e
setBuffer was renamed to replaceBuffer.
vgvassilev Mar 15, 2020
ca58c59
The PCHGenerator was enhanced to protect against build races.
vgvassilev Mar 15, 2020
1999129
PragmaIntroducerKind was renamed to PragmaIntroducer.
vgvassilev Mar 15, 2020
97ee8ae
The member was hidden in favor of an accessor.
vgvassilev Mar 15, 2020
a841267
Fix weird whitespace.
vgvassilev Mar 15, 2020
5e1f0d2
isExplicitSpecified was renamed to hasExplicitSpecifier.
vgvassilev Mar 15, 2020
28a8a54
isExplicitSpecified was refactored into an enum.
vgvassilev Mar 16, 2020
4bb1456
addPassesToEmitFile takes an extra argument.
vgvassilev Mar 16, 2020
4137fc9
Add override keyword and InclusionDirective callback takes extra arg.
vgvassilev Mar 17, 2020
4d560be
TypeNameContext was moved to DeclaratorContext.
vgvassilev Mar 17, 2020
be0676c
getTypeQualifiers was renamed to getMethodQualifiers.
vgvassilev Mar 17, 2020
5e2f971
Use directly the const-checking routine.
vgvassilev Mar 17, 2020
59bb23b
Index goes behind the getASTIndex interface.
vgvassilev Mar 17, 2020
fa730b3
The interface requires us to tell if the value will be discarded.
vgvassilev Mar 17, 2020
ed8efda
Add an include to the LegacyPassManager for object's size.
vgvassilev Mar 17, 2020
4c9424f
Remove redundant include.
vgvassilev Mar 17, 2020
51eb720
The default JIT settings are assumed by default now.
vgvassilev Mar 17, 2020
9310cf0
getNewUninitMemBuffer is only available in WritableMemoryBuffer.
vgvassilev Mar 17, 2020
6887420
BuryPointer went to llvm.
vgvassilev Mar 17, 2020
ced088b
Fix unintended negation typo.
vgvassilev Mar 17, 2020
20e0130
CreateASTDumper takes 2 more parameters.
vgvassilev Mar 17, 2020
0fc6d52
Add LLVM_FALLTHROUGH to silence warnings.
vgvassilev Mar 17, 2020
a012700
The SourceLocation parameter is optional.
vgvassilev Mar 17, 2020
1185650
first and second were renamed to getBegin and getEnd.
vgvassilev Mar 17, 2020
138bdff
Try moving cling to the new orc jit api.
vgvassilev Mar 18, 2020
13802c9
Delegate the TargetMachine initialization to JITTargetMachineBuilder.
vgvassilev Apr 5, 2020
16f27b0
BuildCXXNew takes an llvm::Optional and passing 0 means ArraySize is 0.
vgvassilev Apr 11, 2020
3cbbca7
Suppress cmake diagnostic.
vgvassilev Apr 15, 2020
b8a8f9d
auto func requires c++14
vgvassilev Apr 16, 2020
0b3eef5
BuildReturnStmt requires setting up a current function scope.
vgvassilev Apr 17, 2020
2f02f3a
llvm9 fixes the printing of unscoped enums.
vgvassilev Apr 18, 2020
641baa8
Check for the expected diagnostics.
vgvassilev Apr 19, 2020
fa83877
SymbolRef::getContents returns Expected<StringRef>
vgvassilev Aug 16, 2020
8e9efc4
ActOnModuleImport takes an export location.
vgvassilev Aug 16, 2020
2007706
Fix wrong asserts.
vgvassilev Aug 17, 2020
0bc65fa
Drop support of #pragma cling load header.h
vgvassilev Aug 25, 2020
e7aeab4
Orc JIT now takes the ownership of the llvm::Module.
vgvassilev Sep 5, 2020
b0ca443
Store the llvm::Module ptr before moving it.
vgvassilev Sep 7, 2020
466ecdd
LLVM_ON_WIN32 was dropped.
vgvassilev Oct 5, 2020
3b32047
Better export cling's cmake targets
vgvassilev Sep 18, 2020
2d62727
Include ExternalProject for the clad plugin.
vgvassilev Sep 18, 2020
fed4500
Complete the upgrade to LLVM/Clang 9.0 for cling.
vgvassilev Mar 18, 2020
d22049b
first and second were renamed to getBegin and getEnd.
vgvassilev Sep 10, 2020
4ec33e1
Implement -Dbuiltin_cling=Off
vgvassilev Sep 10, 2020
9705071
Readd -fPIC for cling. Somehow it's not propagated from LLVM_ENABLE_PIC
vgvassilev Sep 27, 2020
b166a16
getLocStart was renamed to getBeginLoc and getLocEnd to getEndLoc.
vgvassilev Sep 10, 2020
686accb
getPCMCache was renamed to getModuleCache
vgvassilev Sep 10, 2020
3de89ff
getModuleFileName was split into two functions.
vgvassilev Sep 18, 2020
eafb9ad
Remove redundant (and deleted) include.
vgvassilev Sep 18, 2020
45b1eb4
Add missing include and qualify StringRef.
vgvassilev Sep 18, 2020
fca9c7c
Add missing include
vgvassilev Sep 18, 2020
fa1b13d
Bitstream{Reader,Writer}.h was moved in Bitstream
vgvassilev Sep 18, 2020
47e663b
EvaluateAsInt takes a special Expr::EvalResult argument.
vgvassilev Sep 18, 2020
d877783
getPCMCache was renamed to getModuleCache.
vgvassilev Sep 19, 2020
be8d055
Handle the llvm::Error return types.
vgvassilev Sep 19, 2020
a155e57
Avoid reconfiguring llvm on a source change.
vgvassilev Sep 26, 2020
f9d7408
Remove warnings specific to llvm-5.
vgvassilev Sep 27, 2020
d58170b
Mark the include directories of clang and llvm as system.
vgvassilev Sep 28, 2020
574d05c
Remove unused parameters. Fixes -Wunused-parameter.
vgvassilev Sep 30, 2020
7b4939f
Remove unused member from the JIT.
vgvassilev Sep 30, 2020
025a92a
Fix warnings coming from shadowing names.
vgvassilev Sep 30, 2020
8bfa94a
cling::Transaction::Initialize does not need Sema.
vgvassilev Sep 30, 2020
4dd159f
loadGlobalModuleIndex does not need a trigger source location
vgvassilev Sep 30, 2020
1d2a3f3
Consolidate setting CLING_CXXFLAGS in interpreter/CMakeLists
vgvassilev Sep 30, 2020
adaae06
LLVM-9 recommends gcc version at least 5.1
vgvassilev Oct 5, 2020
0dedaf6
Revert "Enable unicode output on terminals."
Axel-Naumann Oct 21, 2020
a7dc1b6
[cling] Import updated lit config:
Axel-Naumann Oct 28, 2020
42a87cc
[cling] Get rid of extra-complex built_cling:
Axel-Naumann Oct 28, 2020
bce58d3
[cling] Only JIT symbols that are unavailable:
Axel-Naumann Oct 28, 2020
163e544
Reset the LexLevel when parsing recursively.
vgvassilev Nov 2, 2020
df17598
[cling] Reset Sema::CurContext to TU before auto-import:
Axel-Naumann Nov 3, 2020
34656f2
[cling] Plugins on Windows are not supported, don't build the example…
vgvassilev Nov 3, 2020
6cb0ec1
The Ty pointer can be null.
vgvassilev Nov 3, 2020
152e697
Store the current parser token and prevent the inner parse to overwri…
vgvassilev Nov 3, 2020
eb4f055
[test] Remove ineffective re-load guard in stressInterpreter:
Axel-Naumann Oct 29, 2020
dab2aae
[cling] Remove pseudo-conditional / simplify (NFC).
Axel-Naumann Oct 30, 2020
21970df
[cling] Unload even if no T->module:
Axel-Naumann Nov 3, 2020
fa2e945
[metacling] Fix line numbers of rootmap fwd decls:
Axel-Naumann Nov 9, 2020
2cbbf09
[core] Flag explicit tmplt spec as autoloadable:
Axel-Naumann Nov 9, 2020
0f2f143
Add support for DiagnosticEngine state change within recursive parsing.
pcanal Jan 28, 2020
2b90d52
Improve "[cling] DefinitionShadower: allow shadowing of non-user-defi…
vgvassilev Nov 12, 2020
fc520d9
Do not install cling under ROOTSYS/include/cling
vgvassilev Dec 18, 2020
05e3bd6
Add a module for Vc.
vgvassilev Dec 19, 2020
bb5810b
[cxxmodules] Don't complain when modulemap for implicit modules has c…
yamaguchi1024 Dec 17, 2018
9b5ff16
[cling] Allow cling as ASTSource to complete tmplt spec:
Axel-Naumann Feb 4, 2021
2a03723
[cling] When unloading, also forget that the decl was emitted.
Axel-Naumann Feb 4, 2021
49b53c9
Bring back the old workaround.
vgvassilev Feb 9, 2021
b280d99
Fixes Issue #6812.
jalopezg-git Feb 1, 2021
384c769
[metacling] Prevent inclusion of complex.h, use raw string literal:
Axel-Naumann Feb 11, 2021
5a2d785
Revert "Bring back the old workaround."
Axel-Naumann Feb 11, 2021
ed4925e
[cling] Improve 67b613517b: unsigned vallues cannot be negative:
Axel-Naumann Feb 11, 2021
62089de
[metacling] Also fwd decl templt spec args:
Axel-Naumann Feb 11, 2021
b13c7b8
Fixed CUDA mode for Clang/LLVM 9 upgrade
SimeonEhrig Feb 11, 2021
30a7fb7
Fix warnings about the ignored quals.
vgvassilev Feb 12, 2021
2db1ac1
removeRedeclFromChain is a template static. Fixes osx warning.
vgvassilev Feb 12, 2021
418713c
DeclExtractor: exit early if there is nothing to do
jalopezg-git Feb 16, 2021
0098eb6
[dict] Move dict decls to ROOTDict namespace:
Axel-Naumann Feb 23, 2021
e97886b
[matrix] Move operators into inline namespace TMatrixTAutoloadOps:
Axel-Naumann Feb 23, 2021
6d86f70
[cling] Windows needs more symbols to be injected:
Axel-Naumann Feb 24, 2021
c786a48
[llvm] Work around inconsistency of {std|llvm}::is_trivially_copyable:
Axel-Naumann Feb 24, 2021
c67fffe
[tutorials] v7/climate/global_temperatures.C needs Davix.
Axel-Naumann Feb 25, 2021
0d4fb8a
Complete the llvm upgrade for ROOT.
vgvassilev Sep 19, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ endforeach()
add_custom_target(move_artifacts DEPENDS ${stamp_file} ${artifact_files_builddir})

add_subdirectory (interpreter)
# Add the compilation flags from LLVM to the flags we use to compile cling-based tools.
set(CLING_CXXFLAGS "${CLING_CXXFLAGS} ${ROOT_LLVM_FLAGS}")

#---CXX MODULES-----------------------------------------------------------------------------------
if(cxxmodules)
Expand Down
3 changes: 3 additions & 0 deletions README/ReleaseNotes/v624/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ Note that the preferred way to steer ROOT's concurrency level is still through `

See the discussion at [ROOT-11014](https://sft.its.cern.ch/jira/browse/ROOT-11014) for more context.

### Interpreter
- cling's LLVM is upgraded to version 9.0

## I/O Libraries


Expand Down
10 changes: 9 additions & 1 deletion cmake/modules/RootBuildOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ ROOT_BUILD_OPTION(asimage ON "Enable support for image processing via libAfterIm
ROOT_BUILD_OPTION(builtin_afterimage OFF "Build bundled copy of libAfterImage")
ROOT_BUILD_OPTION(builtin_cfitsio OFF "Build CFITSIO internally (requires network)")
ROOT_BUILD_OPTION(builtin_clang ON "Build bundled copy of Clang")
ROOT_BUILD_OPTION(builtin_cling ON "Build bundled copy of Cling")
ROOT_BUILD_OPTION(builtin_davix OFF "Build Davix internally (requires network)")
ROOT_BUILD_OPTION(builtin_fftw3 OFF "Build FFTW3 internally (requires network)")
ROOT_BUILD_OPTION(builtin_freetype OFF "Build bundled copy of freetype")
Expand Down Expand Up @@ -274,6 +275,7 @@ if(builtin_all)
set(builtin_afterimage_defvalue ON)
set(builtin_cfitsio_defvalue ON)
set(builtin_clang_defvalue ON)
set(builtin_cling_defvalue ON)
set(builtin_davix_defvalue ON)
set(builtin_fftw3_defvalue ON)
set(builtin_freetype_defvalue ON)
Expand Down Expand Up @@ -347,7 +349,7 @@ endif()

#---Apply minimal or gminimal------------------------------------------------------------------
foreach(opt ${root_build_options})
if(NOT opt MATCHES "builtin_llvm|builtin_clang|shared")
if(NOT opt MATCHES "builtin_llvm|builtin_clang|builtin_cling|shared")
if(minimal)
set(${opt}_defvalue OFF)
elseif(gminimal AND NOT opt MATCHES "x11|cocoa")
Expand Down Expand Up @@ -377,6 +379,12 @@ if(roottest OR rootbench)
set(testing ON CACHE BOOL "" FORCE)
endif()

if (builtin_cling)
if (NOT builtin_clang OR NOT builtin_llvm)
message(WARNING "No need to build internal llvm or clang. Consider turning builtin_clang=Off and builtin_llvm=Off")
endif()
endif(builtin_cling)

if(root7)
if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14 CACHE STRING "C++14 standard used with root7")
Expand Down
23 changes: 0 additions & 23 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1016,29 +1016,6 @@ if(arrow)

endif()

#---Check for cling and llvm --------------------------------------------------------

set(CLING_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/interpreter/cling/include)

if(MSVC)
set(CLING_CXXFLAGS "-DNOMINMAX -D_XKEYCHECK_H")
else()
set(CLING_CXXFLAGS "-fvisibility=hidden -Wno-shadow -fno-strict-aliasing -Wno-unused-parameter -Wwrite-strings -Wno-long-long")
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CLING_CXXFLAGS "${CLING_CXXFLAGS} -Wno-missing-field-initializers")
endif()
#---These are the libraries that we link ROOT with CLING---------------------------
set(CLING_LIBRARIES clingInterpreter clingMetaProcessor clingUtils)
add_custom_target(CLING)
add_dependencies(CLING ${CLING_LIBRARIES})
if (builtin_llvm)
add_dependencies(CLING intrinsics_gen)
endif()
if (builtin_clang)
add_dependencies(CLING clang-headers)
endif()

#---Check for gfal-------------------------------------------------------------------
if(gfal)
find_package(GFAL)
Expand Down
6 changes: 5 additions & 1 deletion core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ if(MSVC)
target_compile_definitions(Core PRIVATE _USE_MATH_DEFINES)
endif()

# Inclusion of `complex.h` causes havoc: `complex` and `I` become CPP macros.
# Darwin's complex.h does not implement C11's __STDC_NO_COMPLEX__, use the
# header guard instead. This prevents inclusion of complex.h in Darwin.pcm.
target_compile_definitions(Core PRIVATE __STDC_NO_COMPLEX__ __COMPLEX_H__)

#while basic libs do not depend on Core, we have to add includes directly

target_include_directories(Core PUBLIC
Expand Down Expand Up @@ -256,5 +261,4 @@ target_link_libraries(Core
${CMAKE_THREAD_LIBS_INIT}
${corelinklibs}
)

add_dependencies(Core CLING)
2 changes: 1 addition & 1 deletion core/base/inc/Rtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ public: \

#define NamespaceImpUnique(name,key) \
namespace name { \
namespace ROOT { \
namespace ROOTDict { \
::ROOT::TGenericClassInfo *GenerateInitInstance(); \
namespace { \
static int _R__UNIQUE_(_NAME2_(R__dummyint,key)) = \
Expand Down
8 changes: 3 additions & 5 deletions core/clingutils/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,6 @@ target_include_directories(ClingUtils PRIVATE
target_include_directories(ClingUtils SYSTEM PRIVATE ${CLANG_INCLUDE_DIRS} ${LLVM_INCLUDE_DIRS})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CLING_CXXFLAGS}")

# This is to avoid warnings coming from GCC 7 in llvm/src/include/llvm/ADT/DenseMap.h:1010
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
ROOT_ADD_CXX_FLAG(CMAKE_CXX_FLAGS -Wno-maybe-uninitialized)
endif()

ROOT_INSTALL_HEADERS()

#### STL dictionary (replacement for cintdlls)##############################
Expand Down Expand Up @@ -110,6 +105,9 @@ set(clinginclude ${CMAKE_SOURCE_DIR}/interpreter/cling/include)
set(custom_modulemaps)
if (runtime_cxxmodules)
set(custom_modulemaps boost.modulemap tinyxml2.modulemap cuda.modulemap module.modulemap.build)
if (Vc_FOUND)
set(custom_modulemaps ${custom_modulemaps} vc.modulemap)
endif(Vc_FOUND)
if (NOT libcxx)
if (MSVC)
set(custom_modulemaps ${custom_modulemaps} vcruntime.modulemap)
Expand Down
6 changes: 6 additions & 0 deletions core/clingutils/res/TClingUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,12 @@ int FwdDeclFromRcdDecl(const clang::RecordDecl& recordDecl,
int FwdDeclFromTmplDecl(const clang::TemplateDecl& tmplDecl,
const cling::Interpreter& interpreter,
std::string& defString);

//______________________________________________________________________________
int FwdDeclIfTmplSpec(const clang::RecordDecl& recordDecl,
const cling::Interpreter& interpreter,
std::string& defString,
const std::string &normalizedName);
//______________________________________________________________________________
int GetDefArg(const clang::ParmVarDecl& par, std::string& valAsString, const clang::PrintingPolicy& pp);

Expand Down
72 changes: 58 additions & 14 deletions core/clingutils/src/TClingUtils.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1572,7 +1572,7 @@ long ROOT::TMetaUtils::GetLineNumber(const clang::Decl *decl)
}

if (!sourceLocation.isFileID()) {
sourceLocation = sourceManager.getExpansionRange(sourceLocation).second;
sourceLocation = sourceManager.getExpansionRange(sourceLocation).getEnd();
}

if (sourceLocation.isValid() && sourceLocation.isFileID()) {
Expand Down Expand Up @@ -3328,7 +3328,7 @@ getFinalSpellingLoc(clang::SourceManager& sourceManager,
clang::SourceLocation sourceLoc) {
// Follow macro expansion until we hit a source file.
if (!sourceLoc.isFileID()) {
return sourceManager.getExpansionRange(sourceLoc).second;
return sourceManager.getExpansionRange(sourceLoc).getEnd();
}
return sourceLoc;
}
Expand Down Expand Up @@ -3394,7 +3394,8 @@ llvm::StringRef ROOT::TMetaUtils::GetFileName(const clang::Decl& decl,
true /*isAngled*/, 0/*FromDir*/, foundDir,
ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>>(),
0/*Searchpath*/, 0/*RelPath*/,
0/*IsMapped*/, 0/*RequestingModule*/, 0/*SuggestedModule*/,
0/*SuggestedModule*/, 0/*RequestingModule*/,
0/*IsMapped*/, nullptr /*IsFrameworkFound*/,
false /*SkipCache*/,
false /*BuildSystemModule*/,
false /*OpenFile*/, true /*CacheFailures*/);
Expand Down Expand Up @@ -3448,8 +3449,9 @@ llvm::StringRef ROOT::TMetaUtils::GetFileName(const clang::Decl& decl,
FELong = HdrSearch.LookupFile(trailingPart, SourceLocation(),
true /*isAngled*/, 0/*FromDir*/, FoundDir,
ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>>(),
0/*IsMapped*/, 0/*Searchpath*/, 0/*RelPath*/,
0/*RequestingModule*/, 0/*SuggestedModule*/);
0/*Searchpath*/, 0/*RelPath*/,
0/*SuggestedModule*/, 0/*RequestingModule*/,
0/*IsMapped*/, nullptr /*IsFrameworkFound*/);
}

if (!FELong) {
Expand All @@ -3473,10 +3475,9 @@ llvm::StringRef ROOT::TMetaUtils::GetFileName(const clang::Decl& decl,
if (HdrSearch.LookupFile(trailingPart, SourceLocation(),
true /*isAngled*/, 0/*FromDir*/, FoundDir,
ArrayRef<std::pair<const FileEntry *, const DirectoryEntry *>>(),
0/*IsMapped*/,
0/*Searchpath*/,
0/*RelPath*/,
0/*RequestingModule*/, 0 /*SuggestedModule*/) == FELong) {
0/*Searchpath*/, 0/*RelPath*/,
0/*SuggestedModule*/, 0/*RequestingModule*/,
0/*IsMapped*/, nullptr /*IsFrameworkFound*/) == FELong) {
return trailingPart;
}
}
Expand Down Expand Up @@ -4184,10 +4185,10 @@ int dumpDeclForAssert(const clang::Decl& D, const char* commentStart) {
llvm::StringRef ROOT::TMetaUtils::GetComment(const clang::Decl &decl, clang::SourceLocation *loc)
{
clang::SourceManager& sourceManager = decl.getASTContext().getSourceManager();
clang::SourceLocation sourceLocation = decl.getLocEnd();
clang::SourceLocation sourceLocation = decl.getEndLoc();

// If the location is a macro get the expansion location.
sourceLocation = sourceManager.getExpansionRange(sourceLocation).second;
sourceLocation = sourceManager.getExpansionRange(sourceLocation).getEnd();
// FIXME: We should optimize this routine instead making it do the wrong thing
// returning an empty comment if the decl came from the AST.
// In order to do that we need to: check if the decl has an attribute and
Expand Down Expand Up @@ -4218,7 +4219,7 @@ llvm::StringRef ROOT::TMetaUtils::GetComment(const clang::Decl &decl, clang::Sou
} else if (FD->doesThisDeclarationHaveABody()) {
// commentStart is at body's '}'
// But we might end up e.g. at the ')' of a CPP macro
assert((decl.getLocEnd() != sourceLocation || *commentStart == '}'
assert((decl.getEndLoc() != sourceLocation || *commentStart == '}'
|| dumpDeclForAssert(*FD, commentStart))
&& "Expected macro or end of body at '}'");
if (*commentStart) ++commentStart;
Expand Down Expand Up @@ -5325,6 +5326,48 @@ static int TreatSingleTemplateArg(const clang::TemplateArgument& arg,
return 1;
}

////////////////////////////////////////////////////////////////////////////////
/// Convert a tmplt decl to its fwd decl

int ROOT::TMetaUtils::AST2SourceTools::FwdDeclIfTmplSpec(const clang::RecordDecl& recordDecl,
const cling::Interpreter& interpreter,
std::string& defString,
const std::string &normalizedName)
{
// If this is an explicit specialization, inject it into cling, too, such that it can have
// externalLexicalStorage, see TCling.cxx's ExtVisibleStorageAdder::VisitClassTemplateSpecializationDecl.
if (auto tmplSpecDeclPtr = llvm::dyn_cast<clang::ClassTemplateSpecializationDecl>(&recordDecl)) {
if (const auto *specDef = tmplSpecDeclPtr->getDefinition()) {
if (specDef->getTemplateSpecializationKind() != clang::TSK_ExplicitSpecialization)
return 0;
// normalizedName contains scope, no need to enclose in namespace!
if (GetErrorIgnoreLevel() == ROOT::TMetaUtils::kInfo)
std::cout << " Forward declaring template spec " << normalizedName << ":\n";
for (auto arg : tmplSpecDeclPtr->getTemplateArgs().asArray()) {
std::string argFwdDecl;
int retCode = TreatSingleTemplateArg(arg, argFwdDecl, interpreter, /*acceptStl=*/false);
if (GetErrorIgnoreLevel() == ROOT::TMetaUtils::kInfo) {
std::cout << " o Template argument ";
if (retCode == 0) {
std::cout << "successfully treated. Arg fwd decl: " << argFwdDecl << std::endl;
} else {
std::cout << "could not be treated. Abort fwd declaration generation.\n";
}
}

if (retCode != 0) { // A sign we must bail out
return retCode;
}
defString += argFwdDecl + '\n';
}
defString += "template <> class " + normalizedName + ';';
return 0;
}
}

return 0;
}

////////////////////////////////////////////////////////////////////////////////
/// Convert a rcd decl to its fwd decl
/// If this is a template specialisation, treat in the proper way.
Expand Down Expand Up @@ -5503,8 +5546,9 @@ int ROOT::TMetaUtils::AST2SourceTools::GetDefArg(const clang::ParmVarDecl& par,

// The value is an integer
if (defArgType->isIntegerType()){
llvm::APSInt result;
defArgExprPtr->EvaluateAsInt(result,ctxt);
clang::Expr::EvalResult evalResult;
defArgExprPtr->EvaluateAsInt(evalResult, ctxt);
llvm::APSInt result = evalResult.Val.getInt();
auto uintVal = *result.getRawData();
if (result.isNegative()){
long long int intVal=uintVal*-1;
Expand Down
16 changes: 8 additions & 8 deletions core/dictgen/src/LinkdefReader.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -736,13 +736,13 @@ class PragmaExtraInclude : public LinkdefReaderPragmaHandler {
}

void HandlePragma(clang::Preprocessor &PP,
clang::PragmaIntroducerKind Introducer,
clang::PragmaIntroducer Introducer,
clang::Token &tok) {
// Handle a #pragma found by the Preprocessor.

// check whether we care about the pragma - we are a named handler,
// thus this could actually be transformed into an assert:
if (Introducer != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (Introducer.Kind != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (!tok.getIdentifierInfo()) return; // must be "link"
if (tok.getIdentifierInfo()->getName() != "extra_include") return;

Expand Down Expand Up @@ -785,13 +785,13 @@ class PragmaIoReadInclude : public LinkdefReaderPragmaHandler {
}

void HandlePragma(clang::Preprocessor &PP,
clang::PragmaIntroducerKind Introducer,
clang::PragmaIntroducer Introducer,
clang::Token &tok) {
// Handle a #pragma found by the Preprocessor.

// check whether we care about the pragma - we are a named handler,
// thus this could actually be transformed into an assert:
if (Introducer != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (Introducer.Kind != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (!tok.getIdentifierInfo()) return; // must be "link"
if (tok.getIdentifierInfo()->getName() != "read") return;

Expand Down Expand Up @@ -844,13 +844,13 @@ class PragmaLinkCollector : public LinkdefReaderPragmaHandler {
}

void HandlePragma(clang::Preprocessor &PP,
clang::PragmaIntroducerKind Introducer,
clang::PragmaIntroducer Introducer,
clang::Token &tok) {
// Handle a #pragma found by the Preprocessor.

// check whether we care about the pragma - we are a named handler,
// thus this could actually be transformed into an assert:
if (Introducer != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (Introducer.Kind != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (!tok.getIdentifierInfo()) return; // must be "link"
if (tok.getIdentifierInfo()->getName() != "link") return;

Expand Down Expand Up @@ -949,13 +949,13 @@ class PragmaCreateCollector : public LinkdefReaderPragmaHandler {
}

void HandlePragma(clang::Preprocessor &PP,
clang::PragmaIntroducerKind Introducer,
clang::PragmaIntroducer Introducer,
clang::Token &tok) {
// Handle a #pragma found by the Preprocessor.

// check whether we care about the pragma - we are a named handler,
// thus this could actually be transformed into an assert:
if (Introducer != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (Introducer.Kind != clang::PIK_HashPragma) return; // only #pragma, not C-style.
if (!tok.getIdentifierInfo()) return; // must be "link"
if (tok.getIdentifierInfo()->getName() != "create") return;

Expand Down
10 changes: 6 additions & 4 deletions core/dictgen/src/TModuleGenerator.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ TModuleGenerator::GetSourceFileKind(const char *filename) const
true /*isAngled*/, 0 /*FromDir*/, CurDir,
clang::ArrayRef<std::pair<const clang::FileEntry*,
const clang::DirectoryEntry*>>(),
0 /*IsMapped*/, 0 /*SearchPath*/, 0 /*RelativePath*/,
0 /*RequestingModule*/, 0/*SuggestedModule*/);
nullptr /*SearchPath*/,/*RelativePath*/ nullptr,
nullptr /*RequestingModule*/, nullptr /*SuggestedModule*/,
nullptr /*IsMapped*/, nullptr /*IsFrameworkFound*/);
if (hdrFileEntry) {
return kSFKHeader;
}
Expand Down Expand Up @@ -576,8 +577,9 @@ bool TModuleGenerator::FindHeader(const std::string &hdrName, std::string &hdrFu
true /*isAngled*/, 0 /*FromDir*/, CurDir,
clang::ArrayRef<std::pair<const clang::FileEntry*,
const clang::DirectoryEntry*>>(),
0 /*IsMapped*/, 0 /*SearchPath*/, 0 /*RelativePath*/,
0 /*RequestingModule*/, 0/*SuggestedModule*/)) {
nullptr /*SearchPath*/, nullptr /*RelativePath*/,
nullptr /*RequestingModule*/, nullptr/*SuggestedModule*/,
nullptr /*IsMapped*/, nullptr /*IsFrameworkFound*/)) {
hdrFullPath = hdrFileEntry->getName();
return true;
}
Expand Down
Loading