Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • rshimoura/ebrains-spack-builds
  • ziaee/ebrains-spack-builds
  • hl11/ebrains-spack-builds
  • filippomarchetti/ebrains-spack-builds
  • jkaiser/ebrains-spack-builds
  • hjorth/ebrains-spack-builds-sept-2024
  • dsegebarth/ebrains-spack-builds
  • kozlov/ebrains-spack-builds
  • dsegebarth/ebrains-spack-builds-na-3
  • ansimsek/ebrains-spack-builds
  • lupoc/ebrains-spack-builds
  • hartmut/ebrains-spack-builds
  • ri/tech-hub/platform/esd/ebrains-spack-builds
  • lcalori0/ebrains-spack-builds
  • deepu/ebrains-spack-builds
  • noelp/ebrains-spack-builds
16 results
Show changes
Showing
with 992 additions and 549 deletions
Index: lldb/bindings/python/get-python-config.py
===================================================================
--- lldb/bindings/python/get-python-config.py
+++ lldb/bindings/python/get-python-config.py
@@ -44,15 +44,21 @@
elif args.variable_name == "LLDB_PYTHON_EXE_RELATIVE_PATH":
tried = list()
exe = sys.executable
- prefix = os.path.realpath(sys.prefix)
+ prefix = sys.prefix
while True:
try:
print(relpath_nodots(exe, prefix))
break
except ValueError:
tried.append(exe)
- if os.path.islink(exe):
- exe = os.path.join(os.path.realpath(os.path.dirname(exe)), os.readlink(exe))
+ real_exe_dirname = os.path.realpath(os.path.dirname(exe))
+ real_prefix = os.path.realpath(prefix)
+ if prefix != real_prefix:
+ prefix = real_prefix
+ exe = os.path.join(real_exe_dirname, os.path.basename(exe))
+ continue
+ elif os.path.islink(exe):
+ exe = os.path.join(real_exe_dirname, os.readlink(exe))
continue
else:
print("Could not find a relative path to sys.executable under sys.prefix", file=sys.stderr)
From e5f0939fde75f769c53c6c99c9ed6886e7d58c43 Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <me@harmenstoppels.nl>
Date: Wed, 23 Aug 2023 11:35:23 +0200
Subject: [PATCH] Add corresponding -I for libelf.h
Funnily enough, it's added to `include_directories` in multiple places,
except where it's necessary.
---
openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
index 92523c23f68b..52e1923f97b7 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -51,6 +51,7 @@ endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/impl
${LIBOMPTARGET_LLVM_INCLUDE_DIRS}
+ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR}
)
set(LIBOMPTARGET_DLOPEN_LIBHSA OFF)
--
2.39.2
From 5e149c3ec8118ad8f3d20a30ce5d3fbac4072515 Mon Sep 17 00:00:00 2001
From: Harmen Stoppels <me@harmenstoppels.nl>
Date: Wed, 23 Aug 2023 11:35:23 +0200
Subject: [PATCH] Add corresponding -I for libelf.h
Funnily enough, it's added to `include_directories` in multiple places,
except where it's necessary.
---
openmp/libomptarget/plugins/amdgpu/CMakeLists.txt | 1 +
1 file changed, 1 insertion(+)
diff --git a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
index 66bf680d15c7..6be12ab6d7f8 100644
--- a/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
+++ b/openmp/libomptarget/plugins/amdgpu/CMakeLists.txt
@@ -99,6 +99,7 @@ target_include_directories(
PRIVATE
${LIBOMPTARGET_INCLUDE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/impl
+ ${LIBOMPTARGET_DEP_LIBELF_INCLUDE_DIR}
)
--
2.39.2
--- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -435,7 +435,12 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
using namespace chrono;
if (__d > duration<_Rep, _Period>::zero())
{
+#if ! (defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__))
+ // GCC's long double const folding is incomplete for IBM128 long doubles.
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
+#else
+ _LIBCPP_CONSTEXPR duration<long double> _Max = duration<long double>(ULLONG_MAX/1000000000ULL) ;
+#endif
nanoseconds __ns;
if (__d < _Max)
{
-- a/libcxx/include/thread
+++ b/libcxx/include/thread
@@ -370,7 +370,7 @@ sleep_for(const chrono::duration<_Rep, _Period>& __d)
using namespace chrono;
if (__d > duration<_Rep, _Period>::zero())
{
-#if defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__)
+#if ! (defined(_LIBCPP_COMPILER_GCC) && (__powerpc__ || __POWERPC__))
// GCC's long double const folding is incomplete for IBM128 long doubles.
_LIBCPP_CONSTEXPR duration<long double> _Max = nanoseconds::max();
#else
paths:
- layout:
- executables:
- "bin/clang-3.9"
- "bin/clang++-3.9"
script: |
echo "clang version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)"
echo "Target: x86_64-pc-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /usr/bin"
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@3.9.1 +clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang-3.9$"
cxx: ".*/bin/clang[+][+]-3.9$"
# `~` and other weird characters in the version string
- layout:
- executables:
- "bin/clang-6.0"
- "bin/clang++-6.0"
script: |
echo "clang version 6.0.1-svn334776-1~exp1~20181018152737.116 (branches/release_60)"
echo "Target: x86_64-pc-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /usr/bin",
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@6.0.1 +clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang-6.0$"
cxx: ".*/bin/clang[+][+]-6.0$"
- layout:
- executables:
- "bin/clang-9.0"
- "bin/clang++-9.0"
script: |
echo "clang version 9.0.1-+201911131414230800840845a1eea-1~exp1~20191113231141.78"
echo "Target: x86_64-pc-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /usr/bin"
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@9.0.1 +clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang-9.0$"
cxx: ".*/bin/clang[+][+]-9.0$"
# Multiple LLVM packages in the same prefix
- layout:
- executables:
- "bin/clang-8"
- "bin/clang++-8"
script: |
echo "clang version 8.0.0-3~ubuntu18.04.2 (tags/RELEASE_800/final)"
echo "Target: x86_64-pc-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /usr/bin"
- executables:
- "bin/ld.lld-8"
script: 'echo "LLD 8.0.0 (compatible with GNU linkers)"'
- executables:
- "bin/lldb"
script: 'echo "lldb version 8.0.0"'
- executables:
- "bin/clang-3.9"
- "bin/clang++-3.9"
script: |
echo "clang version 3.9.1-19ubuntu1 (tags/RELEASE_391/rc2)"
echo "Target: x86_64-pc-linux-gnu"
echo "Thread model: posix"
echo "InstalledDir: /usr/bin"
platforms: ["darwin", "linux"]
results:
- spec: 'llvm@8.0.0+clang+lld+lldb'
extra_attributes:
compilers:
c: ".*/bin/clang-8$"
cxx: ".*/bin/clang[+][+]-8$"
- spec: 'llvm@3.9.1+clang~lld~lldb'
extra_attributes:
compilers:
c: ".*/bin/clang-3.9$"
cxx: ".*/bin/clang[+][+]-3.9$"
# Apple Clang should not be detected
- layout:
- executables:
- "bin/clang"
- "bin/clang++"
script: |
echo "Apple clang version 11.0.0 (clang-1100.0.33.8)"
echo "Target: x86_64-apple-darwin19.5.0"
echo "Thread model: posix"
echo "InstalledDir: /Library/Developer/CommandLineTools/usr/bin"
platforms: ["darwin"]
results: []
diff --git a/lldb/include/lldb/Host/Config.h.cmake b/lldb/include/lldb/Host/Config.h.cmake
--- a/lldb/include/lldb/Host/Config.h.cmake
+++ b/lldb/include/lldb/Host/Config.h.cmake
@@ -38,6 +38,8 @@
#cmakedefine01 LLDB_ENABLE_CURSES
+#cmakedefine01 CURSES_HAVE_NCURSES_CURSES_H
+
#cmakedefine01 LLDB_ENABLE_LIBEDIT
#cmakedefine01 LLDB_ENABLE_LIBXML2
diff --git a/lldb/source/Core/IOHandlerCursesGUI.cpp b/lldb/source/Core/IOHandlerCursesGUI.cpp
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -10,9 +10,14 @@
#include "lldb/Host/Config.h"
#if LLDB_ENABLE_CURSES
+#if CURSES_HAVE_NCURSES_CURSES_H
+#include <ncurses/curses.h>
+#include <ncurses/panel.h>
+#else
#include <curses.h>
#include <panel.h>
#endif
+#endif
#if defined(__APPLE__)
#include <deque>
--- a/llvm/utils/benchmark/src/benchmark_register.h
+++ b/llvm/utils/benchmark/src/benchmark_register.h
@@ -2,6 +2,7 @@
#define BENCHMARK_REGISTER_H
#include <vector>
+#include <limits>
#include "check.h"
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 4493bb65d444..e2b3c61b3c33 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -74,6 +74,9 @@
/* Patch version of the LLVM API */
#define LLVM_VERSION_PATCH ${LLVM_VERSION_PATCH}
+/* LLVM version suffix */
+#cmakedefine LLVM_VERSION_SUFFIX "${LLVM_VERSION_SUFFIX}"
+
/* LLVM version string */
#define LLVM_VERSION_STRING "${PACKAGE_VERSION}"
diff --git a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
index e3c2a580396e..5f76992d193e 100644
--- a/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
+++ b/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake
@@ -249,3 +249,6 @@ if (NOT LIBOMPTARGET_CUDA_TOOLKIT_ROOT_DIR_PRESET AND
endif()
endif()
endif()
+
+find_package(Threads REQUIRED)
+set(OPENMP_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
diff --git a/openmp/libomptarget/src/CMakeLists.txt b/openmp/libomptarget/src/CMakeLists.txt
index 15e6c3bbaf1f..3e5a73504a08 100644
--- a/openmp/libomptarget/src/CMakeLists.txt
+++ b/openmp/libomptarget/src/CMakeLists.txt
@@ -30,6 +30,7 @@ if(OPENMP_STANDALONE_BUILD OR (NOT OPENMP_ENABLE_LIBOMPTARGET_PROFILING))
add_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES})
target_link_libraries(omptarget
${CMAKE_DL_LIBS}
+ ${OPENMP_PTHREAD_LIB}
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
else()
set(LLVM_LINK_COMPONENTS
@@ -37,6 +38,7 @@ else()
)
add_llvm_library(omptarget SHARED ${LIBOMPTARGET_SRC_FILES}
LINK_LIBS ${CMAKE_DL_LIBS}
+ ${OPENMP_PTHREAD_LIB}
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports"
)
target_compile_definitions(omptarget PUBLIC OMPTARGET_PROFILE_ENABLED)
From 5916da23627103563e38702de2d3bcff65d60406 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johann=20Kl=C3=A4hn?= <johann.klaehn@kip.uni-heidelberg.de>
Date: Wed, 26 Jul 2017 15:06:10 +0200
Subject: [PATCH 1/5] [Tooling] Fully qualify template parameters of nested
name specifier in getFullyQualifiedName
---
tools/clang/lib/AST/QualTypeNames.cpp | 18 ++++++++++++++----
tools/clang/unittests/Tooling/QualTypeNamesTest.cpp | 8 +++++++-
2 files changed, 21 insertions(+), 5 deletions(-)
diff --git a/tools/clang/lib/AST/QualTypeNames.cpp b/tools/clang/lib/AST/QualTypeNames.cpp
index 8b605ef295..8fcedccf48 100644
--- a/tools/clang/lib/AST/QualTypeNames.cpp
+++ b/tools/clang/lib/AST/QualTypeNames.cpp
@@ -359,11 +359,21 @@ NestedNameSpecifier *createNestedNameSpecifier(const ASTContext &Ctx,
const TypeDecl *TD,
bool FullyQualify,
bool WithGlobalNsPrefix) {
+ const Type *TypePtr = TD->getTypeForDecl();
+ // In case of template specializations iterate over the arguments and
+ // fully qualify them as well.
+ if (isa<const TemplateSpecializationType>(TypePtr) ||
+ isa<const RecordType>(TypePtr)) {
+ // We are asked to fully qualify and we have a Record Type (which
+ // may point to a template specialization) or Template
+ // Specialization Type. We need to fully qualify their arguments.
+
+ TypePtr = getFullyQualifiedTemplateType(Ctx, TypePtr, WithGlobalNsPrefix);
+ }
+
return NestedNameSpecifier::Create(
- Ctx,
- createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix),
- false /*No TemplateKeyword*/,
- TD->getTypeForDecl());
+ Ctx, createOuterNNS(Ctx, TD, FullyQualify, WithGlobalNsPrefix),
+ false /*No TemplateKeyword*/, TypePtr);
}
/// Return the fully qualified type, including fully-qualified
diff --git a/tools/clang/unittests/Tooling/QualTypeNamesTest.cpp b/tools/clang/unittests/Tooling/QualTypeNamesTest.cpp
index b4c56f7bd5..e9ab495098 100644
--- a/tools/clang/unittests/Tooling/QualTypeNamesTest.cpp
+++ b/tools/clang/unittests/Tooling/QualTypeNamesTest.cpp
@@ -67,6 +67,10 @@ TEST(QualTypeNameTest, getFullyQualifiedName) {
diff -pur spack-src/clang/unittests/Tooling/QualTypeNamesTest.cpp spack-src-new/clang/unittests/Tooling/QualTypeNamesTest.cpp
--- spack-src/clang/unittests/Tooling/QualTypeNamesTest.cpp 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/unittests/Tooling/QualTypeNamesTest.cpp 2025-02-03 18:25:49.156686779 +0100
@@ -66,6 +66,10 @@ TEST(QualTypeNameTest, getFullyQualified
// Template parameter expansion.
Visitor.ExpectedQualTypeNames["CheckC"] =
"A::B::Template0<A::B::C::MyInt, A::B::AnotherClass>";
......@@ -54,16 +12,16 @@ index b4c56f7bd5..e9ab495098 100644
// Recursive template parameter expansion.
Visitor.ExpectedQualTypeNames["CheckD"] =
"A::B::Template0<A::B::Template1<A::B::C::MyInt, A::B::AnotherClass>, "
@@ -109,7 +113,7 @@ TEST(QualTypeNameTest, getFullyQualifiedName) {
" using InnerAlias = OuterTemplateClass<T>;\n"
@@ -111,7 +115,7 @@ TEST(QualTypeNameTest, getFullyQualified
" InnerAlias<int> AliasTypeVal;\n"
" InnerAlias<Class0>::Inner AliasInnerTypeVal;\n"
" }\n"
- " template<class X, class Y> class Template0;"
+ " template<class X, class Y> struct Template0 { typedef int nested; };"
" template<class X, class Y> class Template1;"
" typedef B::Class0 AnotherClass;\n"
" void Function1(Template0<C::MyInt,\n"
@@ -117,6 +121,8 @@ TEST(QualTypeNameTest, getFullyQualifiedName) {
@@ -119,6 +123,8 @@ TEST(QualTypeNameTest, getFullyQualified
" void Function2(Template0<Template1<C::MyInt, AnotherClass>,\n"
" Template0<int, long> > CheckD);\n"
" void Function3(const B::Class0* CheckM);\n"
......@@ -72,6 +30,3 @@ index b4c56f7bd5..e9ab495098 100644
" }\n"
"template<typename... Values> class Variadic {};\n"
"Variadic<int, B::Template0<int, char>, "
--
2.18.0
From e673a5527dd2df322884eb2498736483df05957d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johann=20Kl=C3=A4hn?= <johann@jklaehn.de>
Date: Fri, 3 Nov 2017 11:17:59 +0100
Subject: [PATCH 2/5] [libclang] Add support for obtaining fully qualified
names of types
This patch allows retrieving the fully qualified names of types
through libclang and clang.cindex (Python).
---
clang/bindings/python/clang/cindex.py | 13 +++++++++++
.../python/tests/cindex/test_cursor.py | 8 +++++++
clang/include/clang-c/Index.h | 10 ++++++++-
clang/tools/libclang/CMakeLists.txt | 1 +
clang/tools/libclang/CXType.cpp | 22 +++++++++++++++++++
clang/tools/libclang/libclang.exports | 1 +
6 files changed, 54 insertions(+), 1 deletion(-)
diff --git a/tools/clang/bindings/python/clang/cindex.py b/tools/clang/bindings/python/clang/cindex.py
index 8e5a9fe0068..c309f7017b2 100644
--- a/tools/clang/bindings/python/clang/cindex.py
+++ b/tools/clang/bindings/python/clang/cindex.py
@@ -2427,6 +2427,14 @@ class Type(Structure):
diff -pur spack-src/clang/bindings/python/clang/cindex.py spack-src-new/clang/bindings/python/clang/cindex.py
--- spack-src/clang/bindings/python/clang/cindex.py 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/bindings/python/clang/cindex.py 2025-02-03 18:35:08.767069975 +0100
@@ -2428,6 +2428,14 @@ class Type(Structure):
"""Retrieve the spelling of this Type."""
return conf.lib.clang_getTypeSpelling(self)
......@@ -35,21 +17,20 @@ index 8e5a9fe0068..c309f7017b2 100644
if type(other) != type(self):
return False
@@ -3869,6 +3877,11 @@ functionList = [
[Type],
_CXString,
_CXString.from_result),
+
+ ("clang_getFullyQualifiedTypeName",
+ [Type],
+ _CXString,
+ _CXString.from_result),
+
("clang_hashCursor",
[Cursor],
c_uint),
diff --git a/tools/clang/bindings/python/tests/cindex/test_cursor.py b/tools/clang/bindings/python/tests/cindex/test_cursor.py
index ef875e97247..6a53c7205df 100644
--- a/tools/clang/bindings/python/tests/cindex/test_cursor.py
+++ b/tools/clang/bindings/python/tests/cindex/test_cursor.py
diff -pur spack-src/clang/bindings/python/tests/cindex/test_cursor.py spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py
--- spack-src/clang/bindings/python/tests/cindex/test_cursor.py 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py 2025-02-03 18:35:08.767069975 +0100
@@ -316,6 +316,14 @@ class TestCursor(unittest.TestCase):
underlying = typedef.underlying_typedef_type
self.assertEqual(underlying.kind, TypeKind.INT)
......@@ -65,24 +46,22 @@ index ef875e97247..6a53c7205df 100644
def test_semantic_parent(self):
tu = get_tu(kParentTest, 'cpp')
curs = get_cursors(tu, 'f')
diff --git a/tools/clang/include/clang-c/Index.h b/tools/clang/include/clang-c/Index.h
index 74badac740b..b0c62fe948e 100644
--- a/tools/clang/include/clang-c/Index.h
+++ b/tools/clang/include/clang-c/Index.h
@@ -32,7 +32,7 @@
diff -pur spack-src/clang/include/clang-c/Index.h spack-src-new/clang/include/clang-c/Index.h
--- spack-src/clang/include/clang-c/Index.h 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/include/clang-c/Index.h 2025-02-03 18:35:52.971255790 +0100
@@ -33,7 +33,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
*/
#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 59
+#define CINDEX_VERSION_MINOR 60
-#define CINDEX_VERSION_MINOR 62
+#define CINDEX_VERSION_MINOR 63
#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
@@ -3389,6 +3389,14 @@ CINDEX_LINKAGE CXType clang_getCursorType(CXCursor C);
*/
#define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1))
@@ -3447,6 +3447,14 @@ CINDEX_LINKAGE CXType clang_getCursorTyp
CINDEX_LINKAGE CXString clang_getTypeSpelling(CXType CT);
+/**
/**
+ * Retrieve the fully qualified name of the underlying type.
+ * This includes full qualification of all template parameters etc.
+ *
......@@ -90,14 +69,14 @@ index 74badac740b..b0c62fe948e 100644
+ */
+CINDEX_LINKAGE CXString clang_getFullyQualifiedTypeName(CXType CT);
+
/**
+/**
* Retrieve the underlying type of a typedef declaration.
*
diff --git a/tools/clang/tools/libclang/CMakeLists.txt b/tools/clang/tools/libclang/CMakeLists.txt
index 613ead1a36b..a583fa206d1 100644
--- a/tools/clang/tools/libclang/CMakeLists.txt
+++ b/tools/clang/tools/libclang/CMakeLists.txt
@@ -43,6 +43,7 @@ set(LIBS
* If the cursor does not reference a typedef declaration, an invalid type is
diff -pur spack-src/clang/tools/libclang/CMakeLists.txt spack-src-new/clang/tools/libclang/CMakeLists.txt
--- spack-src/clang/tools/libclang/CMakeLists.txt 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/CMakeLists.txt 2025-02-03 18:35:11.263080474 +0100
@@ -52,6 +52,7 @@ set(LIBS
clangSema
clangSerialization
clangTooling
......@@ -105,10 +84,9 @@ index 613ead1a36b..a583fa206d1 100644
)
if (CLANG_ENABLE_ARCMT)
diff --git a/tools/clang/tools/libclang/CXType.cpp b/tools/clang/tools/libclang/CXType.cpp
index acecf87d0cd..afdeb467769 100644
--- a/tools/clang/tools/libclang/CXType.cpp
+++ b/tools/clang/tools/libclang/CXType.cpp
diff -pur spack-src/clang/tools/libclang/CXType.cpp spack-src-new/clang/tools/libclang/CXType.cpp
--- spack-src/clang/tools/libclang/CXType.cpp 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/CXType.cpp 2025-02-03 18:35:11.263080474 +0100
@@ -19,6 +19,7 @@
#include "clang/AST/DeclObjC.h"
#include "clang/AST/DeclTemplate.h"
......@@ -117,7 +95,7 @@ index acecf87d0cd..afdeb467769 100644
#include "clang/AST/Type.h"
#include "clang/Basic/AddressSpaces.h"
#include "clang/Frontend/ASTUnit.h"
@@ -302,6 +303,27 @@ CXString clang_getTypeSpelling(CXType CT) {
@@ -303,6 +304,27 @@ CXString clang_getTypeSpelling(CXType CT
return cxstring::createDup(OS.str());
}
......@@ -145,18 +123,14 @@ index acecf87d0cd..afdeb467769 100644
CXType clang_getTypedefDeclUnderlyingType(CXCursor C) {
using namespace cxcursor;
CXTranslationUnit TU = cxcursor::getCursorTU(C);
diff --git a/tools/clang/tools/libclang/libclang.exports b/tools/clang/tools/libclang/libclang.exports
index 3c76090d64f..6e860e7263e 100644
--- a/tools/clang/tools/libclang/libclang.exports
+++ b/tools/clang/tools/libclang/libclang.exports
@@ -241,6 +241,7 @@ clang_getFileLocation
clang_getFileName
clang_getFileTime
clang_getFileUniqueID
+clang_getFullyQualifiedTypeName
clang_getFunctionTypeCallingConv
clang_getIBOutletCollectionType
clang_getIncludedFile
--
2.23.0
diff -pur spack-src/clang/tools/libclang/libclang.map spack-src-new/clang/tools/libclang/libclang.map
--- spack-src/clang/tools/libclang/libclang.map 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/libclang.map 2025-02-03 18:36:14.531346336 +0100
@@ -303,6 +303,7 @@ LLVM_13 {
clang_getFileName;
clang_getFileTime;
clang_getFileUniqueID;
+ clang_getFullyQualifiedTypeName;
clang_getFunctionTypeCallingConv;
clang_getIBOutletCollectionType;
clang_getIncludedFile;
From 075a7a3e667fe3d923de6d7a6929e61922c8b139 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johann=20Kl=C3=A4hn?= <johann@jklaehn.de>
Date: Fri, 3 Nov 2017 21:19:51 +0100
Subject: [PATCH 3/5] [libclang] Add option to keep whitespace when tokenizing
Introduces new `clang_tokenizeRange` function which accepts options to control
tokenization behavior. `clang_tokenize` is kept for backwards compatibility.
---
clang/bindings/python/clang/cindex.py | 31 ++++++++++++++----
.../python/tests/cindex/test_cursor.py | 9 ++++++
clang/include/clang-c/Index.h | 32 +++++++++++++++++--
clang/tools/libclang/CIndex.cpp | 15 +++++++--
clang/tools/libclang/libclang.exports | 1 +
5 files changed, 75 insertions(+), 13 deletions(-)
diff --git a/tools/clang/bindings/python/clang/cindex.py b/clang/bindings/python/clang/cindex.py
index c309f7017b2..1589acc9e7e 100644
--- a/tools/clang/bindings/python/clang/cindex.py
+++ b/tools/clang/bindings/python/clang/cindex.py
diff -pur spack-src/clang/bindings/python/clang/cindex.py spack-src-new/clang/bindings/python/clang/cindex.py
--- spack-src/clang/bindings/python/clang/cindex.py 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/bindings/python/clang/cindex.py 2025-02-03 18:37:54.447765317 +0100
@@ -529,6 +529,13 @@ class TokenGroup(object):
You should not instantiate this class outside of this module.
......@@ -70,7 +54,7 @@ index c309f7017b2..1589acc9e7e 100644
def get_field_offsetof(self):
"""Returns the offsetof the FIELD_DECL pointed by this Cursor."""
@@ -3080,18 +3090,21 @@ class TranslationUnit(ClangObject):
@@ -3073,18 +3091,21 @@ class TranslationUnit(ClangObject):
return CodeCompletionResults(ptr)
return None
......@@ -94,7 +78,7 @@ index c309f7017b2..1589acc9e7e 100644
class File(ClangObject):
"""
@@ -3969,6 +3982,10 @@ functionList = [
@@ -3957,6 +3983,10 @@ functionList = [
("clang_tokenize",
[TranslationUnit, SourceRange, POINTER(POINTER(Token)), POINTER(c_uint)]),
......@@ -105,10 +89,9 @@ index c309f7017b2..1589acc9e7e 100644
("clang_visitChildren",
[Cursor, callbacks['cursor_visit'], py_object],
c_uint),
diff --git a/tools/clang/bindings/python/tests/cindex/test_cursor.py b/clang/bindings/python/tests/cindex/test_cursor.py
index 6a53c7205df..0965c1f4ae1 100644
--- a/tools/clang/bindings/python/tests/cindex/test_cursor.py
+++ b/tools/clang/bindings/python/tests/cindex/test_cursor.py
diff -pur spack-src/clang/bindings/python/tests/cindex/test_cursor.py spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py
--- spack-src/clang/bindings/python/tests/cindex/test_cursor.py 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py 2025-02-03 18:37:54.447765317 +0100
@@ -10,6 +10,7 @@ import unittest
from clang.cindex import AvailabilityKind
from clang.cindex import CursorKind
......@@ -117,7 +100,7 @@ index 6a53c7205df..0965c1f4ae1 100644
from clang.cindex import TranslationUnit
from clang.cindex import TypeKind
from .util import get_cursor
@@ -488,6 +489,14 @@ class TestCursor(unittest.TestCase):
@@ -480,6 +489,14 @@ class TestCursor(unittest.TestCase):
self.assertEqual(tokens[0].spelling, 'int')
self.assertEqual(tokens[1].spelling, 'foo')
......@@ -132,20 +115,19 @@ index 6a53c7205df..0965c1f4ae1 100644
def test_get_token_cursor(self):
"""Ensure we can map tokens to cursors."""
tu = get_tu('class A {}; int foo(A var = A());', lang='cpp')
diff --git a/tools/clang/include/clang-c/Index.h b/clang/include/clang-c/Index.h
index b0c62fe948e..84ed03b8920 100644
--- a/tools/clang/include/clang-c/Index.h
+++ b/tools/clang/include/clang-c/Index.h
@@ -32,7 +32,7 @@
diff -pur spack-src/clang/include/clang-c/Index.h spack-src-new/clang/include/clang-c/Index.h
--- spack-src/clang/include/clang-c/Index.h 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/include/clang-c/Index.h 2025-02-03 18:38:17.919863604 +0100
@@ -33,7 +33,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
*/
#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 60
+#define CINDEX_VERSION_MINOR 61
-#define CINDEX_VERSION_MINOR 63
+#define CINDEX_VERSION_MINOR 64
#define CINDEX_VERSION_ENCODE(major, minor) ( \
((major) * 10000) \
@@ -4969,6 +4969,28 @@ CINDEX_LINKAGE CXSourceLocation clang_getTokenLocation(CXTranslationUnit,
#define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1))
@@ -5036,6 +5044,28 @@ CINDEX_LINKAGE CXSourceLocation clang_ge
*/
CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
......@@ -174,7 +156,7 @@ index b0c62fe948e..84ed03b8920 100644
/**
* Tokenize the source code described by the given range into raw
* lexical tokens.
@@ -4985,9 +5007,13 @@ CINDEX_LINKAGE CXSourceRange clang_getTokenExtent(CXTranslationUnit, CXToken);
@@ -5052,9 +5082,13 @@ CINDEX_LINKAGE CXSourceRange clang_getTo
* \param NumTokens will be set to the number of tokens in the \c *Tokens
* array.
*
......@@ -190,22 +172,21 @@ index b0c62fe948e..84ed03b8920 100644
/**
* Annotate the given set of tokens by providing cursors for each token
diff --git a/tools/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 1dc961f58a2..3a283e76ed8 100644
--- a/tools/clang/tools/libclang/CIndex.cpp
+++ b/tools/clang/tools/libclang/CIndex.cpp
@@ -6670,7 +6670,7 @@ CXSourceRange clang_getTokenExtent(CXTranslationUnit TU, CXToken CXTok) {
diff -pur spack-src/clang/tools/libclang/CIndex.cpp spack-src-new/clang/tools/libclang/CIndex.cpp
--- spack-src/clang/tools/libclang/CIndex.cpp 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/CIndex.cpp 2025-02-03 18:37:55.855771214 +0100
@@ -6882,7 +6882,7 @@ CXSourceRange clang_getTokenExtent(CXTra
}
static void getTokens(ASTUnit *CXXUnit, SourceRange Range,
- SmallVectorImpl<CXToken> &CXTokens) {
+ SmallVectorImpl<CXToken> &CXTokens, unsigned options) {
SourceManager &SourceMgr = CXXUnit->getSourceManager();
std::pair<FileID, unsigned> BeginLocInfo
= SourceMgr.getDecomposedSpellingLoc(Range.getBegin());
@@ -6692,6 +6692,9 @@ static void getTokens(ASTUnit *CXXUnit, SourceRange Range,
CXXUnit->getASTContext().getLangOpts(),
Buffer.begin(), Buffer.data() + BeginLocInfo.second, Buffer.end());
std::pair<FileID, unsigned> BeginLocInfo =
SourceMgr.getDecomposedSpellingLoc(Range.getBegin());
@@ -6903,6 +6903,9 @@ static void getTokens(ASTUnit *CXXUnit,
CXXUnit->getASTContext().getLangOpts(), Buffer.begin(),
Buffer.data() + BeginLocInfo.second, Buffer.end());
Lex.SetCommentRetentionState(true);
+ if (options & CXTokenize_KeepWhitespace) {
+ Lex.SetKeepWhitespaceMode(true);
......@@ -213,8 +194,8 @@ index 1dc961f58a2..3a283e76ed8 100644
// Lex tokens until we hit the end of the range.
const char *EffectiveBufferEnd = Buffer.data() + EndLocInfo.second;
@@ -6765,7 +6768,7 @@ CXToken *clang_getToken(CXTranslationUnit TU, CXSourceLocation Location) {
SourceLocation End = SM.getComposedLoc(DecomposedEnd.first, DecomposedEnd.second);
@@ -6973,7 +6976,7 @@ CXToken *clang_getToken(CXTranslationUni
SM.getComposedLoc(DecomposedEnd.first, DecomposedEnd.second);
SmallVector<CXToken, 32> CXTokens;
- getTokens(CXXUnit, SourceRange(Begin, End), CXTokens);
......@@ -222,20 +203,20 @@ index 1dc961f58a2..3a283e76ed8 100644
if (CXTokens.empty())
return NULL;
@@ -6779,6 +6782,12 @@ CXToken *clang_getToken(CXTranslationUnit TU, CXSourceLocation Location) {
@@ -6987,6 +6990,12 @@ CXToken *clang_getToken(CXTranslationUni
void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
CXToken **Tokens, unsigned *NumTokens) {
void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range, CXToken **Tokens,
unsigned *NumTokens) {
+ return clang_tokenizeRange(TU, Range, Tokens, NumTokens, CXTokenize_None);
+}
+
+void clang_tokenizeRange(CXTranslationUnit TU, CXSourceRange Range,
+ CXToken **Tokens, unsigned *NumTokens,
+ unsigned options) {
LOG_FUNC_SECTION {
*Log << TU << ' ' << Range;
}
@@ -6804,7 +6813,7 @@ void clang_tokenize(CXTranslationUnit TU, CXSourceRange Range,
LOG_FUNC_SECTION { *Log << TU << ' ' << Range; }
if (Tokens)
@@ -7010,7 +7019,7 @@ void clang_tokenize(CXTranslationUnit TU
return;
SmallVector<CXToken, 32> CXTokens;
......@@ -244,18 +225,14 @@ index 1dc961f58a2..3a283e76ed8 100644
if (CXTokens.empty())
return;
diff --git a/tools/clang/tools/libclang/libclang.exports b/clang/tools/libclang/libclang.exports
index 6e860e7263e..6af6c0ca3e8 100644
--- a/tools/clang/tools/libclang/libclang.exports
+++ b/tools/clang/tools/libclang/libclang.exports
@@ -338,6 +338,7 @@ clang_suspendTranslationUnit
clang_sortCodeCompletionResults
clang_toggleCrashRecovery
clang_tokenize
+clang_tokenizeRange
clang_CompilationDatabase_fromDirectory
clang_CompilationDatabase_dispose
clang_CompilationDatabase_getCompileCommands
--
2.23.0
diff -pur spack-src/clang/tools/libclang/libclang.map spack-src-new/clang/tools/libclang/libclang.map
--- spack-src/clang/tools/libclang/libclang.map 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/libclang.map 2025-02-03 18:38:37.647946177 +0100
@@ -398,6 +399,7 @@ LLVM_13 {
clang_suspendTranslationUnit;
clang_toggleCrashRecovery;
clang_tokenize;
+ clang_tokenizeRange;
clang_uninstall_llvm_fatal_error_handler;
clang_visitChildren;
clang_visitChildrenWithBlock;
From c7701fe91022a116e0a37f410e70fe8906f56441 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Johann=20Kl=C3=A4hn?= <johann.klaehn@kip.uni-heidelberg.de>
Date: Mon, 17 Jul 2017 12:25:49 +0200
Subject: [PATCH 11/12] [libclang] Allow visiting of implicit declarations and
template instantiations (WIP!)
---
bindings/python/clang/cindex.py | 45 +++++++++--
bindings/python/tests/cindex/test_cursor.py | 33 ++++++++
include/clang-c/Index.h | 31 ++++++++
tools/libclang/CIndex.cpp | 112 ++++++++++++++++++++++++++--
tools/libclang/CursorVisitor.h | 12 ++-
tools/libclang/libclang.exports | 2 +
6 files changed, 219 insertions(+), 16 deletions(-)
diff --git a/tools/clang/bindings/python/clang/cindex.py b/tools/clang/bindings/python/clang/cindex.py
index b21f2b75f2..2416fd1803 100644
--- a/tools/clang/bindings/python/clang/cindex.py
+++ b/tools/clang/bindings/python/clang/cindex.py
@@ -1407,6 +1407,15 @@ class Cursor(Structure):
diff -pur spack-src/clang/bindings/python/clang/cindex.py spack-src-new/clang/bindings/python/clang/cindex.py
--- spack-src/clang/bindings/python/clang/cindex.py 2025-02-03 18:51:43.871219854 +0100
+++ spack-src-new/clang/bindings/python/clang/cindex.py 2025-02-03 18:39:41.616213701 +0100
@@ -1426,6 +1426,15 @@ class Cursor(Structure):
"""
_fields_ = [("_kind_id", c_int), ("xdata", c_int), ("data", c_void_p * 3)]
......@@ -33,7 +17,7 @@ index b21f2b75f2..2416fd1803 100644
@staticmethod
def from_location(tu, location):
# We store a reference to the TU in the instance so the TU won't get
@@ -1496,6 +1505,10 @@ class Cursor(Structure):
@@ -1515,6 +1524,10 @@ class Cursor(Structure):
"""
return conf.lib.clang_EnumDecl_isScoped(self)
......@@ -44,7 +28,7 @@ index b21f2b75f2..2416fd1803 100644
def get_definition(self):
"""
If the cursor is a reference to a declaration or a declaration of
@@ -1790,8 +1803,12 @@ class Cursor(Structure):
@@ -1831,8 +1844,12 @@ class Cursor(Structure):
"""Returns the value of the indicated arg as an unsigned 64b integer."""
return conf.lib.clang_Cursor_getTemplateArgumentUnsignedValue(self, num)
......@@ -59,7 +43,7 @@ index b21f2b75f2..2416fd1803 100644
# FIXME: Expose iteration from CIndex, PR6125.
def visitor(child, parent, children):
@@ -1804,18 +1821,24 @@ class Cursor(Structure):
@@ -1845,18 +1862,24 @@ class Cursor(Structure):
children.append(child)
return 1 # continue
children = []
......@@ -89,7 +73,7 @@ index b21f2b75f2..2416fd1803 100644
yield descendant
def get_tokens(self, options=0):
@@ -3840,6 +3863,10 @@ functionList = [
@@ -3928,6 +3951,10 @@ functionList = [
[Type],
bool),
......@@ -100,7 +84,7 @@ index b21f2b75f2..2416fd1803 100644
("clang_isInvalid",
[CursorKind],
bool),
@@ -3903,6 +3930,10 @@ functionList = [
@@ -3991,6 +4018,10 @@ functionList = [
[Cursor, callbacks['cursor_visit'], py_object],
c_uint),
......@@ -111,55 +95,153 @@ index b21f2b75f2..2416fd1803 100644
("clang_Cursor_getNumArguments",
[Cursor],
c_int),
diff --git a/tools/clang/bindings/python/tests/cindex/test_cursor.py b/tools/clang/bindings/python/tests/cindex/test_cursor.py
index 6c20577302..43606b605c 100644
--- a/tools/clang/bindings/python/tests/cindex/test_cursor.py
+++ b/tools/clang/bindings/python/tests/cindex/test_cursor.py
@@ -70,6 +70,39 @@ def test_get_children():
assert tu_nodes[2].displayname == 'f0(int, int)'
assert tu_nodes[2].is_definition() == True
+def test_get_children_with_implicit():
+ tu = get_tu('struct X {}; X x;', lang='cpp')
+ cursor = get_cursor(tu, 'X')
+
+ children = list(cursor.get_children())
+ assert len(children) == 0
+
+ children = list(cursor.get_children(with_implicit=True))
+ assert len(children) > 0
+ for child in children:
+ assert child.is_implicit()
+ assert child.spelling == "X"
+ assert child.kind in [CursorKind.CONSTRUCTOR, CursorKind.STRUCT_DECL]
+
+def test_get_children_with_template_instantiations():
+ tu = get_tu(
+ 'template <typename T> T frobnicate(T val);'
+ 'extern template int frobnicate<int>(int);',
+ lang='cpp')
+ cursor = get_cursor(tu, 'frobnicate')
+ assert cursor.kind == CursorKind.FUNCTION_TEMPLATE
+
+ for child in cursor.get_children():
+ # should not return an instantiation:
+ assert child.kind != CursorKind.FUNCTION_DECL
+
+ for child in cursor.get_children(with_template_instantiations=True):
+ if child.kind == CursorKind.FUNCTION_DECL:
+ assert child.spelling == 'frobnicate'
+ break
+ else:
+ assert False, "Couldn't find template instantiation"
+
def test_references():
"""Ensure that references to TranslationUnit are kept."""
tu = get_tu('int x;')
diff --git a/tools/clang/include/clang-c/Index.h b/tools/clang/include/clang-c/Index.h
index 7fd17366ee..abe70e9566 100644
--- a/tools/clang/include/clang-c/Index.h
+++ b/tools/clang/include/clang-c/Index.h
@@ -2670,6 +2670,11 @@ CINDEX_LINKAGE unsigned clang_isPreprocessing(enum CXCursorKind);
diff -pur spack-src/clang/bindings/python/clang/cindex.py.orig spack-src-new/clang/bindings/python/clang/cindex.py.orig
--- spack-src/clang/bindings/python/clang/cindex.py.orig 2025-02-03 18:51:19.639119257 +0100
+++ spack-src-new/clang/bindings/python/clang/cindex.py.orig 2025-02-03 18:37:54.447765317 +0100
@@ -529,6 +529,13 @@ class TokenGroup(object):
You should not instantiate this class outside of this module.
"""
+
+ # Default tokenization mode.
+ TOKENIZE_NONE = 0
+
+ # Used to indicate that tokens for whitespace should be returned.
+ TOKENIZE_KEEP_WHITESPACE = 1
+
def __init__(self, tu, memory, count):
self._tu = tu
self._memory = memory
@@ -538,7 +545,7 @@ class TokenGroup(object):
conf.lib.clang_disposeTokens(self._tu, self._memory, self._count)
@staticmethod
- def get_tokens(tu, extent):
+ def get_tokens(tu, extent, options=0):
"""Helper method to return all tokens in an extent.
This functionality is needed multiple places in this module. We define
@@ -547,8 +554,8 @@ class TokenGroup(object):
tokens_memory = POINTER(Token)()
tokens_count = c_uint()
- conf.lib.clang_tokenize(tu, extent, byref(tokens_memory),
- byref(tokens_count))
+ conf.lib.clang_tokenizeRange(
+ tu, extent, byref(tokens_memory), byref(tokens_count), options)
count = int(tokens_count.value)
@@ -1852,13 +1859,16 @@ class Cursor(Structure):
for descendant in child.walk_preorder():
yield descendant
- def get_tokens(self):
+ def get_tokens(self, options=0):
"""Obtain Token instances formulating that compose this Cursor.
This is a generator for Token instances. It returns all tokens which
occupy the extent this cursor occupies.
+
+ options is a bitwise or of TokenGroup.TOKENIZE_XXX flags which will
+ control tokenization behavior.
"""
- return TokenGroup.get_tokens(self._tu, self.extent)
+ return TokenGroup.get_tokens(self._tu, self.extent, options)
def get_field_offsetof(self):
"""Returns the offsetof the FIELD_DECL pointed by this Cursor."""
@@ -3081,18 +3091,21 @@ class TranslationUnit(ClangObject):
return CodeCompletionResults(ptr)
return None
- def get_tokens(self, locations=None, extent=None):
+ def get_tokens(self, locations=None, extent=None, options=0):
"""Obtain tokens in this translation unit.
This is a generator for Token instances. The caller specifies a range
of source code to obtain tokens for. The range can be specified as a
2-tuple of SourceLocation or as a SourceRange. If both are defined,
behavior is undefined.
+
+ options is a bitwise or of TokenGroup.TOKENIZE_XXX flags which will
+ control tokenization behavior.
"""
if locations is not None:
extent = SourceRange(start=locations[0], end=locations[1])
- return TokenGroup.get_tokens(self, extent)
+ return TokenGroup.get_tokens(self, extent, options)
class File(ClangObject):
"""
@@ -3970,6 +3983,10 @@ functionList = [
("clang_tokenize",
[TranslationUnit, SourceRange, POINTER(POINTER(Token)), POINTER(c_uint)]),
+ ("clang_tokenizeRange",
+ [TranslationUnit, SourceRange, POINTER(POINTER(Token)), POINTER(c_uint),
+ c_uint]),
+
("clang_visitChildren",
[Cursor, callbacks['cursor_visit'], py_object],
c_uint),
diff -pur spack-src/clang/bindings/python/tests/cindex/test_cursor.py spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py
--- spack-src/clang/bindings/python/tests/cindex/test_cursor.py 2025-02-03 18:51:43.871219854 +0100
+++ spack-src-new/clang/bindings/python/tests/cindex/test_cursor.py 2025-02-03 18:39:41.616213701 +0100
@@ -94,6 +94,39 @@ class TestCursor(unittest.TestCase):
self.assertEqual(tu_nodes[2].displayname, 'f0(int, int)')
self.assertEqual(tu_nodes[2].is_definition(), True)
+ def test_get_children_with_implicit():
+ tu = get_tu('struct X {}; X x;', lang='cpp')
+ cursor = get_cursor(tu, 'X')
+
+ children = list(cursor.get_children())
+ self.assertEqual(len(children), 0, [(c.kind, c.spelling) for c in children])
+
+ children = list(cursor.get_children(with_implicit=True))
+ self.assertNotEqual(len(children), 0)
+ for child in children:
+ self.assertTrue(child.is_implicit())
+ self.assertEqual(child.spelling, "X")
+ self.assertIn(child.kind, [CursorKind.CONSTRUCTOR, CursorKind.STRUCT_DECL])
+
+ def test_get_children_with_template_instantiations():
+ tu = get_tu(
+ 'template <typename T> T frobnicate(T val);'
+ 'extern template int frobnicate<int>(int);',
+ lang='cpp')
+ cursor = get_cursor(tu, 'frobnicate')
+ self.assertEqual(cursor.kind, CursorKind.FUNCTION_TEMPLATE)
+
+ for child in cursor.get_children():
+ # should not return an instantiation:
+ self.assertNotEqual(child.kind, CursorKind.FUNCTION_DECL)
+
+ for child in cursor.get_children(with_template_instantiations=True):
+ if child.kind == CursorKind.FUNCTION_DECL:
+ self.assertEqual(child.spelling, 'frobnicate')
+ break
+ else:
+ self.fail("Couldn't find template instantiation")
+
def test_references(self):
"""Ensure that references to TranslationUnit are kept."""
tu = get_tu('int x;')
diff -pur spack-src/clang/include/clang-c/Index.h spack-src-new/clang/include/clang-c/Index.h
--- spack-src/clang/include/clang-c/Index.h 2025-02-03 18:51:43.871219854 +0100
+++ spack-src-new/clang/include/clang-c/Index.h 2025-02-03 18:40:48.276492163 +0100
@@ -33,7 +33,7 @@
* compatible, thus CINDEX_VERSION_MAJOR is expected to remain stable.
*/
#define CINDEX_VERSION_MAJOR 0
-#define CINDEX_VERSION_MINOR 64
+#define CINDEX_VERSION_MINOR 65
#define CINDEX_VERSION_ENCODE(major, minor) (((major)*10000) + ((minor)*1))
@@ -2817,6 +2817,11 @@ CINDEX_LINKAGE unsigned clang_isPreproce
*/
CINDEX_LINKAGE unsigned clang_isUnexposed(enum CXCursorKind);
......@@ -169,10 +251,10 @@ index 7fd17366ee..abe70e9566 100644
+CINDEX_LINKAGE unsigned clang_isImplicit(CXCursor);
+
/**
* \brief Describe the linkage of the entity referred to by a cursor.
* Describe the linkage of the entity referred to by a cursor.
*/
@@ -3961,6 +3966,32 @@ CINDEX_LINKAGE unsigned clang_visitChildrenWithBlock(CXCursor parent,
# endif
@@ -4274,6 +4279,32 @@ clang_visitChildrenWithBlock(CXCursor pa
#endif
#endif
+typedef enum {
......@@ -204,19 +286,16 @@ index 7fd17366ee..abe70e9566 100644
/**
* @}
*/
diff --git a/tools/clang/tools/libclang/CIndex.cpp b/tools/clang/tools/libclang/CIndex.cpp
index 27f74b2aa2..f32611b8d7 100644
--- a/tools/clang/tools/libclang/CIndex.cpp
+++ b/tools/clang/tools/libclang/CIndex.cpp
@@ -192,10 +192,11 @@ bool CursorVisitor::Visit(CXCursor Cursor, bool CheckedRegionOfInterest) {
assert(0 && "Invalid declaration cursor");
diff -pur spack-src/clang/tools/libclang/CIndex.cpp spack-src-new/clang/tools/libclang/CIndex.cpp
--- spack-src/clang/tools/libclang/CIndex.cpp 2025-02-03 18:51:43.871219854 +0100
+++ spack-src-new/clang/tools/libclang/CIndex.cpp 2025-02-03 18:39:43.000219486 +0100
@@ -203,9 +203,10 @@ bool CursorVisitor::Visit(CXCursor Curso
return true; // abort.
}
-
- // Ignore implicit declarations, unless it's an objc method because
- // currently we should report implicit methods for properties when indexing.
- if (D->isImplicit() && !isa<ObjCMethodDecl>(D))
+
+ // Unless instructed otherwise we ignore implicit declarations.
+ // ObjC methods are currently visited in any case, because implicit methods
+ // for properties should be reported when indexing.
......@@ -224,10 +303,10 @@ index 27f74b2aa2..f32611b8d7 100644
return false;
}
@@ -700,10 +701,13 @@ bool CursorVisitor::VisitTagDecl(TagDecl *D) {
@@ -713,10 +714,13 @@ bool CursorVisitor::VisitTagDecl(TagDecl
bool CursorVisitor::VisitClassTemplateSpecializationDecl(
ClassTemplateSpecializationDecl *D) {
ClassTemplateSpecializationDecl *D) {
- bool ShouldVisitBody = false;
+ bool ShouldVisitBody = VisitTemplateInstantiations;
switch (D->getSpecializationKind()) {
......@@ -239,19 +318,19 @@ index 27f74b2aa2..f32611b8d7 100644
+ case TSK_Undeclared:
// Nothing to visit
return false;
@@ -712,6 +716,7 @@ bool CursorVisitor::VisitClassTemplateSpecializationDecl(
@@ -725,6 +729,7 @@ bool CursorVisitor::VisitClassTemplateSp
break;
case TSK_ExplicitSpecialization:
+ // Always visit body of explicit specializations
ShouldVisitBody = true;
break;
}
@@ -908,7 +913,31 @@ bool CursorVisitor::VisitFunctionTemplateDecl(FunctionTemplateDecl *D) {
@@ -945,7 +950,31 @@ bool CursorVisitor::VisitFunctionTemplat
return true;
auto* FD = D->getTemplatedDecl();
auto *FD = D->getTemplatedDecl();
- return VisitAttributes(FD) || VisitFunctionDecl(FD);
+ if (VisitAttributes(FD) || VisitFunctionDecl(FD))
+ return true;
......@@ -281,11 +360,10 @@ index 27f74b2aa2..f32611b8d7 100644
}
bool CursorVisitor::VisitClassTemplateDecl(ClassTemplateDecl *D) {
@@ -918,7 +947,40 @@ bool CursorVisitor::VisitClassTemplateDecl(ClassTemplateDecl *D) {
return true;
auto* CD = D->getTemplatedDecl();
- return VisitAttributes(CD) || VisitCXXRecordDecl(CD);
@@ -956,6 +985,40 @@ bool CursorVisitor::VisitClassTemplateDe
auto *CD = D->getTemplatedDecl();
return VisitAttributes(CD) || VisitCXXRecordDecl(CD);
+ if (VisitAttributes(CD) || VisitCXXRecordDecl(CD))
+ return true;
+
......@@ -323,7 +401,7 @@ index 27f74b2aa2..f32611b8d7 100644
}
bool CursorVisitor::VisitTemplateTemplateParmDecl(TemplateTemplateParmDecl *D) {
@@ -4314,6 +4376,24 @@ unsigned clang_visitChildrenWithBlock(CXCursor parent,
@@ -4596,6 +4659,24 @@ unsigned clang_visitChildrenWithBlock(CX
return clang_visitChildren(parent, visitWithBlock, block);
}
......@@ -348,7 +426,7 @@ index 27f74b2aa2..f32611b8d7 100644
static CXString getDeclSpelling(const Decl *D) {
if (!D)
return cxstring::createEmpty();
@@ -5402,6 +5482,22 @@ unsigned clang_isUnexposed(enum CXCursorKind K) {
@@ -5983,6 +6064,22 @@ unsigned clang_isUnexposed(enum CXCursor
}
}
......@@ -368,14 +446,13 @@ index 27f74b2aa2..f32611b8d7 100644
+ return D->isImplicit();
+}
+
CXCursorKind clang_getCursorKind(CXCursor C) {
return C.kind;
}
diff --git a/tools/clang/tools/libclang/CursorVisitor.h b/tools/clang/tools/libclang/CursorVisitor.h
index 82f251a348..c659e866ef 100644
--- a/tools/clang/tools/libclang/CursorVisitor.h
+++ b/tools/clang/tools/libclang/CursorVisitor.h
@@ -96,6 +96,12 @@ private:
CXCursorKind clang_getCursorKind(CXCursor C) { return C.kind; }
CXSourceLocation clang_getCursorLocation(CXCursor C) {
diff -pur spack-src/clang/tools/libclang/CursorVisitor.h spack-src-new/clang/tools/libclang/CursorVisitor.h
--- spack-src/clang/tools/libclang/CursorVisitor.h 2022-01-20 22:31:59.000000000 +0100
+++ spack-src-new/clang/tools/libclang/CursorVisitor.h 2025-02-03 18:39:43.000219486 +0100
@@ -104,6 +104,12 @@ private:
/// record entries.
bool VisitDeclsOnly;
......@@ -388,7 +465,7 @@ index 82f251a348..c659e866ef 100644
// FIXME: Eventually remove. This part of a hack to support proper
// iteration over all Decls contained lexically within an ObjC container.
DeclContext::decl_iterator *DI_current;
@@ -147,7 +153,9 @@ public:
@@ -152,12 +158,16 @@ public:
bool VisitIncludedPreprocessingEntries = false,
SourceRange RegionOfInterest = SourceRange(),
bool VisitDeclsOnly = false,
......@@ -396,38 +473,32 @@ index 82f251a348..c659e866ef 100644
+ PostChildrenVisitorTy PostChildrenVisitor = nullptr,
+ bool VisitImplicitDeclarations = false,
+ bool VisitTemplateInstantiations = false)
: TU(TU), AU(cxtu::getASTUnit(TU)),
Visitor(Visitor), PostChildrenVisitor(PostChildrenVisitor),
ClientData(ClientData),
@@ -155,6 +163,8 @@ public:
VisitIncludedEntities(VisitIncludedPreprocessingEntries),
RegionOfInterest(RegionOfInterest),
VisitDeclsOnly(VisitDeclsOnly),
+ VisitImplicitDeclarations(VisitImplicitDeclarations),
+ VisitTemplateInstantiations(VisitTemplateInstantiations),
DI_current(nullptr), FileDI_current(nullptr)
{
: TU(TU), AU(cxtu::getASTUnit(TU)), Visitor(Visitor),
PostChildrenVisitor(PostChildrenVisitor), ClientData(ClientData),
VisitPreprocessorLast(VisitPreprocessorLast),
VisitIncludedEntities(VisitIncludedPreprocessingEntries),
RegionOfInterest(RegionOfInterest), VisitDeclsOnly(VisitDeclsOnly),
+ VisitImplicitDeclarations(VisitImplicitDeclarations),
+ VisitTemplateInstantiations(VisitTemplateInstantiations),
DI_current(nullptr), FileDI_current(nullptr) {
Parent.kind = CXCursor_NoDeclFound;
diff --git a/tools/clang/tools/libclang/libclang.exports b/tools/clang/tools/libclang/libclang.exports
index b8e3df23ef..59c46ae09e 100644
--- a/tools/clang/tools/libclang/libclang.exports
+++ b/tools/clang/tools/libclang/libclang.exports
@@ -291,6 +291,7 @@ clang_isDeclaration
clang_isExpression
clang_isFileMultipleIncludeGuarded
clang_isFunctionTypeVariadic
+clang_isImplicit
clang_isInvalid
clang_isPODType
clang_isPreprocessing
@@ -332,6 +333,7 @@ clang_CompileCommand_getNumArgs
clang_CompileCommand_getArg
clang_visitChildren
clang_visitChildrenWithBlock
+clang_visitChildrenWithOptions
clang_ModuleMapDescriptor_create
clang_ModuleMapDescriptor_dispose
clang_ModuleMapDescriptor_setFrameworkModuleName
--
2.13.0
Parent.data[0] = nullptr;
diff -pur spack-src/clang/tools/libclang/libclang.map spack-src-new/clang/tools/libclang/libclang.map
--- spack-src/clang/tools/libclang/libclang.map 2025-02-03 18:51:43.871219854 +0100
+++ spack-src-new/clang/tools/libclang/libclang.map 2025-02-03 18:40:21.600380765 +0100
@@ -375,6 +375,7 @@ LLVM_13 {
clang_isExpression;
clang_isFileMultipleIncludeGuarded;
clang_isFunctionTypeVariadic;
+ clang_isImplicit;
clang_isInvalid;
clang_isInvalidDeclaration;
clang_isPODType;
@@ -403,6 +404,7 @@ LLVM_13 {
clang_uninstall_llvm_fatal_error_handler;
clang_visitChildren;
clang_visitChildrenWithBlock;
+ clang_visitChildrenWithOptions;
local: *;
};
--- spack-src/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake.org 2022-02-08 14:58:13.000000000 +0900
+++ spack-src/openmp/libomptarget/cmake/Modules/LibomptargetGetDependencies.cmake 2022-02-08 13:58:53.000000000 +0900
@@ -276,4 +276,5 @@
endif()
endif()
-set(OPENMP_PTHREAD_LIB ${LLVM_PTHREAD_LIB})
+find_package(Threads REQUIRED)
+set(OPENMP_PTHREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
--- spack-src/openmp/libomptarget/src/CMakeLists.txt.org 2022-02-09 08:49:35.000000000 +0900
+++ spack-src/openmp/libomptarget/src/CMakeLists.txt 2022-02-09 08:50:18.000000000 +0900
@@ -36,6 +36,7 @@
endif()
target_link_libraries(omptarget PRIVATE
${CMAKE_DL_LIBS}
+ ${OPENMP_PTHREAD_LIB}
"-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports")
# Install libomptarget under the lib destination folder.
--- spack-src/libcxx/include/__config.org 2022-02-03 14:36:11.000000000 +0900
+++ spack-src/libcxx/include/__config 2022-02-04 08:39:59.000000000 +0900
@@ -52,7 +52,11 @@
# elif __cplusplus <= 201703L
# define _LIBCPP_STD_VER 17
# elif __cplusplus <= 202002L
-# define _LIBCPP_STD_VER 20
+# if defined(__FUJITSU) || defined(__CLANG_FUJITSU)
+# define _LIBCPP_STD_VER 17
+# else
+# define _LIBCPP_STD_VER 20
+# endif
# else
# define _LIBCPP_STD_VER 21 // current year, or date of c++2b ratification
# endif
diff -pur spack-src/clang/include/clang/Tooling/CommonOptionsParser.h spack-src-new/clang/include/clang/Tooling/CommonOptionsParser.h
--- spack-src/clang/include/clang/Tooling/CommonOptionsParser.h 2025-02-17 12:35:27.296733912 +0100
+++ spack-src-new/clang/include/clang/Tooling/CommonOptionsParser.h 2025-02-17 12:35:59.393070972 +0100
@@ -64,7 +64,7 @@ namespace tooling {
/// \endcode
class CommonOptionsParser {
-protected:
+public:
/// Parses command-line, initializes a compilation database.
///
/// This constructor can change argc and argv contents, e.g. consume
This diff is collapsed.