class PPConditionalDirectiveRecord

Declaration

class PPConditionalDirectiveRecord : public PPCallbacks { /* full declaration omitted */ };

Description

Records preprocessor conditional directive regions and allows querying in which region source locations belong to.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:25

Inherits from: PPCallbacks

Member Variables

private clang::SourceManager& SourceMgr
private SmallVector<clang::SourceLocation, 6> CondDirectiveStack
private clang::PPConditionalDirectiveRecord:: CondDirectiveLocsTy CondDirectiveLocs
The locations of conditional directives in source order.

Method Overview

  • private void Elif(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::PPCallbacks::ConditionValueKind ConditionValue, clang::SourceLocation IfLoc)
  • private void Elifdef(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::SourceLocation IfLoc)
  • private void Elifdef(clang::SourceLocation Loc, const clang::Token & MacroNameTok, const clang::MacroDefinition & MD)
  • private void Elifndef(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::SourceLocation IfLoc)
  • private void Elifndef(clang::SourceLocation Loc, const clang::Token & MacroNameTok, const clang::MacroDefinition & MD)
  • private void Else(clang::SourceLocation Loc, clang::SourceLocation IfLoc)
  • private void Endif(clang::SourceLocation Loc, clang::SourceLocation IfLoc)
  • private void If(clang::SourceLocation Loc, clang::SourceRange ConditionRange, clang::PPCallbacks::ConditionValueKind ConditionValue)
  • private void Ifdef(clang::SourceLocation Loc, const clang::Token & MacroNameTok, const clang::MacroDefinition & MD)
  • private void Ifndef(clang::SourceLocation Loc, const clang::Token & MacroNameTok, const clang::MacroDefinition & MD)
  • public PPConditionalDirectiveRecord(clang::SourceManager & SM)
  • private void addCondDirectiveLoc(clang::PPConditionalDirectiveRecord::CondDirectiveLoc DirLoc)
  • public bool areInDifferentConditionalDirectiveRegion(clang::SourceLocation LHS, clang::SourceLocation RHS) const
  • public clang::SourceLocation findConditionalDirectiveRegionLoc(clang::SourceLocation Loc) const
  • public clang::SourceManager & getSourceManager() const
  • public size_t getTotalMemory() const
  • public bool rangeIntersectsConditionalDirective(clang::SourceRange Range) const

Inherited from PPCallbacks:

Methods

void Elif(clang::SourceLocation Loc,
          clang::SourceRange ConditionRange,
          clang::PPCallbacks::ConditionValueKind
              ConditionValue,
          clang::SourceLocation IfLoc)

Description

Hook called whenever an # elif is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:90

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceRange ConditionRange
The SourceRange of the expression being tested.
clang::PPCallbacks::ConditionValueKind ConditionValue
The evaluated value of the condition.
clang::SourceLocation IfLoc
the source location of the # if/ # ifdef/ # ifndef directive.

void Elifdef(clang::SourceLocation Loc,
             clang::SourceRange ConditionRange,
             clang::SourceLocation IfLoc)

Description

Hook called whenever an # elifdef is skipped.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:98

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceRange ConditionRange
The SourceRange of the expression being tested.
clang::SourceLocation IfLoc
the source location of the # if/ # ifdef/ # ifndef directive.

void Elifdef(clang::SourceLocation Loc,
             const clang::Token& MacroNameTok,
             const clang::MacroDefinition& MD)

Description

Hook called whenever an # elifdef branch is taken.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:96

Parameters

clang::SourceLocation Loc
the source location of the directive.
const clang::Token& MacroNameTok
Information on the token being tested.
const clang::MacroDefinition& MD
The MacroDefinition if the name was a macro, null otherwise.

void Elifndef(clang::SourceLocation Loc,
              clang::SourceRange ConditionRange,
              clang::SourceLocation IfLoc)

Description

Hook called whenever an # elifndef is skipped.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:102

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceRange ConditionRange
The SourceRange of the expression being tested.
clang::SourceLocation IfLoc
the source location of the # if/ # ifdef/ # ifndef directive.

void Elifndef(clang::SourceLocation Loc,
              const clang::Token& MacroNameTok,
              const clang::MacroDefinition& MD)

Description

Hook called whenever an # elifndef branch is taken.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:100

Parameters

clang::SourceLocation Loc
the source location of the directive.
const clang::Token& MacroNameTok
Information on the token being tested.
const clang::MacroDefinition& MD
The MacroDefinition if the name was a macro, null otherwise.

void Else(clang::SourceLocation Loc,
          clang::SourceLocation IfLoc)

Description

Hook called whenever an # else is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:104

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceLocation IfLoc
the source location of the # if/ # ifdef/ # ifndef directive.

void Endif(clang::SourceLocation Loc,
           clang::SourceLocation IfLoc)

Description

Hook called whenever an # endif is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:105

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceLocation IfLoc
the source location of the # if/ # ifdef/ # ifndef directive.

void If(clang::SourceLocation Loc,
        clang::SourceRange ConditionRange,
        clang::PPCallbacks::ConditionValueKind
            ConditionValue)

Description

Hook called whenever an # if is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:88

Parameters

clang::SourceLocation Loc
the source location of the directive.
clang::SourceRange ConditionRange
The SourceRange of the expression being tested.
clang::PPCallbacks::ConditionValueKind ConditionValue
The evaluated value of the condition.

void Ifdef(clang::SourceLocation Loc,
           const clang::Token& MacroNameTok,
           const clang::MacroDefinition& MD)

Description

Hook called whenever an # ifdef is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:92

Parameters

clang::SourceLocation Loc
the source location of the directive.
const clang::Token& MacroNameTok
Information on the token being tested.
const clang::MacroDefinition& MD
The MacroDefinition if the name was a macro, null otherwise.

void Ifndef(clang::SourceLocation Loc,
            const clang::Token& MacroNameTok,
            const clang::MacroDefinition& MD)

Description

Hook called whenever an # ifndef is seen.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:94

Parameters

clang::SourceLocation Loc
the source location of the directive.
const clang::Token& MacroNameTok
Information on the token being tested.
const clang::MacroDefinition& MD
The MacroDefiniton if the name was a macro, null otherwise.

PPConditionalDirectiveRecord(
    clang::SourceManager& SM)

Description

Construct a new preprocessing record.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:66

Parameters

clang::SourceManager& SM

void addCondDirectiveLoc(
    clang::PPConditionalDirectiveRecord::
        CondDirectiveLoc DirLoc)

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:62

Parameters

clang::PPConditionalDirectiveRecord:: CondDirectiveLoc DirLoc

bool areInDifferentConditionalDirectiveRegion(
    clang::SourceLocation LHS,
    clang::SourceLocation RHS) const

Description

Returns true if the given locations are in different regions, separated by conditional directive blocks.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:79

Parameters

clang::SourceLocation LHS
clang::SourceLocation RHS

clang::SourceLocation
findConditionalDirectiveRegionLoc(
    clang::SourceLocation Loc) const

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:85

Parameters

clang::SourceLocation Loc

clang::SourceManager& getSourceManager() const

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:70

size_t getTotalMemory() const

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:68

bool rangeIntersectsConditionalDirective(
    clang::SourceRange Range) const

Description

Returns true if the given range intersects with a conditional directive. if a # if/ # endif block is fully contained within the range, this function will return false.

Declared at: clang/include/clang/Lex/PPConditionalDirectiveRecord.h:75

Parameters

clang::SourceRange Range