Skip to content

Commit 13d60b8

Browse files
AutomergerAutomerger
authored andcommitted
Propagating prior merge from 'llvm.org/master'.
2 parents 19c6cd8 + 05da52c commit 13d60b8

38 files changed

+513
-203
lines changed

include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ LANGOPT(Freestanding, 1, 0, "freestanding implementation")
133133
LANGOPT(NoBuiltin , 1, 0, "disable builtin functions")
134134
LANGOPT(NoMathBuiltin , 1, 0, "disable math builtin functions")
135135
LANGOPT(GNUAsm , 1, 1, "GNU-style inline assembly")
136-
LANGOPT(Coroutines , 1, 0, "C++ coroutines")
136+
LANGOPT(CoroutinesTS , 1, 0, "C++ coroutines TS")
137137

138138
BENIGN_LANGOPT(ThreadsafeStatics , 1, 1, "thread-safe static initializers")
139139
LANGOPT(POSIXThreads , 1, 0, "POSIX thread support")

include/clang/Basic/SourceManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1291,7 +1291,7 @@ class SourceManager : public RefCountedBase<SourceManager> {
12911291
///
12921292
/// Note that this name does not respect \#line directives. Use
12931293
/// getPresumedLoc for normal clients.
1294-
const char *getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const;
1294+
StringRef getBufferName(SourceLocation Loc, bool *Invalid = nullptr) const;
12951295

12961296
/// \brief Return the file characteristic of the specified source
12971297
/// location, indicating whether this is a normal file, a system

include/clang/Driver/CC1Options.td

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -638,10 +638,6 @@ def fdefault_calling_conv_EQ : Joined<["-"], "fdefault-calling-conv=">,
638638
def finclude_default_header : Flag<["-"], "finclude-default-header">,
639639
HelpText<"Include the default header file for OpenCL">;
640640

641-
// C++ TSes.
642-
def fcoroutines : Flag<["-"], "fcoroutines">,
643-
HelpText<"Enable support for the C++ Coroutines TS">;
644-
645641
//===----------------------------------------------------------------------===//
646642
// Header Search Options
647643
//===----------------------------------------------------------------------===//

include/clang/Driver/Options.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,13 @@ def fno_autolink : Flag <["-"], "fno-autolink">, Group<f_Group>,
481481
Flags<[DriverOption, CC1Option]>,
482482
HelpText<"Disable generation of linker directives for automatic library linking">;
483483

484+
// C++ Coroutines TS
485+
def fcoroutines_ts : Flag <["-"], "fcoroutines-ts">, Group<f_Group>,
486+
Flags<[DriverOption, CC1Option]>,
487+
HelpText<"Enable support for the C++ Coroutines TS">;
488+
def fno_coroutines_ts : Flag <["-"], "fno-coroutines-ts">, Group<f_Group>,
489+
Flags<[DriverOption]>;
490+
484491
def fembed_bitcode_EQ : Joined<["-"], "fembed-bitcode=">,
485492
Group<f_Group>, Flags<[DriverOption, CC1Option]>, MetaVarName<"<option>">,
486493
HelpText<"Embed LLVM bitcode (option: off, all, bitcode, marker)">;

include/clang/Lex/DirectoryLookup.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class DirectoryLookup {
8888

8989
/// getName - Return the directory or filename corresponding to this lookup
9090
/// object.
91-
const char *getName() const;
91+
StringRef getName() const;
9292

9393
/// getDir - Return the directory that this entry refers to.
9494
///

include/clang/Lex/HeaderMap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class HeaderMapImpl {
4545
SmallVectorImpl<char> &DestPath) const;
4646

4747
/// Return the filename of the headermap.
48-
const char *getFileName() const;
48+
StringRef getFileName() const;
4949

5050
/// Print the contents of this headermap to stderr.
5151
void dump() const;

include/clang/Rewrite/Core/HTMLRewrite.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ namespace html {
6262

6363
void AddLineNumbers(Rewriter& R, FileID FID);
6464

65-
void AddHeaderFooterInternalBuiltinCSS(Rewriter& R, FileID FID,
66-
const char *title = nullptr);
65+
void AddHeaderFooterInternalBuiltinCSS(Rewriter &R, FileID FID,
66+
StringRef title);
6767

6868
/// SyntaxHighlight - Relex the specified FileID and annotate the HTML with
6969
/// information about keywords, comments, etc.

lib/Basic/IdentifierTable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ static KeywordStatus getKeywordStatus(const LangOptions &LangOpts,
150150
if (LangOpts.ObjC2 && (Flags & KEYARC)) return KS_Enabled;
151151
if (LangOpts.ObjC2 && (Flags & KEYOBJC2)) return KS_Enabled;
152152
if (LangOpts.ConceptsTS && (Flags & KEYCONCEPTS)) return KS_Enabled;
153-
if (LangOpts.Coroutines && (Flags & KEYCOROUTINES)) return KS_Enabled;
153+
if (LangOpts.CoroutinesTS && (Flags & KEYCOROUTINES)) return KS_Enabled;
154154
if (LangOpts.ModulesTS && (Flags & KEYMODULES)) return KS_Enabled;
155155
if (LangOpts.CPlusPlus && (Flags & KEYCXX11)) return KS_Future;
156156
return KS_Disabled;

lib/Basic/SourceManager.cpp

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1437,8 +1437,8 @@ SourceManager::getFileCharacteristic(SourceLocation Loc) const {
14371437
/// Return the filename or buffer identifier of the buffer the location is in.
14381438
/// Note that this name does not respect \#line directives. Use getPresumedLoc
14391439
/// for normal clients.
1440-
const char *SourceManager::getBufferName(SourceLocation Loc,
1441-
bool *Invalid) const {
1440+
StringRef SourceManager::getBufferName(SourceLocation Loc,
1441+
bool *Invalid) const {
14421442
if (isInvalid(Loc, Invalid)) return "<invalid loc>";
14431443

14441444
return getBuffer(getFileID(Loc), Invalid)->getBufferIdentifier();
@@ -1470,7 +1470,7 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc,
14701470
// To get the source name, first consult the FileEntry (if one exists)
14711471
// before the MemBuffer as this will avoid unnecessarily paging in the
14721472
// MemBuffer.
1473-
const char *Filename;
1473+
StringRef Filename;
14741474
if (C->OrigEntry)
14751475
Filename = C->OrigEntry->getName();
14761476
else
@@ -1513,7 +1513,7 @@ PresumedLoc SourceManager::getPresumedLoc(SourceLocation Loc,
15131513
}
15141514
}
15151515

1516-
return PresumedLoc(Filename, LineNo, ColNo, IncludeLoc);
1516+
return PresumedLoc(Filename.data(), LineNo, ColNo, IncludeLoc);
15171517
}
15181518

15191519
/// \brief Returns whether the PresumedLoc for a given SourceLocation is
@@ -2095,10 +2095,10 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
20952095

20962096
// Clear the lookup cache, it depends on a common location.
20972097
IsBeforeInTUCache.clear();
2098-
const char *LB = getBuffer(LOffs.first)->getBufferIdentifier();
2099-
const char *RB = getBuffer(ROffs.first)->getBufferIdentifier();
2100-
bool LIsBuiltins = strcmp("<built-in>", LB) == 0;
2101-
bool RIsBuiltins = strcmp("<built-in>", RB) == 0;
2098+
StringRef LB = getBuffer(LOffs.first)->getBufferIdentifier();
2099+
StringRef RB = getBuffer(ROffs.first)->getBufferIdentifier();
2100+
bool LIsBuiltins = LB == "<built-in>";
2101+
bool RIsBuiltins = RB == "<built-in>";
21022102
// Sort built-in before non-built-in.
21032103
if (LIsBuiltins || RIsBuiltins) {
21042104
if (LIsBuiltins != RIsBuiltins)
@@ -2107,17 +2107,17 @@ bool SourceManager::isBeforeInTranslationUnit(SourceLocation LHS,
21072107
// lower IDs come first.
21082108
return LOffs.first < ROffs.first;
21092109
}
2110-
bool LIsAsm = strcmp("<inline asm>", LB) == 0;
2111-
bool RIsAsm = strcmp("<inline asm>", RB) == 0;
2110+
bool LIsAsm = LB == "<inline asm>";
2111+
bool RIsAsm = RB == "<inline asm>";
21122112
// Sort assembler after built-ins, but before the rest.
21132113
if (LIsAsm || RIsAsm) {
21142114
if (LIsAsm != RIsAsm)
21152115
return RIsAsm;
21162116
assert(LOffs.first == ROffs.first);
21172117
return false;
21182118
}
2119-
bool LIsScratch = strcmp("<scratch space>", LB) == 0;
2120-
bool RIsScratch = strcmp("<scratch space>", RB) == 0;
2119+
bool LIsScratch = LB == "<scratch space>";
2120+
bool RIsScratch = RB == "<scratch space>";
21212121
// Sort scratch after inline asm, but before the rest.
21222122
if (LIsScratch || RIsScratch) {
21232123
if (LIsScratch != RIsScratch)

lib/CodeGen/CGCXX.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
134134
llvm::GlobalValue::LinkageTypes TargetLinkage =
135135
getFunctionLinkage(TargetDecl);
136136

137+
// available_externally definitions aren't real definitions, so we cannot
138+
// create an alias to one.
139+
if (TargetLinkage == llvm::GlobalValue::AvailableExternallyLinkage)
140+
return true;
141+
137142
// Check if we have it already.
138143
StringRef MangledName = getMangledName(AliasDecl);
139144
llvm::GlobalValue *Entry = GetGlobalValue(MangledName);
@@ -156,14 +161,7 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl,
156161

157162
// Instead of creating as alias to a linkonce_odr, replace all of the uses
158163
// of the aliasee.
159-
if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
160-
(TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage ||
161-
!TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>())) {
162-
// FIXME: An extern template instantiation will create functions with
163-
// linkage "AvailableExternally". In libc++, some classes also define
164-
// members with attribute "AlwaysInline" and expect no reference to
165-
// be generated. It is desirable to reenable this optimisation after
166-
// corresponding LLVM changes.
164+
if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {
167165
addReplacement(MangledName, Aliasee);
168166
return false;
169167
}

0 commit comments

Comments
 (0)