aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Lex/TokenLexer.cpp
diff options
context:
space:
mode:
authorHarald van Dijk <harald@gigawatt.nl>2021-01-25 22:34:49 +0000
committerHarald van Dijk <harald@gigawatt.nl>2021-01-25 22:34:49 +0000
commitb43c26d036dcbf7a6881f39e4434cf059364022a (patch)
treeec3c8a1bb6541ffea56899a424cd1e3cd4336beb /clang/lib/Lex/TokenLexer.cpp
parent1fba21778f84f266f7d32153c88e59e1900fbe5b (diff)
downloadllvm-b43c26d036dcbf7a6881f39e4434cf059364022a.zip
llvm-b43c26d036dcbf7a6881f39e4434cf059364022a.tar.gz
llvm-b43c26d036dcbf7a6881f39e4434cf059364022a.tar.bz2
Restore GNU , ## __VA_ARGS__ behavior in MSVC mode
As noted in D91913, MSVC implements the GNU behavior for , ## __VA_ARGS__ as well. Do the same when `-fms-compatibility` is used. Reviewed By: rsmith Differential Revision: https://reviews.llvm.org/D95392
Diffstat (limited to 'clang/lib/Lex/TokenLexer.cpp')
-rw-r--r--clang/lib/Lex/TokenLexer.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index 6e962df..97cb2cf 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/lib/Lex/TokenLexer.cpp
@@ -152,7 +152,8 @@ bool TokenLexer::MaybeRemoveCommaBeforeVaArgs(
// named arguments, where it remains. With GNU extensions, it is removed
// regardless of named arguments.
// Microsoft also appears to support this extension, unofficially.
- if (!PP.getLangOpts().GNUMode && Macro->getNumParams() < 2)
+ if (!PP.getLangOpts().GNUMode && !PP.getLangOpts().MSVCCompat &&
+ Macro->getNumParams() < 2)
return false;
// Is a comma available to be removed?