blob: fe081b69bbbde1025335dcabf020ae1f672f4b9d [file] [log] [blame]
Douglas Gregor065f8d12010-03-18 17:52:52 +00001//===--- PreprocessingRecord.cpp - Record of Preprocessing ------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file implements the PreprocessingRecord class, which maintains a record
11// of what occurred during preprocessing, and its helpers.
12//
13//===----------------------------------------------------------------------===//
14#include "clang/Lex/PreprocessingRecord.h"
15#include "clang/Lex/MacroInfo.h"
16#include "clang/Lex/Token.h"
17
18using namespace clang;
19
20void PreprocessingRecord::addPreprocessedEntity(PreprocessedEntity *Entity) {
21 PreprocessedEntities.push_back(Entity);
22}
23
24void PopulatePreprocessingRecord::MacroExpands(const Token &Id,
25 const MacroInfo* MI) {
26 Record.addPreprocessedEntity(
27 new (Record) MacroInstantiation(Id.getIdentifierInfo(),
28 Id.getLocation(),
29 MI->getDefinitionLoc()));
30}
31
32void PopulatePreprocessingRecord::MacroDefined(const IdentifierInfo *II,
33 const MacroInfo *MI) {
34 SourceRange R(MI->getDefinitionLoc(), MI->getDefinitionEndLoc());
35 Record.addPreprocessedEntity(
36 new (Record) MacroDefinition(II, MI->getDefinitionLoc(), R));
37}