[PATCH] D24962: [ASTMatchers] Let registerMatcher() take a const char * instead of a StringRef

Martin Böhme via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 27 06:53:54 PDT 2016


mboehme created this revision.
mboehme added a reviewer: klimek.
mboehme added a subscriber: cfe-commits.
Herald added a subscriber: klimek.

r282433 added LLVM_ATTRIBUTE_ALWAYS_INLINE to the StringRef(const char *)
constructor. This causes the size of the stack frame for
RegistryMaps::RegistryMaps() to become excessive when compiling with gcc. This
change avoids inlining the StringRef constructor for every REGISTER_MATCHER
line.

https://reviews.llvm.org/D24962

Files:
  lib/ASTMatchers/Dynamic/Registry.cpp

Index: lib/ASTMatchers/Dynamic/Registry.cpp
===================================================================
--- lib/ASTMatchers/Dynamic/Registry.cpp
+++ lib/ASTMatchers/Dynamic/Registry.cpp
@@ -40,11 +40,11 @@
   const ConstructorMap &constructors() const { return Constructors; }
 
 private:
-  void registerMatcher(StringRef MatcherName, MatcherDescriptor *Callback);
+  void registerMatcher(const char *MatcherName, MatcherDescriptor *Callback);
   ConstructorMap Constructors;
 };
 
-void RegistryMaps::registerMatcher(StringRef MatcherName,
+void RegistryMaps::registerMatcher(const char *MatcherName,
                                    MatcherDescriptor *Callback) {
   assert(Constructors.find(MatcherName) == Constructors.end());
   Constructors[MatcherName] = Callback;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D24962.72647.patch
Type: text/x-patch
Size: 784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160927/dbbf2049/attachment.bin>


More information about the cfe-commits mailing list