Skip to content

Commit 3cd0f86

Browse files
committed
merge main into amd-staging
2 parents 16ad33e + 23c2f88 commit 3cd0f86

File tree

177 files changed

+571
-376
lines changed

Some content is hidden

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

177 files changed

+571
-376
lines changed

.ci/metrics/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929
# name.
3030
GITHUB_JOB_TO_TRACK = {
3131
"github_llvm_premerge_checks": {
32-
"Build and Test Linux (Test Only - Please Ignore Results)": "premerge_linux",
33-
"Build and Test Windows (Test Only - Please Ignore Results)": "premerge_windows",
32+
"Build and Test Linux": "premerge_linux",
33+
"Build and Test Windows": "premerge_windows",
3434
}
3535
}
3636

.github/workflows/premerge.yaml

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ on:
1616
- closed
1717
push:
1818
branches:
19-
- 'main'
2019
- 'release/**'
2120

2221
concurrency:
@@ -25,7 +24,7 @@ concurrency:
2524

2625
jobs:
2726
premerge-checks-linux:
28-
name: Build and Test Linux (Test Only - Please Ignore Results)
27+
name: Build and Test Linux
2928
if: >-
3029
github.repository_owner == 'llvm' &&
3130
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -43,9 +42,6 @@ jobs:
4342
# Mark the job as a success even if the step fails so that people do
4443
# not get notified while the new premerge pipeline is in an
4544
# experimental state.
46-
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
47-
# are ready for people to start recieving notifications.
48-
continue-on-error: true
4945
run: |
5046
git config --global --add safe.directory '*'
5147
@@ -74,7 +70,7 @@ jobs:
7470
include-hidden-files: 'true'
7571

7672
premerge-checks-windows:
77-
name: Build and Test Windows (Test Only - Please Ignore Results)
73+
name: Build and Test Windows
7874
if: >-
7975
github.repository_owner == 'llvm' &&
8076
(github.event_name != 'pull_request' || github.event.action != 'closed')
@@ -110,9 +106,6 @@ jobs:
110106
# Mark the job as a success even if the step fails so that people do
111107
# not get notified while the new premerge pipeline is in an
112108
# experimental state.
113-
# TODO(boomanaiden154): Remove this once the pipeline is stable and we
114-
# are ready for people to start recieving notifications.
115-
continue-on-error: true
116109
if: ${{ steps.vars.outputs.windows-projects != '' }}
117110
shell: cmd
118111
run: |

bolt/lib/Profile/BoltAddressTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ BoltAddressTranslation::getSecondaryEntryPointId(uint64_t Address,
600600
if (FunctionIt == SecondaryEntryPointsMap.end())
601601
return 0;
602602
const std::vector<uint32_t> &Offsets = FunctionIt->second;
603-
auto OffsetIt = std::find(Offsets.begin(), Offsets.end(), Offset);
603+
auto OffsetIt = llvm::find(Offsets, Offset);
604604
if (OffsetIt == Offsets.end())
605605
return 0;
606606
// Adding one here because main entry point is not stored in BAT, and
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
//===--- AvoidPragmaOnceCheck.cpp - clang-tidy ----------------------------===//
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 "AvoidPragmaOnceCheck.h"
10+
11+
#include "clang/Basic/SourceManager.h"
12+
#include "clang/Lex/PPCallbacks.h"
13+
#include "clang/Lex/Preprocessor.h"
14+
#include "llvm/ADT/StringRef.h"
15+
16+
namespace clang::tidy::portability {
17+
18+
class PragmaOnceCallbacks : public PPCallbacks {
19+
public:
20+
PragmaOnceCallbacks(AvoidPragmaOnceCheck *Check, const SourceManager &SM)
21+
: Check(Check), SM(SM) {}
22+
void PragmaDirective(SourceLocation Loc,
23+
PragmaIntroducerKind Introducer) override {
24+
auto Str = llvm::StringRef(SM.getCharacterData(Loc));
25+
if (!Str.consume_front("#"))
26+
return;
27+
Str = Str.trim();
28+
if (!Str.consume_front("pragma"))
29+
return;
30+
Str = Str.trim();
31+
if (Str.starts_with("once"))
32+
Check->diag(Loc,
33+
"avoid 'pragma once' directive; use include guards instead");
34+
}
35+
36+
private:
37+
AvoidPragmaOnceCheck *Check;
38+
const SourceManager &SM;
39+
};
40+
41+
void AvoidPragmaOnceCheck::registerPPCallbacks(const SourceManager &SM,
42+
Preprocessor *PP,
43+
Preprocessor *ModuleExpanderPP) {
44+
PP->addPPCallbacks(std::make_unique<PragmaOnceCallbacks>(this, SM));
45+
}
46+
47+
} // namespace clang::tidy::portability
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//===--- AvoidPragmaOnceCheck.h - clang-tidy --------------------*- 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+
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMAONCECHECK_H
10+
#define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMAONCECHECK_H
11+
12+
#include "../ClangTidyCheck.h"
13+
14+
namespace clang::tidy::portability {
15+
16+
/// Finds uses of ``#pragma once`` and suggests replacing them with standard
17+
/// include guards (``#ifndef``/``#define``/``#endif``) for improved
18+
/// portability.
19+
///
20+
/// For the user-facing documentation see:
21+
/// http://clang.llvm.org/extra/clang-tidy/checks/portability/avoid-pragma-once.html
22+
class AvoidPragmaOnceCheck : public ClangTidyCheck {
23+
public:
24+
AvoidPragmaOnceCheck(StringRef Name, ClangTidyContext *Context)
25+
: ClangTidyCheck(Name, Context) {}
26+
bool isLanguageVersionSupported(const LangOptions &LangOpts) const override {
27+
return LangOpts.CPlusPlus || LangOpts.C99;
28+
}
29+
30+
void registerPPCallbacks(const SourceManager &SM, Preprocessor *PP,
31+
Preprocessor *ModuleExpanderPP) override;
32+
};
33+
34+
} // namespace clang::tidy::portability
35+
36+
#endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_PORTABILITY_AVOIDPRAGMAONCECHECK_H

clang-tools-extra/clang-tidy/portability/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set(LLVM_LINK_COMPONENTS
55
)
66

77
add_clang_library(clangTidyPortabilityModule STATIC
8+
AvoidPragmaOnceCheck.cpp
89
PortabilityTidyModule.cpp
910
RestrictSystemIncludesCheck.cpp
1011
SIMDIntrinsicsCheck.cpp

clang-tools-extra/clang-tidy/portability/PortabilityTidyModule.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "../ClangTidy.h"
1010
#include "../ClangTidyModule.h"
1111
#include "../ClangTidyModuleRegistry.h"
12+
#include "AvoidPragmaOnceCheck.h"
1213
#include "RestrictSystemIncludesCheck.h"
1314
#include "SIMDIntrinsicsCheck.h"
1415
#include "StdAllocatorConstCheck.h"
@@ -20,6 +21,8 @@ namespace portability {
2021
class PortabilityModule : public ClangTidyModule {
2122
public:
2223
void addCheckFactories(ClangTidyCheckFactories &CheckFactories) override {
24+
CheckFactories.registerCheck<AvoidPragmaOnceCheck>(
25+
"portability-avoid-pragma-once");
2326
CheckFactories.registerCheck<RestrictSystemIncludesCheck>(
2427
"portability-restrict-system-includes");
2528
CheckFactories.registerCheck<SIMDIntrinsicsCheck>(

clang-tools-extra/clangd/test/path-mappings.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# RUN: rm -rf %t
33
# RUN: cp -r %S/Inputs/path-mappings %t
44
#
5-
# RUN: clangd --path-mappings 'C:\client=%t/server' -lit-test < %s | FileCheck -strict-whitespace %s
5+
# RUN: clangd --clang-tidy=false --path-mappings 'C:\client=%t/server' -lit-test < %s | FileCheck -strict-whitespace %s
66
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{"processId":123,"rootPath":"clangd","capabilities":{},"trace":"off"}}
77
---
88
{

clang-tools-extra/clangd/test/system-include-extractor.test

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# Bless the mock driver we've just created so that clangd can execute it.
5353
# Note: include clangd's stderr in the FileCheck input with "2>&1" so that we
5454
# can match output lines like "ASTWorker building file"
55-
# RUN: clangd -lit-test -query-driver="**.test,**.sh" < %t.test 2>&1 | FileCheck -strict-whitespace %t.test
55+
# RUN: clangd --clang-tidy=false -lit-test -query-driver="**.test,**.sh" < %t.test 2>&1 | FileCheck -strict-whitespace %t.test
5656
{"jsonrpc":"2.0","id":0,"method":"initialize","params":{}}
5757
---
5858
{
@@ -88,4 +88,4 @@
8888

8989
# Run clangd a second time, to make sure it picks up the driver name from the config file
9090
# Note, we need to pass -enable-config because -lit-test otherwise disables it
91-
# RUN: clangd -lit-test -enable-config -query-driver="**.test,**.sh" < %t.test 2>&1 | FileCheck -strict-whitespace %t.test
91+
# RUN: clangd --clang-tidy=false -lit-test -enable-config -query-driver="**.test,**.sh" < %t.test 2>&1 | FileCheck -strict-whitespace %t.test

clang-tools-extra/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,12 @@ New checks
136136
Finds unintended character output from ``unsigned char`` and ``signed char``
137137
to an ``ostream``.
138138

139+
- New :doc:`portability-avoid-pragma-once
140+
<clang-tidy/checks/portability/avoid-pragma-once>` check.
141+
142+
Finds uses of ``#pragma once`` and suggests replacing them with standard
143+
include guards (``#ifndef``/``#define``/``#endif``) for improved portability.
144+
139145
- New :doc:`readability-ambiguous-smartptr-reset-call
140146
<clang-tidy/checks/readability/ambiguous-smartptr-reset-call>` check.
141147

0 commit comments

Comments
 (0)