diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2017-01-11 13:40:15 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2017-01-11 13:42:40 +0100 |
commit | 6ec5717e06007c540474d91ec99345fb5edc47a8 (patch) | |
tree | 3f46ffbca13590190af628a2a4cbdb04ed525de5 /compilerplugins | |
parent | 2597a2f1ada7738efc539b68b1ba164c342a72eb (diff) |
loplugin:externvar (clang-cl)
Change-Id: I638199f1455bead71f0a03f15e4b6f418a0cd0e2
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/externvar.cxx | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/compilerplugins/clang/externvar.cxx b/compilerplugins/clang/externvar.cxx index 9569a3de37d2..b9b5648258f4 100644 --- a/compilerplugins/clang/externvar.cxx +++ b/compilerplugins/clang/externvar.cxx @@ -8,6 +8,7 @@ */ #include "check.hxx" +#include "compat.hxx" #include "plugin.hxx" // Find variable declarations at namespace scope that need not have external @@ -72,6 +73,14 @@ public: // not needed and will not be emitted" return true; } + SourceLocation argLoc; + if (compat::isMacroArgExpansion(compiler, def->getLocation(), &argLoc) + && (Lexer::getImmediateMacroName( + argLoc, compiler.getSourceManager(), compiler.getLangOpts()) + == "DEFINE_GUID")) + { + return true; + } report( DiagnosticsEngine::Warning, "variable with external linkage not declared in an include file", |