Add Diagnostic::Report method for reporting diagnostics without a location.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@86760 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/clang-cc/clang-cc.cpp b/tools/clang-cc/clang-cc.cpp
index c7fa4c4..98e4b28 100644
--- a/tools/clang-cc/clang-cc.cpp
+++ b/tools/clang-cc/clang-cc.cpp
@@ -862,16 +862,14 @@
const FileEntry *File = FileMgr.getFile(InFile);
if (File) SourceMgr.createMainFileID(File, SourceLocation());
if (SourceMgr.getMainFileID().isInvalid()) {
- PP.getDiagnostics().Report(FullSourceLoc(), diag::err_fe_error_reading)
- << InFile.c_str();
+ PP.getDiagnostics().Report(diag::err_fe_error_reading) << InFile.c_str();
return true;
}
} else {
llvm::MemoryBuffer *SB = llvm::MemoryBuffer::getSTDIN();
SourceMgr.createMainFileIDForMemBuffer(SB);
if (SourceMgr.getMainFileID().isInvalid()) {
- PP.getDiagnostics().Report(FullSourceLoc(),
- diag::err_fe_error_reading_stdin);
+ PP.getDiagnostics().Report(diag::err_fe_error_reading_stdin);
return true;
}
}
@@ -1576,8 +1574,7 @@
Context));
if (!Consumer.get()) {
- PP.getDiagnostics().Report(FullSourceLoc(),
- diag::err_fe_invalid_ast_action);
+ PP.getDiagnostics().Report(diag::err_fe_invalid_ast_action);
return;
}
@@ -1804,8 +1801,7 @@
// Set up the creation routine for code-completion.
CreateCodeCompleter = BuildPrintingCodeCompleter;
} else {
- PP.getDiagnostics().Report(FullSourceLoc(),
- diag::err_fe_invalid_code_complete_file)
+ PP.getDiagnostics().Report(diag::err_fe_invalid_code_complete_file)
<< CodeCompletionAt.FileName;
}
}
@@ -1904,7 +1900,7 @@
std::string Error;
llvm::OwningPtr<ASTUnit> AST(ASTUnit::LoadFromPCHFile(InFile, &Error));
if (!AST) {
- Diags.Report(FullSourceLoc(), diag::err_fe_invalid_ast_file) << Error;
+ Diags.Report(diag::err_fe_invalid_ast_file) << Error;
return;
}
@@ -1917,7 +1913,7 @@
OutPath, Context));
if (!Consumer.get()) {
- Diags.Report(FullSourceLoc(), diag::err_fe_invalid_ast_action);
+ Diags.Report(diag::err_fe_invalid_ast_action);
return;
}
@@ -1960,7 +1956,7 @@
static void LLVMErrorHandler(void *UserData, const std::string &Message) {
Diagnostic &Diags = *static_cast<Diagnostic*>(UserData);
- Diags.Report(FullSourceLoc(), diag::err_fe_error_backend) << Message;
+ Diags.Report(diag::err_fe_error_backend) << Message;
// We cannot recover from llvm errors.
exit(1);
@@ -2131,16 +2127,14 @@
Target(TargetInfo::CreateTargetInfo(Triple.getTriple()));
if (Target == 0) {
- Diags.Report(FullSourceLoc(), diag::err_fe_unknown_triple)
- << Triple.getTriple().c_str();
+ Diags.Report(diag::err_fe_unknown_triple) << Triple.getTriple().c_str();
return 1;
}
// Set the target ABI if specified.
if (!TargetABI.empty()) {
if (!Target->setABI(TargetABI)) {
- Diags.Report(FullSourceLoc(), diag::err_fe_unknown_target_abi)
- << TargetABI;
+ Diags.Report(diag::err_fe_unknown_target_abi) << TargetABI;
return 1;
}
}
@@ -2195,15 +2189,14 @@
// Handle generating dependencies, if requested.
if (!DependencyFile.empty()) {
if (DependencyTargets.empty()) {
- Diags.Report(FullSourceLoc(), diag::err_fe_dependency_file_requires_MT);
+ Diags.Report(diag::err_fe_dependency_file_requires_MT);
continue;
}
std::string ErrStr;
llvm::raw_ostream *DependencyOS =
new llvm::raw_fd_ostream(DependencyFile.c_str(), ErrStr);
if (!ErrStr.empty()) {
- Diags.Report(FullSourceLoc(), diag::err_fe_error_opening)
- << DependencyFile << ErrStr;
+ Diags.Report(diag::err_fe_error_opening) << DependencyFile << ErrStr;
continue;
}