14 #include "llvm/Support/Capacity.h" 16 using namespace clang;
28 CondDirectiveLocsTy::const_iterator low = llvm::lower_bound(
30 if (low == CondDirectiveLocs.end())
36 CondDirectiveLocsTy::const_iterator
37 upp = std::upper_bound(low, CondDirectiveLocs.end(),
40 if (upp != CondDirectiveLocs.end())
41 uppRegion = upp->getRegionLoc();
43 return low->getRegionLoc() != uppRegion;
50 if (CondDirectiveLocs.empty())
55 return CondDirectiveStack.back();
57 CondDirectiveLocsTy::const_iterator low = llvm::lower_bound(
59 assert(low != CondDirectiveLocs.end());
60 return low->getRegionLoc();
63 void PPConditionalDirectiveRecord::addCondDirectiveLoc(
64 CondDirectiveLoc DirLoc) {
69 assert(CondDirectiveLocs.empty() ||
72 CondDirectiveLocs.push_back(DirLoc);
78 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
79 CondDirectiveStack.push_back(Loc);
83 const Token &MacroNameTok,
85 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
86 CondDirectiveStack.push_back(Loc);
90 const Token &MacroNameTok,
92 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
93 CondDirectiveStack.push_back(Loc);
100 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
101 CondDirectiveStack.back() = Loc;
106 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
107 CondDirectiveStack.back() = Loc;
112 addCondDirectiveLoc(CondDirectiveLoc(Loc, CondDirectiveStack.back()));
113 assert(!CondDirectiveStack.empty());
114 CondDirectiveStack.pop_back();
118 return llvm::capacity_in_bytes(CondDirectiveLocs);
PPConditionalDirectiveRecord(SourceManager &SM)
Construct a new preprocessing record.
bool isBeforeInTranslationUnit(SourceLocation LHS, SourceLocation RHS) const
Determines the order of 2 source locations in the translation unit.
A description of the current definition of a macro.
size_t getTotalMemory() const
Token - This structure provides full information about a lexed token.
bool isInSystemHeader(SourceLocation Loc) const
Returns if a SourceLocation is in a system header.
SourceLocation getEnd() const
Encodes a location in the source.
bool rangeIntersectsConditionalDirective(SourceRange Range) const
Returns true if the given range intersects with a conditional directive.
Dataflow Directional Tag Classes.
SourceLocation findConditionalDirectiveRegionLoc(SourceLocation Loc) const
A trivial tuple used to represent a source range.
SourceLocation getBegin() const
This class handles loading and caching of source files into memory.