Skip to content

Commit 8b47882

Browse files
authored
Merge pull request #508 from AMD-Lightning-Internal/amd/merge/upstream_merge_20250205082821
merge main into amd-staging
2 parents 41e48c4 + 35b6ea6 commit 8b47882

File tree

389 files changed

+13127
-4348
lines changed

Some content is hidden

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

389 files changed

+13127
-4348
lines changed

.github/workflows/build-ci-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ jobs:
9696
run: |
9797
function push_container {
9898
image_name=$1
99-
latest_name=$(echo $image_name | sed 's/:[.0-9]\+$/:latest/g')
99+
latest_name=$(echo $image_name | sed 's/:[a-f0-9]\+$/:latest/g')
100100
podman tag $image_name $latest_name
101101
echo "Pushing $image_name ..."
102102
podman push $image_name

.github/workflows/release-binaries.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ jobs:
5858
target-cmake-flags: ${{ steps.vars.outputs.target-cmake-flags }}
5959
ccache: ${{ steps.vars.outputs.ccache }}
6060
build-flang: ${{ steps.vars.outputs.build-flang }}
61-
enable-pgo: ${{ steps.vars.outputs.enable-pgo }}
6261
release-binary-basename: ${{ steps.vars.outputs.release-binary-basename }}
6362
release-binary-filename: ${{ steps.vars.outputs.release-binary-filename }}
6463
build-runs-on: ${{ steps.vars.outputs.build-runs-on }}
@@ -130,9 +129,6 @@ jobs:
130129
echo ccache=sccache >> $GITHUB_OUTPUT
131130
fi
132131
133-
# Detect necessary CMake flags
134-
echo "enable-pgo=false" >> $GITHUB_OUTPUT
135-
target_cmake_flags="-DLLVM_RELEASE_ENABLE_PGO=OFF"
136132
# The macOS builds try to cross compile some libraries so we need to
137133
# add extra CMake args to disable them.
138134
# See https://github.com/llvm/llvm-project/issues/99767
@@ -238,13 +234,14 @@ jobs:
238234
${{ needs.prepare.outputs.target-cmake-flags }} \
239235
-C clang/cmake/caches/Release.cmake \
240236
-DBOOTSTRAP_LLVM_PARALLEL_LINK_JOBS=1 \
241-
-DBOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
237+
-DBOOTSTRAP_BOOTSTRAP_CPACK_PACKAGE_FILE_NAME="${{ needs.prepare.outputs.release-binary-basename }}"
242238
243239
- name: Build
244240
shell: bash
245241
run: |
246242
ninja -v -C ${{ steps.setup-stage.outputs.build-prefix }}/build stage2-package
247-
mv ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/${{ needs.prepare.outputs.release-binary-filename }} .
243+
release_dir=`find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname 'stage2-bins'`
244+
mv $release_dir/${{ needs.prepare.outputs.release-binary-filename }} .
248245
249246
- uses: actions/upload-artifact@26f96dfa697d77e81fd5907df203aa23a56210a8 #v4.3.0
250247
with:
@@ -259,7 +256,7 @@ jobs:
259256
shell: bash
260257
run: |
261258
find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname ${{ needs.prepare.outputs.release-binary-filename }} -delete
262-
rm -Rf ${{ steps.setup-stage.outputs.build-prefix }}/build/tools/clang/stage2-bins/_CPack_Packages
259+
find ${{ steps.setup-stage.outputs.build-prefix }}/build -iname _CPack_Packages -prune -exec rm -r {} +
263260
264261
- name: Save Stage
265262
uses: ./workflows-main/.github/workflows/release-binaries-save-stage

clang/docs/ReleaseNotes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,8 @@ Bug Fixes to AST Handling
149149
Miscellaneous Bug Fixes
150150
^^^^^^^^^^^^^^^^^^^^^^^
151151

152+
- HTML tags in comments that span multiple lines are now parsed correctly by Clang's comment parser. (#GH120843)
153+
152154
Miscellaneous Clang Crashes Fixed
153155
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
154156

clang/include/clang/Basic/TargetInfo.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,7 @@ class TargetInfo : public TransferrableTargetInfo,
14711471
/// specification
14721472
virtual bool validateBranchProtection(StringRef Spec, StringRef Arch,
14731473
BranchProtectionInfo &BPI,
1474+
const LangOptions &LO,
14741475
StringRef &Err) const {
14751476
Err = "";
14761477
return false;

clang/include/clang/Driver/Options.td

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7027,6 +7027,7 @@ defm backslash : OptInFC1FFlag<"backslash", "Specify that backslash in string in
70277027
defm xor_operator : OptInFC1FFlag<"xor-operator", "Enable .XOR. as a synonym of .NEQV.">;
70287028
defm logical_abbreviations : OptInFC1FFlag<"logical-abbreviations", "Enable logical abbreviations">;
70297029
defm implicit_none : OptInFC1FFlag<"implicit-none", "No implicit typing allowed unless overridden by IMPLICIT statements">;
7030+
defm implicit_none_ext : OptInFC1FFlag<"implicit-none-ext", "No implicit externals allowed">;
70307031
defm underscoring : OptInFC1FFlag<"underscoring", "Appends one trailing underscore to external names">;
70317032
defm offload_global_filtering : OptInFC1FFlag<"offload-global-filtering", "Enable/disable OpenMP global filtering pass">;
70327033
defm ppc_native_vec_elem_order: BoolOptionWithoutMarshalling<"f", "ppc-native-vector-element-order",

clang/include/clang/Tooling/DependencyScanning/DependencyScanningService.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,18 @@ enum class ScanningOptimizations {
5555
HeaderSearch = 1,
5656

5757
/// Remove warnings from system modules.
58-
SystemWarnings = 2,
58+
SystemWarnings = (1 << 1),
5959

6060
/// Remove unused -ivfsoverlay arguments.
61-
VFS = 4,
61+
VFS = (1 << 2),
6262

6363
/// Canonicalize -D and -U options.
64-
Macros = 8,
64+
Macros = (1 << 3),
6565

66-
DSS_LAST_BITMASK_ENUM(Macros),
66+
/// Ignore the compiler's working directory if it is safe.
67+
IgnoreCWD = (1 << 4),
68+
69+
DSS_LAST_BITMASK_ENUM(IgnoreCWD),
6770
Default = All
6871
};
6972

clang/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,17 @@ class DependencyScanningTool {
128128
/// \param LookupModuleOutput This function is called to fill in
129129
/// "-fmodule-file=", "-o" and other output
130130
/// arguments for dependencies.
131+
/// \param TUBuffer Optional memory buffer for translation unit input. If
132+
/// TUBuffer is nullopt, the input should be included in the
133+
/// Commandline already.
131134
///
132135
/// \returns a \c StringError with the diagnostic output if clang errors
133136
/// occurred, \c TranslationUnitDeps otherwise.
134-
llvm::Expected<TranslationUnitDeps>
135-
getTranslationUnitDependencies(const std::vector<std::string> &CommandLine,
136-
StringRef CWD,
137-
const llvm::DenseSet<ModuleID> &AlreadySeen,
138-
LookupModuleOutputCallback LookupModuleOutput);
137+
llvm::Expected<TranslationUnitDeps> getTranslationUnitDependencies(
138+
const std::vector<std::string> &CommandLine, StringRef CWD,
139+
const llvm::DenseSet<ModuleID> &AlreadySeen,
140+
LookupModuleOutputCallback LookupModuleOutput,
141+
std::optional<llvm::MemoryBufferRef> TUBuffer = std::nullopt);
139142

140143
/// Given a compilation context specified via the Clang driver command-line,
141144
/// gather modular dependencies of module with the given name, and return the

clang/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h

Lines changed: 42 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include "clang/Tooling/DependencyScanning/ModuleDepCollector.h"
1818
#include "llvm/Support/Error.h"
1919
#include "llvm/Support/FileSystem.h"
20+
#include "llvm/Support/MemoryBufferRef.h"
2021
#include <optional>
2122
#include <string>
2223

@@ -83,9 +84,21 @@ class DependencyScanningWorker {
8384
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS);
8485

8586
/// Run the dependency scanning tool for a given clang driver command-line,
86-
/// and report the discovered dependencies to the provided consumer. If \p
87-
/// ModuleName isn't empty, this function reports the dependencies of module
88-
/// \p ModuleName.
87+
/// and report the discovered dependencies to the provided consumer. If
88+
/// TUBuffer is not nullopt, it is used as TU input for the dependency
89+
/// scanning. Otherwise, the input should be included as part of the
90+
/// command-line.
91+
///
92+
/// \returns false if clang errors occurred (with diagnostics reported to
93+
/// \c DiagConsumer), true otherwise.
94+
bool computeDependencies(
95+
StringRef WorkingDirectory, const std::vector<std::string> &CommandLine,
96+
DependencyConsumer &DepConsumer, DependencyActionController &Controller,
97+
DiagnosticConsumer &DiagConsumer,
98+
std::optional<llvm::MemoryBufferRef> TUBuffer = std::nullopt);
99+
100+
/// Run the dependency scanning tool for a given clang driver command-line
101+
/// for a specific module.
89102
///
90103
/// \returns false if clang errors occurred (with diagnostics reported to
91104
/// \c DiagConsumer), true otherwise.
@@ -94,13 +107,28 @@ class DependencyScanningWorker {
94107
DependencyConsumer &DepConsumer,
95108
DependencyActionController &Controller,
96109
DiagnosticConsumer &DiagConsumer,
97-
std::optional<StringRef> ModuleName = std::nullopt);
110+
StringRef ModuleName);
111+
112+
/// Run the dependency scanning tool for a given clang driver command-line
113+
/// for a specific translation unit via file system or memory buffer.
114+
///
98115
/// \returns A \c StringError with the diagnostic output if clang errors
99116
/// occurred, success otherwise.
100117
llvm::Error computeDependencies(
101118
StringRef WorkingDirectory, const std::vector<std::string> &CommandLine,
102119
DependencyConsumer &Consumer, DependencyActionController &Controller,
103-
std::optional<StringRef> ModuleName = std::nullopt);
120+
std::optional<llvm::MemoryBufferRef> TUBuffer = std::nullopt);
121+
122+
/// Run the dependency scanning tool for a given clang driver command-line
123+
/// for a specific module.
124+
///
125+
/// \returns A \c StringError with the diagnostic output if clang errors
126+
/// occurred, success otherwise.
127+
llvm::Error computeDependencies(StringRef WorkingDirectory,
128+
const std::vector<std::string> &CommandLine,
129+
DependencyConsumer &Consumer,
130+
DependencyActionController &Controller,
131+
StringRef ModuleName);
104132

105133
bool shouldEagerLoadModules() const { return EagerLoadModules; }
106134

@@ -121,6 +149,15 @@ class DependencyScanningWorker {
121149
ScanningOptimizations OptimizeArgs;
122150
/// Whether to set up command-lines to load PCM files eagerly.
123151
bool EagerLoadModules;
152+
153+
/// Private helper functions.
154+
bool scanDependencies(StringRef WorkingDirectory,
155+
const std::vector<std::string> &CommandLine,
156+
DependencyConsumer &Consumer,
157+
DependencyActionController &Controller,
158+
DiagnosticConsumer &DC,
159+
llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> FS,
160+
std::optional<StringRef> ModuleName);
124161
};
125162

126163
} // end namespace dependencies

clang/lib/AST/ASTContext.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1055,7 +1055,8 @@ void ASTContext::PrintStats() const {
10551055
void ASTContext::mergeDefinitionIntoModule(NamedDecl *ND, Module *M,
10561056
bool NotifyListeners) {
10571057
if (NotifyListeners)
1058-
if (auto *Listener = getASTMutationListener())
1058+
if (auto *Listener = getASTMutationListener();
1059+
Listener && !ND->isUnconditionallyVisible())
10591060
Listener->RedefinedHiddenDefinition(ND, M);
10601061

10611062
MergedDefModules[cast<NamedDecl>(ND->getCanonicalDecl())].push_back(M);

clang/lib/AST/ByteCode/Compiler.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4715,6 +4715,14 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
47154715
} else if (!this->visit(MC->getImplicitObjectArgument())) {
47164716
return false;
47174717
}
4718+
} else if (const auto *PD =
4719+
dyn_cast<CXXPseudoDestructorExpr>(E->getCallee())) {
4720+
const Expr *Base = PD->getBase();
4721+
if (!Base->isGLValue())
4722+
return this->discard(Base);
4723+
if (!this->visit(Base))
4724+
return false;
4725+
return this->emitKill(E);
47184726
} else if (!FuncDecl) {
47194727
const Expr *Callee = E->getCallee();
47204728
CalleeOffset = this->allocateLocalPrimitive(Callee, PT_FnPtr, true, false);

0 commit comments

Comments
 (0)