Skip to content

Revert "[llvm] add support for mustache templating language (#105893)" #130873

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

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

PeterChou1
Copy link
Contributor

This patch caused certain GCC buildbots to failed
errors: https://lab.llvm.org/buildbot/#/builders/66/builds/11049

@llvmbot
Copy link
Member

llvmbot commented Mar 12, 2025

@llvm/pr-subscribers-llvm-support

Author: None (PeterChou1)

Changes

This patch caused certain GCC buildbots to failed
errors: https://lab.llvm.org/buildbot/#/builders/66/builds/11049


Patch is 69.42 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/130873.diff

5 Files Affected:

  • (removed) llvm/include/llvm/Support/Mustache.h (-127)
  • (modified) llvm/lib/Support/CMakeLists.txt (-1)
  • (removed) llvm/lib/Support/Mustache.cpp (-793)
  • (modified) llvm/unittests/Support/CMakeLists.txt (-1)
  • (removed) llvm/unittests/Support/MustacheTest.cpp (-1226)
diff --git a/llvm/include/llvm/Support/Mustache.h b/llvm/include/llvm/Support/Mustache.h
deleted file mode 100644
index 41173b96d1a9a..0000000000000
--- a/llvm/include/llvm/Support/Mustache.h
+++ /dev/null
@@ -1,127 +0,0 @@
-//===--- Mustache.h ---------------------------------------------*- C++ -*-===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-//
-// Implementation of the Mustache templating language supports version 1.4.2
-// currently relies on llvm::json::Value for data input.
-// See the Mustache spec for more information
-// (https://mustache.github.io/mustache.5.html).
-//
-// Current Features Supported:
-// - Variables
-// - Sections
-// - Inverted Sections
-// - Partials
-// - Comments
-// - Lambdas
-// - Unescaped Variables
-//
-// Features Not Supported:
-// - Set Delimiter
-// - Blocks
-// - Parents
-// - Dynamic Names
-//
-// The Template class is a container class that outputs the Mustache template
-// string and is the main class for users. It stores all the lambdas and the
-// ASTNode Tree. When the Template is instantiated it tokenizes the Template
-// String and creates a vector of Tokens. Then it calls a basic recursive
-// descent parser to construct the ASTNode Tree. The ASTNodes are all stored
-// in an arena allocator which is freed once the template class goes out of
-// scope.
-//
-// Usage:
-// \code
-//   // Creating a simple template and rendering it
-//   auto Template = Template("Hello, {{name}}!");
-//   Value Data = {{"name", "World"}};
-//   std::string Out;
-//   raw_string_ostream OS(Out);
-//   T.render(Data, OS);
-//   // Out == "Hello, World!"
-//
-//   // Creating a template with a partial and rendering it
-//   auto Template = Template("{{>partial}}");
-//   Template.registerPartial("partial", "Hello, {{name}}!");
-//   Value Data = {{"name", "World"}};
-//   std::string Out;
-//   raw_string_ostream OS(Out);
-//   T.render(Data, OS);
-//   // Out == "Hello, World!"
-//
-//   // Creating a template with a lambda and rendering it
-//   Value D = Object{};
-//   auto T = Template("Hello, {{lambda}}!");
-//   Lambda L = []() -> llvm::json::Value { return "World"; };
-//   T.registerLambda("lambda", L);
-//   std::string Out;
-//   raw_string_ostream OS(Out);
-//   T.render(D, OS);
-//   // Out == "Hello, World!"
-// \endcode
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SUPPORT_MUSTACHE
-#define LLVM_SUPPORT_MUSTACHE
-
-#include "Error.h"
-#include "llvm/ADT/StringMap.h"
-#include "llvm/Support/Allocator.h"
-#include "llvm/Support/JSON.h"
-#include "llvm/Support/StringSaver.h"
-#include <functional>
-#include <vector>
-
-namespace llvm::mustache {
-
-using Lambda = std::function<llvm::json::Value()>;
-using SectionLambda = std::function<llvm::json::Value(std::string)>;
-
-class ASTNode;
-
-// A Template represents the container for the AST and the partials
-// and Lambdas that are registered with it.
-class Template {
-public:
-  Template(StringRef TemplateStr);
-
-  Template(const Template &) = delete;
-
-  Template &operator=(const Template &) = delete;
-
-  Template(Template &&Other) noexcept;
-
-  Template &operator=(Template &&Other) noexcept;
-
-  void render(const llvm::json::Value &Data, llvm::raw_ostream &OS);
-
-  void registerPartial(std::string Name, std::string Partial);
-
-  void registerLambda(std::string Name, Lambda Lambda);
-
-  void registerLambda(std::string Name, SectionLambda Lambda);
-
-  // By default the Mustache Spec Specifies that HTML special characters
-  // should be escaped. This function allows the user to specify which
-  // characters should be escaped.
-  void overrideEscapeCharacters(DenseMap<char, std::string> Escapes);
-
-private:
-  StringMap<ASTNode *> Partials;
-  StringMap<Lambda> Lambdas;
-  StringMap<SectionLambda> SectionLambdas;
-  DenseMap<char, std::string> Escapes;
-  // The allocator for the ASTNode Tree
-  llvm::BumpPtrAllocator AstAllocator;
-  // Allocator for each render call resets after each render
-  llvm::BumpPtrAllocator RenderAllocator;
-  ASTNode *Tree;
-};
-} // namespace llvm::mustache
-
-#endif // LLVM_SUPPORT_MUSTACHE
diff --git a/llvm/lib/Support/CMakeLists.txt b/llvm/lib/Support/CMakeLists.txt
index 2754c97fce6c1..49a26a618de83 100644
--- a/llvm/lib/Support/CMakeLists.txt
+++ b/llvm/lib/Support/CMakeLists.txt
@@ -220,7 +220,6 @@ add_llvm_component_library(LLVMSupport
   MD5.cpp
   MSP430Attributes.cpp
   MSP430AttributeParser.cpp
-  Mustache.cpp      
   NativeFormatting.cpp
   OptimizedStructLayout.cpp
   Optional.cpp
diff --git a/llvm/lib/Support/Mustache.cpp b/llvm/lib/Support/Mustache.cpp
deleted file mode 100644
index 2735bf2ca3b9b..0000000000000
--- a/llvm/lib/Support/Mustache.cpp
+++ /dev/null
@@ -1,793 +0,0 @@
-//===-- Mustache.cpp ------------------------------------------------------===//
-//
-// Part of the LLVM Project, 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
-//
-//===----------------------------------------------------------------------===//
-#include "llvm/Support/Mustache.h"
-#include "llvm/ADT/SmallVector.h"
-#include "llvm/Support/Error.h"
-#include "llvm/Support/raw_ostream.h"
-#include <sstream>
-
-using namespace llvm;
-using namespace llvm::mustache;
-
-namespace {
-
-using Accessor = SmallVector<std::string>;
-
-static bool isFalsey(const json::Value &V) {
-  return V.getAsNull() || (V.getAsBoolean() && !V.getAsBoolean().value()) ||
-         (V.getAsArray() && V.getAsArray()->empty());
-}
-
-static Accessor splitMustacheString(StringRef Str) {
-  // We split the mustache string into an accessor.
-  // For example:
-  //    "a.b.c" would be split into {"a", "b", "c"}
-  // We make an exception for a single dot which
-  // refers to the current context.
-  Accessor Tokens;
-  if (Str == ".") {
-    Tokens.emplace_back(Str);
-    return Tokens;
-  }
-  while (!Str.empty()) {
-    StringRef Part;
-    std::tie(Part, Str) = Str.split(".");
-    Tokens.emplace_back(Part.trim());
-  }
-  return Tokens;
-}
-} // namespace
-
-namespace llvm::mustache {
-
-class Token {
-public:
-  enum class Type {
-    Text,
-    Variable,
-    Partial,
-    SectionOpen,
-    SectionClose,
-    InvertSectionOpen,
-    UnescapeVariable,
-    Comment,
-  };
-
-  Token(std::string Str)
-      : TokenType(Type::Text), RawBody(std::move(Str)), TokenBody(RawBody),
-        AccessorValue({}), Indentation(0) {};
-
-  Token(std::string RawBody, std::string TokenBody, char Identifier)
-      : RawBody(std::move(RawBody)), TokenBody(std::move(TokenBody)),
-        Indentation(0) {
-    TokenType = getTokenType(Identifier);
-    if (TokenType == Type::Comment)
-      return;
-    StringRef AccessorStr(this->TokenBody);
-    if (TokenType != Type::Variable)
-      AccessorStr = AccessorStr.substr(1);
-    AccessorValue = splitMustacheString(StringRef(AccessorStr).trim());
-  }
-
-  Accessor getAccessor() const { return AccessorValue; }
-
-  Type getType() const { return TokenType; }
-
-  void setIndentation(size_t NewIndentation) { Indentation = NewIndentation; }
-
-  size_t getIndentation() const { return Indentation; }
-
-  static Type getTokenType(char Identifier) {
-    switch (Identifier) {
-    case '#':
-      return Type::SectionOpen;
-    case '/':
-      return Type::SectionClose;
-    case '^':
-      return Type::InvertSectionOpen;
-    case '!':
-      return Type::Comment;
-    case '>':
-      return Type::Partial;
-    case '&':
-      return Type::UnescapeVariable;
-    default:
-      return Type::Variable;
-    }
-  }
-
-  Type TokenType;
-  // RawBody is the original string that was tokenized.
-  std::string RawBody;
-  // TokenBody is the original string with the identifier removed.
-  std::string TokenBody;
-  Accessor AccessorValue;
-  size_t Indentation;
-};
-
-class ASTNode {
-public:
-  enum Type {
-    Root,
-    Text,
-    Partial,
-    Variable,
-    UnescapeVariable,
-    Section,
-    InvertSection,
-  };
-
-  ASTNode(llvm::BumpPtrAllocator &Alloc, llvm::StringMap<ASTNode *> &Partials,
-          llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          llvm::DenseMap<char, std::string> &Escapes)
-      : Allocator(Alloc), Partials(Partials), Lambdas(Lambdas),
-        SectionLambdas(SectionLambdas), Escapes(Escapes), Ty(Type::Root),
-        Parent(nullptr), ParentContext(nullptr) {}
-
-  ASTNode(std::string Body, ASTNode *Parent, llvm::BumpPtrAllocator &Alloc,
-          llvm::StringMap<ASTNode *> &Partials,
-          llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          llvm::DenseMap<char, std::string> &Escapes)
-      : Allocator(Alloc), Partials(Partials), Lambdas(Lambdas),
-        SectionLambdas(SectionLambdas), Escapes(Escapes), Ty(Type::Text),
-        Body(std::move(Body)), Parent(Parent), ParentContext(nullptr) {}
-
-  // Constructor for Section/InvertSection/Variable/UnescapeVariable Nodes
-  ASTNode(Type Ty, Accessor Accessor, ASTNode *Parent,
-          llvm::BumpPtrAllocator &Alloc, llvm::StringMap<ASTNode *> &Partials,
-          llvm::StringMap<Lambda> &Lambdas,
-          llvm::StringMap<SectionLambda> &SectionLambdas,
-          llvm::DenseMap<char, std::string> &Escapes)
-      : Allocator(Alloc), Partials(Partials), Lambdas(Lambdas),
-        SectionLambdas(SectionLambdas), Escapes(Escapes), Ty(Ty),
-        Parent(Parent), AccessorValue(std::move(Accessor)),
-        ParentContext(nullptr) {}
-
-  void addChild(ASTNode *Child) { Children.emplace_back(Child); };
-
-  void setRawBody(std::string NewBody) { RawBody = std::move(NewBody); };
-
-  void setIndentation(size_t NewIndentation) { Indentation = NewIndentation; };
-
-  void render(const llvm::json::Value &Data, llvm::raw_ostream &OS);
-
-private:
-  void renderLambdas(const llvm::json::Value &Contexts, llvm::raw_ostream &OS,
-                     Lambda &L);
-
-  void renderSectionLambdas(const llvm::json::Value &Contexts,
-                            llvm::raw_ostream &OS, SectionLambda &L);
-
-  void renderPartial(const llvm::json::Value &Contexts, llvm::raw_ostream &OS,
-                     ASTNode *Partial);
-
-  void renderChild(const llvm::json::Value &Context, llvm::raw_ostream &OS);
-
-  const llvm::json::Value *findContext();
-
-  llvm::BumpPtrAllocator &Allocator;
-  StringMap<ASTNode *> &Partials;
-  StringMap<Lambda> &Lambdas;
-  StringMap<SectionLambda> &SectionLambdas;
-  DenseMap<char, std::string> &Escapes;
-  Type Ty;
-  size_t Indentation = 0;
-  std::string RawBody;
-  std::string Body;
-  ASTNode *Parent;
-  // TODO: switch implementation to SmallVector<T>
-  std::vector<ASTNode *> Children;
-  const Accessor AccessorValue;
-  const llvm::json::Value *ParentContext;
-};
-
-// A wrapper for arena allocator for ASTNodes
-ASTNode *createRootNode(void *Node, llvm::BumpPtrAllocator &Alloc,
-                        llvm::StringMap<ASTNode *> &Partials,
-                        llvm::StringMap<Lambda> &Lambdas,
-                        llvm::StringMap<SectionLambda> &SectionLambdas,
-                        llvm::DenseMap<char, std::string> &Escapes) {
-  return new (Node) ASTNode(Alloc, Partials, Lambdas, SectionLambdas, Escapes);
-}
-
-ASTNode *createNode(void *Node, ASTNode::Type T, Accessor A, ASTNode *Parent,
-                    llvm::BumpPtrAllocator &Alloc,
-                    llvm::StringMap<ASTNode *> &Partials,
-                    llvm::StringMap<Lambda> &Lambdas,
-                    llvm::StringMap<SectionLambda> &SectionLambdas,
-                    llvm::DenseMap<char, std::string> &Escapes) {
-  return new (Node) ASTNode(T, std::move(A), Parent, Alloc, Partials, Lambdas,
-                            SectionLambdas, Escapes);
-}
-
-ASTNode *createTextNode(void *Node, std::string Body, ASTNode *Parent,
-                        llvm::BumpPtrAllocator &Alloc,
-                        llvm::StringMap<ASTNode *> &Partials,
-                        llvm::StringMap<Lambda> &Lambdas,
-                        llvm::StringMap<SectionLambda> &SectionLambdas,
-                        llvm::DenseMap<char, std::string> &Escapes) {
-  return new (Node) ASTNode(std::move(Body), Parent, Alloc, Partials, Lambdas,
-                            SectionLambdas, Escapes);
-}
-
-// Function to check if there is meaningful text behind.
-// We determine if a token has meaningful text behind
-// if the right of previous token contains anything that is
-// not a newline.
-// For example:
-//  "Stuff {{#Section}}" (returns true)
-//   vs
-//  "{{#Section}} \n" (returns false)
-// We make an exception for when previous token is empty
-// and the current token is the second token.
-// For example:
-//  "{{#Section}}"
-bool hasTextBehind(size_t Idx, const ArrayRef<Token> &Tokens) {
-  if (Idx == 0)
-    return true;
-
-  size_t PrevIdx = Idx - 1;
-  if (Tokens[PrevIdx].getType() != Token::Type::Text)
-    return true;
-
-  const Token &PrevToken = Tokens[PrevIdx];
-  StringRef TokenBody = StringRef(PrevToken.RawBody).rtrim(" \r\t\v");
-  return !TokenBody.ends_with("\n") && !(TokenBody.empty() && Idx == 1);
-}
-
-// Function to check if there's no meaningful text ahead.
-// We determine if a token has text ahead if the left of previous
-// token does not start with a newline.
-bool hasTextAhead(size_t Idx, const ArrayRef<Token> &Tokens) {
-  if (Idx >= Tokens.size() - 1)
-    return true;
-
-  size_t NextIdx = Idx + 1;
-  if (Tokens[NextIdx].getType() != Token::Type::Text)
-    return true;
-
-  const Token &NextToken = Tokens[NextIdx];
-  StringRef TokenBody = StringRef(NextToken.RawBody).ltrim(" ");
-  return !TokenBody.starts_with("\r\n") && !TokenBody.starts_with("\n");
-}
-
-bool requiresCleanUp(Token::Type T) {
-  // We must clean up all the tokens that could contain child nodes.
-  return T == Token::Type::SectionOpen || T == Token::Type::InvertSectionOpen ||
-         T == Token::Type::SectionClose || T == Token::Type::Comment ||
-         T == Token::Type::Partial;
-}
-
-// Adjust next token body if there is no text ahead.
-// For example:
-// The template string
-//  "{{! Comment }} \nLine 2"
-// would be considered as no text ahead and should be rendered as
-//  " Line 2"
-void stripTokenAhead(SmallVectorImpl<Token> &Tokens, size_t Idx) {
-  Token &NextToken = Tokens[Idx + 1];
-  StringRef NextTokenBody = NextToken.TokenBody;
-  // Cut off the leading newline which could be \n or \r\n.
-  if (NextTokenBody.starts_with("\r\n"))
-    NextToken.TokenBody = NextTokenBody.substr(2).str();
-  else if (NextTokenBody.starts_with("\n"))
-    NextToken.TokenBody = NextTokenBody.substr(1).str();
-}
-
-// Adjust previous token body if there no text behind.
-// For example:
-//  The template string
-//  " \t{{#section}}A{{/section}}"
-// would be considered as having no text ahead and would be render as
-//  "A"
-// The exception for this is partial tag which requires us to
-// keep track of the indentation once it's rendered.
-void stripTokenBefore(SmallVectorImpl<Token> &Tokens, size_t Idx,
-                      Token &CurrentToken, Token::Type CurrentType) {
-  Token &PrevToken = Tokens[Idx - 1];
-  StringRef PrevTokenBody = PrevToken.TokenBody;
-  StringRef Unindented = PrevTokenBody.rtrim(" \r\t\v");
-  size_t Indentation = PrevTokenBody.size() - Unindented.size();
-  if (CurrentType != Token::Type::Partial)
-    PrevToken.TokenBody = Unindented.str();
-  CurrentToken.setIndentation(Indentation);
-}
-
-// Simple tokenizer that splits the template into tokens.
-// The mustache spec allows {{{ }}} to unescape variables,
-// but we don't support that here. An unescape variable
-// is represented only by {{& variable}}.
-SmallVector<Token> tokenize(StringRef Template) {
-  SmallVector<Token> Tokens;
-  StringLiteral Open("{{");
-  StringLiteral Close("}}");
-  size_t Start = 0;
-  size_t DelimiterStart = Template.find(Open);
-  if (DelimiterStart == StringRef::npos) {
-    Tokens.emplace_back(Template.str());
-    return Tokens;
-  }
-  while (DelimiterStart != StringRef::npos) {
-    if (DelimiterStart != Start)
-      Tokens.emplace_back(Template.substr(Start, DelimiterStart - Start).str());
-    size_t DelimiterEnd = Template.find(Close, DelimiterStart);
-    if (DelimiterEnd == StringRef::npos)
-      break;
-
-    // Extract the Interpolated variable without delimiters.
-    size_t InterpolatedStart = DelimiterStart + Open.size();
-    size_t InterpolatedEnd = DelimiterEnd - DelimiterStart - Close.size();
-    std::string Interpolated =
-        Template.substr(InterpolatedStart, InterpolatedEnd).str();
-    std::string RawBody = Open.str() + Interpolated + Close.str();
-    Tokens.emplace_back(RawBody, Interpolated, Interpolated[0]);
-    Start = DelimiterEnd + Close.size();
-    DelimiterStart = Template.find(Open, Start);
-  }
-
-  if (Start < Template.size())
-    Tokens.emplace_back(Template.substr(Start).str());
-
-  // Fix up white spaces for:
-  //   - open sections
-  //   - inverted sections
-  //   - close sections
-  //   - comments
-  //
-  // This loop attempts to find standalone tokens and tries to trim out
-  // the surrounding whitespace.
-  // For example:
-  // if you have the template string
-  //  {{#section}} \n Example \n{{/section}}
-  // The output should would be
-  // For example:
-  //  \n Example \n
-  size_t LastIdx = Tokens.size() - 1;
-  for (size_t Idx = 0, End = Tokens.size(); Idx < End; ++Idx) {
-    Token &CurrentToken = Tokens[Idx];
-    Token::Type CurrentType = CurrentToken.getType();
-    // Check if token type requires cleanup.
-    bool RequiresCleanUp = requiresCleanUp(CurrentType);
-
-    if (!RequiresCleanUp)
-      continue;
-
-    // We adjust the token body if there's no text behind or ahead.
-    // A token is considered to have no text ahead if the right of the previous
-    // token is a newline followed by spaces.
-    // A token is considered to have no text behind if the left of the next
-    // token is spaces followed by a newline.
-    // eg.
-    //  "Line 1\n {{#section}} \n Line 2 \n {{/section}} \n Line 3"
-    bool HasTextBehind = hasTextBehind(Idx, Tokens);
-    bool HasTextAhead = hasTextAhead(Idx, Tokens);
-
-    if ((!HasTextAhead && !HasTextBehind) || (!HasTextAhead && Idx == 0))
-      stripTokenAhead(Tokens, Idx);
-
-    if ((!HasTextBehind && !HasTextAhead) || (!HasTextBehind && Idx == LastIdx))
-      stripTokenBefore(Tokens, Idx, CurrentToken, CurrentType);
-  }
-  return Tokens;
-}
-
-// Custom stream to escape strings.
-class EscapeStringStream : public raw_ostream {
-public:
-  explicit EscapeStringStream(llvm::raw_ostream &WrappedStream,
-                              DenseMap<char, std::string> &Escape)
-      : Escape(Escape), WrappedStream(WrappedStream) {
-    SetUnbuffered();
-  }
-
-protected:
-  void write_impl(const char *Ptr, size_t Size) override {
-    llvm::StringRef Data(Ptr, Size);
-    for (char C : Data) {
-      auto It = Escape.find(C);
-      if (It != Escape.end())
-        WrappedStream << It->getSecond();
-      else
-        WrappedStream << C;
-    }
-  }
-
-  uint64_t current_pos() const override { return WrappedStream.tell(); }
-
-private:
-  DenseMap<char, std::string> &Escape;
-  llvm::raw_ostream &WrappedStream;
-};
-
-// Custom stream to add indentation used to for rendering partials.
-class AddIndentationStringStream : public raw_ostream {
-public:
-  explicit AddIndentationStringStream(llvm::raw_ostream &WrappedStream,
-                                      size_t Indentation)
-      : Indentation(Indentation), WrappedStream(WrappedStream) {
-    SetUnbuffered();
-  }
-
-protected:
-  void write_impl(const char *Ptr, size_t Size) override {
-    llvm::StringRef Data(Ptr, Size);
-    SmallString<0> Indent;
-    Indent.resize(Indentation, ' ');
-    for (char C : Data) {
-      WrappedStream << C;
-      if (C == '\n')
-        WrappedStream << Indent;
-    }
-  }
-
-  uint64_t current_pos() const override { return WrappedStream.tell(); }
-
-private:
-  size_t Indentation;
-  llvm::raw_ostream &WrappedStream;
-};
-
-class Parser {
-public:
-  Parser(...
[truncated]

@PeterChou1 PeterChou1 merged commit 554347b into llvm:main Mar 12, 2025
8 of 12 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 12, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-aarch64-darwin running on doug-worker-4 while building llvm at step 6 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/190/builds/16176

Here is the relevant piece of the build log for the reference
Step 6 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM :: ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll' FAILED ********************
Exit Code: 2

Command Output (stderr):
--
RUN: at line 1: /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli -jit-kind=orc-lazy -compile-threads=2 -thread-entry hello /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll | /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli -jit-kind=orc-lazy -compile-threads=2 -thread-entry hello /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll
+ /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
 #0 0x0000000105e43a00 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100ebfa00)
 #1 0x0000000105e41a84 llvm::sys::RunSignalHandlers() (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100ebda84)
 #2 0x0000000105e440bc SignalHandler(int, __siginfo*, void*) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100ec00bc)
 #3 0x0000000189db6584 (/usr/lib/system/libsystem_platform.dylib+0x18047a584)
 #4 0x0000000189d8521c (/usr/lib/system/libsystem_pthread.dylib+0x18044921c)
 #5 0x0000000189cabad0 (/usr/lib/libc++.1.dylib+0x18036fad0)
 #6 0x00000001059edaf0 void llvm::detail::UniqueFunctionBase<void, llvm::Expected<llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef>>>>::CallImpl<llvm::orc::Platform::lookupInitSymbols(llvm::orc::ExecutionSession&, llvm::DenseMap<llvm::orc::JITDylib*, llvm::orc::SymbolLookupSet, llvm::DenseMapInfo<llvm::orc::JITDylib*, void>, llvm::detail::DenseMapPair<llvm::orc::JITDylib*, llvm::orc::SymbolLookupSet>> const&)::$_45>(void*, llvm::Expected<llvm::DenseMap<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef, llvm::DenseMapInfo<llvm::orc::SymbolStringPtr, void>, llvm::detail::DenseMapPair<llvm::orc::SymbolStringPtr, llvm::orc::ExecutorSymbolDef>>>&) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100a69af0)
 #7 0x00000001059e98e0 llvm::orc::AsynchronousSymbolQuery::handleComplete(llvm::orc::ExecutionSession&)::RunQueryCompleteTask::run() (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100a658e0)
 #8 0x0000000105aa49ec void* std::__1::__thread_proxy[abi:un170006]<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct>>, llvm::orc::DynamicThreadPoolTaskDispatcher::dispatch(std::__1::unique_ptr<llvm::orc::Task, std::__1::default_delete<llvm::orc::Task>>)::$_0>>(void*) (/Users/buildbot/buildbot-root/aarch64-darwin/build/bin/lli+0x100b209ec)
 #9 0x0000000189d85f94 (/usr/lib/system/libsystem_pthread.dylib+0x180449f94)
#10 0x0000000189d80d34 (/usr/lib/system/libsystem_pthread.dylib+0x180444d34)
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /Users/buildbot/buildbot-root/aarch64-darwin/build/bin/FileCheck /Users/buildbot/buildbot-root/aarch64-darwin/llvm-project/llvm/test/ExecutionEngine/OrcLazy/multiple-compile-threads-basic.ll

--

********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Mar 12, 2025

LLVM Buildbot has detected a new failure on builder lld-x86_64-win running on as-worker-93 while building llvm at step 7 "test-build-unified-tree-check-all".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/146/builds/2474

Here is the relevant piece of the build log for the reference
Step 7 (test-build-unified-tree-check-all) failure: test (failure)
******************** TEST 'LLVM-Unit :: Support/./SupportTests.exe/38/87' FAILED ********************
Script(shard):
--
GTEST_OUTPUT=json:C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe-LLVM-Unit-12068-38-87.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=87 GTEST_SHARD_INDEX=38 C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe
--

Script:
--
C:\a\lld-x86_64-win\build\unittests\Support\.\SupportTests.exe --gtest_filter=ProgramEnvTest.CreateProcessLongPath
--
C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(160): error: Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp(163): error: fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied



C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:160
Expected equality of these values:
  0
  RC
    Which is: -2

C:\a\lld-x86_64-win\llvm-project\llvm\unittests\Support\ProgramTest.cpp:163
fs::remove(Twine(LongPath)): did not return errc::success.
error number: 13
error message: permission denied




********************


@llvm-ci
Copy link
Collaborator

llvm-ci commented Apr 1, 2025

LLVM Buildbot has detected a new failure on builder llvm-clang-win-x-armv7l running on as-builder-1 while building llvm at step 10 "test-check-clang".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/38/builds/2678

Here is the relevant piece of the build log for the reference
Step 10 (test-check-clang) failure: Test just built components: check-clang completed (failure)
******************** TEST 'Clang :: Driver/offload-Xarch.c' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe --target=x86_64-unknown-linux-gnu -x cuda C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c -Xarch_nvptx64 -O3 -S -nogpulib -nogpuinc -### 2>&1 | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=O3ONCE C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' --target=x86_64-unknown-linux-gnu -x cuda 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c' -Xarch_nvptx64 -O3 -S -nogpulib -nogpuinc '-###'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=O3ONCE 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 4
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -x cuda C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c -Xarch_device -O3 -S -nogpulib -nogpuinc -### 2>&1 | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=O3ONCE C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -x cuda 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c' -Xarch_device -O3 -S -nogpulib -nogpuinc '-###'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=O3ONCE 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 5
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -x hip C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c -Xarch_amdgcn -O3 -S -nogpulib -nogpuinc -### 2>&1 | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=O3ONCE C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -x hip 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c' -Xarch_amdgcn -O3 -S -nogpulib -nogpuinc '-###'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=O3ONCE 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 6
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -nogpulib -nogpuinc    -Xarch_amdgcn -march=gfx90a -Xarch_amdgcn -O3 -S -### C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c 2>&1  | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=O3ONCE C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -fopenmp=libomp -fopenmp-targets=amdgcn-amd-amdhsa -nogpulib -nogpuinc -Xarch_amdgcn -march=gfx90a -Xarch_amdgcn -O3 -S '-###' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=O3ONCE 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 9
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -nogpulib -nogpuinc    -Xarch_nvptx64 -march=sm_52 -Xarch_nvptx64 -O3 -S -### C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c 2>&1  | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=O3ONCE C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -nogpulib -nogpuinc -Xarch_nvptx64 -march=sm_52 -Xarch_nvptx64 -O3 -S '-###' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=O3ONCE 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 15
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -nogpulib    --target=x86_64-unknown-linux-gnu -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_52,sm_60 -nogpuinc    -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx90a,gfx1030 -ccc-print-bindings -### C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c 2>&1  | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=OPENMP C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda,amdgcn-amd-amdhsa -nogpulib --target=x86_64-unknown-linux-gnu -Xopenmp-target=nvptx64-nvidia-cuda --offload-arch=sm_52,sm_60 -nogpuinc -Xopenmp-target=amdgcn-amd-amdhsa --offload-arch=gfx90a,gfx1030 -ccc-print-bindings '-###' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=OPENMP 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 31
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -x cuda C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c --offload-arch=sm_52,sm_60 -Xarch_sm_52 -O3 -Xarch_sm_60 -O0    --target=x86_64-unknown-linux-gnu -Xarch_host -O3 -S -nogpulib -nogpuinc -### 2>&1  | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=CUDA C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -x cuda 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c' --offload-arch=sm_52,sm_60 -Xarch_sm_52 -O3 -Xarch_sm_60 -O0 --target=x86_64-unknown-linux-gnu -Xarch_host -O3 -S -nogpulib -nogpuinc '-###'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=CUDA 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# RUN: at line 39
c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe -fopenmp=libomp --offload-arch=gfx90a -nogpulib -nogpuinc    --target=x86_64-unknown-linux-gnu -Xarch_amdgcn -Wl,-lfoo -### C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c 2>&1  | c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe -check-prefix=LIBS C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\clang.exe' -fopenmp=libomp --offload-arch=gfx90a -nogpulib -nogpuinc --target=x86_64-unknown-linux-gnu -Xarch_amdgcn -Wl,-lfoo '-###' 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# executed command: 'c:\buildbot\as-builder-1\x-armv7l\build\bin\filecheck.exe' -check-prefix=LIBS 'C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c'
# .---command stderr------------
# | C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c:45:10: error: LIBS: expected string not found in input
# | // LIBS: "--device-linker=amdgcn-amd-amdhsa=-lfoo"
# |          ^
# | <stdin>:1:1: note: scanning from here
# | clang version 21.0.0git (https://github.com/llvm/llvm-project.git 554347ba45b506c86d0025b1e0e7ab1753c63c6a)
# | ^
# | <stdin>:6:1316: note: possible intended match here
# |  "C:\\buildbot\\as-builder-1\\x-armv7l\\build\\bin\\clang.exe" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-llvm-bc" "-emit-llvm-uselists" "-dumpdir" "a-" "-disable-free" "-clear-ast-before-backend" "-main-file-name" "offload-Xarch.c" "-mrelocation-model" "pic" "-pic-level" "2" "-pic-is-pie" "-mframe-pointer=all" "-fmath-errno" "-ffp-contract=on" "-fno-rounding-math" "-mconstructor-aliases" "-funwind-tables=2" "-target-cpu" "x86-64" "-tune-cpu" "generic" "-debugger-tuning=gdb" "-fdebug-compilation-dir=C:\\buildbot\\as-builder-1\\x-armv7l\\build\\tools\\clang\\test\\Driver" "-fcoverage-compilation-dir=C:\\buildbot\\as-builder-1\\x-armv7l\\build\\tools\\clang\\test\\Driver" "-resource-dir" "C:\\buildbot\\as-builder-1\\x-armv7l\\build\\lib\\clang\\21" "-internal-isystem" "C:\\buildbot\\as-builder-1\\x-armv7l\\build\\lib\\clang\\21\\include" "-internal-isystem" "/usr/local/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-internal-isystem" "C:\\buildbot\\as-builder-1\\x-armv7l\\build\\lib\\clang\\21\\include" "-internal-isystem" "/usr/local/include" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-ferror-limit" "19" "-fopenmp" "--no-offloadlib" "-fgnuc-version=4.2.1" "-fskip-odr-check-in-gmf" "-disable-llvm-passes" "-fopenmp-targets=amdgcn-amd-amdhsa" "-faddrsig" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "C:\\buildbot\\as-builder-1\\x-armv7l\\build\\lit-tmp-51krks2z\\offload-Xarch-90eaa7.bc" "-x" "c" "C:\\buildbot\\as-builder-1\\x-armv7l\\llvm-project\\clang\\test\\Driver\\offload-Xarch.c"
# |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^
# | 
# | Input file: <stdin>
# | Check file: C:\buildbot\as-builder-1\x-armv7l\llvm-project\clang\test\Driver\offload-Xarch.c
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants