aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-24 00:05:05 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2013-02-24 00:05:05 +0000
commit82a29af8cbc4b117af83c5c5dfa875b5699c97c4 (patch)
treeb74e951c269ad42e9d689fc9e8190527ce73a5ea
parentafda905e60151f0bc34c187d51a798b4265f69af (diff)
Add comments for the MacroDirective & MacroInfo classes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175977 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Lex/MacroInfo.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h
index 80b66e4a26..8970dbd2ec 100644
--- a/include/clang/Lex/MacroInfo.h
+++ b/include/clang/Lex/MacroInfo.h
@@ -22,8 +22,8 @@
namespace clang {
class Preprocessor;
-/// MacroInfo - Each identifier that is \#define'd has an instance of this class
-/// associated with it, used to implement macro expansion.
+/// \brief Encapsulates the data about a macro definition (e.g. its tokens).
+/// There's an instance of this class for every #define.
class MacroInfo {
//===--------------------------------------------------------------------===//
// State set when the macro is defined.
@@ -262,6 +262,20 @@ private:
unsigned getDefinitionLengthSlow(SourceManager &SM) const;
};
+/// \brief Encapsulates changes to the "macros namespace" (the location where
+/// the macro name became active, the location where it was undefined, etc.).
+///
+/// MacroDirectives, associated with an identifier, are used to model the macro
+/// history. Usually a macro definition (MacroInfo) is where a macro name
+/// becomes active (MacroDirective) but modules can have their own macro
+/// history, separate from the local (current translation unit) macro history.
+///
+/// For example, if "@import A;" imports macro FOO, there will be a new local
+/// MacroDirective created to indicate that "FOO" became active at the import
+/// location. Module "A" itself will contain another MacroDirective in its macro
+/// history (at the point of the definition of FOO) and both MacroDirectives
+/// will point to the same MacroInfo object.
+///
class MacroDirective {
MacroInfo *Info;
@@ -323,6 +337,7 @@ public:
UndefLocation = UndefLoc;
}
+ /// \brief The data for the macro definition.
const MacroInfo *getInfo() const { return Info; }
MacroInfo *getInfo() { return Info; }