MozCheckAction.cpp (985B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #include "DiagnosticsMatcher.h" 6 #include "plugin.h" 7 #include "clang/Frontend/FrontendPluginRegistry.h" 8 9 class MozCheckAction : public PluginASTAction { 10 public: 11 ASTConsumerPtr CreateASTConsumer(CompilerInstance &CI, 12 StringRef FileName) override { 13 void *Buffer = CI.getASTContext().Allocate<DiagnosticsMatcher>(); 14 auto Matcher = new (Buffer) DiagnosticsMatcher(CI); 15 return Matcher->makeASTConsumer(); 16 } 17 18 bool ParseArgs(const CompilerInstance &CI, 19 const std::vector<std::string> &Args) override { 20 return true; 21 } 22 }; 23 24 static FrontendPluginRegistry::Add<MozCheckAction> X("moz-check", 25 "check moz action"); 26 27 DenseMap<StringRef, bool> InThirdPartyPathCache;