Skip to content

Commit

Permalink
[AutoBump] Merge with 3c53745 (Aug 20)
Browse files Browse the repository at this point in the history
  • Loading branch information
mgehre-amd committed Sep 20, 2024
2 parents 6f28929 + 3c53745 commit f011f11
Show file tree
Hide file tree
Showing 70 changed files with 657 additions and 343 deletions.
13 changes: 13 additions & 0 deletions clang-tools-extra/clang-doc/HTMLGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -678,6 +678,19 @@ static std::unique_ptr<HTMLNode> genHTML(const CommentInfo &I) {
return std::move(ParagraphComment);
}

if (I.Kind == "BlockCommandComment") {
auto BlockComment = std::make_unique<TagNode>(HTMLTag::TAG_DIV);
BlockComment->Children.emplace_back(
std::make_unique<TagNode>(HTMLTag::TAG_DIV, I.Name));
for (const auto &Child : I.Children) {
std::unique_ptr<HTMLNode> Node = genHTML(*Child);
if (Node)
BlockComment->Children.emplace_back(std::move(Node));
}
if (BlockComment->Children.empty())
return nullptr;
return std::move(BlockComment);
}
if (I.Kind == "TextComment") {
if (I.Text == "")
return nullptr;
Expand Down
84 changes: 68 additions & 16 deletions clang-tools-extra/test/clang-doc/basic-project.test
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,62 @@

// HTML-SHAPE: <h1>class Shape</h1>
// HTML-SHAPE: <p>Defined at line 8 of file {{.*}}Shape.h</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Abstract base class for shapes.</p>
// HTML-SHAPE: <p> Provides a common interface for different types of shapes.</p>
// HTML-SHAPE: <h2 id="Functions">Functions</h2>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-SHAPE: <p>public double area()</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Calculates the area of the shape.</p>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-SHAPE: <p>public double perimeter()</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Calculates the perimeter of the shape.</p>
// HTML-SHAPE: <div>return</div>
// HTML-SHAPE: <p> double The perimeter of the shape.</p>
// HTML-SHAPE: <h3 id="{{([0-9A-F]{40})}}">~Shape</h3>
// HTML-SHAPE: <p>public void ~Shape()</p>
// HTML-SHAPE: <p>Defined at line 13 of file {{.*}}Shape.h</p>
// HTML-SHAPE: <div>brief</div>
// HTML-SHAPE: <p> Virtual destructor.</p>

// HTML-CALC: <h1>class Calculator</h1>
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
// HTML-CALC: <h2 id="Functions">Functions</h2>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
// HTML-CALC: <p>public int add(int a, int b)</p>
// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
// HTML-CALC: <p>public int subtract(int a, int b)</p>
// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
// HTML-CALC: <p>public int multiply(int a, int b)</p>
// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
// HTML-CALC: <p>public double divide(int a, int b)</p>
// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <h1>class Calculator</h1>
// HTML-CALC: <p>Defined at line 8 of file {{.*}}Calculator.h</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> A simple calculator class.</p>
// HTML-CALC: <p> Provides basic arithmetic operations.</p>
// HTML-CALC: <h2 id="Functions">Functions</h2>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">add</h3>
// HTML-CALC: <p>public int add(int a, int b)</p>
// HTML-CALC: <p>Defined at line 3 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Adds two integers.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The sum of a and b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">subtract</h3>
// HTML-CALC: <p>public int subtract(int a, int b)</p>
// HTML-CALC: <p>Defined at line 7 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Subtracts the second integer from the first.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The result of a - b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">multiply</h3>
// HTML-CALC: <p>public int multiply(int a, int b)</p>
// HTML-CALC: <p>Defined at line 11 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Multiplies two integers.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> int The product of a and b.</p>
// HTML-CALC: <h3 id="{{([0-9A-F]{40})}}">divide</h3>
// HTML-CALC: <p>public double divide(int a, int b)</p>
// HTML-CALC: <p>Defined at line 15 of file {{.*}}Calculator.cpp</p>
// HTML-CALC: <div>brief</div>
// HTML-CALC: <p> Divides the first integer by the second.</p>
// HTML-CALC: <div>return</div>
// HTML-CALC: <p> double The result of a / b.</p>
// HTML-CALC: <div>throw</div>
// HTML-CALC: <p>if b is zero.</p>

// HTML-RECTANGLE: <h1>class Rectangle</h1>
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.h</p>
Expand All @@ -99,15 +129,27 @@
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">Rectangle</h3>
// HTML-RECTANGLE: <p>public void Rectangle(double width, double height)</p>
// HTML-RECTANGLE: <p>Defined at line 3 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Constructs a new Rectangle object.</p>
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-RECTANGLE: <p>public double area()</p>
// HTML-RECTANGLE: <p>Defined at line 6 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Calculates the area of the rectangle.</p>
// HTML-RECTANGLE: <div>return</div>
// HTML-RECTANGLE: <p> double The area of the rectangle.</p>
// HTML-RECTANGLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-RECTANGLE: <p>public double perimeter()</p>
// HTML-RECTANGLE: <p>Defined at line 10 of file {{.*}}Rectangle.cpp</p>
// HTML-RECTANGLE: <div>brief</div>
// HTML-RECTANGLE: <p> Calculates the perimeter of the rectangle.</p>
// HTML-RECTANGLE: <div>return</div>
// HTML-RECTANGLE: <p> double The perimeter of the rectangle.</p>

// HTML-CIRCLE: <h1>class Circle</h1>
// HTML-CIRCLE: <p>Defined at line 10 of file {{.*}}Circle.h</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Circle class derived from Shape.</p>
// HTML-CIRCLE: <p> Represents a circle with a given radius.</p>
// HTML-CIRCLE: <p>
// HTML-CIRCLE: Inherits from
Expand All @@ -120,12 +162,22 @@
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">Circle</h3>
// HTML-CIRCLE: <p>public void Circle(double radius)</p>
// HTML-CIRCLE: <p>Defined at line 3 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Constructs a new Circle object.</p>
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">area</h3>
// HTML-CIRCLE: <p>public double area()</p>
// HTML-CIRCLE: <p>Defined at line 5 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Calculates the area of the circle.</p>
// HTML-CIRCLE: <div>return</div>
// HTML-CIRCLE: <p> double The area of the circle.</p>
// HTML-CIRCLE: <h3 id="{{([0-9A-F]{40})}}">perimeter</h3>
// HTML-CIRCLE: <p>public double perimeter()</p>
// HTML-CIRCLE: <p>Defined at line 9 of file {{.*}}Circle.cpp</p>
// HTML-CIRCLE: <div>brief</div>
// HTML-CIRCLE: <p> Calculates the perimeter of the circle.</p>
// HTML-CIRCLE: <div>return</div>
// HTML-CIRCLE: <p> double The perimeter of the circle.</p>

// MD-CALC: # class Calculator
// MD-CALC: *Defined at .{{[\/]}}include{{[\/]}}Calculator.h#8*
Expand Down
8 changes: 4 additions & 4 deletions clang/lib/AST/ByteCode/Compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
unsigned DerivedOffset = collectBaseOffset(QualType(ToMP->getClass(), 0),
QualType(FromMP->getClass(), 0));

if (!this->visit(SubExpr))
if (!this->delegate(SubExpr))
return false;

return this->emitGetMemberPtrBasePop(DerivedOffset, CE);
Expand All @@ -229,14 +229,14 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
unsigned DerivedOffset = collectBaseOffset(QualType(FromMP->getClass(), 0),
QualType(ToMP->getClass(), 0));

if (!this->visit(SubExpr))
if (!this->delegate(SubExpr))
return false;
return this->emitGetMemberPtrBasePop(-DerivedOffset, CE);
}

case CK_UncheckedDerivedToBase:
case CK_DerivedToBase: {
if (!this->visit(SubExpr))
if (!this->delegate(SubExpr))
return false;

const auto extractRecordDecl = [](QualType Ty) -> const CXXRecordDecl * {
Expand Down Expand Up @@ -265,7 +265,7 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
}

case CK_BaseToDerived: {
if (!this->visit(SubExpr))
if (!this->delegate(SubExpr))
return false;

unsigned DerivedOffset =
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/AST/ByteCode/Interp.h
Original file line number Diff line number Diff line change
Expand Up @@ -1568,7 +1568,7 @@ inline bool GetPtrBase(InterpState &S, CodePtr OpPC, uint32_t Off) {
if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
return false;
const Pointer &Result = Ptr.atField(Off);
if (Result.isPastEnd())
if (Result.isPastEnd() || !Result.isBaseClass())
return false;
S.Stk.push<Pointer>(Result);
return true;
Expand All @@ -1581,7 +1581,7 @@ inline bool GetPtrBasePop(InterpState &S, CodePtr OpPC, uint32_t Off) {
if (!CheckSubobject(S, OpPC, Ptr, CSK_Base))
return false;
const Pointer &Result = Ptr.atField(Off);
if (Result.isPastEnd())
if (Result.isPastEnd() || !Result.isBaseClass())
return false;
S.Stk.push<Pointer>(Result);
return true;
Expand Down
45 changes: 45 additions & 0 deletions clang/test/AST/ByteCode/builtin-functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,51 @@ namespace isfpclass {
char isfpclass_snan_3 [!__builtin_isfpclass(__builtin_nans(""), 0x01F8) ? 1 : -1]; // fcFinite
}

namespace signbit {
static_assert(
!__builtin_signbit(1.0) && __builtin_signbit(-1.0) && !__builtin_signbit(0.0) && __builtin_signbit(-0.0) &&
!__builtin_signbitf(1.0f) && __builtin_signbitf(-1.0f) && !__builtin_signbitf(0.0f) && __builtin_signbitf(-0.0f) &&
!__builtin_signbitl(1.0L) && __builtin_signbitf(-1.0L) && !__builtin_signbitf(0.0L) && __builtin_signbitf(-0.0L) &&
!__builtin_signbit(1.0f) && __builtin_signbit(-1.0f) && !__builtin_signbit(0.0f) && __builtin_signbit(-0.0f) &&
!__builtin_signbit(1.0L) && __builtin_signbit(-1.0L) && !__builtin_signbit(0.0L) && __builtin_signbit(-0.0L) &&
true, ""
);
}

namespace floating_comparison {
#define LESS(X, Y) \
!__builtin_isgreater(X, Y) && __builtin_isgreater(Y, X) && \
!__builtin_isgreaterequal(X, Y) && __builtin_isgreaterequal(Y, X) && \
__builtin_isless(X, Y) && !__builtin_isless(Y, X) && \
__builtin_islessequal(X, Y) && !__builtin_islessequal(Y, X) && \
__builtin_islessgreater(X, Y) && __builtin_islessgreater(Y, X) && \
!__builtin_isunordered(X, Y) && !__builtin_isunordered(Y, X)
#define EQUAL(X, Y) \
!__builtin_isgreater(X, Y) && !__builtin_isgreater(Y, X) && \
__builtin_isgreaterequal(X, Y) && __builtin_isgreaterequal(Y, X) && \
!__builtin_isless(X, Y) && !__builtin_isless(Y, X) && \
__builtin_islessequal(X, Y) && __builtin_islessequal(Y, X) && \
!__builtin_islessgreater(X, Y) && !__builtin_islessgreater(Y, X) && \
!__builtin_isunordered(X, Y) && !__builtin_isunordered(Y, X)
#define UNORDERED(X, Y) \
!__builtin_isgreater(X, Y) && !__builtin_isgreater(Y, X) && \
!__builtin_isgreaterequal(X, Y) && !__builtin_isgreaterequal(Y, X) && \
!__builtin_isless(X, Y) && !__builtin_isless(Y, X) && \
!__builtin_islessequal(X, Y) && !__builtin_islessequal(Y, X) && \
!__builtin_islessgreater(X, Y) && !__builtin_islessgreater(Y, X) && \
__builtin_isunordered(X, Y) && __builtin_isunordered(Y, X)

static_assert(
LESS(0.0, 1.0) && EQUAL(1.0, 1.0) && EQUAL(0.0, -0.0) &&
UNORDERED(__builtin_nan(""), 1.0) && UNORDERED(__builtin_nan(""), __builtin_inf()) && LESS(0.0, __builtin_inf()) &&
LESS(0.0f, 1.0f) && EQUAL(1.0f, 1.0f) && EQUAL(0.0f, -0.0f) &&
UNORDERED(__builtin_nanf(""), 1.0f) && UNORDERED(__builtin_nanf(""), __builtin_inff()) && LESS(0.0f, __builtin_inff()) &&
LESS(0.0L, 1.0L) && EQUAL(1.0L, 1.0L) && EQUAL(0.0L, -0.0L) &&
UNORDERED(__builtin_nanl(""), 1.0L) && UNORDERED(__builtin_nanl(""), __builtin_infl()) && LESS(0.0L, __builtin_infl()) &&
true, ""
);
}

namespace fpclassify {
char classify_nan [__builtin_fpclassify(+1, -1, -1, -1, -1, __builtin_nan(""))];
char classify_snan [__builtin_fpclassify(+1, -1, -1, -1, -1, __builtin_nans(""))];
Expand Down
39 changes: 39 additions & 0 deletions clang/test/CodeGenCoroutines/coro-dwarf-O2.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Check that we can still observe the value of the coroutine frame
// with optimizations.
//
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -std=c++20 \
// RUN: -emit-llvm %s -debug-info-kind=limited -dwarf-version=5 \
// RUN: -O2 -o - | FileCheck %s

#include "Inputs/coroutine.h"

template <>
struct std::coroutine_traits<void> {
struct promise_type {
void get_return_object();
std::suspend_always initial_suspend();
std::suspend_always final_suspend() noexcept;
void return_void();
void unhandled_exception();
};
};

struct ScalarAwaiter {
template <typename F> void await_suspend(F);
bool await_ready();
int await_resume();
};

extern "C" void UseScalar(int);

extern "C" void f() {
UseScalar(co_await ScalarAwaiter{});

int Val = co_await ScalarAwaiter{};

co_await ScalarAwaiter{};
}

// CHECK: define {{.*}}@f.resume({{.*}} %[[ARG:.*]])
// CHECK: #dbg_value(ptr %[[ARG]], ![[CORO_NUM:[0-9]+]], !DIExpression(DW_OP_deref)
// CHECK: ![[CORO_NUM]] = !DILocalVariable(name: "__coro_frame"
1 change: 1 addition & 0 deletions clang/test/Modules/merge-using-decls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
// RUN: %clang_cc1 -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++11 %s -DORDER=2

// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fmodules -fimplicit-module-maps -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++17 %s -DORDER=2
// RUN: %clang_cc1 -fexperimental-new-constant-interpreter -fmodules -fimplicit-module-maps -fexperimental-new-constant-interpreter -fmodules-cache-path=%t -x c++ -I%S/Inputs/merge-using-decls -verify -std=c++98 %s -DORDER=1

#if ORDER == 1
#include "a.h"
Expand Down
6 changes: 5 additions & 1 deletion lld/COFF/Symbols.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,13 @@ DefinedImportThunk::DefinedImportThunk(COFFLinkerContext &ctx, StringRef name,

Defined *Undefined::getWeakAlias() {
// A weak alias may be a weak alias to another symbol, so check recursively.
for (Symbol *a = weakAlias; a; a = cast<Undefined>(a)->weakAlias)
DenseSet<Symbol *> weakChain;
for (Symbol *a = weakAlias; a; a = cast<Undefined>(a)->weakAlias) {
if (auto *d = dyn_cast<Defined>(a))
return d;
if (!weakChain.insert(a).second)
break; // We have a cycle.
}
return nullptr;
}

Expand Down
41 changes: 41 additions & 0 deletions lld/test/COFF/weak-external-cycle.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
REQUIRES: x86
RUN: split-file %s %t.dir && cd %t.dir

RUN: llvm-mc -filetype=obj -triple=x86_64-windows test.s -o test.obj
RUN: llvm-mc -filetype=obj -triple=x86_64-windows sym2.s -o sym2.obj
RUN: llvm-mc -filetype=obj -triple=x86_64-windows def.s -o def.obj

RUN: not lld-link -machine:amd64 -dll -noentry -out:test.dll test.obj sym2.obj 2>&1 | FileCheck -check-prefix=ERR %s

ERR: error: undefined symbol: testsym
ERR-NEXT: >>> referenced by test.obj
ERR-EMPTY:
ERR-NEXT: error: undefined symbol: sym1
ERR-NEXT: >>> referenced by test.obj
ERR-NEXT: >>> referenced by sym2.obj
ERR-EMPTY:
ERR-NEXT: error: undefined symbol: sym2
ERR-NEXT: >>> referenced by test.obj
ERR-NEXT: >>> referenced by sym2.obj

Depending on symbol processing order, we may have temporary weak reference cycles:

RUN: lld-link -machine:amd64 -dll -noentry -out:test.dll test.obj sym2.obj def.obj
RUN: lld-link -machine:amd64 -dll -noentry -out:test.dll test.obj def.obj sym2.obj
RUN: lld-link -machine:amd64 -dll -noentry -out:test.dll def.obj test.obj sym2.obj

#--- test.s
.weak testsym
.set testsym, sym1
.weak sym1
.set sym1, sym2

#--- sym2.s
.weak sym2
.set sym2, sym1

#--- def.s
.globl sym1
.data
sym1:
.word 0
2 changes: 1 addition & 1 deletion lld/test/ELF/exclude-libs.s
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux \
// RUN: %p/Inputs/exclude-libs.s -o %t2.o
// RUN: llvm-as --data-layout=elf %p/Inputs/exclude-libs.ll -o %t3.o
// RUN: llvm-as --data-layout=e %p/Inputs/exclude-libs.ll -o %t3.o
// RUN: mkdir -p %t.dir
// RUN: rm -f %t.dir/exc.a
// RUN: llvm-ar rcs %t.dir/exc.a %t2.o %t3.o
Expand Down
6 changes: 3 additions & 3 deletions lldb/source/API/SBBreakpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ uint32_t SBBreakpoint::GetIgnoreCount() const {
return count;
}

void SBBreakpoint::SetThreadID(tid_t tid) {
void SBBreakpoint::SetThreadID(lldb::tid_t tid) {
LLDB_INSTRUMENT_VA(this, tid);

BreakpointSP bkpt_sp = GetSP();
Expand All @@ -353,10 +353,10 @@ void SBBreakpoint::SetThreadID(tid_t tid) {
}
}

tid_t SBBreakpoint::GetThreadID() {
lldb::tid_t SBBreakpoint::GetThreadID() {
LLDB_INSTRUMENT_VA(this);

tid_t tid = LLDB_INVALID_THREAD_ID;
lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
BreakpointSP bkpt_sp = GetSP();
if (bkpt_sp) {
std::lock_guard<std::recursive_mutex> guard(
Expand Down
Loading

0 comments on commit f011f11

Please sign in to comment.