Skip to content

Commit 1e8336c

Browse files
committed
Merge from '"main"' to '"sycl-web"' (2 commits)
CONFLICT (content): Merge conflict in libclc/CMakeLists.txt
2 parents e1cdb12 + ec0a880 commit 1e8336c

File tree

684 files changed

+26601
-14152
lines changed

Some content is hidden

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

684 files changed

+26601
-14152
lines changed

bolt/README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ generated by Clang/GCC.
2828
NOTE: BOLT is currently incompatible with the `-freorder-blocks-and-partition`
2929
compiler option. Since GCC8 enables this option by default, you have to
3030
explicitly disable it by adding `-fno-reorder-blocks-and-partition` flag if
31-
you are compiling with GCC8.
31+
you are compiling with GCC8 or above.
3232

3333
PIE and .so support has been added recently. Please report bugs if you
3434
encounter any issues.
@@ -37,7 +37,7 @@ encounter any issues.
3737

3838
### Docker Image
3939

40-
You can build and use the docker image containing BOLT using our [docker file](./bolt/utils/docker/Dockerfile).
40+
You can build and use the docker image containing BOLT using our [docker file](utils/docker/Dockerfile).
4141
Alternatively, you can build BOLT manually using the steps below.
4242

4343
### Manual Build
@@ -46,22 +46,19 @@ BOLT heavily uses LLVM libraries, and by design, it is built as one of LLVM
4646
tools. The build process is not much different from a regular LLVM build.
4747
The following instructions are assuming that you are running under Linux.
4848

49-
Start with cloning LLVM and BOLT repos:
49+
Start with cloning LLVM repo:
5050

5151
```
52-
> git clone https://github.com/facebookincubator/BOLT llvm-bolt
52+
> git clone https://github.com/llvm/llvm-project.git
5353
> mkdir build
5454
> cd build
55-
> cmake -G Ninja ../llvm-bolt/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="clang;lld;bolt"
56-
> ninja
55+
> cmake -G Ninja ../llvm-project/llvm -DLLVM_TARGETS_TO_BUILD="X86;AArch64" -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON -DLLVM_ENABLE_PROJECTS="bolt"
56+
> ninja bolt
5757
```
5858

5959
`llvm-bolt` will be available under `bin/`. Add this directory to your path to
6060
ensure the rest of the commands in this tutorial work.
6161

62-
Note that we use a specific snapshot of LLVM monorepo as we currently
63-
rely on a set of patches that are not yet upstreamed.
64-
6562
## Optimizing BOLT's Performance
6663

6764
BOLT runs many internal passes in parallel. If you foresee heavy usage of
@@ -80,7 +77,7 @@ Or if you rather use tcmalloc:
8077

8178
## Usage
8279

83-
For a complete practical guide of using BOLT see [Optimizing Clang with BOLT](./bolt/docs/OptimizingClang.md).
80+
For a complete practical guide of using BOLT see [Optimizing Clang with BOLT](docs/OptimizingClang.md).
8481

8582
### Step 0
8683

bolt/utils/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN apt-get update && \
1111

1212
WORKDIR /home/bolt
1313

14-
RUN git clone --depth 1 https://github.com/facebookincubator/BOLT llvm-project
14+
RUN git clone --depth 1 https://github.com/llvm/llvm-project
1515

1616
RUN mkdir build && \
1717
cd build && \

clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.cpp

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ removeNamespaces(const std::vector<std::string> &Names) {
4343
StringConstructorCheck::StringConstructorCheck(StringRef Name,
4444
ClangTidyContext *Context)
4545
: ClangTidyCheck(Name, Context),
46+
IsStringviewNullptrCheckEnabled(
47+
Context->isCheckEnabled("bugprone-stringview-nullptr")),
4648
WarnOnLargeLength(Options.get("WarnOnLargeLength", true)),
4749
LargeLengthThreshold(Options.get("LargeLengthThreshold", 0x800000)),
4850
StringNames(utils::options::parseStringList(
@@ -121,17 +123,20 @@ void StringConstructorCheck::registerMatchers(MatchFinder *Finder) {
121123
// Check the literal string constructor with char pointer.
122124
// [i.e. string (const char* s);]
123125
Finder->addMatcher(
124-
traverse(TK_AsIs,
125-
cxxConstructExpr(
126-
hasDeclaration(cxxConstructorDecl(ofClass(cxxRecordDecl(
127-
hasAnyName(removeNamespaces(StringNames)))))),
128-
hasArgument(0, expr().bind("from-ptr")),
129-
// do not match std::string(ptr, int)
130-
// match std::string(ptr, alloc)
131-
// match std::string(ptr)
132-
anyOf(hasArgument(1, unless(hasType(isInteger()))),
133-
argumentCountIs(1)))
134-
.bind("constructor")),
126+
traverse(
127+
TK_AsIs,
128+
cxxConstructExpr(
129+
hasDeclaration(cxxConstructorDecl(ofClass(anyOf(
130+
cxxRecordDecl(hasName("basic_string_view"))
131+
.bind("basic_string_view_decl"),
132+
cxxRecordDecl(hasAnyName(removeNamespaces(StringNames))))))),
133+
hasArgument(0, expr().bind("from-ptr")),
134+
// do not match std::string(ptr, int)
135+
// match std::string(ptr, alloc)
136+
// match std::string(ptr)
137+
anyOf(hasArgument(1, unless(hasType(isInteger()))),
138+
argumentCountIs(1)))
139+
.bind("constructor")),
135140
this);
136141
}
137142

@@ -167,6 +172,12 @@ void StringConstructorCheck::check(const MatchFinder::MatchResult &Result) {
167172
Ptr->EvaluateAsRValue(ConstPtr, Ctx) &&
168173
((ConstPtr.Val.isInt() && ConstPtr.Val.getInt().isZero()) ||
169174
(ConstPtr.Val.isLValue() && ConstPtr.Val.isNullPointer()))) {
175+
if (IsStringviewNullptrCheckEnabled &&
176+
Result.Nodes.getNodeAs<CXXRecordDecl>("basic_string_view_decl")) {
177+
// Filter out `basic_string_view` to avoid conflicts with
178+
// `bugprone-stringview-nullptr`
179+
return;
180+
}
170181
diag(Loc, "constructing string from nullptr is undefined behaviour");
171182
}
172183
}

clang-tools-extra/clang-tidy/bugprone/StringConstructorCheck.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class StringConstructorCheck : public ClangTidyCheck {
3030
void check(const ast_matchers::MatchFinder::MatchResult &Result) override;
3131

3232
private:
33+
const bool IsStringviewNullptrCheckEnabled;
3334
const bool WarnOnLargeLength;
3435
const unsigned int LargeLengthThreshold;
3536
std::vector<std::string> StringNames;

0 commit comments

Comments
 (0)