Skip to content

Commit

Permalink
Merged main:aea7929b0a04 into amd-gfx:afee35083123
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
SC llvm team authored and SC llvm team committed Nov 23, 2023
2 parents afee350 + aea7929 commit 454073d
Show file tree
Hide file tree
Showing 45 changed files with 1,169 additions and 289 deletions.
1 change: 1 addition & 0 deletions clang/include/clang/Basic/LangOptions.def
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ LANGOPT(XLPragmaPack, 1, 0, "IBM XL #pragma pack handling")
LANGOPT(RetainCommentsFromSystemHeaders, 1, 0, "retain documentation comments from system headers in the AST")

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

LANGOPT(SanitizeAddressFieldPadding, 2, 0, "controls how aggressive is ASan "
"field padding (0: none, 1:least "
Expand Down
12 changes: 12 additions & 0 deletions clang/include/clang/Driver/Options.td
Original file line number Diff line number Diff line change
Expand Up @@ -1754,6 +1754,18 @@ def fswift_async_fp_EQ : Joined<["-"], "fswift-async-fp=">,
NormalizedValuesScope<"CodeGenOptions::SwiftAsyncFramePointerKind">,
NormalizedValues<["Auto", "Always", "Never"]>,
MarshallingInfoEnum<CodeGenOpts<"SwiftAsyncFramePointer">, "Always">;
defm apinotes : BoolOption<"f", "apinotes",
LangOpts<"APINotes">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption], "Enable">,
NegFlag<SetFalse, [], [ClangOption], "Disable">,
BothFlags<[], [ClangOption, CC1Option], "external API notes support">>,
Group<f_clang_Group>;
defm apinotes_modules : BoolOption<"f", "apinotes-modules",
LangOpts<"APINotesModules">, DefaultFalse,
PosFlag<SetTrue, [], [ClangOption], "Enable">,
NegFlag<SetFalse, [], [ClangOption], "Disable">,
BothFlags<[], [ClangOption, CC1Option], "module-based external API notes support">>,
Group<f_clang_Group>;
def fapinotes_swift_version : Joined<["-"], "fapinotes-swift-version=">,
Group<f_clang_Group>, Visibility<[ClangOption, CC1Option]>,
MetaVarName<"<version>">,
Expand Down
25 changes: 22 additions & 3 deletions clang/include/clang/Interpreter/CodeCompletion.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,27 @@ namespace clang {
class CodeCompletionResult;
class CompilerInstance;

void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
unsigned Line, unsigned Col, const CompilerInstance *ParentCI,
std::vector<std::string> &CCResults);
struct ReplCodeCompleter {
ReplCodeCompleter() = default;
std::string Prefix;

/// \param InterpCI [in] The compiler instance that is used to trigger code
/// completion

/// \param Content [in] The string where code completion is triggered.

/// \param Line [in] The line number of the code completion point.

/// \param Col [in] The column number of the code completion point.

/// \param ParentCI [in] The running interpreter compiler instance that
/// provides ASTContexts.

/// \param CCResults [out] The completion results.
void codeComplete(CompilerInstance *InterpCI, llvm::StringRef Content,
unsigned Line, unsigned Col,
const CompilerInstance *ParentCI,
std::vector<std::string> &CCResults);
};
} // namespace clang
#endif
1 change: 1 addition & 0 deletions clang/include/clang/Interpreter/Interpreter.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class Interpreter {
const ASTContext &getASTContext() const;
ASTContext &getASTContext();
const CompilerInstance *getCompilerInstance() const;
CompilerInstance *getCompilerInstance();
llvm::Expected<llvm::orc::LLJIT &> getExecutionEngine();

llvm::Expected<PartialTranslationUnit &> Parse(llvm::StringRef Code);
Expand Down
7 changes: 7 additions & 0 deletions clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6720,6 +6720,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
Args.addOptOutFlag(CmdArgs, options::OPT_fassume_sane_operator_new,
options::OPT_fno_assume_sane_operator_new);

if (Args.hasFlag(options::OPT_fapinotes, options::OPT_fno_apinotes, false))
CmdArgs.push_back("-fapinotes");
if (Args.hasFlag(options::OPT_fapinotes_modules,
options::OPT_fno_apinotes_modules, false))
CmdArgs.push_back("-fapinotes-modules");
Args.AddLastArg(CmdArgs, options::OPT_fapinotes_swift_version);

// -fblocks=0 is default.
if (Args.hasFlag(options::OPT_fblocks, options::OPT_fno_blocks,
TC.IsBlocksDefault()) ||
Expand Down
8 changes: 8 additions & 0 deletions clang/lib/Frontend/CompilerInstance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -756,6 +756,14 @@ void CompilerInstance::createSema(TranslationUnitKind TUKind,
TheSema->addExternalSource(ExternalSemaSrc.get());
ExternalSemaSrc->InitializeSema(*TheSema);
}

// If we're building a module and are supposed to load API notes,
// notify the API notes manager.
if (auto *currentModule = getPreprocessor().getCurrentModule()) {
(void)TheSema->APINotes.loadCurrentModuleAPINotes(
currentModule, getLangOpts().APINotesModules,
getAPINotesOpts().ModuleSearchPaths);
}
}

// Output Files
Expand Down
23 changes: 23 additions & 0 deletions clang/lib/Frontend/CompilerInvocation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3267,6 +3267,16 @@ static bool ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args,
return Diags.getNumErrors() == NumErrorsBefore;
}

static void GenerateAPINotesArgs(const APINotesOptions &Opts,
ArgumentConsumer Consumer) {
if (!Opts.SwiftVersion.empty())
GenerateArg(Consumer, OPT_fapinotes_swift_version,
Opts.SwiftVersion.getAsString());

for (const auto &Path : Opts.ModuleSearchPaths)
GenerateArg(Consumer, OPT_iapinotes_modules, Path);
}

static void ParseAPINotesArgs(APINotesOptions &Opts, ArgList &Args,
DiagnosticsEngine &diags) {
if (const Arg *A = Args.getLastArg(OPT_fapinotes_swift_version)) {
Expand Down Expand Up @@ -4746,6 +4756,18 @@ std::string CompilerInvocation::getModuleHash() const {
for (const auto &ext : getFrontendOpts().ModuleFileExtensions)
ext->hashExtension(HBuilder);

// Extend the signature with the Swift version for API notes.
const APINotesOptions &APINotesOpts = getAPINotesOpts();
if (!APINotesOpts.SwiftVersion.empty()) {
HBuilder.add(APINotesOpts.SwiftVersion.getMajor());
if (auto Minor = APINotesOpts.SwiftVersion.getMinor())
HBuilder.add(*Minor);
if (auto Subminor = APINotesOpts.SwiftVersion.getSubminor())
HBuilder.add(*Subminor);
if (auto Build = APINotesOpts.SwiftVersion.getBuild())
HBuilder.add(*Build);
}

// When compiling with -gmodules, also hash -fdebug-prefix-map as it
// affects the debug info in the PCM.
if (getCodeGenOpts().DebugTypeExtRefs)
Expand Down Expand Up @@ -4776,6 +4798,7 @@ void CompilerInvocationBase::generateCC1CommandLine(
GenerateFrontendArgs(getFrontendOpts(), Consumer, getLangOpts().IsHeaderFile);
GenerateTargetArgs(getTargetOpts(), Consumer);
GenerateHeaderSearchArgs(getHeaderSearchOpts(), Consumer);
GenerateAPINotesArgs(getAPINotesOpts(), Consumer);
GenerateLangArgs(getLangOpts(), Consumer, T, getFrontendOpts().DashX);
GenerateCodeGenArgs(getCodeGenOpts(), Consumer, T,
getFrontendOpts().OutputFile, &getLangOpts());
Expand Down
Loading

0 comments on commit 454073d

Please sign in to comment.