Skip to content

Commit 454073d

Browse files
SC llvm teamSC llvm team
SC llvm team
authored and
SC llvm team
committed
Merged main:aea7929b0a04 into amd-gfx:afee35083123
Local branch amd-gfx afee350 Merged main:381efa496000 into amd-gfx:df4f5070dfea Remote branch main aea7929 [libc++] Unify __is_trivial_equality_predicate and __is_trivial_plus_operation into __desugars_to (llvm#68642)
2 parents afee350 + aea7929 commit 454073d

File tree

45 files changed

+1169
-289
lines changed

Some content is hidden

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

45 files changed

+1169
-289
lines changed

clang/include/clang/Basic/LangOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -405,6 +405,7 @@ LANGOPT(XLPragmaPack, 1, 0, "IBM XL #pragma pack handling")
405405
LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST")
406406

407407
LANGOPT(APINotes, 1, 0, "use external API notes")
408+
LANGOPT(APINotesModules, 1, 0, "use module-based external API notes")
408409

409410
LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan "
410411
"field padding (0: none, 1:least "

clang/include/clang/Driver/Options.td

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1754,6 +1754,18 @@ def fswift_async_fp_EQ : Joined<["-"], "fswift-async-fp=">,
17541754
NormalizedValuesScope<"CodeGenOptions::SwiftAsyncFramePointerKind">,
17551755
NormalizedValues<["Auto", "Always", "Never"]>,
17561756
MarshallingInfoEnum<CodeGenOpts<"SwiftAsyncFramePointer">, "Always">;
1757+
defm apinotes : BoolOption<"f", "apinotes",
1758+
LangOpts<"APINotes">, DefaultFalse,
1759+
PosFlag<SetTrue, [], [ClangOption], "Enable">,
1760+
NegFlag<SetFalse, [], [ClangOption], "Disable">,
1761+
BothFlags<[], [ClangOption, CC1Option], "external API notes support">>,
1762+
Group<f_clang_Group>;
1763+
defm apinotes_modules : BoolOption<"f", "apinotes-modules",
1764+
LangOpts<"APINotesModules">, DefaultFalse,
1765+
PosFlag<SetTrue, [], [ClangOption], "Enable">,
1766+
NegFlag<SetFalse, [], [ClangOption], "Disable">,
1767+
BothFlags<[], [ClangOption, CC1Option], "module-based external API notes support">>,
1768+
Group<f_clang_Group>;
17571769
def fapinotes_swift_version : Joined<["-"], "fapinotes-swift-version=">,
17581770
Group<f_clang_Group>, Visibility<[ClangOption, CC1Option]>,
17591771
MetaVarName<"<version>">,

clang/include/clang/Interpreter/CodeCompletion.h

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,27 @@ namespace clang {
2323
class CodeCompletionResult;
2424
class CompilerInstance;
2525

26-
void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
27-
unsigned Line, unsigned Col, const CompilerInstance *ParentCI,
28-
std::vector<std::string> &CCResults);
26+
struct ReplCodeCompleter {
27+
ReplCodeCompleter() = default;
28+
std::string Prefix;
29+
30+
/// \param InterpCI [in] The compiler instance that is used to trigger code
31+
/// completion
32+
33+
/// \param Content [in] The string where code completion is triggered.
34+
35+
/// \param Line [in] The line number of the code completion point.
36+
37+
/// \param Col [in] The column number of the code completion point.
38+
39+
/// \param ParentCI [in] The running interpreter compiler instance that
40+
/// provides ASTContexts.
41+
42+
/// \param CCResults [out] The completion results.
43+
void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
44+
unsigned Line, unsigned Col,
45+
const CompilerInstance *ParentCI,
46+
std::vector<std::string> &CCResults);
47+
};
2948
} // namespace clang
3049
#endif

clang/include/clang/Interpreter/Interpreter.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class Interpreter {
101101
const ASTContext &getASTContext() const;
102102
ASTContext &getASTContext();
103103
const CompilerInstance *getCompilerInstance() const;
104+
CompilerInstance *getCompilerInstance();
104105
llvm::Expected<llvm::orc::LLJIT &> getExecutionEngine();
105106

106107
llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6720,6 +6720,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
67206720
Args.addOptOutFlag(CmdArgs, options::OPT_fassume_sane_operator_new,
67216721
options::OPT_fno_assume_sane_operator_new);
67226722

6723+
if (Args.hasFlag(options::OPT_fapinotes, options::OPT_fno_apinotes, false))
6724+
CmdArgs.push_back("-fapinotes");
6725+
if (Args.hasFlag(options::OPT_fapinotes_modules,
6726+
options::OPT_fno_apinotes_modules, false))
6727+
CmdArgs.push_back("-fapinotes-modules");
6728+
Args.AddLastArg(CmdArgs, options::OPT_fapinotes_swift_version);
6729+
67236730
// -fblocks=0 is default.
67246731
if (Args.hasFlag(options::OPT_fblocks, options::OPT_fno_blocks,
67256732
TC.IsBlocksDefault()) ||

clang/lib/Frontend/CompilerInstance.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,14 @@ void CompilerInstance::createSema(TranslationUnitKind TUKind,
756756
TheSema->addExternalSource(ExternalSemaSrc.get());
757757
ExternalSemaSrc->InitializeSema(*TheSema);
758758
}
759+
760+
// If we're building a module and are supposed to load API notes,
761+
// notify the API notes manager.
762+
if (auto *currentModule = getPreprocessor().getCurrentModule()) {
763+
(void)TheSema->APINotes.loadCurrentModuleAPINotes(
764+
currentModule, getLangOpts().APINotesModules,
765+
getAPINotesOpts().ModuleSearchPaths);
766+
}
759767
}
760768

761769
// Output Files

clang/lib/Frontend/CompilerInvocation.cpp

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3267,6 +3267,16 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
32673267
return Diags.getNumErrors() == NumErrorsBefore;
32683268
}
32693269

3270+
static void GenerateAPINotesArgs(const APINotesOptions &Opts,
3271+
ArgumentConsumer Consumer) {
3272+
if (!Opts.SwiftVersion.empty())
3273+
GenerateArg(Consumer, OPT_fapinotes_swift_version,
3274+
Opts.SwiftVersion.getAsString());
3275+
3276+
for (const auto &Path : Opts.ModuleSearchPaths)
3277+
GenerateArg(Consumer, OPT_iapinotes_modules, Path);
3278+
}
3279+
32703280
static void ParseAPINotesArgs(APINotesOptions &Opts, ArgList &Args,
32713281
DiagnosticsEngine &diags) {
32723282
if (const Arg *A = Args.getLastArg(OPT_fapinotes_swift_version)) {
@@ -4746,6 +4756,18 @@ std::string CompilerInvocation::getModuleHash() const {
47464756
for (const auto &ext : getFrontendOpts().ModuleFileExtensions)
47474757
ext->hashExtension(HBuilder);
47484758

4759+
// Extend the signature with the Swift version for API notes.
4760+
const APINotesOptions &APINotesOpts = getAPINotesOpts();
4761+
if (!APINotesOpts.SwiftVersion.empty()) {
4762+
HBuilder.add(APINotesOpts.SwiftVersion.getMajor());
4763+
if (auto Minor = APINotesOpts.SwiftVersion.getMinor())
4764+
HBuilder.add(*Minor);
4765+
if (auto Subminor = APINotesOpts.SwiftVersion.getSubminor())
4766+
HBuilder.add(*Subminor);
4767+
if (auto Build = APINotesOpts.SwiftVersion.getBuild())
4768+
HBuilder.add(*Build);
4769+
}
4770+
47494771
// When compiling with -gmodules, also hash -fdebug-prefix-map as it
47504772
// affects the debug info in the PCM.
47514773
if (getCodeGenOpts().DebugTypeExtRefs)
@@ -4776,6 +4798,7 @@ void CompilerInvocationBase::generateCC1CommandLine(
47764798
GenerateFrontendArgs(getFrontendOpts(), Consumer, getLangOpts().IsHeaderFile);
47774799
GenerateTargetArgs(getTargetOpts(), Consumer);
47784800
GenerateHeaderSearchArgs(getHeaderSearchOpts(), Consumer);
4801+
GenerateAPINotesArgs(getAPINotesOpts(), Consumer);
47794802
GenerateLangArgs(getLangOpts(), Consumer, T, getFrontendOpts().DashX);
47804803
GenerateCodeGenArgs(getCodeGenOpts(), Consumer, T,
47814804
getFrontendOpts().OutputFile, &getLangOpts());

0 commit comments

Comments
 (0)