summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorRichard Smith <richard-llvm@metafoo.co.uk>2013-08-17 00:46:16 +0000
committerRichard Smith <richard-llvm@metafoo.co.uk>2013-08-17 00:46:16 +0000
commitf9b1510576b2039ed1a32a3696efac07ed815171 (patch)
tree68fe203f268acda5e47cba936fcdded72c64aa76 /clang/lib/Sema/SemaOpenMP.cpp
parent15a2fccb787b4040b4f5b514b21b6c6337c48306 (diff)
downloadbcm5719-llvm-f9b1510576b2039ed1a32a3696efac07ed815171.tar.gz
bcm5719-llvm-f9b1510576b2039ed1a32a3696efac07ed815171.zip
Refactor all diagnosing of TypoCorrections through a common function, in
preparation for teaching this function how to diagnose a correction that includes importing a module. llvm-svn: 188602
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp33
1 files changed, 13 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 993eaba86e6..09ecfe09092 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -58,30 +58,23 @@ ExprResult Sema::ActOnOpenMPIdExpression(Scope *CurScope,
VarDecl *VD;
if (!Lookup.isSingleResult()) {
VarDeclFilterCCC Validator(*this);
- TypoCorrection Corrected = CorrectTypo(Id, LookupOrdinaryName, CurScope,
- 0, Validator);
- std::string CorrectedStr = Corrected.getAsString(getLangOpts());
- std::string CorrectedQuotedStr = Corrected.getQuoted(getLangOpts());
- if (Lookup.empty()) {
- if (Corrected.isResolved()) {
- Diag(Id.getLoc(), diag::err_undeclared_var_use_suggest)
- << Id.getName() << CorrectedQuotedStr
- << FixItHint::CreateReplacement(Id.getLoc(), CorrectedStr);
- } else {
- Diag(Id.getLoc(), diag::err_undeclared_var_use)
- << Id.getName();
- }
+ if (TypoCorrection Corrected = CorrectTypo(Id, LookupOrdinaryName, CurScope,
+ 0, Validator)) {
+ diagnoseTypo(Corrected,
+ PDiag(Lookup.empty()? diag::err_undeclared_var_use_suggest
+ : diag::err_omp_expected_var_arg_suggest)
+ << Id.getName());
+ VD = Corrected.getCorrectionDeclAs<VarDecl>();
} else {
- Diag(Id.getLoc(), diag::err_omp_expected_var_arg_suggest)
- << Id.getName() << Corrected.isResolved() << CorrectedQuotedStr
- << FixItHint::CreateReplacement(Id.getLoc(), CorrectedStr);
+ Diag(Id.getLoc(), Lookup.empty() ? diag::err_undeclared_var_use
+ : diag::err_omp_expected_var_arg)
+ << Id.getName();
+ return ExprError();
}
- if (!Corrected.isResolved()) return ExprError();
- VD = Corrected.getCorrectionDeclAs<VarDecl>();
} else {
if (!(VD = Lookup.getAsSingle<VarDecl>())) {
- Diag(Id.getLoc(), diag::err_omp_expected_var_arg_suggest)
- << Id.getName() << 0;
+ Diag(Id.getLoc(), diag::err_omp_expected_var_arg)
+ << Id.getName();
Diag(Lookup.getFoundDecl()->getLocation(), diag::note_declared_at);
return ExprError();
}
OpenPOWER on IntegriCloud