[lld] r274112 - Move isValidCIdentifier to Strings.cpp.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 29 02:08:04 PDT 2016
Author: ruiu
Date: Wed Jun 29 04:08:02 2016
New Revision: 274112
URL: http://llvm.org/viewvc/llvm-project?rev=274112&view=rev
Log:
Move isValidCIdentifier to Strings.cpp.
Modified:
lld/trunk/ELF/OutputSections.cpp
lld/trunk/ELF/Strings.cpp
lld/trunk/ELF/Strings.h
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/OutputSections.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/OutputSections.cpp?rev=274112&r1=274111&r2=274112&view=diff
==============================================================================
--- lld/trunk/ELF/OutputSections.cpp (original)
+++ lld/trunk/ELF/OutputSections.cpp Wed Jun 29 04:08:02 2016
@@ -11,6 +11,7 @@
#include "Config.h"
#include "EhFrame.h"
#include "LinkerScript.h"
+#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"
#include "lld/Core/Parallel.h"
@@ -29,18 +30,6 @@ using namespace llvm::ELF;
using namespace lld;
using namespace lld::elf;
-static bool isAlpha(char C) {
- return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z') || C == '_';
-}
-
-static bool isAlnum(char C) { return isAlpha(C) || ('0' <= C && C <= '9'); }
-
-// Returns true if S is valid as a C language identifier.
-bool elf::isValidCIdentifier(StringRef S) {
- return !S.empty() && isAlpha(S[0]) &&
- std::all_of(S.begin() + 1, S.end(), isAlnum);
-}
-
template <class ELFT>
OutputSectionBase<ELFT>::OutputSectionBase(StringRef Name, uint32_t Type,
uintX_t Flags)
Modified: lld/trunk/ELF/Strings.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Strings.cpp?rev=274112&r1=274111&r2=274112&view=diff
==============================================================================
--- lld/trunk/ELF/Strings.cpp (original)
+++ lld/trunk/ELF/Strings.cpp Wed Jun 29 04:08:02 2016
@@ -11,6 +11,7 @@
#include "Error.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
+#include <algorithm>
using namespace llvm;
using namespace lld;
@@ -55,3 +56,15 @@ std::vector<uint8_t> elf::parseHex(Strin
}
return Hex;
}
+
+static bool isAlpha(char C) {
+ return ('a' <= C && C <= 'z') || ('A' <= C && C <= 'Z') || C == '_';
+}
+
+static bool isAlnum(char C) { return isAlpha(C) || ('0' <= C && C <= '9'); }
+
+// Returns true if S is valid as a C language identifier.
+bool elf::isValidCIdentifier(StringRef S) {
+ return !S.empty() && isAlpha(S[0]) &&
+ std::all_of(S.begin() + 1, S.end(), isAlnum);
+}
Modified: lld/trunk/ELF/Strings.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Strings.h?rev=274112&r1=274111&r2=274112&view=diff
==============================================================================
--- lld/trunk/ELF/Strings.h (original)
+++ lld/trunk/ELF/Strings.h Wed Jun 29 04:08:02 2016
@@ -17,6 +17,7 @@ namespace lld {
namespace elf {
bool globMatch(StringRef S, StringRef T);
std::vector<uint8_t> parseHex(StringRef S);
+bool isValidCIdentifier(StringRef S);
}
}
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=274112&r1=274111&r2=274112&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Wed Jun 29 04:08:02 2016
@@ -12,6 +12,7 @@
#include "LinkerScript.h"
#include "OutputSections.h"
#include "Relocations.h"
+#include "Strings.h"
#include "SymbolTable.h"
#include "Target.h"
More information about the llvm-commits
mailing list