that diagnostics with a source location should occur inside
{Begin,End}SourceFile.
Note that code completion is currently passing in an invalid LangOptions object
due to its implementation, I need to sort this out with Doug.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94927
91177308-0d34-0410-b5e6-
96231b3b80d8
ATU->unlinkTemporaryFile();
ReportSerializedDiagnostics(DiagnosticsFile, *Diags,
- num_unsaved_files, unsaved_files);
+ num_unsaved_files, unsaved_files,
+ ATU->getASTContext().getLangOptions());
for (unsigned i = 0, e = TemporaryFiles.size(); i != e; ++i)
TemporaryFiles[i].eraseFromDisk();
/// \brief The memory buffer from which we parsed the results. We
/// retain this buffer because the completion strings point into it.
llvm::MemoryBuffer *Buffer;
+
+ LangOptions LangOpts;
};
CXCodeCompleteResults *clang_codeComplete(CXIndex CIdx,
Results->Buffer = F;
}
+ // FIXME: The LangOptions we are passing here are not at all correct. However,
+ // in the current design we must pass something in so the SourceLocations have
+ // a LangOptions object to refer to.
ReportSerializedDiagnostics(DiagnosticsFile, *Diags,
- num_unsaved_files, unsaved_files);
+ num_unsaved_files, unsaved_files,
+ Results->LangOpts);
for (unsigned i = 0, e = TemporaryFiles.size(); i != e; ++i)
TemporaryFiles[i].eraseFromDisk();
void clang::ReportSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath,
Diagnostic &Diags,
unsigned num_unsaved_files,
- struct CXUnsavedFile *unsaved_files) {
+ struct CXUnsavedFile *unsaved_files,
+ const LangOptions &LangOpts) {
using llvm::MemoryBuffer;
using llvm::StringRef;
MemoryBuffer *F = MemoryBuffer::getFile(DiagnosticsPath.c_str());
SourceMgr.overrideFileContents(File, Buffer);
}
+ Diags.getClient()->BeginSourceFile(LangOpts, 0);
+
// Parse the diagnostics, emitting them one by one until we've
// exhausted the data.
StringRef Buffer = F->getBuffer();
if (!DB.isActive())
return;
}
+
+ Diags.getClient()->EndSourceFile();
}
namespace clang {
class Diagnostic;
+class LangOptions;
class Preprocessor;
/**
void ReportSerializedDiagnostics(const llvm::sys::Path &DiagnosticsPath,
Diagnostic &Diags,
unsigned num_unsaved_files,
- struct CXUnsavedFile *unsaved_files);
+ struct CXUnsavedFile *unsaved_files,
+ const LangOptions &LangOpts);
} // end namespace clang