a.sidorin created this revision.
a.sidorin added reviewers: klimek, aaron.ballman.
a.sidorin added a subscriber: cfe-commits.
a.sidorin set the repository for this revision to rL LLVM.

Using re.sub() to replace a sample with '%'s looks strange and causes a format 
string error if a matcher description contains "%s". This patch resolves this 
issue.

Repository:
  rL LLVM

http://reviews.llvm.org/D17376

Files:
  docs/tools/dump_ast_matchers.py

Index: docs/tools/dump_ast_matchers.py
===================================================================
--- docs/tools/dump_ast_matchers.py
+++ docs/tools/dump_ast_matchers.py
@@ -363,11 +363,11 @@
 
 reference = open('../LibASTMatchersReference.html').read()
 reference = re.sub(r'<!-- START_DECL_MATCHERS.*END_DECL_MATCHERS -->',
-                   '%s', reference, flags=re.S) % node_matcher_table
+                   node_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_NARROWING_MATCHERS.*END_NARROWING_MATCHERS 
-->',
-                   '%s', reference, flags=re.S) % narrowing_matcher_table
+                   narrowing_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_TRAVERSAL_MATCHERS.*END_TRAVERSAL_MATCHERS 
-->',
-                   '%s', reference, flags=re.S) % traversal_matcher_table
+                   traversal_matcher_table, reference, flags=re.S)
 
 with open('../LibASTMatchersReference.html', 'wb') as output:
   output.write(reference)


Index: docs/tools/dump_ast_matchers.py
===================================================================
--- docs/tools/dump_ast_matchers.py
+++ docs/tools/dump_ast_matchers.py
@@ -363,11 +363,11 @@
 
 reference = open('../LibASTMatchersReference.html').read()
 reference = re.sub(r'<!-- START_DECL_MATCHERS.*END_DECL_MATCHERS -->',
-                   '%s', reference, flags=re.S) % node_matcher_table
+                   node_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_NARROWING_MATCHERS.*END_NARROWING_MATCHERS -->',
-                   '%s', reference, flags=re.S) % narrowing_matcher_table
+                   narrowing_matcher_table, reference, flags=re.S)
 reference = re.sub(r'<!-- START_TRAVERSAL_MATCHERS.*END_TRAVERSAL_MATCHERS -->',
-                   '%s', reference, flags=re.S) % traversal_matcher_table
+                   traversal_matcher_table, reference, flags=re.S)
 
 with open('../LibASTMatchersReference.html', 'wb') as output:
   output.write(reference)
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to