Skip to content

Commit 61701f4

Browse files
committed
Merge from 'main' to 'sycl-web' (#1)
Build issue fixed by applying "9643d11e1d7f [clang][sema] NFC, include DarwinSDKInfo header instead of using the forward reference"
2 parents f401d82 + eb26ba9 commit 61701f4

File tree

601 files changed

+21977
-4800
lines changed

Some content is hidden

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

601 files changed

+21977
-4800
lines changed

clang-tools-extra/clangd/Preamble.cpp

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,6 @@ bool isMainFile(llvm::StringRef FileName, const SourceManager &SM) {
312312

313313
} // namespace
314314

315-
PreambleData::PreambleData(const ParseInputs &Inputs,
316-
PrecompiledPreamble Preamble,
317-
std::vector<Diag> Diags, IncludeStructure Includes,
318-
MainFileMacros Macros,
319-
std::unique_ptr<PreambleFileStatusCache> StatCache,
320-
CanonicalIncludes CanonIncludes)
321-
: Version(Inputs.Version), CompileCommand(Inputs.CompileCommand),
322-
Preamble(std::move(Preamble)), Diags(std::move(Diags)),
323-
Includes(std::move(Includes)), Macros(std::move(Macros)),
324-
StatCache(std::move(StatCache)), CanonIncludes(std::move(CanonIncludes)) {
325-
}
326-
327315
std::shared_ptr<const PreambleData>
328316
buildPreamble(PathRef FileName, CompilerInvocation CI,
329317
const ParseInputs &Inputs, bool StoreInMemory,
@@ -393,10 +381,14 @@ buildPreamble(PathRef FileName, CompilerInvocation CI,
393381
vlog("Built preamble of size {0} for file {1} version {2}",
394382
BuiltPreamble->getSize(), FileName, Inputs.Version);
395383
std::vector<Diag> Diags = PreambleDiagnostics.take();
396-
auto Result = std::make_shared<PreambleData>(
397-
Inputs, std::move(*BuiltPreamble), std::move(Diags),
398-
CapturedInfo.takeIncludes(), CapturedInfo.takeMacros(),
399-
std::move(StatCache), CapturedInfo.takeCanonicalIncludes());
384+
auto Result = std::make_shared<PreambleData>(std::move(*BuiltPreamble));
385+
Result->Version = Inputs.Version;
386+
Result->CompileCommand = Inputs.CompileCommand;
387+
Result->Diags = std::move(Diags);
388+
Result->Includes = CapturedInfo.takeIncludes();
389+
Result->Macros = CapturedInfo.takeMacros();
390+
Result->CanonIncludes = CapturedInfo.takeCanonicalIncludes();
391+
Result->StatCache = std::move(StatCache);
400392
Result->MainIsIncludeGuarded = CapturedInfo.isMainFileIncludeGuarded();
401393
return Result;
402394
}

clang-tools-extra/clangd/Preamble.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,7 @@ namespace clangd {
4747
/// As we must avoid re-parsing the preamble, any information that can only
4848
/// be obtained during parsing must be eagerly captured and stored here.
4949
struct PreambleData {
50-
PreambleData(const ParseInputs &Inputs, PrecompiledPreamble Preamble,
51-
std::vector<Diag> Diags, IncludeStructure Includes,
52-
MainFileMacros Macros,
53-
std::unique_ptr<PreambleFileStatusCache> StatCache,
54-
CanonicalIncludes CanonIncludes);
50+
PreambleData(PrecompiledPreamble Preamble) : Preamble(std::move(Preamble)) {}
5551

5652
// Version of the ParseInputs this preamble was built from.
5753
std::string Version;

clang-tools-extra/clangd/benchmarks/IndexBenchmark.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ BENCHMARK(DexBuild);
106106
int main(int argc, char *argv[]) {
107107
if (argc < 3) {
108108
llvm::errs() << "Usage: " << argv[0]
109-
<< " global-symbol-index.yaml requests.json "
109+
<< " global-symbol-index.dex requests.json "
110110
"BENCHMARK_OPTIONS...\n";
111111
return -1;
112112
}

clang-tools-extra/clangd/index/Index.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,12 @@ bool fromJSON(const llvm::json::Value &Parameters, FuzzyFindRequest &Request,
4949
llvm::json::Value toJSON(const FuzzyFindRequest &Request) {
5050
return llvm::json::Object{
5151
{"Query", Request.Query},
52-
{"Scopes", llvm::json::Array{Request.Scopes}},
52+
{"Scopes", Request.Scopes},
5353
{"AnyScope", Request.AnyScope},
5454
{"Limit", Request.Limit},
5555
{"RestrictForCodeCompletion", Request.RestrictForCodeCompletion},
56-
{"ProximityPaths", llvm::json::Array{Request.ProximityPaths}},
57-
{"PreferredTypes", llvm::json::Array{Request.PreferredTypes}},
56+
{"ProximityPaths", Request.ProximityPaths},
57+
{"PreferredTypes", Request.PreferredTypes},
5858
};
5959
}
6060

clang-tools-extra/clangd/index/dex/Iterator.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,6 @@ class OrIterator : public Iterator {
207207
return OS;
208208
}
209209

210-
// FIXME(kbobyrev): Would storing Children in min-heap be faster?
211210
std::vector<std::unique_ptr<Iterator>> Children;
212211
friend Corpus; // For optimizations.
213212
};

clang/include/clang/AST/DeclarationName.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -660,13 +660,13 @@ class DeclarationNameLoc {
660660

661661
// The location (if any) of the operator keyword is stored elsewhere.
662662
struct CXXOpName {
663-
unsigned BeginOpNameLoc;
664-
unsigned EndOpNameLoc;
663+
SourceLocation::UIntTy BeginOpNameLoc;
664+
SourceLocation::UIntTy EndOpNameLoc;
665665
};
666666

667667
// The location (if any) of the operator keyword is stored elsewhere.
668668
struct CXXLitOpName {
669-
unsigned OpNameLoc;
669+
SourceLocation::UIntTy OpNameLoc;
670670
};
671671

672672
// struct {} CXXUsingDirective;

clang/include/clang/Basic/Attr.td

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,8 @@ def Availability : InheritableAttr {
878878
.Case("macos_app_extension", "macOS (App Extension)")
879879
.Case("tvos_app_extension", "tvOS (App Extension)")
880880
.Case("watchos_app_extension", "watchOS (App Extension)")
881+
.Case("maccatalyst", "macCatalyst")
882+
.Case("maccatalyst_app_extension", "macCatalyst (App Extension)")
881883
.Case("swift", "Swift")
882884
.Default(llvm::StringRef());
883885
}
@@ -891,6 +893,8 @@ static llvm::StringRef getPlatformNameSourceSpelling(llvm::StringRef Platform) {
891893
.Case("macos_app_extension", "macOSApplicationExtension")
892894
.Case("tvos_app_extension", "tvOSApplicationExtension")
893895
.Case("watchos_app_extension", "watchOSApplicationExtension")
896+
.Case("maccatalyst", "macCatalyst")
897+
.Case("maccatalyst_app_extension", "macCatalystApplicationExtension")
894898
.Case("zos", "z/OS")
895899
.Default(Platform);
896900
}
@@ -904,6 +908,8 @@ static llvm::StringRef canonicalizePlatformName(llvm::StringRef Platform) {
904908
.Case("macOSApplicationExtension", "macos_app_extension")
905909
.Case("tvOSApplicationExtension", "tvos_app_extension")
906910
.Case("watchOSApplicationExtension", "watchos_app_extension")
911+
.Case("macCatalyst", "maccatalyst")
912+
.Case("macCatalystApplicationExtension", "maccatalyst_app_extension")
907913
.Default(Platform);
908914
} }];
909915
let HasCustomParsing = 1;

clang/include/clang/Basic/BuiltinsPPC.def

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,21 @@ BUILTIN(__builtin_ppc_dcbt, "vv*", "")
4747
BUILTIN(__builtin_ppc_dcbtst, "vv*", "")
4848
BUILTIN(__builtin_ppc_dcbz, "vv*", "")
4949
BUILTIN(__builtin_ppc_icbt, "vv*", "")
50+
BUILTIN(__builtin_ppc_fric, "dd", "")
51+
BUILTIN(__builtin_ppc_frim, "dd", "")
52+
BUILTIN(__builtin_ppc_frims, "ff", "")
53+
BUILTIN(__builtin_ppc_frin, "dd", "")
54+
BUILTIN(__builtin_ppc_frins, "ff", "")
55+
BUILTIN(__builtin_ppc_frip, "dd", "")
56+
BUILTIN(__builtin_ppc_frips, "ff", "")
57+
BUILTIN(__builtin_ppc_friz, "dd", "")
58+
BUILTIN(__builtin_ppc_frizs, "ff", "")
59+
BUILTIN(__builtin_ppc_fsel, "dddd", "")
60+
BUILTIN(__builtin_ppc_fsels, "ffff", "")
61+
BUILTIN(__builtin_ppc_frsqrte, "dd", "")
62+
BUILTIN(__builtin_ppc_frsqrtes, "ff", "")
63+
BUILTIN(__builtin_ppc_fsqrt, "dd", "")
64+
BUILTIN(__builtin_ppc_fsqrts, "ff", "")
5065
BUILTIN(__builtin_ppc_compare_and_swap, "iiD*i*i", "")
5166
BUILTIN(__builtin_ppc_compare_and_swaplp, "iLiD*Li*Li", "")
5267
BUILTIN(__builtin_ppc_fetch_and_add, "UiUiD*Ui", "")
@@ -59,8 +74,11 @@ BUILTIN(__builtin_ppc_fetch_and_swap, "UiUiD*Ui", "")
5974
BUILTIN(__builtin_ppc_fetch_and_swaplp, "ULiULiD*ULi", "")
6075
BUILTIN(__builtin_ppc_ldarx, "LiLiD*", "")
6176
BUILTIN(__builtin_ppc_lwarx, "iiD*", "")
77+
BUILTIN(__builtin_ppc_lharx, "isD*", "")
78+
BUILTIN(__builtin_ppc_lbarx, "UiUcD*", "")
6279
BUILTIN(__builtin_ppc_stdcx, "iLiD*Li", "")
6380
BUILTIN(__builtin_ppc_stwcx, "iiD*i", "")
81+
BUILTIN(__builtin_ppc_sthcx, "isD*s", "")
6482
BUILTIN(__builtin_ppc_tdw, "vLLiLLiIUi", "")
6583
BUILTIN(__builtin_ppc_tw, "viiIUi", "")
6684
BUILTIN(__builtin_ppc_trap, "vi", "")
@@ -81,6 +99,7 @@ BUILTIN(__builtin_ppc_rdlam, "UWiUWiUWiUWIi", "nc")
8199
BUILTIN(__builtin_ppc_cmpeqb, "LLiLLiLLi", "")
82100
BUILTIN(__builtin_ppc_cmprb, "iCIiii", "")
83101
BUILTIN(__builtin_ppc_setb, "LLiLLiLLi", "")
102+
BUILTIN(__builtin_ppc_cmpb, "LLiLLiLLi", "")
84103
// Multiply
85104
BUILTIN(__builtin_ppc_mulhd, "LLiLiLi", "")
86105
BUILTIN(__builtin_ppc_mulhdu, "ULLiULiULi", "")
@@ -116,6 +135,14 @@ BUILTIN(__builtin_ppc_fnmsub, "dddd", "")
116135
BUILTIN(__builtin_ppc_fnmsubs, "ffff", "")
117136
BUILTIN(__builtin_ppc_fre, "dd", "")
118137
BUILTIN(__builtin_ppc_fres, "ff", "")
138+
BUILTIN(__builtin_ppc_dcbtstt, "vv*", "")
139+
BUILTIN(__builtin_ppc_dcbtt, "vv*", "")
140+
BUILTIN(__builtin_ppc_mftbu, "Ui","")
141+
BUILTIN(__builtin_ppc_mfmsr, "Ui", "")
142+
BUILTIN(__builtin_ppc_mfspr, "ULiIi", "")
143+
BUILTIN(__builtin_ppc_mtmsr, "vUi", "")
144+
BUILTIN(__builtin_ppc_mtspr, "vIiULi", "")
145+
BUILTIN(__builtin_ppc_stfiw, "viC*d", "")
119146

120147
BUILTIN(__builtin_ppc_get_timebase, "ULLi", "n")
121148

clang/include/clang/Basic/BuiltinsWebAssembly.def

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,5 @@ TARGET_BUILTIN(__builtin_wasm_narrow_u_i16x8_i32x4, "V8UsV4iV4i", "nc", "simd128
192192
TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_s_f64x2_i32x4, "V4iV2d", "nc", "simd128")
193193
TARGET_BUILTIN(__builtin_wasm_trunc_sat_zero_u_f64x2_i32x4, "V4UiV2d", "nc", "simd128")
194194

195-
TARGET_BUILTIN(__builtin_wasm_load32_zero, "V4iiC*", "n", "simd128")
196-
TARGET_BUILTIN(__builtin_wasm_load64_zero, "V2LLiLLiC*", "n", "simd128")
197-
198195
#undef BUILTIN
199196
#undef TARGET_BUILTIN
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
//===--- DarwinSDKInfo.h - SDK Information parser for darwin ----*- 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_BASIC_DARWIN_SDK_INFO_H
10+
#define LLVM_CLANG_BASIC_DARWIN_SDK_INFO_H
11+
12+
#include "clang/Basic/LLVM.h"
13+
#include "llvm/ADT/DenseMap.h"
14+
#include "llvm/ADT/Triple.h"
15+
#include "llvm/Support/Error.h"
16+
#include "llvm/Support/VersionTuple.h"
17+
#include "llvm/Support/VirtualFileSystem.h"
18+
19+
namespace llvm {
20+
namespace json {
21+
class Object;
22+
} // end namespace json
23+
} // end namespace llvm
24+
25+
namespace clang {
26+
27+
/// The information about the darwin SDK that was used during this compilation.
28+
class DarwinSDKInfo {
29+
public:
30+
/// A value that describes two os-environment pairs that can be used as a key
31+
/// to the version map in the SDK.
32+
struct OSEnvPair {
33+
public:
34+
using StorageType = uint64_t;
35+
36+
constexpr OSEnvPair(llvm::Triple::OSType FromOS,
37+
llvm::Triple::EnvironmentType FromEnv,
38+
llvm::Triple::OSType ToOS,
39+
llvm::Triple::EnvironmentType ToEnv)
40+
: Value(((StorageType(FromOS) * StorageType(llvm::Triple::LastOSType) +
41+
StorageType(FromEnv))
42+
<< 32ull) |
43+
(StorageType(ToOS) * StorageType(llvm::Triple::LastOSType) +
44+
StorageType(ToEnv))) {}
45+
46+
/// Returns the os-environment mapping pair that's used to represent the
47+
/// macOS -> Mac Catalyst version mapping.
48+
static inline constexpr OSEnvPair macOStoMacCatalystPair() {
49+
return OSEnvPair(llvm::Triple::MacOSX, llvm::Triple::UnknownEnvironment,
50+
llvm::Triple::IOS, llvm::Triple::MacABI);
51+
}
52+
53+
private:
54+
StorageType Value;
55+
56+
friend class DarwinSDKInfo;
57+
};
58+
59+
/// Represents a version mapping that maps from a version of one target to a
60+
/// version of a related target.
61+
///
62+
/// e.g. "macOS_iOSMac":{"10.15":"13.1"} is an example of a macOS -> Mac
63+
/// Catalyst version map.
64+
class RelatedTargetVersionMapping {
65+
public:
66+
RelatedTargetVersionMapping(
67+
VersionTuple MinimumKeyVersion, VersionTuple MaximumKeyVersion,
68+
VersionTuple MinimumValue, VersionTuple MaximumValue,
69+
llvm::DenseMap<VersionTuple, VersionTuple> Mapping)
70+
: MinimumKeyVersion(MinimumKeyVersion),
71+
MaximumKeyVersion(MaximumKeyVersion), MinimumValue(MinimumValue),
72+
MaximumValue(MaximumValue), Mapping(Mapping) {
73+
assert(!this->Mapping.empty() && "unexpected empty mapping");
74+
}
75+
76+
/// Returns the value with the lowest version in the mapping.
77+
const VersionTuple &getMinimumValue() const { return MinimumValue; }
78+
79+
/// Returns the mapped key, or the appropriate Minimum / MaximumValue if
80+
/// they key is outside of the mapping bounds. If they key isn't mapped, but
81+
/// within the minimum and maximum bounds, None is returned.
82+
Optional<VersionTuple> map(const VersionTuple &Key,
83+
const VersionTuple &MinimumValue,
84+
Optional<VersionTuple> MaximumValue) const;
85+
86+
static Optional<RelatedTargetVersionMapping>
87+
parseJSON(const llvm::json::Object &Obj,
88+
VersionTuple MaximumDeploymentTarget);
89+
90+
private:
91+
VersionTuple MinimumKeyVersion;
92+
VersionTuple MaximumKeyVersion;
93+
VersionTuple MinimumValue;
94+
VersionTuple MaximumValue;
95+
llvm::DenseMap<VersionTuple, VersionTuple> Mapping;
96+
};
97+
98+
DarwinSDKInfo(VersionTuple Version, VersionTuple MaximumDeploymentTarget,
99+
llvm::DenseMap<OSEnvPair::StorageType,
100+
Optional<RelatedTargetVersionMapping>>
101+
VersionMappings =
102+
llvm::DenseMap<OSEnvPair::StorageType,
103+
Optional<RelatedTargetVersionMapping>>())
104+
: Version(Version), MaximumDeploymentTarget(MaximumDeploymentTarget),
105+
VersionMappings(std::move(VersionMappings)) {}
106+
107+
const llvm::VersionTuple &getVersion() const { return Version; }
108+
109+
// Returns the optional, target-specific version mapping that maps from one
110+
// target to another target.
111+
//
112+
// This mapping is constructed from an appropriate mapping in the SDKSettings,
113+
// for instance, when building for Mac Catalyst, the mapping would contain the
114+
// "macOS_iOSMac" mapping as it maps the macOS versions to the Mac Catalyst
115+
// versions.
116+
//
117+
// This mapping does not exist when the target doesn't have an appropriate
118+
// related version mapping, or when there was an error reading the mapping
119+
// from the SDKSettings, or when it's missing in the SDKSettings.
120+
const RelatedTargetVersionMapping *getVersionMapping(OSEnvPair Kind) const {
121+
auto Mapping = VersionMappings.find(Kind.Value);
122+
if (Mapping == VersionMappings.end())
123+
return nullptr;
124+
return Mapping->getSecond().hasValue() ? Mapping->getSecond().getPointer()
125+
: nullptr;
126+
}
127+
128+
static Optional<DarwinSDKInfo>
129+
parseDarwinSDKSettingsJSON(const llvm::json::Object *Obj);
130+
131+
private:
132+
VersionTuple Version;
133+
VersionTuple MaximumDeploymentTarget;
134+
// Need to wrap the value in an optional here as the value has to be default
135+
// constructible, and std::unique_ptr doesn't like DarwinSDKInfo being
136+
// Optional as Optional is trying to copy it in emplace.
137+
llvm::DenseMap<OSEnvPair::StorageType, Optional<RelatedTargetVersionMapping>>
138+
VersionMappings;
139+
};
140+
141+
/// Parse the SDK information from the SDKSettings.json file.
142+
///
143+
/// \returns an error if the SDKSettings.json file is invalid, None if the
144+
/// SDK has no SDKSettings.json, or a valid \c DarwinSDKInfo otherwise.
145+
Expected<Optional<DarwinSDKInfo>> parseDarwinSDKInfo(llvm::vfs::FileSystem &VFS,
146+
StringRef SDKRootPath);
147+
148+
} // end namespace clang
149+
150+
#endif // LLVM_CLANG_BASIC_DARWIN_SDK_INFO_H

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3593,6 +3593,10 @@ def warn_at_available_unchecked_use : Warning<
35933593
"use if (%select{@available|__builtin_available}0) instead">,
35943594
InGroup<DiagGroup<"unsupported-availability-guard">>;
35953595

3596+
def warn_missing_sdksettings_for_availability_checking : Warning<
3597+
"%0 availability is ignored without a valid 'SDKSettings.json' in the SDK">,
3598+
InGroup<DiagGroup<"ignored-availability-without-sdk-settings">>;
3599+
35963600
// Thread Safety Attributes
35973601
def warn_thread_attribute_ignored : Warning<
35983602
"ignoring %0 attribute because its argument is invalid">,

0 commit comments

Comments
 (0)