Skip to content

Commit c24436f

Browse files
committed
Merge from 'main' to 'sycl-web' (intel#46)
CONFLICT (content): Merge conflict in clang/lib/Driver/Driver.cpp
2 parents 84c4715 + b89e09a commit c24436f

File tree

166 files changed

+4100
-2963
lines changed

Some content is hidden

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

166 files changed

+4100
-2963
lines changed

clang-tools-extra/clangd/QueryDriverDatabase.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -164,15 +164,6 @@ extractSystemIncludesAndTarget(llvm::SmallString<128> Driver,
164164
return llvm::None;
165165
}
166166

167-
if (!llvm::sys::fs::exists(Driver)) {
168-
elog("System include extraction: {0} does not exist.", Driver);
169-
return llvm::None;
170-
}
171-
if (!llvm::sys::fs::can_execute(Driver)) {
172-
elog("System include extraction: {0} is not executable.", Driver);
173-
return llvm::None;
174-
}
175-
176167
llvm::SmallString<128> StdErrPath;
177168
if (auto EC = llvm::sys::fs::createTemporaryFile("system-includes", "clangd",
178169
StdErrPath)) {
@@ -219,11 +210,13 @@ extractSystemIncludesAndTarget(llvm::SmallString<128> Driver,
219210
}
220211
}
221212

213+
std::string ErrMsg;
222214
if (int RC = llvm::sys::ExecuteAndWait(Driver, Args, /*Env=*/llvm::None,
223-
Redirects)) {
215+
Redirects, /*SecondsToWait=*/0,
216+
/*MemoryLimit=*/0, &ErrMsg)) {
224217
elog("System include extraction: driver execution failed with return code: "
225-
"{0}. Args: [{1}]",
226-
llvm::to_string(RC), printArgv(Args));
218+
"{0} - '{1}'. Args: [{2}]",
219+
llvm::to_string(RC), ErrMsg, printArgv(Args));
227220
return llvm::None;
228221
}
229222

clang-tools-extra/clangd/tool/Check.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,13 @@ class Checker {
212212
AST->getTokens(), Start, End);
213213
Tweak::Selection Selection(&Index, *AST, Start, End, std::move(Tree),
214214
nullptr);
215-
for (const auto &T :
216-
prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules)) {
215+
// FS is only populated when applying a tweak, not during prepare as
216+
// prepare should not do any I/O to be fast.
217+
auto Tweaks =
218+
prepareTweaks(Selection, Opts.TweakFilter, Opts.FeatureModules);
219+
Selection.FS =
220+
&AST->getSourceManager().getFileManager().getVirtualFileSystem();
221+
for (const auto &T : Tweaks) {
217222
auto Result = T->apply(Selection);
218223
if (!Result) {
219224
elog(" tweak: {0} ==> FAIL: {1}", T->id(), Result.takeError());

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,8 +1239,6 @@ def warn_pragma_expected_colon : Warning<
12391239
"missing ':' after %0 - ignoring">, InGroup<IgnoredPragmas>;
12401240
def warn_pragma_expected_predicate : Warning<
12411241
"expected %select{'enable', 'disable', 'begin' or 'end'|'disable'}0 - ignoring">, InGroup<IgnoredPragmas>;
1242-
def warn_pragma_begin_end_mismatch : Warning<
1243-
"OpenCL extension end directive mismatches begin directive - ignoring">, InGroup<IgnoredPragmas>;
12441242
def warn_pragma_unknown_extension : Warning<
12451243
"unknown OpenCL extension %0 - ignoring">, InGroup<IgnoredPragmas>;
12461244
def warn_pragma_unsupported_extension : Warning<

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4414,8 +4414,6 @@ def warn_diagnose_if_succeeded : Warning<"%0">, InGroup<UserDefinedWarnings>,
44144414
ShowInSystemHeader;
44154415
def note_ovl_candidate_disabled_by_function_cond_attr : Note<
44164416
"candidate disabled: %0">;
4417-
def note_ovl_candidate_disabled_by_extension : Note<
4418-
"candidate unavailable as it requires OpenCL extension '%0' to be enabled">;
44194417
def err_addrof_function_disabled_by_enable_if_attr : Error<
44204418
"cannot take address of function %0 because it has one or more "
44214419
"non-tautological enable_if conditions">;

clang/include/clang/Basic/Module.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,9 @@ class Module {
141141
/// The name of the umbrella entry, as written in the module map.
142142
std::string UmbrellaAsWritten;
143143

144+
// The path to the umbrella entry relative to the root module's \c Directory.
145+
std::string UmbrellaRelativeToRootModuleDirectory;
146+
144147
/// The module through which entities defined in this module will
145148
/// eventually be exposed, for use in "private" modules.
146149
std::string ExportAsModule;
@@ -188,6 +191,7 @@ class Module {
188191
/// file.
189192
struct Header {
190193
std::string NameAsWritten;
194+
std::string PathRelativeToRootModuleDirectory;
191195
const FileEntry *Entry;
192196

193197
explicit operator bool() { return Entry; }
@@ -197,6 +201,7 @@ class Module {
197201
/// file.
198202
struct DirectoryName {
199203
std::string NameAsWritten;
204+
std::string PathRelativeToRootModuleDirectory;
200205
const DirectoryEntry *Entry;
201206

202207
explicit operator bool() { return Entry; }
@@ -545,7 +550,8 @@ class Module {
545550
/// module.
546551
Header getUmbrellaHeader() const {
547552
if (auto *FE = Umbrella.dyn_cast<const FileEntry *>())
548-
return Header{UmbrellaAsWritten, FE};
553+
return Header{UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory,
554+
FE};
549555
return Header{};
550556
}
551557

clang/include/clang/Frontend/CompilerInstance.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,9 @@ class CompilerInstance : public ModuleLoader {
225225

226226
bool hasInvocation() const { return Invocation != nullptr; }
227227

228-
CompilerInvocation &getInvocation() { return *getInvocationPtr(); }
229-
230-
std::shared_ptr<CompilerInvocation> getInvocationPtr() {
228+
CompilerInvocation &getInvocation() {
231229
assert(Invocation && "Compiler instance has no invocation!");
232-
return Invocation;
230+
return *Invocation;
233231
}
234232

235233
/// setInvocation - Replace the current invocation.

clang/include/clang/Lex/ModuleMap.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,12 +649,14 @@ class ModuleMap {
649649
/// Sets the umbrella header of the given module to the given
650650
/// header.
651651
void setUmbrellaHeader(Module *Mod, const FileEntry *UmbrellaHeader,
652-
Twine NameAsWritten);
652+
const Twine &NameAsWritten,
653+
const Twine &PathRelativeToRootModuleDirectory);
653654

654655
/// Sets the umbrella directory of the given module to the given
655656
/// directory.
656657
void setUmbrellaDir(Module *Mod, const DirectoryEntry *UmbrellaDir,
657-
Twine NameAsWritten);
658+
const Twine &NameAsWritten,
659+
const Twine &PathRelativeToRootModuleDirectory);
658660

659661
/// Adds this header to the given module.
660662
/// \param Role The role of the header wrt the module.

clang/include/clang/Sema/Overload.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -760,9 +760,6 @@ class Sema;
760760
/// This candidate was not viable because its address could not be taken.
761761
ovl_fail_addr_not_available,
762762

763-
/// This candidate was not viable because its OpenCL extension is disabled.
764-
ovl_fail_ext_disabled,
765-
766763
/// This inherited constructor is not viable because it would slice the
767764
/// argument.
768765
ovl_fail_inhctor_slice,

clang/include/clang/Sema/Sema.h

Lines changed: 1 addition & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -10453,73 +10453,6 @@ class Sema final {
1045310453
/// potentially-throwing.
1045410454
bool checkFinalSuspendNoThrow(const Stmt *FinalSuspend);
1045510455

10456-
//===--------------------------------------------------------------------===//
10457-
// OpenCL extensions.
10458-
//
10459-
private:
10460-
std::string CurrOpenCLExtension;
10461-
/// Extensions required by an OpenCL type.
10462-
llvm::DenseMap<const Type*, std::set<std::string>> OpenCLTypeExtMap;
10463-
/// Extensions required by an OpenCL declaration.
10464-
llvm::DenseMap<const Decl*, std::set<std::string>> OpenCLDeclExtMap;
10465-
public:
10466-
llvm::StringRef getCurrentOpenCLExtension() const {
10467-
return CurrOpenCLExtension;
10468-
}
10469-
10470-
/// Check if a function declaration \p FD associates with any
10471-
/// extensions present in OpenCLDeclExtMap and if so return the
10472-
/// extension(s) name(s).
10473-
std::string getOpenCLExtensionsFromDeclExtMap(FunctionDecl *FD);
10474-
10475-
/// Check if a function type \p FT associates with any
10476-
/// extensions present in OpenCLTypeExtMap and if so return the
10477-
/// extension(s) name(s).
10478-
std::string getOpenCLExtensionsFromTypeExtMap(FunctionType *FT);
10479-
10480-
/// Find an extension in an appropriate extension map and return its name
10481-
template<typename T, typename MapT>
10482-
std::string getOpenCLExtensionsFromExtMap(T* FT, MapT &Map);
10483-
10484-
void setCurrentOpenCLExtension(llvm::StringRef Ext) {
10485-
CurrOpenCLExtension = std::string(Ext);
10486-
}
10487-
10488-
/// Set OpenCL extensions for a type which can only be used when these
10489-
/// OpenCL extensions are enabled. If \p Exts is empty, do nothing.
10490-
/// \param Exts A space separated list of OpenCL extensions.
10491-
void setOpenCLExtensionForType(QualType T, llvm::StringRef Exts);
10492-
10493-
/// Set OpenCL extensions for a declaration which can only be
10494-
/// used when these OpenCL extensions are enabled. If \p Exts is empty, do
10495-
/// nothing.
10496-
/// \param Exts A space separated list of OpenCL extensions.
10497-
void setOpenCLExtensionForDecl(Decl *FD, llvm::StringRef Exts);
10498-
10499-
/// Set current OpenCL extensions for a type which can only be used
10500-
/// when these OpenCL extensions are enabled. If current OpenCL extension is
10501-
/// empty, do nothing.
10502-
void setCurrentOpenCLExtensionForType(QualType T);
10503-
10504-
/// Set current OpenCL extensions for a declaration which
10505-
/// can only be used when these OpenCL extensions are enabled. If current
10506-
/// OpenCL extension is empty, do nothing.
10507-
void setCurrentOpenCLExtensionForDecl(Decl *FD);
10508-
10509-
bool isOpenCLDisabledDecl(Decl *FD);
10510-
10511-
/// Check if type \p T corresponding to declaration specifier \p DS
10512-
/// is disabled due to required OpenCL extensions being disabled. If so,
10513-
/// emit diagnostics.
10514-
/// \return true if type is disabled.
10515-
bool checkOpenCLDisabledTypeDeclSpec(const DeclSpec &DS, QualType T);
10516-
10517-
/// Check if declaration \p D used by expression \p E
10518-
/// is disabled due to required OpenCL extensions being disabled. If so,
10519-
/// emit diagnostics.
10520-
/// \return true if type is disabled.
10521-
bool checkOpenCLDisabledDecl(const NamedDecl &D, const Expr &E);
10522-
1052310456
//===--------------------------------------------------------------------===//
1052410457
// OpenMP directives and clauses.
1052510458
//
@@ -10573,21 +10506,6 @@ class Sema final {
1057310506
/// Pop OpenMP function region for non-capturing function.
1057410507
void popOpenMPFunctionRegion(const sema::FunctionScopeInfo *OldFSI);
1057510508

10576-
/// Checks if a type or a declaration is disabled due to the owning extension
10577-
/// being disabled, and emits diagnostic messages if it is disabled.
10578-
/// \param D type or declaration to be checked.
10579-
/// \param DiagLoc source location for the diagnostic message.
10580-
/// \param DiagInfo information to be emitted for the diagnostic message.
10581-
/// \param SrcRange source range of the declaration.
10582-
/// \param Map maps type or declaration to the extensions.
10583-
/// \param Selector selects diagnostic message: 0 for type and 1 for
10584-
/// declaration.
10585-
/// \return true if the type or declaration is disabled.
10586-
template <typename T, typename DiagLocT, typename DiagInfoT, typename MapT>
10587-
bool checkOpenCLDisabledTypeOrDecl(T D, DiagLocT DiagLoc, DiagInfoT DiagInfo,
10588-
MapT &Map, unsigned Selector = 0,
10589-
SourceRange SrcRange = SourceRange());
10590-
1059110509
/// Helper to keep information about the current `omp begin/end declare
1059210510
/// variant` nesting.
1059310511
struct OMPDeclareVariantScope {
@@ -12033,6 +11951,7 @@ class Sema final {
1203311951

1203411952
bool areMatrixTypesOfTheSameDimension(QualType srcTy, QualType destTy);
1203511953

11954+
bool areVectorTypesSameSize(QualType srcType, QualType destType);
1203611955
bool areLaxCompatibleVectorTypes(QualType srcType, QualType destType);
1203711956
bool isLaxVectorConversion(QualType srcType, QualType destType);
1203811957

clang/include/clang/Serialization/ASTWriter.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@ class ASTWriter : public ASTDeserializationListener,
510510
void WriteDeclContextVisibleUpdate(const DeclContext *DC);
511511
void WriteFPPragmaOptions(const FPOptionsOverride &Opts);
512512
void WriteOpenCLExtensions(Sema &SemaRef);
513-
void WriteOpenCLExtensionTypes(Sema &SemaRef);
514-
void WriteOpenCLExtensionDecls(Sema &SemaRef);
515513
void WriteCUDAPragmas(Sema &SemaRef);
516514
void WriteObjCCategories();
517515
void WriteLateParsedTemplates(Sema &SemaRef);

clang/include/clang/Tooling/DependencyScanning/ModuleDepCollector.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,8 @@ struct ModuleDeps {
7575
// the primary TU.
7676
bool ImportedByMainFile = false;
7777

78-
/// The compiler invocation associated with the translation unit that imports
79-
/// this module.
80-
std::shared_ptr<CompilerInvocation> Invocation;
78+
/// Compiler invocation that can be used to build this module (without paths).
79+
CompilerInvocation Invocation;
8180

8281
/// Gets the canonical command line suitable for passing to clang.
8382
///
@@ -147,7 +146,7 @@ class ModuleDepCollectorPP final : public PPCallbacks {
147146
/// Traverses the previously collected direct modular dependencies to discover
148147
/// transitive modular dependencies and fills the parent \c ModuleDepCollector
149148
/// with both.
150-
void handleTopLevelModule(const Module *M);
149+
ModuleID handleTopLevelModule(const Module *M);
151150
void addAllSubmoduleDeps(const Module *M, ModuleDeps &MD,
152151
llvm::DenseSet<const Module *> &AddedModules);
153152
void addModuleDep(const Module *M, ModuleDeps &MD,
@@ -173,13 +172,13 @@ class ModuleDepCollector final : public DependencyCollector {
173172
DependencyConsumer &Consumer;
174173
/// Path to the main source file.
175174
std::string MainFile;
176-
/// The module hash identifying the compilation conditions.
175+
/// Hash identifying the compilation conditions of the current TU.
177176
std::string ContextHash;
178177
/// Non-modular file dependencies. This includes the main source file and
179178
/// textually included header files.
180179
std::vector<std::string> FileDeps;
181180
/// Direct and transitive modular dependencies of the main source file.
182-
std::unordered_map<std::string, ModuleDeps> ModularDeps;
181+
std::unordered_map<const Module *, ModuleDeps> ModularDeps;
183182
/// Options that control the dependency output generation.
184183
std::unique_ptr<DependencyOutputOptions> Opts;
185184
};

clang/lib/Basic/Module.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,10 @@ bool Module::fullModuleNameIs(ArrayRef<StringRef> nameParts) const {
245245

246246
Module::DirectoryName Module::getUmbrellaDir() const {
247247
if (Header U = getUmbrellaHeader())
248-
return {"", U.Entry->getDir()};
248+
return {"", "", U.Entry->getDir()};
249249

250-
return {UmbrellaAsWritten, Umbrella.dyn_cast<const DirectoryEntry *>()};
250+
return {UmbrellaAsWritten, UmbrellaRelativeToRootModuleDirectory,
251+
Umbrella.dyn_cast<const DirectoryEntry *>()};
251252
}
252253

253254
void Module::addTopHeader(const FileEntry *File) {

clang/lib/CodeGen/CGBuiltin.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10885,7 +10885,7 @@ Value *CodeGenFunction::EmitAArch64BuiltinExpr(unsigned BuiltinID,
1088510885
}
1088610886
case NEON::BI__builtin_neon_vrbit_v:
1088710887
case NEON::BI__builtin_neon_vrbitq_v: {
10888-
Int = Intrinsic::aarch64_neon_rbit;
10888+
Int = Intrinsic::bitreverse;
1088910889
return EmitNeonCall(CGM.getIntrinsic(Int, Ty), Ops, "vrbit");
1089010890
}
1089110891
case NEON::BI__builtin_neon_vaddv_u8:

clang/lib/CodeGen/CGDebugInfo.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4310,7 +4310,9 @@ llvm::DILocalVariable *CGDebugInfo::EmitDeclare(const VarDecl *VD,
43104310
auto *Scope = cast<llvm::DIScope>(LexicalBlockStack.back());
43114311
StringRef Name = VD->getName();
43124312
if (!Name.empty()) {
4313-
if (VD->hasAttr<BlocksAttr>()) {
4313+
// __block vars are stored on the heap if they are captured by a block that
4314+
// can escape the local scope.
4315+
if (VD->isEscapingByref()) {
43144316
// Here, we need an offset *into* the alloca.
43154317
CharUnits offset = CharUnits::fromQuantity(32);
43164318
Expr.push_back(llvm::dwarf::DW_OP_plus_uconst);

clang/lib/Driver/Driver.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4940,6 +4940,7 @@ class OffloadingActionBuilder final {
49404940
return;
49414941

49424942
// Let builders add host linking actions.
4943+
Action* HA = nullptr;
49434944
for (DeviceActionBuilder *SB : SpecializedBuilders) {
49444945
if (!SB->isValid())
49454946
continue;

clang/lib/Frontend/FrontendAction.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ static std::error_code collectModuleHeaderIncludes(
342342
// file relative to the module build directory (the directory containing
343343
// the module map file) so this will find the same file that we found
344344
// while parsing the module map.
345-
addHeaderInclude(H.NameAsWritten, Includes, LangOpts, Module->IsExternC);
345+
addHeaderInclude(H.PathRelativeToRootModuleDirectory, Includes, LangOpts,
346+
Module->IsExternC);
346347
}
347348
}
348349
// Note that Module->PrivateHeaders will not be a TopHeader.
@@ -351,8 +352,8 @@ static std::error_code collectModuleHeaderIncludes(
351352
Module->addTopHeader(UmbrellaHeader.Entry);
352353
if (Module->Parent)
353354
// Include the umbrella header for submodules.
354-
addHeaderInclude(UmbrellaHeader.NameAsWritten, Includes, LangOpts,
355-
Module->IsExternC);
355+
addHeaderInclude(UmbrellaHeader.PathRelativeToRootModuleDirectory,
356+
Includes, LangOpts, Module->IsExternC);
356357
} else if (Module::DirectoryName UmbrellaDir = Module->getUmbrellaDir()) {
357358
// Add all of the headers we find in this subdirectory.
358359
std::error_code EC;
@@ -386,7 +387,8 @@ static std::error_code collectModuleHeaderIncludes(
386387
auto PathIt = llvm::sys::path::rbegin(Dir->path());
387388
for (int I = 0; I != Dir.level() + 1; ++I, ++PathIt)
388389
Components.push_back(*PathIt);
389-
SmallString<128> RelativeHeader(UmbrellaDir.NameAsWritten);
390+
SmallString<128> RelativeHeader(
391+
UmbrellaDir.PathRelativeToRootModuleDirectory);
390392
for (auto It = Components.rbegin(), End = Components.rend(); It != End;
391393
++It)
392394
llvm::sys::path::append(RelativeHeader, *It);
@@ -470,7 +472,7 @@ static Module *prepareToBuildModule(CompilerInstance &CI,
470472
// Dig out the module definition.
471473
HeaderSearch &HS = CI.getPreprocessor().getHeaderSearchInfo();
472474
Module *M = HS.lookupModule(CI.getLangOpts().CurrentModule,
473-
/*AllowSearch=*/false);
475+
/*AllowSearch=*/true);
474476
if (!M) {
475477
CI.getDiagnostics().Report(diag::err_missing_module)
476478
<< CI.getLangOpts().CurrentModule << ModuleMapFilename;
@@ -528,8 +530,8 @@ getInputBufferForModule(CompilerInstance &CI, Module *M) {
528530
SmallString<256> HeaderContents;
529531
std::error_code Err = std::error_code();
530532
if (Module::Header UmbrellaHeader = M->getUmbrellaHeader())
531-
addHeaderInclude(UmbrellaHeader.NameAsWritten, HeaderContents,
532-
CI.getLangOpts(), M->IsExternC);
533+
addHeaderInclude(UmbrellaHeader.PathRelativeToRootModuleDirectory,
534+
HeaderContents, CI.getLangOpts(), M->IsExternC);
533535
Err = collectModuleHeaderIncludes(
534536
CI.getLangOpts(), FileMgr, CI.getDiagnostics(),
535537
CI.getPreprocessor().getHeaderSearchInfo().getModuleMap(), M,

clang/lib/Frontend/FrontendActions.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,8 @@ bool GenerateHeaderModuleAction::BeginSourceFileAction(
297297
<< Name;
298298
continue;
299299
}
300-
Headers.push_back({std::string(Name), &FE->getFileEntry()});
300+
Headers.push_back(
301+
{std::string(Name), std::string(Name), &FE->getFileEntry()});
301302
}
302303
HS.getModuleMap().createHeaderModule(CI.getLangOpts().CurrentModule, Headers);
303304

0 commit comments

Comments
 (0)