diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2012-11-14 02:18:46 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2012-11-14 02:18:46 +0000 |
commit | 4fa4b480270c14dfdcd0dfd4f76938e973082e3b (patch) | |
tree | 45fdb1ce591b3624b6a1c76e10463ba4503f7ba5 /include/clang/Lex/MacroInfo.h | |
parent | 66cff7257698d5528632917d38f9a3037bb1506d (diff) |
Suppress elided variadic macro argument extension diagnostic for macros using
the related comma pasting extension.
In certain cases, we used to get two diagnostics for what is essentially one
extension. This change suppresses the first diagnostic in certain cases
where we know we're going to print the second diagnostic. The
diagnostic is redundant, and it can't be suppressed in the definition
of the macro because it points at the use of the macro, so we want to
avoid printing it if possible.
The implementation works by detecting constructs which look like comma
pasting at the time of the definition of the macro; this information
is then used when the macro is used. (We can't actually detect
whether we're using the comma pasting extension until the macro is
actually used, but we can detecting constructs which will be comma
pasting if the varargs argument is elided.)
<rdar://problem/12292192>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@167907 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Lex/MacroInfo.h')
-rw-r--r-- | include/clang/Lex/MacroInfo.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/clang/Lex/MacroInfo.h b/include/clang/Lex/MacroInfo.h index aba77d580d..aeedd735e3 100644 --- a/include/clang/Lex/MacroInfo.h +++ b/include/clang/Lex/MacroInfo.h @@ -76,6 +76,9 @@ class MacroInfo { /// it has not yet been redefined or undefined. bool IsBuiltinMacro : 1; + /// \brief Whether this macro contains the sequence ", ## __VA_ARGS__" + bool HasCommaPasting : 1; + /// \brief True if this macro was loaded from an AST file. bool IsFromAST : 1; @@ -253,6 +256,9 @@ public: /// __LINE__, which requires processing before expansion. bool isBuiltinMacro() const { return IsBuiltinMacro; } + bool hasCommaPasting() const { return HasCommaPasting; } + void setHasCommaPasting() { HasCommaPasting = true; } + /// isFromAST - Return true if this macro was loaded from an AST file. bool isFromAST() const { return IsFromAST; } |