Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package clang-extract for openSUSE:Factory checked in at 2024-07-22 17:17:25 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/clang-extract (Old) and /work/SRC/openSUSE:Factory/.clang-extract.new.17339 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "clang-extract" Mon Jul 22 17:17:25 2024 rev:6 rq:1188956 version:0~20240721.9b2dfb6 Changes: -------- --- /work/SRC/openSUSE:Factory/clang-extract/clang-extract.changes 2024-07-15 19:50:00.925312737 +0200 +++ /work/SRC/openSUSE:Factory/.clang-extract.new.17339/clang-extract.changes 2024-07-22 17:18:50.671290940 +0200 @@ -1,0 +2,14 @@ +Mon Jul 22 08:27:55 UTC 2024 - mvet...@suse.com + +- Update to version 0~20240721.9b2dfb6: + * Remove the EnumConstantTable + +------------------------------------------------------------------- +Sat Jul 20 06:18:05 UTC 2024 - mvet...@suse.com + +- Update to version 0~20240720.6054fa3: + * Fix nested struct being discarded if parent struct is flagged as partial + * Fix __builtin_convertvector escaping the closure + * Fix dropped attributes from vector types + +------------------------------------------------------------------- Old: ---- clang-extract-0~20240714.17e3908.tar.xz New: ---- clang-extract-0~20240721.9b2dfb6.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ clang-extract.spec ++++++ --- /var/tmp/diff_new_pack.joIyAS/_old 2024-07-22 17:18:51.275315227 +0200 +++ /var/tmp/diff_new_pack.joIyAS/_new 2024-07-22 17:18:51.279315387 +0200 @@ -17,7 +17,7 @@ Name: clang-extract -Version: 0~20240714.17e3908 +Version: 0~20240721.9b2dfb6 Release: 0 Summary: A tool to extract code content from source files License: Apache-2.0 WITH LLVM-exception AND NCSA ++++++ _service ++++++ --- /var/tmp/diff_new_pack.joIyAS/_old 2024-07-22 17:18:51.307316513 +0200 +++ /var/tmp/diff_new_pack.joIyAS/_new 2024-07-22 17:18:51.311316675 +0200 @@ -2,7 +2,7 @@ <service name="tar_scm" mode="manual"> <param name="scm">git</param> <param name="url">https://github.com/SUSE/clang-extract</param> - <param name="revision">17e39080348d8cd6598e84ad3610c1f913395432</param> + <param name="revision">9b2dfb68740ef30742f6afcf58e7e160958316d9</param> <param name="versionformat">0~%cd.%h</param> <param name="changesgenerate">enable</param> <param name="changesauthor">mvet...@suse.com</param> ++++++ clang-extract-0~20240714.17e3908.tar.xz -> clang-extract-0~20240721.9b2dfb6.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/Closure.hh new/clang-extract-0~20240721.9b2dfb6/libcextract/Closure.hh --- old/clang-extract-0~20240714.17e3908/libcextract/Closure.hh 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/Closure.hh 2024-07-21 18:49:09.000000000 +0200 @@ -21,7 +21,6 @@ #include <clang/AST/RecursiveASTVisitor.h> #include <unordered_set> -#include "EnumConstTbl.hh" #include "LLVMMisc.hh" using namespace clang; @@ -134,8 +133,7 @@ public: DeclClosureVisitor(ASTUnit *ast) : RecursiveASTVisitor(), - AST(ast), - EnumTable(ast) + AST(ast) { } @@ -195,18 +193,14 @@ return VISITOR_CONTINUE /* Special Traversal functions which marks if a Decl was already analyzed. - This macro generates them. */ -#define DEF_MARKING_TRAVERSE_DECL(DECL) \ - bool Traverse##DECL(DECL *decl) \ - { \ - DO_NOT_RUN_IF_ALREADY_ANALYZED(decl); \ - Mark_As_Analyzed(decl); \ - return RecursiveASTVisitor::Traverse##DECL(decl); \ - } - - /* Override of TraverseDecl that marks that the given Decl was analyzed. So + Override of TraverseDecl that marks that the given Decl was analyzed. So far it seems we only need this function for now. */ - DEF_MARKING_TRAVERSE_DECL(Decl); + bool TraverseDecl(Decl *decl) + { + DO_NOT_RUN_IF_ALREADY_ANALYZED(decl); + Mark_As_Analyzed(decl); + return RecursiveASTVisitor::TraverseDecl(decl); + } /* -------- C Declarations ----------------- */ @@ -266,6 +260,20 @@ typedef struct { int a; } A; */ return VisitTypedefNameDecl(typedecl); } else { + /* In case this references a struct/union defined inside a struct (nested + struct), then we also need to analyze the parent struct. */ + RecordDecl *parent = dyn_cast<RecordDecl>(decl->getLexicalDeclContext()); + if (parent) { + /* If the parent struct is flagged as not needing a complete definition + then we need to set it to true, else the nested struct won't be + output as of only a partial definition of the parent struct is + output. */ + parent->setCompleteDefinitionRequired(true); + + /* Analyze parent struct. */ + TRY_TO(TraverseDecl(parent)); + } + Closure.Add_Decl_And_Prevs(Maybe_Partial_Decl(decl)); } @@ -310,7 +318,7 @@ bool VisitEnumConstantDecl(EnumConstantDecl *decl) { /* Add original EnumDecl it originated. */ - EnumDecl *enum_decl = EnumTable.Get(decl); + EnumDecl *enum_decl = dyn_cast<EnumDecl>(decl->getLexicalDeclContext()); if (enum_decl) { return TraverseDecl(enum_decl); } @@ -444,6 +452,14 @@ return VISITOR_CONTINUE; } + bool VisitConvertVectorExpr(const ConvertVectorExpr *expr) + { + const TypeSourceInfo *tsi = expr->getTypeSourceInfo(); + TRY_TO(TraverseTypeLoc(tsi->getTypeLoc())); + + return VISITOR_CONTINUE; + } + /* -------- Types ----------------- */ bool VisitTagType(const TagType *type) { @@ -531,13 +547,8 @@ may be (?) the ideal datastructure for this. */ ClosureSet Closure; - /** The table maping EnumConstantDecl to its original EnumDecl, used to find - out where a certain EnumConstantDecl was defined. */ - EnumConstantTable EnumTable; - /** The set of all analyzed Decls. */ std::unordered_set<Decl *> AnalyzedDecls; #undef TRY_TO #undef DO_NOT_RUN_IF_ALREADY_ANALYZED -#undef DEF_MARKING_TRAVERSE_DECL }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/EnumConstTbl.cpp new/clang-extract-0~20240721.9b2dfb6/libcextract/EnumConstTbl.cpp --- old/clang-extract-0~20240714.17e3908/libcextract/EnumConstTbl.cpp 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/EnumConstTbl.cpp 1970-01-01 01:00:00.000000000 +0100 @@ -1,67 +0,0 @@ -//===- EnumConstTbl.cpp - Table mapping enum constants to its enum Decl *- C++ -*-===// -// -// This project is licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -/// \file -/// Implements a table mapping enum constants to its original enum Decl. -// -//===----------------------------------------------------------------------===// - -/* Author: Giuliano Belinassi */ - -#include "EnumConstTbl.hh" -#include <iostream> - -EnumConstantTable::EnumConstantTable(ASTUnit *ast) -{ - clang::ASTUnit::top_level_iterator it; - for (it = ast->top_level_begin(); it != ast->top_level_end(); ++it) { - EnumDecl *decl = dynamic_cast<EnumDecl *>(*it); - - if (decl && decl->isThisDeclarationADefinition()) { - Insert(decl); - } - } -} - -bool EnumConstantTable::Insert(EnumDecl *decl) -{ - bool inserted = false; - - for (EnumConstantDecl *field : decl->enumerators()) { - const std::string symbol = field->getNameAsString(); - - /* Ensure that such symbol was not inserted before. */ - assert(!Get(symbol)); - - /* Insert symbol in table. */ - Table[symbol] = decl; - } - - return inserted; -} - -EnumDecl *EnumConstantTable::Get(const std::string &str) -{ - return Table[str]; -} - -EnumDecl *EnumConstantTable::Get(const StringRef &ref) -{ - return Get(ref.str()); -} - -EnumDecl *EnumConstantTable::Get(const EnumConstantDecl *ecdecl) -{ - return Get(ecdecl->getName()); -} - -void EnumConstantTable::Dump(void) -{ - for (auto &p: Table) - std::cout << " " << p.first << " => " << p.second << '\n'; -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/EnumConstTbl.hh new/clang-extract-0~20240721.9b2dfb6/libcextract/EnumConstTbl.hh --- old/clang-extract-0~20240714.17e3908/libcextract/EnumConstTbl.hh 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/EnumConstTbl.hh 1970-01-01 01:00:00.000000000 +0100 @@ -1,64 +0,0 @@ -//===- EnumConstTbl.hh - Table mapping enum constants to its enum Decl *- C++ -*-===// -// -// This project is licensed under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// -// -/// \file -/// Implements a table mapping enum constants to its original enum Decl. -// -//===----------------------------------------------------------------------===// - -/* Author: Giuliano Belinassi */ - -#pragma once - -#include <clang/Tooling/Tooling.h> -#include <unordered_map> - -using namespace clang; - -/** Maps EnumConstant to its respective EnumConstantDecl - * - * clang accept code like this: - * - * enum { - * const0 = 0, - * const1 = 1, - * } - * - * int f(void) { - * return const1; - * } - * - * In such cases, clang misses the reference to the enum and only stores that - * there is a reference to a EnumConstantDecl, which is const1, and therefore - * we lose the reference to the original enum. - * - * This class solves this problem by mapping the symbol to its original enum. - * -*/ - -class EnumConstantTable -{ - public: - - /* Construct with empty table. */ - EnumConstantTable(){} - - /* Construct adding all EnumDecl from ast. */ - EnumConstantTable(ASTUnit *ast); - - bool Insert(EnumDecl *decl); - - EnumDecl *Get(const std::string &str); - EnumDecl *Get(const StringRef &ref); - EnumDecl *Get(const EnumConstantDecl *decl); - - void Dump(void); - - private: - std::unordered_map<std::string, EnumDecl*> Table; -}; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/FunctionDepsFinder.hh new/clang-extract-0~20240721.9b2dfb6/libcextract/FunctionDepsFinder.hh --- old/clang-extract-0~20240714.17e3908/libcextract/FunctionDepsFinder.hh 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/FunctionDepsFinder.hh 2024-07-21 18:49:09.000000000 +0200 @@ -15,7 +15,6 @@ #pragma once -#include "EnumConstTbl.hh" #include "MacroWalker.hh" #include "IncludeTree.hh" #include "PrettyPrint.hh" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/PrettyPrint.cpp new/clang-extract-0~20240721.9b2dfb6/libcextract/PrettyPrint.cpp --- old/clang-extract-0~20240714.17e3908/libcextract/PrettyPrint.cpp 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/PrettyPrint.cpp 2024-07-21 18:49:09.000000000 +0200 @@ -357,6 +357,15 @@ bool has_attr = false; SourceManager &SM = AST->getSourceManager(); + /* Vector type attributes are not encoded in the AttrVec structure, hence + we have to check for its existence and expand until we match the ';' + token. See small/attr-11.c testcase. */ + if (TypedefDecl *tdecl = dyn_cast<TypedefDecl>(decl)) { + if (isa<clang::VectorType>(tdecl->getTypeSourceInfo()->getType().getTypePtr())) { + has_attr = true; + } + } + for (size_t i = 0; i < attrvec.size(); i++) { const Attr *attr = attrvec[i]; SourceLocation loc = attr->getRange().getEnd(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/libcextract/meson.build new/clang-extract-0~20240721.9b2dfb6/libcextract/meson.build --- old/clang-extract-0~20240714.17e3908/libcextract/meson.build 2024-07-15 01:22:09.000000000 +0200 +++ new/clang-extract-0~20240721.9b2dfb6/libcextract/meson.build 2024-07-21 18:49:09.000000000 +0200 @@ -17,7 +17,6 @@ 'ArgvParser.cpp', 'DscFileGenerator.cpp', 'ElfCXX.cpp', - 'EnumConstTbl.cpp', 'Error.cpp', 'FunctionDepsFinder.cpp', 'FunctionExternalizeFinder.cpp', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/testsuite/small/attr-11.c new/clang-extract-0~20240721.9b2dfb6/testsuite/small/attr-11.c --- old/clang-extract-0~20240714.17e3908/testsuite/small/attr-11.c 1970-01-01 01:00:00.000000000 +0100 +++ new/clang-extract-0~20240721.9b2dfb6/testsuite/small/attr-11.c 2024-07-21 18:49:09.000000000 +0200 @@ -0,0 +1,13 @@ +/* { dg-options "-Wno-everything -DCE_EXTRACT_FUNCTIONS=f -DCE_NO_EXTERNALIZATION" }*/ + +typedef long long __m64 __attribute__((__vector_size__(8), __aligned__(8))); + +typedef int __v2si __attribute__((__vector_size__(8))); + +__v2si f(void) +{ + __v2si _0 = {0, 0}; + return _0; +} + +/* { dg-final { scan-tree-dump "typedef int __v2si __attribute__\(\(__vector_size__\(8\)\)\);" } } */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/testsuite/small/record-nested-3.c new/clang-extract-0~20240721.9b2dfb6/testsuite/small/record-nested-3.c --- old/clang-extract-0~20240714.17e3908/testsuite/small/record-nested-3.c 1970-01-01 01:00:00.000000000 +0100 +++ new/clang-extract-0~20240721.9b2dfb6/testsuite/small/record-nested-3.c 2024-07-21 18:49:09.000000000 +0200 @@ -0,0 +1,19 @@ +/* { dg-options "-DCE_EXTRACT_FUNCTIONS=fts3PrefixParameter -DCE_NO_EXTERNALIZATION" }*/ + +struct Fts3Table { + struct Fts3Index { + int nPrefix; + } *aIndex; +}; + +int fts3PrefixParameter( + const char *zParam, + int *pnIndex, + struct Fts3Index **apIndex +){ + int a = sizeof(struct Fts3Index); + return 0; +} + +/* { dg-final { scan-tree-dump "struct Fts3Table *{" } } */ +/* { dg-final { scan-tree-dump "} *\*aIndex;" } } */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/clang-extract-0~20240714.17e3908/testsuite/small/vectortype-1.c new/clang-extract-0~20240721.9b2dfb6/testsuite/small/vectortype-1.c --- old/clang-extract-0~20240714.17e3908/testsuite/small/vectortype-1.c 1970-01-01 01:00:00.000000000 +0100 +++ new/clang-extract-0~20240721.9b2dfb6/testsuite/small/vectortype-1.c 2024-07-21 18:49:09.000000000 +0200 @@ -0,0 +1,16 @@ +/* { dg-options "-Wno-everything -DCE_EXTRACT_FUNCTIONS=f -DCE_NO_EXTERNALIZATION" }*/ + +typedef float __v8sf __attribute__ ((__vector_size__ (32))); + +typedef unsigned int __v8su __attribute__ ((__vector_size__ (32))); + +typedef float __m256 __attribute__ ((__vector_size__ (32), __aligned__(32))); + +typedef long long __m256i __attribute__((__vector_size__(32), __aligned__(32))); + +__m256 __attribute__((__nodebug__, __min_vector_width__(256))) +f (__m256i __A) { + return (__m256)__builtin_convertvector((__v8su)__A, __v8sf); +} + +/* { dg-final { scan-tree-dump "typedef float __v8sf __attribute__ \(\(__vector_size__ \(32\)\)\);" } } */