forked from OSchip/llvm-project
Rename create(MacroArg)InstantiationLoc to create(MacroArg)ExpansionLoc.
llvm-svn: 136054
This commit is contained in:
parent
aa63153ff7
commit
115b077f30
|
@ -583,20 +583,20 @@ public:
|
|||
SrcMgr::C_User, LoadedID, LoadedOffset);
|
||||
}
|
||||
|
||||
/// createMacroArgInstantiationLoc - Return a new SourceLocation that encodes
|
||||
/// the fact that a token from SpellingLoc should actually be referenced from
|
||||
/// InstantiationLoc, and that it represents the instantiation of a macro
|
||||
/// createMacroArgExpansionLoc - Return a new SourceLocation that encodes the
|
||||
/// fact that a token from SpellingLoc should actually be referenced from
|
||||
/// ExpansionLoc, and that it represents the instantiation of a macro
|
||||
/// argument into the function-like macro body.
|
||||
SourceLocation createMacroArgInstantiationLoc(SourceLocation Loc,
|
||||
SourceLocation InstantiationLoc,
|
||||
SourceLocation createMacroArgExpansionLoc(SourceLocation Loc,
|
||||
SourceLocation ExpansionLoc,
|
||||
unsigned TokLength);
|
||||
|
||||
/// createInstantiationLoc - Return a new SourceLocation that encodes the fact
|
||||
/// createExpansionLoc - Return a new SourceLocation that encodes the fact
|
||||
/// that a token from SpellingLoc should actually be referenced from
|
||||
/// InstantiationLoc.
|
||||
SourceLocation createInstantiationLoc(SourceLocation Loc,
|
||||
SourceLocation InstantiationLocStart,
|
||||
SourceLocation InstantiationLocEnd,
|
||||
/// ExpansionLoc.
|
||||
SourceLocation createExpansionLoc(SourceLocation Loc,
|
||||
SourceLocation ExpansionLocStart,
|
||||
SourceLocation ExpansionLocEnd,
|
||||
unsigned TokLength,
|
||||
int LoadedID = 0,
|
||||
unsigned LoadedOffset = 0);
|
||||
|
@ -1080,10 +1080,10 @@ private:
|
|||
return getLoadedSLocEntry(static_cast<unsigned>(-ID - 2));
|
||||
}
|
||||
|
||||
/// createInstantiationLoc - Implements the common elements of storing an
|
||||
/// createExpansionLoc - Implements the common elements of storing an
|
||||
/// instantiation info struct into the SLocEntry table and producing a source
|
||||
/// location that refers to it.
|
||||
SourceLocation createInstantiationLocImpl(const SrcMgr::InstantiationInfo &II,
|
||||
SourceLocation createExpansionLocImpl(const SrcMgr::InstantiationInfo &II,
|
||||
unsigned TokLength,
|
||||
int LoadedID = 0,
|
||||
unsigned LoadedOffset = 0);
|
||||
|
|
|
@ -406,7 +406,7 @@ void SourceManager::clearIDTables() {
|
|||
// The highest possible offset is 2^31-1, so CurrentLoadedOffset starts at
|
||||
// 2^31.
|
||||
CurrentLoadedOffset = 1U << 31U;
|
||||
createInstantiationLoc(SourceLocation(),SourceLocation(),SourceLocation(), 1);
|
||||
createExpansionLoc(SourceLocation(),SourceLocation(),SourceLocation(), 1);
|
||||
}
|
||||
|
||||
/// getOrCreateContentCache - Create or return a cached ContentCache for the
|
||||
|
@ -518,27 +518,29 @@ FileID SourceManager::createFileID(const ContentCache *File,
|
|||
}
|
||||
|
||||
SourceLocation
|
||||
SourceManager::createMacroArgInstantiationLoc(SourceLocation SpellingLoc,
|
||||
SourceLocation ILoc,
|
||||
SourceManager::createMacroArgExpansionLoc(SourceLocation SpellingLoc,
|
||||
SourceLocation ExpansionLoc,
|
||||
unsigned TokLength) {
|
||||
InstantiationInfo II =
|
||||
InstantiationInfo::createForMacroArg(SpellingLoc, ILoc);
|
||||
return createInstantiationLocImpl(II, TokLength);
|
||||
InstantiationInfo::createForMacroArg(SpellingLoc, ExpansionLoc);
|
||||
return createExpansionLocImpl(II, TokLength);
|
||||
}
|
||||
|
||||
SourceLocation SourceManager::createInstantiationLoc(SourceLocation SpellingLoc,
|
||||
SourceLocation ILocStart,
|
||||
SourceLocation ILocEnd,
|
||||
SourceLocation
|
||||
SourceManager::createExpansionLoc(SourceLocation SpellingLoc,
|
||||
SourceLocation ExpansionLocStart,
|
||||
SourceLocation ExpansionLocEnd,
|
||||
unsigned TokLength,
|
||||
int LoadedID,
|
||||
unsigned LoadedOffset) {
|
||||
InstantiationInfo II =
|
||||
InstantiationInfo::create(SpellingLoc, ILocStart, ILocEnd);
|
||||
return createInstantiationLocImpl(II, TokLength, LoadedID, LoadedOffset);
|
||||
InstantiationInfo::create(SpellingLoc, ExpansionLocStart,
|
||||
ExpansionLocEnd);
|
||||
return createExpansionLocImpl(II, TokLength, LoadedID, LoadedOffset);
|
||||
}
|
||||
|
||||
SourceLocation
|
||||
SourceManager::createInstantiationLocImpl(const InstantiationInfo &II,
|
||||
SourceManager::createExpansionLocImpl(const InstantiationInfo &II,
|
||||
unsigned TokLength,
|
||||
int LoadedID,
|
||||
unsigned LoadedOffset) {
|
||||
|
|
|
@ -187,7 +187,7 @@ Lexer *Lexer::Create_PragmaLexer(SourceLocation SpellingLoc,
|
|||
|
||||
// Set the SourceLocation with the remapping information. This ensures that
|
||||
// GetMappedTokenLoc will remap the tokens as they are lexed.
|
||||
L->FileLoc = SM.createInstantiationLoc(SM.getLocForStartOfFile(SpellingFID),
|
||||
L->FileLoc = SM.createExpansionLoc(SM.getLocForStartOfFile(SpellingFID),
|
||||
ExpansionLocStart,
|
||||
ExpansionLocEnd, TokLen);
|
||||
|
||||
|
@ -914,7 +914,7 @@ static SourceLocation GetMappedTokenLoc(Preprocessor &PP,
|
|||
std::pair<SourceLocation,SourceLocation> II =
|
||||
SM.getImmediateExpansionRange(FileLoc);
|
||||
|
||||
return SM.createInstantiationLoc(SpellingLoc, II.first, II.second, TokLen);
|
||||
return SM.createExpansionLoc(SpellingLoc, II.first, II.second, TokLen);
|
||||
}
|
||||
|
||||
/// getSourceLocation - Return a source location identifier for the specified
|
||||
|
|
|
@ -284,7 +284,7 @@ bool Preprocessor::HandleMacroExpandedIdentifier(Token &Identifier,
|
|||
// Update the tokens location to include both its expansion and physical
|
||||
// locations.
|
||||
SourceLocation Loc =
|
||||
SourceMgr.createInstantiationLoc(Identifier.getLocation(), ExpandLoc,
|
||||
SourceMgr.createExpansionLoc(Identifier.getLocation(), ExpandLoc,
|
||||
ExpansionEnd,Identifier.getLength());
|
||||
Identifier.setLocation(Loc);
|
||||
|
||||
|
@ -875,7 +875,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
|
|||
ComputeDATE_TIME(DATELoc, TIMELoc, *this);
|
||||
Tok.setKind(tok::string_literal);
|
||||
Tok.setLength(strlen("\"Mmm dd yyyy\""));
|
||||
Tok.setLocation(SourceMgr.createInstantiationLoc(DATELoc, Tok.getLocation(),
|
||||
Tok.setLocation(SourceMgr.createExpansionLoc(DATELoc, Tok.getLocation(),
|
||||
Tok.getLocation(),
|
||||
Tok.getLength()));
|
||||
return;
|
||||
|
@ -884,7 +884,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
|
|||
ComputeDATE_TIME(DATELoc, TIMELoc, *this);
|
||||
Tok.setKind(tok::string_literal);
|
||||
Tok.setLength(strlen("\"hh:mm:ss\""));
|
||||
Tok.setLocation(SourceMgr.createInstantiationLoc(TIMELoc, Tok.getLocation(),
|
||||
Tok.setLocation(SourceMgr.createExpansionLoc(TIMELoc, Tok.getLocation(),
|
||||
Tok.getLocation(),
|
||||
Tok.getLength()));
|
||||
return;
|
||||
|
|
|
@ -335,8 +335,7 @@ void Preprocessor::CreateString(const char *Buf, unsigned Len, Token &Tok,
|
|||
SourceLocation Loc = ScratchBuf->getToken(Buf, Len, DestPtr);
|
||||
|
||||
if (ExpansionLoc.isValid())
|
||||
Loc = SourceMgr.createInstantiationLoc(Loc, ExpansionLoc,
|
||||
ExpansionLoc, Len);
|
||||
Loc = SourceMgr.createExpansionLoc(Loc, ExpansionLoc, ExpansionLoc, Len);
|
||||
Tok.setLocation(Loc);
|
||||
|
||||
// If this is a raw identifier or a literal token, set the pointer data.
|
||||
|
|
|
@ -57,7 +57,7 @@ void TokenLexer::Init(Token &Tok, SourceLocation ELEnd, MacroArgs *Actuals) {
|
|||
// creating separate source location entries for each token.
|
||||
SourceLocation macroStart = SM.getExpansionLoc(Tokens[0].getLocation());
|
||||
MacroDefStartInfo = SM.getDecomposedLoc(macroStart);
|
||||
MacroExpansionStart = SM.createInstantiationLoc(macroStart,
|
||||
MacroExpansionStart = SM.createExpansionLoc(macroStart,
|
||||
ExpandLocStart,
|
||||
ExpandLocEnd,
|
||||
Macro->getDefinitionLength(SM));
|
||||
|
@ -231,7 +231,7 @@ void TokenLexer::ExpandFunctionArguments() {
|
|||
"Expected arg identifier to come from definition");
|
||||
for (unsigned i = FirstResult, e = ResultToks.size(); i != e; ++i) {
|
||||
Token &Tok = ResultToks[i];
|
||||
Tok.setLocation(SM.createMacroArgInstantiationLoc(Tok.getLocation(),
|
||||
Tok.setLocation(SM.createMacroArgExpansionLoc(Tok.getLocation(),
|
||||
curInst,
|
||||
Tok.getLength()));
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ void TokenLexer::ExpandFunctionArguments() {
|
|||
for (unsigned i = ResultToks.size() - NumToks, e = ResultToks.size();
|
||||
i != e; ++i) {
|
||||
Token &Tok = ResultToks[i];
|
||||
Tok.setLocation(SM.createMacroArgInstantiationLoc(Tok.getLocation(),
|
||||
Tok.setLocation(SM.createMacroArgExpansionLoc(Tok.getLocation(),
|
||||
curInst,
|
||||
Tok.getLength()));
|
||||
}
|
||||
|
@ -421,7 +421,7 @@ void TokenLexer::Lex(Token &Tok) {
|
|||
MacroStartSLocOffset)) {
|
||||
SourceLocation instLoc;
|
||||
if (Tok.is(tok::comment)) {
|
||||
instLoc = SM.createInstantiationLoc(Tok.getLocation(),
|
||||
instLoc = SM.createExpansionLoc(Tok.getLocation(),
|
||||
ExpandLocStart,
|
||||
ExpandLocEnd,
|
||||
Tok.getLength());
|
||||
|
@ -574,8 +574,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
|
|||
// information so that the user knows where it came from.
|
||||
SourceManager &SM = PP.getSourceManager();
|
||||
SourceLocation Loc =
|
||||
SM.createInstantiationLoc(PasteOpLoc, ExpandLocStart,
|
||||
ExpandLocEnd, 2);
|
||||
SM.createExpansionLoc(PasteOpLoc, ExpandLocStart, ExpandLocEnd, 2);
|
||||
// If we're in microsoft extensions mode, downgrade this from a hard
|
||||
// error to a warning that defaults to an error. This allows
|
||||
// disabling it.
|
||||
|
@ -616,7 +615,7 @@ bool TokenLexer::PasteTokens(Token &Tok) {
|
|||
assert(pasteLocInst.isValid() &&
|
||||
"Expected '##' to come from definition");
|
||||
|
||||
Tok.setLocation(SM.createInstantiationLoc(Tok.getLocation(),
|
||||
Tok.setLocation(SM.createExpansionLoc(Tok.getLocation(),
|
||||
pasteLocInst,
|
||||
pasteLocInst,
|
||||
Tok.getLength()));
|
||||
|
|
|
@ -1359,7 +1359,7 @@ ASTReader::ASTReadResult ASTReader::ReadSLocEntryRecord(int ID) {
|
|||
|
||||
case SM_SLOC_EXPANSION_ENTRY: {
|
||||
SourceLocation SpellingLoc = ReadSourceLocation(*F, Record[1]);
|
||||
SourceMgr.createInstantiationLoc(SpellingLoc,
|
||||
SourceMgr.createExpansionLoc(SpellingLoc,
|
||||
ReadSourceLocation(*F, Record[2]),
|
||||
ReadSourceLocation(*F, Record[3]),
|
||||
Record[4],
|
||||
|
|
Loading…
Reference in New Issue