summaryrefslogtreecommitdiffstats
path: root/clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-05-17 17:26:02 +0000
committerVedant Kumar <vsk@apple.com>2016-05-17 17:26:02 +0000
commit5119923cdd7c2340ce669e57bf67cb7ac79724ac (patch)
tree4afa65b132d77d56f2ae0e553997144258b10d53 /clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp
parent1c0f0b242da706ee4b31b5107273476358895049 (diff)
downloadbcm5719-llvm-5119923cdd7c2340ce669e57bf67cb7ac79724ac.tar.gz
bcm5719-llvm-5119923cdd7c2340ce669e57bf67cb7ac79724ac.zip
[clang-tidy] Skip misc-macro-parentheses for namespaces (Fix PR27400)
If a use of a macro argument is preceded by the `namespace` keyword, do not warn that the use should be wrapped in parentheses. Patch by Mads Ravn! llvm-svn: 269786
Diffstat (limited to 'clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp b/clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp
index 4b3e1ca688e..590bc4d8138 100644
--- a/clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/misc/MacroParenthesesCheck.cpp
@@ -184,6 +184,10 @@ void MacroParenthesesPPCallbacks::argument(const Token &MacroNameTok,
Next.isOneOf(tok::comma, tok::greater))
continue;
+ // Namespaces.
+ if (Prev.is(tok::kw_namespace))
+ continue;
+
Check->diag(Tok.getLocation(), "macro argument should be enclosed in "
"parentheses")
<< FixItHint::CreateInsertion(Tok.getLocation(), "(")
OpenPOWER on IntegriCloud