Skip to content

Commit b2181c3

Browse files
author
Pavel V Chupin
committed
Merge from 'main' to 'sycl-web' (91 commits)
CONFLICT (content): Merge conflict in llvm/lib/Transforms/IPO/PassManagerBuilder.cpp
2 parents af11c17 + fb4113e commit b2181c3

File tree

334 files changed

+6414
-8632
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

334 files changed

+6414
-8632
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
*~
1414
# Merge files created by git.
1515
*.orig
16+
# Reject files created by patch.
17+
*.rej
1618
# Byte compiled python modules.
1719
*.pyc
1820
# vim swap files

bolt/test/AArch64/r_aarch64_prelxx.s

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// This test checks processing of R_AARCH64_PREL64/32/16 relocations
2+
// S + A - P = Value
3+
// S = P - A + Value
4+
5+
// mul(D1,0x100) == << 8
6+
// mul(D2,0x10000) == << 16
7+
// mul(D3,0x1000000) == << 24
8+
9+
// REQUIRES: system-linux
10+
11+
// RUN: %clang %cflags -nostartfiles -nostdlib %s -o %t.exe -mlittle-endian \
12+
// RUN: -Wl,-q -Wl,-z,max-page-size=4
13+
// RUN: llvm-readelf -Wa %t.exe | FileCheck %s -check-prefix=CHECKPREL
14+
15+
// CHECKPREL: R_AARCH64_PREL16 {{.*}} .dummy + 0
16+
// CHECKPREL-NEXT: R_AARCH64_PREL32 {{.*}} _start + 4
17+
// CHECKPREL-NEXT: R_AARCH64_PREL64 {{.*}} _start + 8
18+
19+
// RUN: llvm-bolt %t.exe -o %t.bolt
20+
// RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL32
21+
22+
// CHECKPREL32: [[#%x,DATATABLEADDR:]] <datatable>:
23+
// CHECKPREL32-NEXT: 00:
24+
// CHECKPREL32-NEXT: 04: [[#%x,D0:]] [[#%x,D1:]] [[#%x,D2:]] [[#%x,D3:]]
25+
26+
// 4 is offset in datatable
27+
// 8 is addend
28+
// CHECKPREL32: [[#DATATABLEADDR + 4 - 8 + D0 + mul(D1,0x100) + mul(D2,0x10000) + mul(D3,0x1000000)]] <_start>:
29+
30+
// RUN: llvm-objdump -D %t.bolt | FileCheck %s --check-prefix=CHECKPREL64
31+
// CHECKPREL64: [[#%x,DATATABLEADDR:]] <datatable>:
32+
// CHECKPREL64-NEXT: 00:
33+
// CHECKPREL64-NEXT: 04:
34+
// CHECKPREL64-NEXT: 08: [[#%x,D0:]] [[#%x,D1:]] [[#%x,D2:]] [[#%x,D3:]]
35+
// CHECKPREL64-NEXT: 0c: 00 00 00 00
36+
37+
// 8 is offset in datatable
38+
// 12 is addend
39+
// CHECKPREL64: [[#DATATABLEADDR + 8 - 12 + D0 + mul(D1,0x100) + mul(D2,0x10000) + mul(D3,0x1000000)]] <_start>:
40+
41+
.section .text
42+
.align 4
43+
.globl _start
44+
.type _start, %function
45+
_start:
46+
adr x0, datatable
47+
mov x0, #0
48+
ret
49+
50+
.section .dummy, "da"
51+
dummy:
52+
.word 0
53+
54+
.data
55+
.align 8
56+
datatable:
57+
.hword dummy - datatable
58+
.align 2
59+
.word _start - datatable
60+
.xword _start - datatable

bolt/test/runtime/AArch64/r_aarch64_prelxx.s

Lines changed: 0 additions & 37 deletions
This file was deleted.

clang-tools-extra/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ add_subdirectory(clang-doc)
1414
add_subdirectory(clang-include-fixer)
1515
add_subdirectory(clang-move)
1616
add_subdirectory(clang-query)
17+
add_subdirectory(include-cleaner)
1718
add_subdirectory(pp-trace)
1819
add_subdirectory(pseudo)
1920
add_subdirectory(tool-template)
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
add_subdirectory(lib)
2+
if(CLANG_INCLUDE_TESTS)
3+
add_subdirectory(test)
4+
add_subdirectory(unittests)
5+
endif()

clang-tools-extra/include-cleaner/README.md

Whitespace-only changes.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//===--- AnalysisInternal.h - Analysis building blocks ------------- C++-*-===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
//
9+
// This file provides smaller, testable pieces of the used-header analysis.
10+
// We find the headers by chaining together several mappings.
11+
//
12+
// AST => AST node => Symbol => Location => Header
13+
// /
14+
// Macro expansion =>
15+
//
16+
// The individual steps are declared here.
17+
// (AST => AST Node => Symbol is one API to avoid materializing DynTypedNodes).
18+
//
19+
//===----------------------------------------------------------------------===//
20+
21+
#ifndef CLANG_INCLUDE_CLEANER_ANALYSISINTERNAL_H
22+
#define CLANG_INCLUDE_CLEANER_ANALYSISINTERNAL_H
23+
24+
#include "clang/Basic/SourceLocation.h"
25+
#include "llvm/ADT/STLFunctionalExtras.h"
26+
27+
namespace clang {
28+
class Decl;
29+
class NamedDecl;
30+
namespace include_cleaner {
31+
32+
/// Traverses part of the AST from \p Root, finding uses of symbols.
33+
///
34+
/// Each use is reported to the callback:
35+
/// - the SourceLocation describes where the symbol was used. This is usually
36+
/// the primary location of the AST node found under Root.
37+
/// - the NamedDecl is the symbol referenced. It is canonical, rather than e.g.
38+
/// the redecl actually found by lookup.
39+
///
40+
/// walkAST is typically called once per top-level declaration in the file
41+
/// being analyzed, in order to find all references within it.
42+
void walkAST(Decl &Root, llvm::function_ref<void(SourceLocation, NamedDecl &)>);
43+
44+
} // namespace include_cleaner
45+
} // namespace clang
46+
47+
#endif
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
set(LLVM_LINK_COMPONENTS Support)
2+
3+
add_clang_library(clangIncludeCleaner
4+
WalkAST.cpp
5+
6+
LINK_LIBS
7+
clangBasic
8+
clangAST
9+
)
10+
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//===--- WalkAST.cpp - Find declaration references in the AST -------------===//
2+
//
3+
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4+
// See https://llvm.org/LICENSE.txt for license information.
5+
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6+
//
7+
//===----------------------------------------------------------------------===//
8+
9+
#include "AnalysisInternal.h"
10+
#include "clang/AST/RecursiveASTVisitor.h"
11+
12+
namespace clang {
13+
namespace include_cleaner {
14+
namespace {
15+
using DeclCallback = llvm::function_ref<void(SourceLocation, NamedDecl &)>;
16+
17+
class ASTWalker : public RecursiveASTVisitor<ASTWalker> {
18+
DeclCallback Callback;
19+
20+
void report(SourceLocation Loc, NamedDecl *ND) {
21+
if (!ND || Loc.isInvalid())
22+
return;
23+
Callback(Loc, *cast<NamedDecl>(ND->getCanonicalDecl()));
24+
}
25+
26+
public:
27+
ASTWalker(DeclCallback Callback) : Callback(Callback) {}
28+
29+
bool VisitTagTypeLoc(TagTypeLoc TTL) {
30+
report(TTL.getNameLoc(), TTL.getDecl());
31+
return true;
32+
}
33+
34+
bool VisitDeclRefExpr(DeclRefExpr *DRE) {
35+
report(DRE->getLocation(), DRE->getFoundDecl());
36+
return true;
37+
}
38+
};
39+
40+
} // namespace
41+
42+
void walkAST(Decl &Root, DeclCallback Callback) {
43+
ASTWalker(Callback).TraverseDecl(&Root);
44+
}
45+
46+
} // namespace include_cleaner
47+
} // namespace clang
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
set(CLANG_INCLUDE_CLEANER_TEST_DEPS
2+
ClangIncludeCleanerTests
3+
)
4+
5+
foreach (dep FileCheck not count)
6+
if(TARGET ${dep})
7+
list(APPEND CLANG_INCLUDE_CLEANER_TEST_DEPS ${dep})
8+
endif()
9+
endforeach()
10+
11+
configure_lit_site_cfg(
12+
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
13+
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
14+
MAIN_CONFIG
15+
${CMAKE_CURRENT_BINARY_DIR}/lit.cfg.py)
16+
17+
configure_lit_site_cfg(
18+
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
19+
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
20+
MAIN_CONFIG
21+
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.cfg.py)
22+
23+
add_lit_testsuite(check-clang-include-cleaner "Running the clang-include-cleaner regression tests"
24+
${CMAKE_CURRENT_BINARY_DIR}
25+
DEPENDS ${CLANG_INCLUDE_CLEANER_TEST_DEPS})

0 commit comments

Comments
 (0)