Skip to content

Commit 90bd09f

Browse files
authored
Merge pull request #1937 from dcci/pch-something
apple-llvm-split-commit: 3fc266ffe0d9de9792d76e26ddcb1b2c9802ccfd apple-llvm-split-dir: lldb/
2 parents b1c0fa3 + 8f857f3 commit 90bd09f

File tree

1 file changed

+0
-69
lines changed

1 file changed

+0
-69
lines changed

lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "clang/Basic/Version.h"
1717
#include "clang/CodeGen/CodeGenAction.h"
1818
#include "clang/CodeGen/ModuleBuilder.h"
19-
#include "clang/CodeGen/ObjectFilePCHContainerOperations.h"
2019
#include "clang/Edit/Commit.h"
2120
#include "clang/Edit/EditedSource.h"
2221
#include "clang/Edit/EditsReceiver.h"
@@ -27,7 +26,6 @@
2726
#include "clang/Frontend/FrontendPluginRegistry.h"
2827
#include "clang/Frontend/TextDiagnosticBuffer.h"
2928
#include "clang/Frontend/TextDiagnosticPrinter.h"
30-
#include "clang/Lex/HeaderSearch.h"
3129
#include "clang/Lex/Preprocessor.h"
3230
#include "clang/Parse/ParseAST.h"
3331
#include "clang/Rewrite/Core/Rewriter.h"
@@ -213,50 +211,6 @@ class ClangDiagnosticManagerAdapter : public clang::DiagnosticConsumer {
213211
std::shared_ptr<clang::TextDiagnosticBuffer> m_passthrough;
214212
};
215213

216-
class LoggingDiagnosticConsumer : public clang::DiagnosticConsumer {
217-
public:
218-
LoggingDiagnosticConsumer() {
219-
m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
220-
m_passthrough.reset(new clang::TextDiagnosticBuffer);
221-
}
222-
223-
LoggingDiagnosticConsumer(
224-
const std::shared_ptr<clang::TextDiagnosticBuffer> &passthrough) {
225-
m_log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_EXPRESSIONS);
226-
m_passthrough = passthrough;
227-
}
228-
229-
void HandleDiagnostic(DiagnosticsEngine::Level DiagLevel,
230-
const clang::Diagnostic &Info) {
231-
if (m_log) {
232-
llvm::SmallVector<char, 32> diag_str;
233-
Info.FormatDiagnostic(diag_str);
234-
diag_str.push_back('\0');
235-
const char *data = diag_str.data();
236-
m_log->Printf("[clang] COMPILER DIAGNOSTIC: %s", data);
237-
238-
lldbassert(Info.getID() != clang::diag::err_unsupported_ast_node &&
239-
"'log enable lldb expr' to investigate.");
240-
}
241-
242-
m_passthrough->HandleDiagnostic(DiagLevel, Info);
243-
}
244-
245-
void FlushDiagnostics(DiagnosticsEngine &Diags) {
246-
m_passthrough->FlushDiagnostics(Diags);
247-
}
248-
249-
DiagnosticConsumer *clone(DiagnosticsEngine &Diags) const {
250-
return new LoggingDiagnosticConsumer(m_passthrough);
251-
}
252-
253-
clang::TextDiagnosticBuffer *GetPassthrough() { return m_passthrough.get(); }
254-
255-
private:
256-
Log *m_log;
257-
std::shared_ptr<clang::TextDiagnosticBuffer> m_passthrough;
258-
};
259-
260214
//===----------------------------------------------------------------------===//
261215
// Implementation of ClangExpressionParser
262216
//===----------------------------------------------------------------------===//
@@ -309,15 +263,6 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
309263
m_compiler->setVirtualFileSystem(
310264
FileSystem::Instance().GetVirtualFileSystem());
311265

312-
// Register the support for object-file-wrapped Clang modules.
313-
std::shared_ptr<clang::PCHContainerOperations> pch_operations =
314-
m_compiler->getPCHContainerOperations();
315-
pch_operations->registerWriter(
316-
llvm::make_unique<ObjectFilePCHContainerWriter>());
317-
pch_operations->registerReader(
318-
llvm::make_unique<ObjectFilePCHContainerReader>());
319-
320-
// 2. Install the target.
321266
lldb::LanguageType frame_lang =
322267
expr.Language(); // defaults to lldb::eLanguageTypeUnknown
323268
bool overridden_target_opts = false;
@@ -367,9 +312,6 @@ ClangExpressionParser::ClangExpressionParser(ExecutionContextScope *exe_scope,
367312
log->Printf("Using default target triple of %s",
368313
m_compiler->getTargetOpts().Triple.c_str());
369314
}
370-
371-
m_compiler->getTargetOpts().CPU = "";
372-
373315
// Now add some special fixes for known architectures: Any arm32 iOS
374316
// environment, but not on arm64
375317
if (m_compiler->getTargetOpts().Triple.find("arm64") == std::string::npos &&
@@ -1145,17 +1087,6 @@ lldb_private::Status ClangExpressionParser::PrepareForExecution(
11451087
return err;
11461088
}
11471089

1148-
for (llvm::Function &function : *llvm_module_up.get()) {
1149-
llvm::AttributeList attributes = function.getAttributes();
1150-
llvm::AttrBuilder attributes_to_remove;
1151-
1152-
attributes_to_remove.addAttribute("target-cpu");
1153-
1154-
function.setAttributes(attributes.removeAttributes(
1155-
function.getContext(), llvm::AttributeList::FunctionIndex,
1156-
attributes_to_remove));
1157-
}
1158-
11591090
ConstString function_name;
11601091

11611092
if (execution_policy != eExecutionPolicyTopLevel) {

0 commit comments

Comments
 (0)