summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2014-05-03 03:45:55 +0000
committerAlp Toker <alp@nuanti.com>2014-05-03 03:45:55 +0000
commitb6cc592ea3195d49bee6c59f24a071d18865cb57 (patch)
treedbdad383ca4a5eb3c4de70f53e33ae7c62ad6ab3 /clang/lib/Sema/SemaChecking.cpp
parentb7b579aa93346123487e4408084600e7514aa93d (diff)
downloadbcm5719-llvm-b6cc592ea3195d49bee6c59f24a071d18865cb57.tar.gz
bcm5719-llvm-b6cc592ea3195d49bee6c59f24a071d18865cb57.zip
Fix a bunch of mislayered clang/Lex includes from Sema
llvm-svn: 207896
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp34
1 files changed, 14 insertions, 20 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 1b44fe9822c..ca7a92e0e11 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -27,7 +27,7 @@
#include "clang/Basic/CharInfo.h"
#include "clang/Basic/TargetBuiltins.h"
#include "clang/Basic/TargetInfo.h"
-#include "clang/Lex/Preprocessor.h"
+#include "clang/Lex/Lexer.h" // TODO: Extract static functions to fix layering.
#include "clang/Sema/Initialization.h"
#include "clang/Sema/Lookup.h"
#include "clang/Sema/ScopeInfo.h"
@@ -43,8 +43,8 @@ using namespace sema;
SourceLocation Sema::getLocationOfStringLiteralByte(const StringLiteral *SL,
unsigned ByteNo) const {
- return SL->getLocationOfByte(ByteNo, PP.getSourceManager(),
- PP.getLangOpts(), PP.getTargetInfo());
+ return SL->getLocationOfByte(ByteNo, getSourceManager(), LangOpts,
+ Context.getTargetInfo());
}
/// Checks that a call expression's argument count is the desired number.
@@ -2860,7 +2860,7 @@ CXXRecordMembersNamed(StringRef Name, Sema &S, QualType Ty) {
if (!RD || !RD->getDefinition())
return Results;
- LookupResult R(S, &S.PP.getIdentifierTable().get(Name), SourceLocation(),
+ LookupResult R(S, &S.Context.Idents.get(Name), SourceLocation(),
Sema::LookupMemberName);
R.suppressDiagnostics();
@@ -2906,8 +2906,7 @@ bool CheckPrintfHandler::checkForCStrMembers(
if (Method->getMinRequiredArguments() == 0 &&
AT.matchesType(S.Context, Method->getReturnType())) {
// FIXME: Suggest parens if the expression needs them.
- SourceLocation EndLoc =
- S.getPreprocessor().getLocForEndOfToken(E->getLocEnd());
+ SourceLocation EndLoc = S.getLocForEndOfToken(E->getLocEnd());
S.Diag(E->getLocStart(), diag::note_printf_c_str)
<< "c_str()"
<< FixItHint::CreateInsertion(EndLoc, ".c_str()");
@@ -3236,7 +3235,7 @@ CheckPrintfHandler::checkFormatExpr(const analyze_printf::PrintfSpecifier &FS,
Hints.push_back(FixItHint::CreateInsertion(E->getLocStart(),
CastFix.str()));
- SourceLocation After = S.PP.getLocForEndOfToken(E->getLocEnd());
+ SourceLocation After = S.getLocForEndOfToken(E->getLocEnd());
Hints.push_back(FixItHint::CreateInsertion(After, ")"));
}
@@ -3786,8 +3785,7 @@ static void emitReplacement(Sema &S, SourceLocation Loc, SourceRange Range,
// Lookup all std::abs
if (NamespaceDecl *Std = S.getStdNamespace()) {
- LookupResult R(S, &S.PP.getIdentifierTable().get("abs"), Loc,
- Sema::LookupAnyName);
+ LookupResult R(S, &S.Context.Idents.get("abs"), Loc, Sema::LookupAnyName);
R.suppressDiagnostics();
S.LookupQualifiedName(R, Std);
@@ -3960,20 +3958,17 @@ static bool CheckMemorySizeofForComparison(Sema &S, const Expr *E,
if (!Size->isComparisonOp() && !Size->isEqualityOp() && !Size->isLogicalOp())
return false;
- Preprocessor &PP = S.getPreprocessor();
SourceRange SizeRange = Size->getSourceRange();
S.Diag(Size->getOperatorLoc(), diag::warn_memsize_comparison)
<< SizeRange << FnName;
S.Diag(FnLoc, diag::warn_memsize_comparison_paren_note)
- << FnName
- << FixItHint::CreateInsertion(
- PP.getLocForEndOfToken(Size->getLHS()->getLocEnd()),
- ")")
+ << FnName << FixItHint::CreateInsertion(
+ S.getLocForEndOfToken(Size->getLHS()->getLocEnd()), ")")
<< FixItHint::CreateRemoval(RParenLoc);
S.Diag(SizeRange.getBegin(), diag::warn_memsize_comparison_cast_note)
<< FixItHint::CreateInsertion(SizeRange.getBegin(), "(size_t)(")
- << FixItHint::CreateInsertion(
- PP.getLocForEndOfToken(SizeRange.getEnd()), ")");
+ << FixItHint::CreateInsertion(S.getLocForEndOfToken(SizeRange.getEnd()),
+ ")");
return true;
}
@@ -4087,7 +4082,7 @@ void Sema::CheckMemaccessArguments(const CallExpr *Call,
SourceLocation SL = SizeOfArg->getExprLoc();
SourceRange DSR = Dest->getSourceRange();
SourceRange SSR = SizeOfArg->getSourceRange();
- SourceManager &SM = PP.getSourceManager();
+ SourceManager &SM = getSourceManager();
if (SM.isMacroArgExpansion(SL)) {
ReadableName = Lexer::getImmediateMacroName(SL, SM, LangOpts);
@@ -4340,7 +4335,7 @@ void Sema::CheckStrncatArguments(const CallExpr *CE,
// Generate the diagnostic.
SourceLocation SL = LenArg->getLocStart();
SourceRange SR = LenArg->getSourceRange();
- SourceManager &SM = PP.getSourceManager();
+ SourceManager &SM = getSourceManager();
// If the function is defined as a builtin macro, do not show macro expansion.
if (SM.isMacroArgExpansion(SL)) {
@@ -6275,8 +6270,7 @@ void Sema::DiagnoseAlwaysNonNullPointer(Expr *E,
return;
}
Diag(E->getExprLoc(), diag::note_function_to_function_call)
- << FixItHint::CreateInsertion(
- getPreprocessor().getLocForEndOfToken(E->getLocEnd()), "()");
+ << FixItHint::CreateInsertion(getLocForEndOfToken(E->getLocEnd()), "()");
}
OpenPOWER on IntegriCloud