congliu updated this revision to Diff 43007. congliu added a comment. Replaced namespace with module; Removed extra space after module at line 103
http://reviews.llvm.org/D15571 Files: clang-tidy/add_new_check.py Index: clang-tidy/add_new_check.py =================================================================== --- clang-tidy/add_new_check.py +++ clang-tidy/add_new_check.py @@ -73,6 +73,7 @@ namespace clang { namespace tidy { +namespace %(module)s { /// FIXME: Write a short description. /// @@ -86,18 +87,20 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace %(module)s } // namespace tidy } // namespace clang #endif // %(header_guard)s """ % {'header_guard': header_guard, 'check_name': check_name_camel, - 'check_name_dashes': check_name_dashes}) + 'check_name_dashes': check_name_dashes, + 'module': module}) # Adds the implementation of the new check. -def write_implementation(module_path, check_name_camel): +def write_implementation(module_path, module, check_name_camel): filename = os.path.join(module_path, check_name_camel) + '.cpp' print('Creating %s...' % filename) with open(filename, 'wb') as f: @@ -123,6 +126,7 @@ namespace clang { namespace tidy { +namespace %(module)s { void %(check_name)s::registerMatchers(MatchFinder *Finder) { // FIXME: Add matchers. @@ -139,10 +143,12 @@ << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_"); } +} // namespace %(module)s } // namespace tidy } // namespace clang -""" % {'check_name': check_name_camel}) +""" % {'check_name': check_name_camel, + 'module': module}) # Modifies the module to include the new check. @@ -261,7 +267,7 @@ if not adapt_cmake(module_path, check_name_camel): return write_header(module_path, module, check_name, check_name_camel) - write_implementation(module_path, check_name_camel) + write_implementation(module_path, module, check_name_camel) adapt_module(module_path, module, check_name, check_name_camel) write_test(module_path, module, check_name) write_docs(module_path, module, check_name)
Index: clang-tidy/add_new_check.py =================================================================== --- clang-tidy/add_new_check.py +++ clang-tidy/add_new_check.py @@ -73,6 +73,7 @@ namespace clang { namespace tidy { +namespace %(module)s { /// FIXME: Write a short description. /// @@ -86,18 +87,20 @@ void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; +} // namespace %(module)s } // namespace tidy } // namespace clang #endif // %(header_guard)s """ % {'header_guard': header_guard, 'check_name': check_name_camel, - 'check_name_dashes': check_name_dashes}) + 'check_name_dashes': check_name_dashes, + 'module': module}) # Adds the implementation of the new check. -def write_implementation(module_path, check_name_camel): +def write_implementation(module_path, module, check_name_camel): filename = os.path.join(module_path, check_name_camel) + '.cpp' print('Creating %s...' % filename) with open(filename, 'wb') as f: @@ -123,6 +126,7 @@ namespace clang { namespace tidy { +namespace %(module)s { void %(check_name)s::registerMatchers(MatchFinder *Finder) { // FIXME: Add matchers. @@ -139,10 +143,12 @@ << FixItHint::CreateInsertion(MatchedDecl->getLocation(), "awesome_"); } +} // namespace %(module)s } // namespace tidy } // namespace clang -""" % {'check_name': check_name_camel}) +""" % {'check_name': check_name_camel, + 'module': module}) # Modifies the module to include the new check. @@ -261,7 +267,7 @@ if not adapt_cmake(module_path, check_name_camel): return write_header(module_path, module, check_name, check_name_camel) - write_implementation(module_path, check_name_camel) + write_implementation(module_path, module, check_name_camel) adapt_module(module_path, module, check_name, check_name_camel) write_test(module_path, module, check_name) write_docs(module_path, module, check_name)
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits