Skip to content

Commit 2f96a3c

Browse files
committed
Merge commit 'e8baa792e7db0b03a842448b5e85623da48a4367^' into users/meinersbur/flang_runtime_move-files
2 parents e13784f + e088249 commit 2f96a3c

File tree

280 files changed

+9881
-5398
lines changed

Some content is hidden

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

280 files changed

+9881
-5398
lines changed

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

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,20 @@ OptionalValueConversionCheck::getCheckTraversalKind() const {
4343
}
4444

4545
void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
46-
auto ConstructTypeMatcher =
47-
qualType(hasCleanType(qualType().bind("optional-type")));
46+
auto BindOptionalType = qualType(
47+
hasCleanType(qualType(hasDeclaration(namedDecl(
48+
matchers::matchesAnyListedName(OptionalTypes))))
49+
.bind("optional-type")));
4850

49-
auto CallTypeMatcher =
51+
auto EqualsBoundOptionalType =
5052
qualType(hasCleanType(equalsBoundNode("optional-type")));
5153

5254
auto OptionalDereferenceMatcher = callExpr(
5355
anyOf(
5456
cxxOperatorCallExpr(hasOverloadedOperatorName("*"),
55-
hasUnaryOperand(hasType(CallTypeMatcher)))
57+
hasUnaryOperand(hasType(EqualsBoundOptionalType)))
5658
.bind("op-call"),
57-
cxxMemberCallExpr(thisPointerType(CallTypeMatcher),
59+
cxxMemberCallExpr(thisPointerType(EqualsBoundOptionalType),
5860
callee(cxxMethodDecl(anyOf(
5961
hasOverloadedOperatorName("*"),
6062
matchers::matchesAnyListedName(ValueMethods)))))
@@ -66,10 +68,7 @@ void OptionalValueConversionCheck::registerMatchers(MatchFinder *Finder) {
6668
hasArgument(0, ignoringImpCasts(OptionalDereferenceMatcher)));
6769
Finder->addMatcher(
6870
cxxConstructExpr(
69-
argumentCountIs(1U),
70-
hasDeclaration(cxxConstructorDecl(
71-
ofClass(matchers::matchesAnyListedName(OptionalTypes)))),
72-
hasType(ConstructTypeMatcher),
71+
argumentCountIs(1U), hasType(BindOptionalType),
7372
hasArgument(0U, ignoringImpCasts(anyOf(OptionalDereferenceMatcher,
7473
StdMoveCallMatcher))),
7574
unless(anyOf(hasAncestor(typeLoc()),

clang-tools-extra/test/clang-tidy/checkers/fuchsia/default-arguments-calls.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ void S::x(int i = 12) {}
2626
int main() {
2727
S s;
2828
s.x();
29-
// CHECK-NOTES: [[@LINE-1]]:3: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
29+
// CHECK-NOTES: [[@LINE-1]]:5: warning: calling a function that uses a default argument is disallowed [fuchsia-default-arguments-calls]
3030
// CHECK-NOTES: [[@LINE-6]]:11: note: default parameter was declared here
3131
// CHECK-NEXT: void S::x(int i = 12) {}
3232
x();

clang/cmake/caches/Fuchsia-stage2.cmake

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -300,19 +300,22 @@ if(FUCHSIA_SDK)
300300
set(LLVM_RUNTIME_MULTILIB_hwasan+noexcept_TARGETS "aarch64-unknown-fuchsia;riscv64-unknown-fuchsia" CACHE STRING "")
301301
endif()
302302

303-
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi)
303+
foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.main-none-eabi;aarch64-none-elf)
304304
list(APPEND BUILTIN_TARGETS "${target}")
305305
set(BUILTINS_${target}_CMAKE_SYSTEM_NAME Generic CACHE STRING "")
306306
set(BUILTINS_${target}_CMAKE_SYSTEM_PROCESSOR arm CACHE STRING "")
307307
set(BUILTINS_${target}_CMAKE_SYSROOT "" CACHE STRING "")
308308
set(BUILTINS_${target}_CMAKE_BUILD_TYPE MinSizeRel CACHE STRING "")
309309
foreach(lang C;CXX;ASM)
310-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb")
310+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "--target=${target}")
311+
if(NOT ${target} STREQUAL "aarch64-none-elf")
312+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mthumb")
313+
endif()
311314
if(${target} STREQUAL "armv8m.main-none-eabi")
312-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
315+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33")
313316
endif()
314317
if(${target} STREQUAL "armv8.1m.main-none-eabi")
315-
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
318+
set(BUILTINS_${target}_CMAKE_${lang}_local_flags "${BUILTINS_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55")
316319
endif()
317320
set(BUILTINS_${target}_CMAKE_${lang}_FLAGS "${BUILTINS_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
318321
endforeach()
@@ -330,12 +333,15 @@ foreach(target armv6m-none-eabi;armv7m-none-eabi;armv8m.main-none-eabi;armv8.1m.
330333
foreach(lang C;CXX;ASM)
331334
# TODO: The preprocessor defines workaround various issues in libc and libc++ integration.
332335
# These should be addressed and removed over time.
333-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -mthumb -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
336+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "--target=${target} -Wno-atomic-alignment \"-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)\" \"-Dfprintf(stream, format, ...)=printf(format)\" \"-Dgettimeofday(tv, tz)\" -D_LIBCPP_PRINT=1")
337+
if(NOT ${target} STREQUAL "aarch64-none-elf")
338+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mthumb")
339+
endif()
334340
if(${target} STREQUAL "armv8m.main-none-eabi")
335-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33" CACHE STRING "")
341+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=softfp -march=armv8m.main+fp+dsp -mcpu=cortex-m33")
336342
endif()
337343
if(${target} STREQUAL "armv8.1m.main-none-eabi")
338-
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55" CACHE STRING "")
344+
set(RUNTIMES_${target}_CMAKE_${lang}_local_flags "${RUNTIMES_${target}_CMAKE_${lang}_local_flags} -mfloat-abi=hard -march=armv8.1-m.main+mve.fp+fp.dp -mcpu=cortex-m55")
339345
endif()
340346
set(RUNTIMES_${target}_CMAKE_${lang}_FLAGS "${RUNTIMES_${target}_CMAKE_${lang}_local_flags}" CACHE STRING "")
341347
endforeach()

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,6 +458,10 @@ Modified Compiler Flags
458458
``memset`` and similar functions for which it is a documented undefined
459459
behavior. It is implied by ``-Wnontrivial-memaccess``
460460

461+
- Added ``-fmodules-reduced-bmi`` flag corresponding to
462+
``-fexperimental-modules-reduced-bmi`` flag. The ``-fmodules-reduced-bmi`` flag
463+
is intended to be enabled by default in the future.
464+
461465
Removed Compiler Flags
462466
-------------------------
463467

@@ -698,6 +702,8 @@ Bug Fixes to Compiler Builtins
698702

699703
- Fix ``__has_builtin`` incorrectly returning ``false`` for some C++ type traits. (#GH111477)
700704

705+
- Fix ``__builtin_source_location`` incorrectly returning wrong column for method chains. (#GH119129)
706+
701707
Bug Fixes to Attribute Support
702708
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
703709

clang/docs/StandardCPlusPlusModules.rst

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -602,16 +602,16 @@ unnecessary dependencies for the BMI. To mitigate the problem, Clang has a
602602
compiler option to reduce the information contained in the BMI. These two
603603
formats are known as Full BMI and Reduced BMI, respectively.
604604

605-
Users can use the ``-fexperimental-modules-reduced-bmi`` option to produce a
605+
Users can use the ``-fmodules-reduced-bmi`` option to produce a
606606
Reduced BMI.
607607

608608
For the one-phase compilation model (CMake implements this model), with
609-
``-fexperimental-modules-reduced-bmi``, the generated BMI will be a Reduced
609+
``-fmodules-reduced-bmi``, the generated BMI will be a Reduced
610610
BMI automatically. (The output path of the BMI is specified by
611611
``-fmodule-output=`` as usual with the one-phase compilation model).
612612

613613
It is also possible to produce a Reduced BMI with the two-phase compilation
614-
model. When ``-fexperimental-modules-reduced-bmi``, ``--precompile``, and
614+
model. When ``-fmodules-reduced-bmi``, ``--precompile``, and
615615
``-fmodule-output=`` are specified, the generated BMI specified by ``-o`` will
616616
be a full BMI and the BMI specified by ``-fmodule-output=`` will be a Reduced
617617
BMI. The dependency graph in this case would look like:
@@ -625,7 +625,7 @@ BMI. The dependency graph in this case would look like:
625625
-> ...
626626
-> consumer_n.cpp
627627
628-
Clang does not emit diagnostics when ``-fexperimental-modules-reduced-bmi`` is
628+
Clang does not emit diagnostics when ``-fmodules-reduced-bmi`` is
629629
used with a non-module unit. This design permits users of the one-phase
630630
compilation model to try using reduced BMIs without needing to modify the build
631631
system. The two-phase compilation module requires build system support.
@@ -691,11 +691,10 @@ ensure it is reachable, e.g. ``using N::g;``.
691691
Support for Reduced BMIs is still experimental, but it may become the default
692692
in the future. The expected roadmap for Reduced BMIs as of Clang 19.x is:
693693

694-
1. ``-fexperimental-modules-reduced-bmi`` is opt-in for 1~2 releases. The period depends
694+
1. ``-fexperimental-modules-reduced-bmi`` was introduced in v19.x
695+
2. For v20.x, ``-fmodules-reduced-bmi`` is introduced as an equivalent non-experimental
696+
option. It is expected to stay opt-in for 1~2 releases, though the period depends
695697
on user feedback and may be extended.
696-
2. Announce that Reduced BMIs are no longer experimental and introduce
697-
``-fmodules-reduced-bmi`` as a new option, and recommend use of the new
698-
option. This transition is expected to take 1~2 additional releases as well.
699698
3. Finally, ``-fmodules-reduced-bmi`` will be the default. When that time
700699
comes, the term BMI will refer to the Reduced BMI and the Full BMI will only
701700
be meaningful to build systems which elect to support two-phase compilation.
@@ -814,8 +813,8 @@ With reduced BMI, non-cascading changes can be more powerful. For example,
814813

815814
.. code-block:: console
816815
817-
$ clang++ -std=c++20 A.cppm -c -fmodule-output=A.pcm -fexperimental-modules-reduced-bmi -o A.o
818-
$ clang++ -std=c++20 B.cppm -c -fmodule-output=B.pcm -fexperimental-modules-reduced-bmi -o B.o -fmodule-file=A=A.pcm
816+
$ clang++ -std=c++20 A.cppm -c -fmodule-output=A.pcm -fmodules-reduced-bmi -o A.o
817+
$ clang++ -std=c++20 B.cppm -c -fmodule-output=B.pcm -fmodules-reduced-bmi -o B.o -fmodule-file=A=A.pcm
819818
$ md5sum B.pcm
820819
6c2bd452ca32ab418bf35cd141b060b9 B.pcm
821820
@@ -831,8 +830,8 @@ and recompile the example:
831830

832831
.. code-block:: console
833832
834-
$ clang++ -std=c++20 A.cppm -c -fmodule-output=A.pcm -fexperimental-modules-reduced-bmi -o A.o
835-
$ clang++ -std=c++20 B.cppm -c -fmodule-output=B.pcm -fexperimental-modules-reduced-bmi -o B.o -fmodule-file=A=A.pcm
833+
$ clang++ -std=c++20 A.cppm -c -fmodule-output=A.pcm -fmodules-reduced-bmi -o A.o
834+
$ clang++ -std=c++20 B.cppm -c -fmodule-output=B.pcm -fmodules-reduced-bmi -o B.o -fmodule-file=A=A.pcm
836835
$ md5sum B.pcm
837836
6c2bd452ca32ab418bf35cd141b060b9 B.pcm
838837

clang/include/clang/APINotes/Types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,9 @@ class FunctionInfo : public CommonEntityInfo {
542542
/// The result type of this function, as a C type.
543543
std::string ResultType;
544544

545+
/// Ownership convention for return value
546+
std::string SwiftReturnOwnership;
547+
545548
/// The function parameters.
546549
std::vector<ParamInfo> Params;
547550

@@ -622,7 +625,8 @@ inline bool operator==(const FunctionInfo &LHS, const FunctionInfo &RHS) {
622625
LHS.NumAdjustedNullable == RHS.NumAdjustedNullable &&
623626
LHS.NullabilityPayload == RHS.NullabilityPayload &&
624627
LHS.ResultType == RHS.ResultType && LHS.Params == RHS.Params &&
625-
LHS.RawRetainCountConvention == RHS.RawRetainCountConvention;
628+
LHS.RawRetainCountConvention == RHS.RawRetainCountConvention &&
629+
LHS.SwiftReturnOwnership == RHS.SwiftReturnOwnership;
626630
}
627631

628632
inline bool operator!=(const FunctionInfo &LHS, const FunctionInfo &RHS) {

clang/include/clang/AST/ASTContext.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,11 @@ class ASTContext : public RefCountedBase<ASTContext> {
245245
mutable llvm::FoldingSet<ObjCObjectPointerType> ObjCObjectPointerTypes;
246246
mutable llvm::FoldingSet<DependentUnaryTransformType>
247247
DependentUnaryTransformTypes;
248-
mutable llvm::ContextualFoldingSet<AutoType, ASTContext&> AutoTypes;
248+
// An AutoType can have a dependency on another AutoType via its template
249+
// arguments. Since both dependent and dependency are on the same set,
250+
// we can end up in an infinite recursion when looking for a node if we used
251+
// a `FoldingSet`, since both could end up in the same bucket.
252+
mutable llvm::DenseMap<llvm::FoldingSetNodeID, AutoType *> AutoTypes;
249253
mutable llvm::FoldingSet<DeducedTemplateSpecializationType>
250254
DeducedTemplateSpecializationTypes;
251255
mutable llvm::FoldingSet<AtomicType> AtomicTypes;

clang/include/clang/AST/Type.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6553,7 +6553,7 @@ class DeducedType : public Type {
65536553

65546554
/// Represents a C++11 auto or C++14 decltype(auto) type, possibly constrained
65556555
/// by a type-constraint.
6556-
class AutoType : public DeducedType, public llvm::FoldingSetNode {
6556+
class AutoType : public DeducedType {
65576557
friend class ASTContext; // ASTContext creates these
65586558

65596559
ConceptDecl *TypeConstraintConcept;

clang/include/clang/Driver/Options.td

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3195,11 +3195,14 @@ defm skip_odr_check_in_gmf : BoolOption<"f", "skip-odr-check-in-gmf",
31953195
"Perform ODR checks for decls in the global module fragment.">>,
31963196
Group<f_Group>;
31973197

3198-
def modules_reduced_bmi : Flag<["-"], "fexperimental-modules-reduced-bmi">,
3198+
def modules_reduced_bmi : Flag<["-"], "fmodules-reduced-bmi">,
31993199
Group<f_Group>, Visibility<[ClangOption, CC1Option]>,
32003200
HelpText<"Generate the reduced BMI">,
32013201
MarshallingInfoFlag<FrontendOpts<"GenReducedBMI">>;
32023202

3203+
def experimental_modules_reduced_bmi : Flag<["-"], "fexperimental-modules-reduced-bmi">,
3204+
Group<f_Group>, Visibility<[ClangOption, CC1Option]>, Alias<modules_reduced_bmi>;
3205+
32033206
def fmodules_embed_all_files : Joined<["-"], "fmodules-embed-all-files">,
32043207
Visibility<[ClangOption, CC1Option, CLOption]>,
32053208
HelpText<"Embed the contents of all files read by this compilation into "
@@ -6837,10 +6840,6 @@ def flang_deprecated_no_hlfir : Flag<["-"], "flang-deprecated-no-hlfir">,
68376840
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
68386841
HelpText<"Do not use HLFIR lowering (deprecated)">;
68396842

6840-
def flang_experimental_integer_overflow : Flag<["-"], "flang-experimental-integer-overflow">,
6841-
Flags<[HelpHidden]>, Visibility<[FlangOption, FC1Option]>,
6842-
HelpText<"Add nsw flag to internal operations such as do-variable increment (experimental)">;
6843-
68446843
//===----------------------------------------------------------------------===//
68456844
// FLangOption + CoreOption + NoXarchOption
68466845
//===----------------------------------------------------------------------===//

clang/lib/APINotes/APINotesFormat.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const uint16_t VERSION_MAJOR = 0;
2424
/// API notes file minor version number.
2525
///
2626
/// When the format changes IN ANY WAY, this number should be incremented.
27-
const uint16_t VERSION_MINOR = 33; // SwiftEscapable
27+
const uint16_t VERSION_MINOR = 34; // SwiftReturnOwnership
2828

2929
const uint8_t kSwiftConforms = 1;
3030
const uint8_t kSwiftDoesNotConform = 2;

0 commit comments

Comments
 (0)