зеркало из https://github.com/microsoft/clang-1.git
The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140190 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
cc6306e967
Коммит
de4e0a8e57
|
@ -138,21 +138,16 @@ namespace clang {
|
|||
class MacroDefinition : public PreprocessingDirective {
|
||||
/// \brief The name of the macro being defined.
|
||||
const IdentifierInfo *Name;
|
||||
|
||||
/// \brief The location of the macro name in the macro definition.
|
||||
SourceLocation Location;
|
||||
|
||||
public:
|
||||
explicit MacroDefinition(const IdentifierInfo *Name, SourceLocation Location,
|
||||
SourceRange Range)
|
||||
: PreprocessingDirective(MacroDefinitionKind, Range), Name(Name),
|
||||
Location(Location) { }
|
||||
explicit MacroDefinition(const IdentifierInfo *Name, SourceRange Range)
|
||||
: PreprocessingDirective(MacroDefinitionKind, Range), Name(Name) { }
|
||||
|
||||
/// \brief Retrieve the name of the macro being defined.
|
||||
const IdentifierInfo *getName() const { return Name; }
|
||||
|
||||
/// \brief Retrieve the location of the macro name in the definition.
|
||||
SourceLocation getLocation() const { return Location; }
|
||||
SourceLocation getLocation() const { return getSourceRange().getBegin(); }
|
||||
|
||||
// Implement isa/cast/dyncast/etc.
|
||||
static bool classof(const PreprocessedEntity *PE) {
|
||||
|
|
|
@ -229,9 +229,7 @@ void PreprocessingRecord::MacroDefined(const Token &Id,
|
|||
const MacroInfo *MI) {
|
||||
SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc());
|
||||
MacroDefinition *Def
|
||||
= new (*this) MacroDefinition(Id.getIdentifierInfo(),
|
||||
MI->getDefinitionLoc(),
|
||||
R);
|
||||
= new (*this) MacroDefinition(Id.getIdentifierInfo(), R);
|
||||
addPreprocessedEntity(Def);
|
||||
MacroDefinitions[MI] = getPPEntityID(PreprocessedEntities.size()-1,
|
||||
/*isLoaded=*/false);
|
||||
|
|
|
@ -1404,7 +1404,6 @@ PreprocessedEntity *ASTReader::LoadPreprocessedEntity(Module &F) {
|
|||
IdentifierInfo *II = getLocalIdentifier(F, Record[3]);
|
||||
MacroDefinition *MD
|
||||
= new (PPRec) MacroDefinition(II,
|
||||
ReadSourceLocation(F, Record[4]),
|
||||
SourceRange(
|
||||
ReadSourceLocation(F, Record[1]),
|
||||
ReadSourceLocation(F, Record[2])));
|
||||
|
|
|
@ -1759,7 +1759,6 @@ void ASTWriter::WritePreprocessorDetail(PreprocessingRecord &PPRec) {
|
|||
AddSourceLocation(MD->getSourceRange().getBegin(), Record);
|
||||
AddSourceLocation(MD->getSourceRange().getEnd(), Record);
|
||||
AddIdentifierRef(MD->getName(), Record);
|
||||
AddSourceLocation(MD->getLocation(), Record);
|
||||
Stream.EmitRecord(PPD_MACRO_DEFINITION, Record);
|
||||
continue;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче