summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-20 22:14:48 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-09-20 22:14:48 +0000
commit0d48fb89c023a98e991e29c01347ea588a38a790 (patch)
tree63d12bfa9d04c82fc57678d88c00686ab5490704 /clang
parentb3642c2c7a209e025daef6b35b78699265a41970 (diff)
downloadbcm5719-llvm-0d48fb89c023a98e991e29c01347ea588a38a790.tar.gz
bcm5719-llvm-0d48fb89c023a98e991e29c01347ea588a38a790.zip
The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it. llvm-svn: 140190
Diffstat (limited to 'clang')
-rw-r--r--clang/include/clang/Lex/PreprocessingRecord.h11
-rw-r--r--clang/lib/Lex/PreprocessingRecord.cpp4
-rw-r--r--clang/lib/Serialization/ASTReader.cpp1
-rw-r--r--clang/lib/Serialization/ASTWriter.cpp1
4 files changed, 4 insertions, 13 deletions
diff --git a/clang/include/clang/Lex/PreprocessingRecord.h b/clang/include/clang/Lex/PreprocessingRecord.h
index bf1bb5301b6..c76224d1244 100644
--- a/clang/include/clang/Lex/PreprocessingRecord.h
+++ b/clang/include/clang/Lex/PreprocessingRecord.h
@@ -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) {
diff --git a/clang/lib/Lex/PreprocessingRecord.cpp b/clang/lib/Lex/PreprocessingRecord.cpp
index a4315b78d5b..2368b389810 100644
--- a/clang/lib/Lex/PreprocessingRecord.cpp
+++ b/clang/lib/Lex/PreprocessingRecord.cpp
@@ -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);
diff --git a/clang/lib/Serialization/ASTReader.cpp b/clang/lib/Serialization/ASTReader.cpp
index 25b86876b3d..392658d48e8 100644
--- a/clang/lib/Serialization/ASTReader.cpp
+++ b/clang/lib/Serialization/ASTReader.cpp
@@ -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])));
diff --git a/clang/lib/Serialization/ASTWriter.cpp b/clang/lib/Serialization/ASTWriter.cpp
index 2aa1e6c4e3f..f646c59ebdd 100644
--- a/clang/lib/Serialization/ASTWriter.cpp
+++ b/clang/lib/Serialization/ASTWriter.cpp
@@ -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;
}
OpenPOWER on IntegriCloud