Skip to content

Commit e21abfd

Browse files
committed
Merge remote-tracking branch 'otcshare_llvm/sycl-web' into llvmspirv_pulldown
2 parents 5bb5c34 + e9cae4f commit e21abfd

File tree

1,475 files changed

+58496
-53007
lines changed

Some content is hidden

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

1,475 files changed

+58496
-53007
lines changed

clang/docs/Block-ABI-Apple.txt

Lines changed: 0 additions & 1 deletion
This file was deleted.

clang/docs/Makefile.sphinx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ html:
5050
@# Kind of a hack, but HTML-formatted docs are on the way out anyway.
5151
@echo "Copying legacy HTML-formatted docs into $(BUILDDIR)/html"
5252
@cp -a *.html $(BUILDDIR)/html
53-
@# FIXME: What we really need is a way to specify redirects, so that
54-
@# we can just redirect to a reST'ified version of this document.
55-
@# PR14714 is tracking the issue of redirects.
56-
@cp -a Block-ABI-Apple.txt $(BUILDDIR)/html
5753
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
5854

5955
dirhtml:

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ CODEGENOPT(DisableLifetimeMarkers, 1, 0) ///< Don't emit any lifetime markers
6464
CODEGENOPT(DisableO0ImplyOptNone , 1, 0) ///< Don't annonate function with optnone at O0
6565
CODEGENOPT(ExperimentalStrictFloatingPoint, 1, 0) ///< Enables the new, experimental
6666
///< strict floating point.
67-
CODEGENOPT(DisableNoundefAttrs, 1, 0) ///< Disable emitting `noundef` attributes on IR call arguments and return values
67+
CODEGENOPT(EnableNoundefAttrs, 1, 0) ///< Enable emitting `noundef` attributes on IR call arguments and return values
6868
CODEGENOPT(LegacyPassManager, 1, 0) ///< Use the legacy pass manager.
6969
CODEGENOPT(DebugPassManager, 1, 0) ///< Prints debug information for the new
7070
///< pass manager.

clang/include/clang/Basic/DiagnosticParseKinds.td

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -958,6 +958,9 @@ def err_duplicate_class_virt_specifier : Error<
958958
def err_duplicate_virt_specifier : Error<
959959
"class member already marked '%0'">;
960960

961+
def err_virt_specifier_outside_class : Error<
962+
"'%0' specifier is not allowed outside a class definition">;
963+
961964
def err_expected_parameter_pack : Error<
962965
"expected the name of a parameter pack">;
963966
def err_paren_sizeof_parameter_pack : Error<

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5438,9 +5438,9 @@ def disable_free : Flag<["-"], "disable-free">,
54385438
def clear_ast_before_backend : Flag<["-"], "clear-ast-before-backend">,
54395439
HelpText<"Clear the Clang AST before running backend code generation">,
54405440
MarshallingInfoFlag<CodeGenOpts<"ClearASTBeforeBackend">>;
5441-
def disable_noundef_analysis : Flag<["-"], "disable-noundef-analysis">, Group<f_Group>,
5442-
HelpText<"Disable analyzing function argument and return types for mandatory definedness">,
5443-
MarshallingInfoFlag<CodeGenOpts<"DisableNoundefAttrs">>;
5441+
def enable_noundef_analysis : Flag<["-"], "enable-noundef-analysis">, Group<f_Group>,
5442+
HelpText<"Enable analyzing function argument and return types for mandatory definedness">,
5443+
MarshallingInfoFlag<CodeGenOpts<"EnableNoundefAttrs">>;
54445444
def discard_value_names : Flag<["-"], "discard-value-names">,
54455445
HelpText<"Discard value names in LLVM IR">,
54465446
MarshallingInfoFlag<CodeGenOpts<"DiscardValueNames">>;

clang/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1237,9 +1237,7 @@ enum CallDescriptionFlags : int {
12371237
/// arguments and the name of the function.
12381238
class CallDescription {
12391239
friend CallEvent;
1240-
1241-
mutable IdentifierInfo *II = nullptr;
1242-
mutable bool IsLookupDone = false;
1240+
mutable Optional<const IdentifierInfo *> II;
12431241
// The list of the qualified names used to identify the specified CallEvent,
12441242
// e.g. "{a, b}" represent the qualified names, like "a::b".
12451243
std::vector<const char *> QualifiedName;
@@ -1273,7 +1271,9 @@ class CallDescription {
12731271
Optional<size_t> RequiredParams = None)
12741272
: QualifiedName(QualifiedName), RequiredArgs(RequiredArgs),
12751273
RequiredParams(readRequiredParams(RequiredArgs, RequiredParams)),
1276-
Flags(Flags) {}
1274+
Flags(Flags) {
1275+
assert(!QualifiedName.empty());
1276+
}
12771277

12781278
/// Construct a CallDescription with default flags.
12791279
CallDescription(ArrayRef<const char *> QualifiedName,
@@ -1283,6 +1283,17 @@ class CallDescription {
12831283

12841284
/// Get the name of the function that this object matches.
12851285
StringRef getFunctionName() const { return QualifiedName.back(); }
1286+
1287+
/// Get the qualified name parts in reversed order.
1288+
/// E.g. { "std", "vector", "data" } -> "vector", "std"
1289+
auto begin_qualified_name_parts() const {
1290+
return std::next(QualifiedName.rbegin());
1291+
}
1292+
auto end_qualified_name_parts() const { return QualifiedName.rend(); }
1293+
1294+
/// It's false, if and only if we expect a single identifier, such as
1295+
/// `getenv`. It's true for `std::swap`, or `my::detail::container::data`.
1296+
bool hasQualifiedNameParts() const { return QualifiedName.size() > 1; }
12861297
};
12871298

12881299
/// An immutable map from CallDescriptions to arbitrary data. Provides a unified

clang/lib/CodeGen/CGCall.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,7 +2262,7 @@ void CodeGenModule::ConstructAttributeList(
22622262
getLangOpts().Sanitize.has(SanitizerKind::Return);
22632263

22642264
// Determine if the return type could be partially undef
2265-
if (!CodeGenOpts.DisableNoundefAttrs && HasStrictReturn) {
2265+
if (CodeGenOpts.EnableNoundefAttrs && HasStrictReturn) {
22662266
if (!RetTy->isVoidType() && RetAI.getKind() != ABIArgInfo::Indirect &&
22672267
DetermineNoUndef(RetTy, getTypes(), DL, RetAI))
22682268
RetAttrs.addAttribute(llvm::Attribute::NoUndef);
@@ -2397,7 +2397,7 @@ void CodeGenModule::ConstructAttributeList(
23972397

23982398
// Decide whether the argument we're handling could be partially undef
23992399
bool ArgNoUndef = DetermineNoUndef(ParamType, getTypes(), DL, AI);
2400-
if (!CodeGenOpts.DisableNoundefAttrs && ArgNoUndef)
2400+
if (CodeGenOpts.EnableNoundefAttrs && ArgNoUndef)
24012401
Attrs.addAttribute(llvm::Attribute::NoUndef);
24022402

24032403
// 'restrict' -> 'noalias' is done in EmitFunctionProlog when we

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -568,25 +568,28 @@ namespace {
568568
// the files we were handed.
569569
struct ReadModuleNames : ASTReaderListener {
570570
Preprocessor &PP;
571-
llvm::SmallVector<IdentifierInfo*, 8> LoadedModules;
571+
llvm::SmallVector<std::string, 8> LoadedModules;
572572

573573
ReadModuleNames(Preprocessor &PP) : PP(PP) {}
574574

575575
void ReadModuleName(StringRef ModuleName) override {
576-
LoadedModules.push_back(PP.getIdentifierInfo(ModuleName));
576+
// Keep the module name as a string for now. It's not safe to create a new
577+
// IdentifierInfo from an ASTReader callback.
578+
LoadedModules.push_back(ModuleName.str());
577579
}
578580

579581
void registerAll() {
580582
ModuleMap &MM = PP.getHeaderSearchInfo().getModuleMap();
581-
for (auto *II : LoadedModules)
582-
MM.cacheModuleLoad(*II, MM.findModule(II->getName()));
583+
for (const std::string &LoadedModule : LoadedModules)
584+
MM.cacheModuleLoad(*PP.getIdentifierInfo(LoadedModule),
585+
MM.findModule(LoadedModule));
583586
LoadedModules.clear();
584587
}
585588

586589
void markAllUnavailable() {
587-
for (auto *II : LoadedModules) {
590+
for (const std::string &LoadedModule : LoadedModules) {
588591
if (Module *M = PP.getHeaderSearchInfo().getModuleMap().findModule(
589-
II->getName())) {
592+
LoadedModule)) {
590593
M->HasIncompatibleModuleFile = true;
591594

592595
// Mark module as available if the only reason it was unavailable

clang/lib/Parse/ParseDecl.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2021,6 +2021,18 @@ Parser::DeclGroupPtrTy Parser::ParseDeclGroup(ParsingDeclSpec &DS,
20212021
Actions.CodeCompleteAfterFunctionEquals(D);
20222022
return nullptr;
20232023
}
2024+
// We're at the point where the parsing of function declarator is finished.
2025+
//
2026+
// A common error is that users accidently add a virtual specifier
2027+
// (e.g. override) in an out-line method definition.
2028+
// We attempt to recover by stripping all these specifiers coming after
2029+
// the declarator.
2030+
while (auto Specifier = isCXX11VirtSpecifier()) {
2031+
Diag(Tok, diag::err_virt_specifier_outside_class)
2032+
<< VirtSpecifiers::getSpecifierName(Specifier)
2033+
<< FixItHint::CreateRemoval(Tok.getLocation());
2034+
ConsumeToken();
2035+
}
20242036
// Look at the next token to make sure that this isn't a function
20252037
// declaration. We have to check this because __attribute__ might be the
20262038
// start of a function definition in GCC-extended K&R C.

clang/lib/Sema/SemaOverload.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9586,7 +9586,8 @@ static bool haveSameParameterTypes(ASTContext &Context, const FunctionDecl *F1,
95869586
for (unsigned I = 0; I != NumParams; ++I) {
95879587
QualType T1 = NextParam(F1, I1, I == 0);
95889588
QualType T2 = NextParam(F2, I2, I == 0);
9589-
if (!T1.isNull() && !T1.isNull() && !Context.hasSameUnqualifiedType(T1, T2))
9589+
assert(!T1.isNull() && !T2.isNull() && "Unexpected null param types");
9590+
if (!Context.hasSameUnqualifiedType(T1, T2))
95909591
return false;
95919592
}
95929593
return true;

0 commit comments

Comments
 (0)