summaryrefslogtreecommitdiffstats
path: root/clang/include/clang/Parse
diff options
context:
space:
mode:
Diffstat (limited to 'clang/include/clang/Parse')
-rw-r--r--clang/include/clang/Parse/Action.h12
-rw-r--r--clang/include/clang/Parse/Parser.h18
2 files changed, 30 insertions, 0 deletions
diff --git a/clang/include/clang/Parse/Action.h b/clang/include/clang/Parse/Action.h
index ba480c5b7c4..47583993bc2 100644
--- a/clang/include/clang/Parse/Action.h
+++ b/clang/include/clang/Parse/Action.h
@@ -637,6 +637,18 @@ public:
// Expression Parsing Callbacks.
//===--------------------------------------------------------------------===//
+ /// \brief Notifies the action when the parser is processing an unevaluated
+ /// operand.
+ ///
+ /// \param UnevaluatedOperand true to indicate that the parser is processing
+ /// an unevaluated operand, or false otherwise.
+ ///
+ /// \returns whether the the action module was previously in an unevaluated
+ /// operand.
+ virtual bool setUnevaluatedOperand(bool UnevaluatedOperand) {
+ return false;
+ }
+
// Primary Expressions.
/// \brief Retrieve the source range that corresponds to the given
diff --git a/clang/include/clang/Parse/Parser.h b/clang/include/clang/Parse/Parser.h
index d613ae13293..75458d821e8 100644
--- a/clang/include/clang/Parse/Parser.h
+++ b/clang/include/clang/Parse/Parser.h
@@ -105,6 +105,24 @@ class Parser {
}
};
+ /// \brief RAII object that enters an unevaluated operand.
+ class EnterUnevaluatedOperand {
+ /// \brief The action object.
+ Action &Actions;
+
+ /// \brief Whether we were previously within an unevaluated operand.
+ bool PreviouslyInUnevaluatedOperand;
+
+ public:
+ explicit EnterUnevaluatedOperand(Action &Actions) : Actions(Actions) {
+ PreviouslyInUnevaluatedOperand = Actions.setUnevaluatedOperand(true);
+ }
+
+ ~EnterUnevaluatedOperand() {
+ Actions.setUnevaluatedOperand(PreviouslyInUnevaluatedOperand);
+ }
+ };
+
public:
Parser(Preprocessor &PP, Action &Actions);
~Parser();
OpenPOWER on IntegriCloud