[cfe-commits] r140057 - in /cfe/trunk: include/clang/Basic/ include/clang/Serialization/ lib/ARCMigrate/ lib/AST/ lib/Basic/ lib/CodeGen/ lib/Frontend/ lib/Lex/ lib/Parse/ lib/Rewrite/ lib/Sema/ lib/Serialization/ lib/StaticAnalyzer/Core/ tools/libclang/
Argyrios Kyrtzidis
akyrtzi at gmail.com
Mon Sep 19 13:40:19 PDT 2011
Author: akirtzidis
Date: Mon Sep 19 15:40:19 2011
New Revision: 140057
URL: http://llvm.org/viewvc/llvm-project?rev=140057&view=rev
Log:
Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
It already works (and is useful with) macro locs as well.
Modified:
cfe/trunk/include/clang/Basic/SourceLocation.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
cfe/trunk/lib/ARCMigrate/TransformActions.cpp
cfe/trunk/lib/ARCMigrate/Transforms.cpp
cfe/trunk/lib/AST/ASTImporter.cpp
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/CodeGen/CodeGenAction.cpp
cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp
cfe/trunk/lib/Lex/Lexer.cpp
cfe/trunk/lib/Lex/PPLexerChange.cpp
cfe/trunk/lib/Lex/PTHLexer.cpp
cfe/trunk/lib/Lex/ScratchBuffer.cpp
cfe/trunk/lib/Lex/TokenConcatenation.cpp
cfe/trunk/lib/Lex/TokenLexer.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
cfe/trunk/lib/Rewrite/RewriteObjC.cpp
cfe/trunk/lib/Sema/DeclSpec.cpp
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
cfe/trunk/tools/libclang/CIndex.cpp
Modified: cfe/trunk/include/clang/Basic/SourceLocation.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceLocation.h?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/SourceLocation.h (original)
+++ cfe/trunk/include/clang/Basic/SourceLocation.h Mon Sep 19 15:40:19 2011
@@ -125,11 +125,10 @@
}
public:
- /// getFileLocWithOffset - Return a source location with the specified offset
- /// from this file SourceLocation.
- SourceLocation getFileLocWithOffset(int Offset) const {
- assert(((getOffset()+Offset) & MacroIDBit) == 0 &&
- "offset overflow or macro loc");
+ /// \brief Return a source location with the specified offset from this
+ /// SourceLocation.
+ SourceLocation getLocWithOffset(int Offset) const {
+ assert(((getOffset()+Offset) & MacroIDBit) == 0 && "offset overflow");
SourceLocation L;
L.ID = ID+Offset;
return L;
Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Mon Sep 19 15:40:19 2011
@@ -1147,7 +1147,7 @@
assert(Module.SLocRemap.find(Loc.getOffset()) != Module.SLocRemap.end() &&
"Cannot find offset to remap.");
int Remap = Module.SLocRemap.find(Loc.getOffset())->second;
- return Loc.getFileLocWithOffset(Remap);
+ return Loc.getLocWithOffset(Remap);
}
/// \brief Read a source location.
Modified: cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransEmptyStatementsAndDealloc.cpp Mon Sep 19 15:40:19 2011
@@ -47,7 +47,7 @@
SourceManager::LocBeforeThanCompare(SM));
--I;
SourceLocation
- AfterMacroLoc = I->getFileLocWithOffset(getARCMTMacroName().size());
+ AfterMacroLoc = I->getLocWithOffset(getARCMTMacroName().size());
assert(AfterMacroLoc.isFileID());
if (AfterMacroLoc == SemiLoc)
Modified: cfe/trunk/lib/ARCMigrate/TransformActions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/TransformActions.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/TransformActions.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/TransformActions.cpp Mon Sep 19 15:40:19 2011
@@ -479,7 +479,7 @@
SourceManager &SM = Ctx.getSourceManager();
loc = SM.getExpansionLoc(loc);
// canReplaceText already checked if loc points at text.
- SourceLocation afterText = loc.getFileLocWithOffset(text.size());
+ SourceLocation afterText = loc.getLocWithOffset(text.size());
addRemoval(CharSourceRange::getCharRange(loc, afterText));
commitInsert(loc, replacementText);
Modified: cfe/trunk/lib/ARCMigrate/Transforms.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ARCMigrate/Transforms.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/ARCMigrate/Transforms.cpp (original)
+++ cfe/trunk/lib/ARCMigrate/Transforms.cpp Mon Sep 19 15:40:19 2011
@@ -94,7 +94,7 @@
SourceLocation SemiLoc = findSemiAfterLocation(loc, Ctx);
if (SemiLoc.isInvalid())
return SourceLocation();
- return SemiLoc.getFileLocWithOffset(1);
+ return SemiLoc.getLocWithOffset(1);
}
/// \brief \arg Loc is the end of a statement range. This returns the location
Modified: cfe/trunk/lib/AST/ASTImporter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTImporter.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTImporter.cpp (original)
+++ cfe/trunk/lib/AST/ASTImporter.cpp Mon Sep 19 15:40:19 2011
@@ -4299,7 +4299,7 @@
std::pair<FileID, unsigned> Decomposed = FromSM.getDecomposedLoc(FromLoc);
SourceManager &ToSM = ToContext.getSourceManager();
return ToSM.getLocForStartOfFile(Import(Decomposed.first))
- .getFileLocWithOffset(Decomposed.second);
+ .getLocWithOffset(Decomposed.second);
}
SourceRange ASTImporter::Import(SourceRange FromRange) {
Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Mon Sep 19 15:40:19 2011
@@ -802,7 +802,7 @@
do {
std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
Loc = getSLocEntry(LocInfo.first).getExpansion().getSpellingLoc();
- Loc = Loc.getFileLocWithOffset(LocInfo.second);
+ Loc = Loc.getLocWithOffset(LocInfo.second);
} while (!Loc.isFileID());
return Loc;
}
@@ -834,7 +834,7 @@
SourceLocation Loc;
do {
Loc = E->getExpansion().getSpellingLoc();
- Loc = Loc.getFileLocWithOffset(Offset);
+ Loc = Loc.getLocWithOffset(Offset);
FID = getFileID(Loc);
E = &getSLocEntry(FID);
@@ -852,7 +852,7 @@
if (Loc.isFileID()) return Loc;
std::pair<FileID, unsigned> LocInfo = getDecomposedLoc(Loc);
Loc = getSLocEntry(LocInfo.first).getExpansion().getSpellingLoc();
- return Loc.getFileLocWithOffset(LocInfo.second);
+ return Loc.getLocWithOffset(LocInfo.second);
}
@@ -1273,7 +1273,7 @@
// Handle virtual #include manipulation.
if (Entry->IncludeOffset) {
IncludeLoc = getLocForStartOfFile(LocInfo.first);
- IncludeLoc = IncludeLoc.getFileLocWithOffset(Entry->IncludeOffset);
+ IncludeLoc = IncludeLoc.getLocWithOffset(Entry->IncludeOffset);
}
}
}
@@ -1457,7 +1457,7 @@
unsigned Size = Content->getBuffer(Diag, *this)->getBufferSize();
if (Size > 0)
--Size;
- return getLocForStartOfFile(FirstFID).getFileLocWithOffset(Size);
+ return getLocForStartOfFile(FirstFID).getLocWithOffset(Size);
}
unsigned FilePos = Content->SourceLineCache[Line - 1];
@@ -1469,9 +1469,9 @@
while (i < BufLength-1 && i < Col-1 && Buf[i] != '\n' && Buf[i] != '\r')
++i;
if (i < Col-1)
- return getLocForStartOfFile(FirstFID).getFileLocWithOffset(FilePos + i);
+ return getLocForStartOfFile(FirstFID).getLocWithOffset(FilePos + i);
- return getLocForStartOfFile(FirstFID).getFileLocWithOffset(FilePos + Col - 1);
+ return getLocForStartOfFile(FirstFID).getLocWithOffset(FilePos + Col - 1);
}
/// \brief Compute a map of macro argument chunks to their expanded source
@@ -1584,7 +1584,7 @@
unsigned MacroArgBeginOffs = I->first;
SourceLocation MacroArgExpandedLoc = I->second;
if (MacroArgExpandedLoc.isValid())
- return MacroArgExpandedLoc.getFileLocWithOffset(Offset - MacroArgBeginOffs);
+ return MacroArgExpandedLoc.getLocWithOffset(Offset - MacroArgBeginOffs);
return Loc;
}
Modified: cfe/trunk/lib/CodeGen/CodeGenAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenAction.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenAction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenAction.cpp Mon Sep 19 15:40:19 2011
@@ -185,7 +185,7 @@
// Translate the offset into the file.
unsigned Offset = D.getLoc().getPointer() - LBuf->getBufferStart();
SourceLocation NewLoc =
- CSM.getLocForStartOfFile(FID).getFileLocWithOffset(Offset);
+ CSM.getLocForStartOfFile(FID).getLocWithOffset(Offset);
return FullSourceLoc(NewLoc, CSM);
}
Modified: cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp (original)
+++ cfe/trunk/lib/Frontend/VerifyDiagnosticsClient.cpp Mon Sep 19 15:40:19 2011
@@ -287,7 +287,7 @@
// next token: {{
if (!PH.Next("{{")) {
- PP.Diag(Pos.getFileLocWithOffset(PH.C-PH.Begin),
+ PP.Diag(Pos.getLocWithOffset(PH.C-PH.Begin),
diag::err_verify_missing_start) << KindStr;
continue;
}
@@ -296,7 +296,7 @@
// search for token: }}
if (!PH.Search("}}")) {
- PP.Diag(Pos.getFileLocWithOffset(PH.C-PH.Begin),
+ PP.Diag(Pos.getLocWithOffset(PH.C-PH.Begin),
diag::err_verify_missing_end) << KindStr;
continue;
}
@@ -323,7 +323,7 @@
if (D->isValid(Error))
DL->push_back(D);
else {
- PP.Diag(Pos.getFileLocWithOffset(ContentBegin-PH.Begin),
+ PP.Diag(Pos.getLocWithOffset(ContentBegin-PH.Begin),
diag::err_verify_invalid_content)
<< KindStr << Error;
}
Modified: cfe/trunk/lib/Lex/Lexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/Lexer.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/Lexer.cpp (original)
+++ cfe/trunk/lib/Lex/Lexer.cpp Mon Sep 19 15:40:19 2011
@@ -449,7 +449,7 @@
}
// Create a lexer starting at the beginning of this token.
- SourceLocation LexerStartLoc = Loc.getFileLocWithOffset(-LocInfo.second);
+ SourceLocation LexerStartLoc = Loc.getLocWithOffset(-LocInfo.second);
Lexer TheLexer(LexerStartLoc, LangOpts, BufStart, LexStart, Buffer.end());
TheLexer.SetCommentRetentionState(true);
@@ -490,7 +490,7 @@
std::pair<FileID, unsigned> BeginFileLocInfo= SM.getDecomposedLoc(BeginFileLoc);
assert(FileLocInfo.first == BeginFileLocInfo.first &&
FileLocInfo.second >= BeginFileLocInfo.second);
- return Loc.getFileLocWithOffset(SM.getDecomposedLoc(BeginFileLoc).second -
+ return Loc.getLocWithOffset(SM.getDecomposedLoc(BeginFileLoc).second -
SM.getDecomposedLoc(FileLoc).second);
}
@@ -673,7 +673,7 @@
// chars, this method is extremely fast.
while (Lexer::isObviouslySimpleCharacter(*TokPtr)) {
if (CharNo == 0)
- return TokStart.getFileLocWithOffset(PhysOffset);
+ return TokStart.getLocWithOffset(PhysOffset);
++TokPtr, --CharNo, ++PhysOffset;
}
@@ -693,7 +693,7 @@
if (!Lexer::isObviouslySimpleCharacter(*TokPtr))
PhysOffset += Lexer::SkipEscapedNewLines(TokPtr)-TokPtr;
- return TokStart.getFileLocWithOffset(PhysOffset);
+ return TokStart.getLocWithOffset(PhysOffset);
}
/// \brief Computes the source location just past the end of the
@@ -731,7 +731,7 @@
else
return Loc;
- return Loc.getFileLocWithOffset(Len);
+ return Loc.getLocWithOffset(Len);
}
/// \brief Returns true if the given MacroID location points at the first
@@ -768,7 +768,7 @@
return false;
FileID FID = SM.getFileID(loc);
- SourceLocation afterLoc = loc.getFileLocWithOffset(tokLen+1);
+ SourceLocation afterLoc = loc.getLocWithOffset(tokLen+1);
if (SM.isInFileID(afterLoc, FID))
return false; // Still in the same FileID, does not point to the last token.
@@ -954,7 +954,7 @@
// Create a new SLoc which is expanded from Expansion(FileLoc) but whose
// characters come from spelling(FileLoc)+Offset.
SourceLocation SpellingLoc = SM.getSpellingLoc(FileLoc);
- SpellingLoc = SpellingLoc.getFileLocWithOffset(CharNo);
+ SpellingLoc = SpellingLoc.getLocWithOffset(CharNo);
// Figure out the expansion loc range, which is the range covered by the
// original _Pragma(...) sequence.
@@ -975,7 +975,7 @@
// the file id from FileLoc with the offset specified.
unsigned CharNo = Loc-BufferStart;
if (FileLoc.isFileID())
- return FileLoc.getFileLocWithOffset(CharNo);
+ return FileLoc.getLocWithOffset(CharNo);
// Otherwise, this is the _Pragma lexer case, which pretends that all of the
// tokens are lexed from where the _Pragma was defined.
@@ -1126,7 +1126,7 @@
NumWhitespaceChars++;
}
- return TokenLoc.getFileLocWithOffset(Tok.getLength() + NumWhitespaceChars);
+ return TokenLoc.getLocWithOffset(Tok.getLength() + NumWhitespaceChars);
}
/// getCharAndSizeSlow - Peek a single 'character' from the specified buffer,
@@ -2250,7 +2250,7 @@
bool Lexer::isCodeCompletionPoint(const char *CurPtr) const {
if (PP && PP->isCodeCompletionEnabled()) {
- SourceLocation Loc = FileLoc.getFileLocWithOffset(CurPtr-BufferStart);
+ SourceLocation Loc = FileLoc.getLocWithOffset(CurPtr-BufferStart);
return Loc == PP->getCodeCompletionLoc();
}
Modified: cfe/trunk/lib/Lex/PPLexerChange.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPLexerChange.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPLexerChange.cpp (original)
+++ cfe/trunk/lib/Lex/PPLexerChange.cpp Mon Sep 19 15:40:19 2011
@@ -94,7 +94,7 @@
SourceMgr.getFileEntryForID(FID) == CodeCompletionFile) {
CodeCompletionFileLoc = SourceMgr.getLocForStartOfFile(FID);
CodeCompletionLoc =
- CodeCompletionFileLoc.getFileLocWithOffset(CodeCompletionOffset);
+ CodeCompletionFileLoc.getLocWithOffset(CodeCompletionOffset);
}
EnterSourceFileWithLexer(new Lexer(FID, InputFile, *this), CurDir);
Modified: cfe/trunk/lib/Lex/PTHLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PTHLexer.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PTHLexer.cpp (original)
+++ cfe/trunk/lib/Lex/PTHLexer.cpp Mon Sep 19 15:40:19 2011
@@ -73,7 +73,7 @@
Tok.setKind(TKind);
Tok.setFlag(TFlags);
assert(!LexingRawMode);
- Tok.setLocation(FileStartLoc.getFileLocWithOffset(FileOffset));
+ Tok.setLocation(FileStartLoc.getLocWithOffset(FileOffset));
Tok.setLength(Len);
// Handle identifiers.
@@ -297,7 +297,7 @@
// NOTE: This is a virtual function; hence it is defined out-of-line.
const unsigned char *OffsetPtr = CurPtr + (DISK_TOKEN_SIZE - 4);
uint32_t Offset = ReadLE32(OffsetPtr);
- return FileStartLoc.getFileLocWithOffset(Offset);
+ return FileStartLoc.getLocWithOffset(Offset);
}
//===----------------------------------------------------------------------===//
Modified: cfe/trunk/lib/Lex/ScratchBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/ScratchBuffer.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/ScratchBuffer.cpp (original)
+++ cfe/trunk/lib/Lex/ScratchBuffer.cpp Mon Sep 19 15:40:19 2011
@@ -53,7 +53,7 @@
// diagnostic points to one.
CurBuffer[BytesUsed-1] = '\0';
- return BufferStartLoc.getFileLocWithOffset(BytesUsed-Len-1);
+ return BufferStartLoc.getLocWithOffset(BytesUsed-Len-1);
}
void ScratchBuffer::AllocScratchBuffer(unsigned RequestLen) {
Modified: cfe/trunk/lib/Lex/TokenConcatenation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenConcatenation.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenConcatenation.cpp (original)
+++ cfe/trunk/lib/Lex/TokenConcatenation.cpp Mon Sep 19 15:40:19 2011
@@ -143,7 +143,7 @@
// source. If they were, it must be okay to stick them together: if there
// were an issue, the tokens would have been lexed differently.
if (PrevTok.getLocation().isFileID() && Tok.getLocation().isFileID() &&
- PrevTok.getLocation().getFileLocWithOffset(PrevTok.getLength()) ==
+ PrevTok.getLocation().getLocWithOffset(PrevTok.getLength()) ==
Tok.getLocation())
return false;
Modified: cfe/trunk/lib/Lex/TokenLexer.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/TokenLexer.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/TokenLexer.cpp (original)
+++ cfe/trunk/lib/Lex/TokenLexer.cpp Mon Sep 19 15:40:19 2011
@@ -652,7 +652,7 @@
unsigned relativeOffset = 0;
SM.isInSLocAddrSpace(loc, MacroDefStart, MacroDefLength, &relativeOffset);
- return MacroExpansionStart.getFileLocWithOffset(relativeOffset);
+ return MacroExpansionStart.getLocWithOffset(relativeOffset);
}
/// \brief Finds the tokens that are consecutive (from the same FileID)
@@ -713,7 +713,7 @@
Token &Tok = *begin_tokens;
int RelOffs = 0;
SM.isInSameSLocAddrSpace(FirstLoc, Tok.getLocation(), &RelOffs);
- Tok.setLocation(Expansion.getFileLocWithOffset(RelOffs));
+ Tok.setLocation(Expansion.getLocWithOffset(RelOffs));
}
}
Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Mon Sep 19 15:40:19 2011
@@ -315,12 +315,12 @@
FILoc = SM.getExpansionLoc(FILoc);
bool IsInvalid = false;
const char *SourcePtr =
- SM.getCharacterData(FILoc.getFileLocWithOffset(-1), &IsInvalid);
+ SM.getCharacterData(FILoc.getLocWithOffset(-1), &IsInvalid);
if (!IsInvalid && *SourcePtr == ' ') {
SourcePtr =
- SM.getCharacterData(FILoc.getFileLocWithOffset(-2), &IsInvalid);
+ SM.getCharacterData(FILoc.getLocWithOffset(-2), &IsInvalid);
if (!IsInvalid && *SourcePtr == ' ') {
- FILoc = FILoc.getFileLocWithOffset(-1);
+ FILoc = FILoc.getLocWithOffset(-1);
FIText = ":";
}
}
Modified: cfe/trunk/lib/Parse/ParseExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExprCXX.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Parse/ParseExprCXX.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExprCXX.cpp Mon Sep 19 15:40:19 2011
@@ -38,7 +38,7 @@
static bool AreTokensAdjacent(Preprocessor &PP, Token &First, Token &Second) {
SourceManager &SM = PP.getSourceManager();
SourceLocation FirstLoc = SM.getSpellingLoc(First.getLocation());
- SourceLocation FirstEnd = FirstLoc.getFileLocWithOffset(First.getLength());
+ SourceLocation FirstEnd = FirstLoc.getLocWithOffset(First.getLength());
return FirstEnd == SM.getSpellingLoc(Second.getLocation());
}
@@ -59,7 +59,7 @@
// Update token information to reflect their change in token type.
ColonToken.setKind(tok::coloncolon);
- ColonToken.setLocation(ColonToken.getLocation().getFileLocWithOffset(-1));
+ ColonToken.setLocation(ColonToken.getLocation().getLocWithOffset(-1));
ColonToken.setLength(2);
DigraphToken.setKind(tok::less);
DigraphToken.setLength(1);
Modified: cfe/trunk/lib/Rewrite/HTMLRewrite.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/HTMLRewrite.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/HTMLRewrite.cpp (original)
+++ cfe/trunk/lib/Rewrite/HTMLRewrite.cpp Mon Sep 19 15:40:19 2011
@@ -277,7 +277,7 @@
const char* FileEnd = Buf->getBufferEnd();
SourceLocation StartLoc = R.getSourceMgr().getLocForStartOfFile(FID);
- SourceLocation EndLoc = StartLoc.getFileLocWithOffset(FileEnd-FileStart);
+ SourceLocation EndLoc = StartLoc.getLocWithOffset(FileEnd-FileStart);
std::string s;
llvm::raw_string_ostream os(s);
Modified: cfe/trunk/lib/Rewrite/RewriteObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Rewrite/RewriteObjC.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Rewrite/RewriteObjC.cpp (original)
+++ cfe/trunk/lib/Rewrite/RewriteObjC.cpp Mon Sep 19 15:40:19 2011
@@ -779,7 +779,7 @@
if (!strncmp(BufPtr, "import", ImportLen)) {
// replace import with include
SourceLocation ImportLoc =
- LocStart.getFileLocWithOffset(BufPtr-MainBufStart);
+ LocStart.getLocWithOffset(BufPtr-MainBufStart);
ReplaceText(ImportLoc, ImportLen, "include");
BufPtr += ImportLen;
}
@@ -809,7 +809,7 @@
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "@synthesize: can't find ';'");
SourceLocation onePastSemiLoc =
- startLoc.getFileLocWithOffset(semiBuf-startBuf+1);
+ startLoc.getLocWithOffset(semiBuf-startBuf+1);
if (PID->getPropertyImplementation() == ObjCPropertyImplDecl::Dynamic)
return; // FIXME: is this correct?
@@ -1051,12 +1051,12 @@
const char *endBuf = SM->getCharacterData(LocEnd);
for (const char *p = startBuf; p < endBuf; p++) {
if (*p == '@' && !strncmp(p+1, "optional", strlen("optional"))) {
- SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
+ SourceLocation OptionalLoc = LocStart.getLocWithOffset(p-startBuf);
ReplaceText(OptionalLoc, strlen("@optional"), "/* @optional */");
}
else if (*p == '@' && !strncmp(p+1, "required", strlen("required"))) {
- SourceLocation OptionalLoc = LocStart.getFileLocWithOffset(p-startBuf);
+ SourceLocation OptionalLoc = LocStart.getLocWithOffset(p-startBuf);
ReplaceText(OptionalLoc, strlen("@required"), "/* @required */");
}
@@ -1717,7 +1717,7 @@
// Replace ')' in for '(' type elem in collection ')' with ';'
SourceLocation rightParenLoc = S->getRParenLoc();
const char *rparenBuf = SM->getCharacterData(rightParenLoc);
- SourceLocation lparenLoc = startLoc.getFileLocWithOffset(rparenBuf-startBuf);
+ SourceLocation lparenLoc = startLoc.getLocWithOffset(rparenBuf-startBuf);
buf = ";\n\t";
// unsigned long limit = [l_collection countByEnumeratingWithState:&enumState
@@ -1794,7 +1794,7 @@
// Insert all these *after* the statement body.
// FIXME: If this should support Obj-C++, support CXXTryStmt
if (isa<CompoundStmt>(S->getBody())) {
- SourceLocation endBodyLoc = OrigEnd.getFileLocWithOffset(1);
+ SourceLocation endBodyLoc = OrigEnd.getLocWithOffset(1);
InsertText(endBodyLoc, buf);
} else {
/* Need to treat single statements specially. For example:
@@ -1807,7 +1807,7 @@
const char *stmtBuf = SM->getCharacterData(OrigEnd);
const char *semiBuf = strchr(stmtBuf, ';');
assert(semiBuf && "Can't find ';'");
- SourceLocation endBodyLoc = OrigEnd.getFileLocWithOffset(semiBuf-stmtBuf+1);
+ SourceLocation endBodyLoc = OrigEnd.getLocWithOffset(semiBuf-stmtBuf+1);
InsertText(endBodyLoc, buf);
}
Stmts.pop_back();
@@ -1839,7 +1839,7 @@
SourceLocation endLoc = S->getSynchBody()->getLocStart();
const char *endBuf = SM->getCharacterData(endLoc);
while (*endBuf != ')') endBuf--;
- SourceLocation rparenLoc = startLoc.getFileLocWithOffset(endBuf-startBuf);
+ SourceLocation rparenLoc = startLoc.getLocWithOffset(endBuf-startBuf);
buf = ");\n";
// declare a new scope with two variables, _stack and _rethrow.
buf += "/* @try scope begin */ \n{ struct _objc_exception_data {\n";
@@ -1931,7 +1931,7 @@
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "RewriteTryReturnStmts: can't find ';'");
- SourceLocation onePastSemiLoc = startLoc.getFileLocWithOffset(semiBuf-startBuf+1);
+ SourceLocation onePastSemiLoc = startLoc.getLocWithOffset(semiBuf-startBuf+1);
std::string buf;
buf = "{ objc_exception_try_exit(&_stack); return";
@@ -1954,7 +1954,7 @@
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "RewriteSyncReturnStmts: can't find ';'");
- SourceLocation onePastSemiLoc = startLoc.getFileLocWithOffset(semiBuf-startBuf+1);
+ SourceLocation onePastSemiLoc = startLoc.getLocWithOffset(semiBuf-startBuf+1);
std::string buf;
buf = "{ objc_exception_try_exit(&_stack);";
@@ -1992,7 +1992,7 @@
SourceLocation lastCurlyLoc = startLoc;
if (S->getNumCatchStmts()) {
- startLoc = startLoc.getFileLocWithOffset(1);
+ startLoc = startLoc.getLocWithOffset(1);
buf = " /* @catch begin */ else {\n";
buf += " id _caught = objc_exception_extract(&_stack);\n";
buf += " objc_exception_try_enter (&_stack);\n";
@@ -2073,7 +2073,7 @@
"bogus @catch body location");
// Insert the last (implicit) else clause *before* the right curly brace.
- bodyLoc = bodyLoc.getFileLocWithOffset(-1);
+ bodyLoc = bodyLoc.getLocWithOffset(-1);
buf = "} /* last catch end */\n";
buf += "else {\n";
buf += " _rethrow = _caught;\n";
@@ -2101,9 +2101,9 @@
assert(*SM->getCharacterData(endLoc) == '}' &&
"bogus @finally body location");
- startLoc = startLoc.getFileLocWithOffset(1);
+ startLoc = startLoc.getLocWithOffset(1);
InsertText(startLoc, " if (!_rethrow) objc_exception_try_exit(&_stack);\n");
- endLoc = endLoc.getFileLocWithOffset(-1);
+ endLoc = endLoc.getLocWithOffset(-1);
InsertText(endLoc, " if (_rethrow) objc_exception_throw(_rethrow);\n");
// Set lastCurlyLoc
@@ -2127,7 +2127,7 @@
RewriteTryReturnStmts(S->getTryBody());
}
// Now emit the final closing curly brace...
- lastCurlyLoc = lastCurlyLoc.getFileLocWithOffset(1);
+ lastCurlyLoc = lastCurlyLoc.getLocWithOffset(1);
InsertText(lastCurlyLoc, " } /* @try scope end */\n");
return 0;
}
@@ -2156,7 +2156,7 @@
const char *semiBuf = strchr(startBuf, ';');
assert((*semiBuf == ';') && "@throw: can't find ';'");
- SourceLocation semiLoc = startLoc.getFileLocWithOffset(semiBuf-startBuf);
+ SourceLocation semiLoc = startLoc.getLocWithOffset(semiBuf-startBuf);
ReplaceText(semiLoc, 1, ");");
return 0;
}
@@ -2287,8 +2287,8 @@
const char *startRef = 0, *endRef = 0;
if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
// Get the locations of the startRef, endRef.
- SourceLocation LessLoc = Loc.getFileLocWithOffset(startRef-startBuf);
- SourceLocation GreaterLoc = Loc.getFileLocWithOffset(endRef-startBuf+1);
+ SourceLocation LessLoc = Loc.getLocWithOffset(startRef-startBuf);
+ SourceLocation GreaterLoc = Loc.getLocWithOffset(endRef-startBuf+1);
// Comment out the protocol references.
InsertText(LessLoc, "/*");
InsertText(GreaterLoc, "*/");
@@ -2332,8 +2332,8 @@
const char *startRef = 0, *endRef = 0;
if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
// Get the locations of the startRef, endRef.
- SourceLocation LessLoc = Loc.getFileLocWithOffset(startRef-endBuf);
- SourceLocation GreaterLoc = Loc.getFileLocWithOffset(endRef-endBuf+1);
+ SourceLocation LessLoc = Loc.getLocWithOffset(startRef-endBuf);
+ SourceLocation GreaterLoc = Loc.getLocWithOffset(endRef-endBuf+1);
// Comment out the protocol references.
InsertText(LessLoc, "/*");
InsertText(GreaterLoc, "*/");
@@ -2355,9 +2355,9 @@
if (scanForProtocolRefs(startBuf, endBuf, startRef, endRef)) {
// Get the locations of the startRef, endRef.
SourceLocation LessLoc =
- Loc.getFileLocWithOffset(startRef-startFuncBuf);
+ Loc.getLocWithOffset(startRef-startFuncBuf);
SourceLocation GreaterLoc =
- Loc.getFileLocWithOffset(endRef-startFuncBuf+1);
+ Loc.getLocWithOffset(endRef-startFuncBuf+1);
// Comment out the protocol references.
InsertText(LessLoc, "/*");
InsertText(GreaterLoc, "*/");
@@ -3384,7 +3384,7 @@
// insert the super class structure definition.
SourceLocation OnePastCurly =
- LocStart.getFileLocWithOffset(cursor-startBuf+1);
+ LocStart.getLocWithOffset(cursor-startBuf+1);
InsertText(OnePastCurly, Result);
}
cursor++; // past '{'
@@ -3392,7 +3392,7 @@
// Now comment out any visibility specifiers.
while (cursor < endBuf) {
if (*cursor == '@') {
- SourceLocation atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ SourceLocation atLoc = LocStart.getLocWithOffset(cursor-startBuf);
// Skip whitespace.
for (++cursor; cursor[0] == ' ' || cursor[0] == '\t'; ++cursor)
/*scan*/;
@@ -3409,20 +3409,20 @@
// of user code, then scan the ivar list and use needToScanForQualifiers
// for type checking.
else if (*cursor == '<') {
- SourceLocation atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ SourceLocation atLoc = LocStart.getLocWithOffset(cursor-startBuf);
InsertText(atLoc, "/* ");
cursor = strchr(cursor, '>');
cursor++;
- atLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ atLoc = LocStart.getLocWithOffset(cursor-startBuf);
InsertText(atLoc, " */");
} else if (*cursor == '^') { // rewrite block specifier.
- SourceLocation caretLoc = LocStart.getFileLocWithOffset(cursor-startBuf);
+ SourceLocation caretLoc = LocStart.getLocWithOffset(cursor-startBuf);
ReplaceText(caretLoc, 1, "*");
}
cursor++;
}
// Don't forget to add a ';'!!
- InsertText(LocEnd.getFileLocWithOffset(1), ";");
+ InsertText(LocEnd.getLocWithOffset(1), ";");
} else { // we don't have any instance variables - insert super struct.
endBuf += Lexer::MeasureTokenLength(LocEnd, *SM, LangOpts);
Result += " {\n struct ";
@@ -4926,7 +4926,7 @@
switch (*argPtr) {
case '^':
// Replace the '^' with '*'.
- LocStart = LocStart.getFileLocWithOffset(argPtr-startBuf);
+ LocStart = LocStart.getLocWithOffset(argPtr-startBuf);
ReplaceText(LocStart, 1, "*");
break;
}
@@ -4946,7 +4946,7 @@
parenCount++;
// advance the location to startArgList.
- DeclLoc = DeclLoc.getFileLocWithOffset(startArgList-startBuf);
+ DeclLoc = DeclLoc.getLocWithOffset(startArgList-startBuf);
assert((DeclLoc.isValid()) && "Invalid DeclLoc");
const char *argPtr = startArgList;
@@ -4955,7 +4955,7 @@
switch (*argPtr) {
case '^':
// Replace the '^' with '*'.
- DeclLoc = DeclLoc.getFileLocWithOffset(argPtr-startArgList);
+ DeclLoc = DeclLoc.getLocWithOffset(argPtr-startArgList);
ReplaceText(DeclLoc, 1, "*");
break;
case '(':
@@ -5055,7 +5055,7 @@
// scan backward (from the decl location) for the end of the previous decl.
while (*startBuf != '^' && *startBuf != ';' && startBuf != MainFileStart)
startBuf--;
- SourceLocation Start = DeclLoc.getFileLocWithOffset(startBuf-endBuf);
+ SourceLocation Start = DeclLoc.getLocWithOffset(startBuf-endBuf);
std::string buf;
unsigned OrigLength=0;
// *startBuf != '^' if we are dealing with a pointer to function that
@@ -5326,7 +5326,7 @@
const char *semiBuf = strchr(startInitializerBuf, ';');
assert((*semiBuf == ';') && "RewriteByRefVar: can't find ';'");
SourceLocation semiLoc =
- startLoc.getFileLocWithOffset(semiBuf-startInitializerBuf);
+ startLoc.getLocWithOffset(semiBuf-startInitializerBuf);
InsertText(semiLoc, "}");
}
Modified: cfe/trunk/lib/Sema/DeclSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/DeclSpec.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/DeclSpec.cpp (original)
+++ cfe/trunk/lib/Sema/DeclSpec.cpp Mon Sep 19 15:40:19 2011
@@ -890,7 +890,7 @@
const char *SpecName = getSpecifierName(SC);
SourceLocation SCLoc = getStorageClassSpecLoc();
- SourceLocation SCEndLoc = SCLoc.getFileLocWithOffset(strlen(SpecName));
+ SourceLocation SCEndLoc = SCLoc.getLocWithOffset(strlen(SpecName));
Diag(D, SCLoc, diag::err_friend_storage_spec)
<< SpecName
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Mon Sep 19 15:40:19 2011
@@ -1302,7 +1302,7 @@
SourceLocation End = getLocationOfByte(startSpecifier + specifierLen - 1);
// Advance the end SourceLocation by one due to half-open ranges.
- End = End.getFileLocWithOffset(1);
+ End = End.getLocWithOffset(1);
return CharSourceRange::getCharRange(Start, End);
}
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Mon Sep 19 15:40:19 2011
@@ -7163,10 +7163,10 @@
UO->getOpcode() == UO_Minus) &&
Loc.isFileID() && UO->getOperatorLoc().isFileID() &&
// Only if the two operators are exactly adjacent.
- Loc.getFileLocWithOffset(1) == UO->getOperatorLoc() &&
+ Loc.getLocWithOffset(1) == UO->getOperatorLoc() &&
// And there is a space or other character before the subexpr of the
// unary +/-. We don't want to warn on "x=-1".
- Loc.getFileLocWithOffset(2) != UO->getSubExpr()->getLocStart() &&
+ Loc.getLocWithOffset(2) != UO->getSubExpr()->getLocStart() &&
UO->getSubExpr()->getLocStart().isFileID()) {
Diag(Loc, diag::warn_not_compound_assign)
<< (UO->getOpcode() == UO_Plus ? "+" : "-")
Modified: cfe/trunk/lib/Sema/SemaExprMember.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprMember.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprMember.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprMember.cpp Mon Sep 19 15:40:19 2011
@@ -1392,7 +1392,7 @@
ExprResult NewBase =
ActOnCallExpr(0, BaseExpr.take(), ParenInsertionLoc,
MultiExprArg(*this, 0, 0),
- ParenInsertionLoc.getFileLocWithOffset(1));
+ ParenInsertionLoc.getLocWithOffset(1));
if (NewBase.isInvalid())
return ExprError();
BaseExpr = NewBase;
Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Mon Sep 19 15:40:19 2011
@@ -323,7 +323,7 @@
assert(MacroLoc.second!=StringRef::npos && "Unable to find macro!");
SourceLocation PCHMissingLoc =
SourceMgr.getLocForStartOfFile(MacroLoc.first)
- .getFileLocWithOffset(MacroLoc.second);
+ .getLocWithOffset(MacroLoc.second);
Reader.Diag(PCHMissingLoc, diag::note_pch_macro_defined_as) << MacroName;
ConflictingDefines = true;
@@ -346,7 +346,7 @@
assert(MacroLoc.second!=StringRef::npos && "Unable to find macro!");
SourceLocation PCHMissingLoc =
SourceMgr.getLocForStartOfFile(MacroLoc.first)
- .getFileLocWithOffset(MacroLoc.second);
+ .getLocWithOffset(MacroLoc.second);
Reader.Diag(PCHMissingLoc, diag::note_using_macro_def_from_pch);
}
Modified: cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp Mon Sep 19 15:40:19 2011
@@ -474,7 +474,7 @@
// Insert the new html.
unsigned DisplayPos = LineEnd - FileStart;
SourceLocation Loc =
- SM.getLocForStartOfFile(LPosInfo.first).getFileLocWithOffset(DisplayPos);
+ SM.getLocForStartOfFile(LPosInfo.first).getLocWithOffset(DisplayPos);
R.InsertTextBefore(Loc, os.str());
@@ -575,7 +575,7 @@
// selected range.
SourceLocation E =
- InstantiationEnd.getFileLocWithOffset(EndColNo - OldEndColNo);
+ InstantiationEnd.getLocWithOffset(EndColNo - OldEndColNo);
html::HighlightRange(R, InstantiationStart, E, HighlightStart, HighlightEnd);
}
Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=140057&r1=140056&r2=140057&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Mon Sep 19 15:40:19 2011
@@ -120,7 +120,7 @@
EndLoc = SM.getExpansionRange(EndLoc).second;
if (R.isTokenRange() && !EndLoc.isInvalid() && EndLoc.isFileID()) {
unsigned Length = Lexer::MeasureTokenLength(EndLoc, SM, LangOpts);
- EndLoc = EndLoc.getFileLocWithOffset(Length);
+ EndLoc = EndLoc.getLocWithOffset(Length);
}
CXSourceRange Result = { { (void *)&SM, (void *)&LangOpts },
@@ -2780,7 +2780,7 @@
1, 1);
if (Start.isInvalid()) return clang_getNullLocation();
- SourceLocation SLoc = Start.getFileLocWithOffset(offset);
+ SourceLocation SLoc = Start.getLocWithOffset(offset);
if (SLoc.isInvalid()) return clang_getNullLocation();
More information about the cfe-commits
mailing list