[PATCH] D83402: ParsedAttrInfo: Change spelling to use StringRef instead of const char*
Marco Biasini via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 8 08:55:37 PDT 2020
biasmv created this revision.
biasmv added reviewers: aaron.ballman, nikic.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.
Store available spellings for attributes as a StringRef instead of a naked const char*. On my machine, this seems to be slightly beneficial for compile times on CTMark. Compilations were executed 10x with and without the change
Program const char* StringRef diff
CTMark/sqlite3/sqlite3.test 0.91 0.90 -0.7%
typeset/consumer-typeset.test 2.79 2.77 -0.5%
CTMark/ClamAV/clamscan.test 3.86 3.85 -0.3%
TMark/mafft/pairlocalalign.test 1.47 1.46 -0.2%
CTMark/Bullet/bullet.test 21.75 21.73 -0.1%
ark/tramp3d-v4/tramp3d-v4.test 18.17 18.19 0.1%
CTMark/SPASS/SPASS.test 3.55 3.55 -0.1%
CTMark/lencod/lencod.test 2.80 2.80 -0.1%
TMark/7zip/7zip-benchmark.test 31.91 31.94 0.1%
CTMark/kimwitu++/kc.test 11.45 11.45 -0.1%
Geomean difference -0.2%
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D83402
Files:
clang/include/clang/Sema/ParsedAttr.h
Index: clang/include/clang/Sema/ParsedAttr.h
===================================================================
--- clang/include/clang/Sema/ParsedAttr.h
+++ clang/include/clang/Sema/ParsedAttr.h
@@ -21,6 +21,7 @@
#include "clang/Sema/Ownership.h"
#include "llvm/ADT/PointerUnion.h"
#include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/TinyPtrVector.h"
#include "llvm/Support/Allocator.h"
#include "llvm/Support/Registry.h"
@@ -63,7 +64,7 @@
/// The syntaxes supported by this attribute and how they're spelled.
struct Spelling {
AttributeCommonInfo::Syntax Syntax;
- const char *NormalizedFullName;
+ llvm::StringRef NormalizedFullName;
};
ArrayRef<Spelling> Spellings;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83402.276449.patch
Type: text/x-patch
Size: 736 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200708/e3abe781/attachment.bin>
More information about the cfe-commits
mailing list