diff options
Diffstat (limited to 'lib/Lex/PreprocessingRecord.cpp')
-rw-r--r-- | lib/Lex/PreprocessingRecord.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/lib/Lex/PreprocessingRecord.cpp b/lib/Lex/PreprocessingRecord.cpp new file mode 100644 index 0000000000..fe081b69bb --- /dev/null +++ b/lib/Lex/PreprocessingRecord.cpp @@ -0,0 +1,37 @@ +//===--- PreprocessingRecord.cpp - Record of Preprocessing ------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file implements the PreprocessingRecord class, which maintains a record +// of what occurred during preprocessing, and its helpers. +// +//===----------------------------------------------------------------------===// +#include "clang/Lex/PreprocessingRecord.h" +#include "clang/Lex/MacroInfo.h" +#include "clang/Lex/Token.h" + +using namespace clang; + +void PreprocessingRecord::addPreprocessedEntity(PreprocessedEntity *Entity) { + PreprocessedEntities.push_back(Entity); +} + +void PopulatePreprocessingRecord::MacroExpands(const Token &Id, + const MacroInfo* MI) { + Record.addPreprocessedEntity( + new (Record) MacroInstantiation(Id.getIdentifierInfo(), + Id.getLocation(), + MI->getDefinitionLoc())); +} + +void PopulatePreprocessingRecord::MacroDefined(const IdentifierInfo *II, + const MacroInfo *MI) { + SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc()); + Record.addPreprocessedEntity( + new (Record) MacroDefinition(II, MI->getDefinitionLoc(), R)); +} |