summaryrefslogtreecommitdiff
path: root/include/llvm/Support
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-03-19 04:47:47 +0000
commit6d191534f63b0ece222e2d6e418144b123c81c0c (patch)
tree72a8ca1b42f1f5c47cdeff5a5593c7b2ffcc8d58 /include/llvm/Support
parent92c5a193e0d17f4b70f507ff976aac6a44962041 (diff)
downloadllvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.gz
llvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.bz2
llvm-6d191534f63b0ece222e2d6e418144b123c81c0c.tar.xz
Object: Provide a richer means of describing auxiliary symbols
The current state of affairs has auxiliary symbols described as a big bag of bytes. This is less than satisfying, it detracts from the YAML file as being human readable. Instead, allow for symbols to optionally contain their auxiliary data. This allows us to have a much higher level way of describing things like weak symbols, function definitions and section definitions. This depends on D3105. Differential Revision: http://llvm-reviews.chandlerc.com/D3092 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204214 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support')
-rw-r--r--include/llvm/Support/COFF.h15
-rw-r--r--include/llvm/Support/YAMLTraits.h26
2 files changed, 39 insertions, 2 deletions
diff --git a/include/llvm/Support/COFF.h b/include/llvm/Support/COFF.h
index 5586253309..dca7fc6ee8 100644
--- a/include/llvm/Support/COFF.h
+++ b/include/llvm/Support/COFF.h
@@ -212,6 +212,10 @@ namespace COFF {
SCT_COMPLEX_TYPE_SHIFT = 4
};
+ enum AuxSymbolType {
+ IMAGE_AUX_SYMBOL_TYPE_TOKEN_DEF = 1
+ };
+
struct section {
char Name[NameSize];
uint32_t VirtualSize;
@@ -337,7 +341,7 @@ namespace COFF {
uint32_t TotalSize;
uint32_t PointerToLinenumber;
uint32_t PointerToNextFunction;
- uint8_t unused[2];
+ char unused[2];
};
struct AuxiliarybfAndefSymbol {
@@ -372,7 +376,14 @@ namespace COFF {
uint32_t CheckSum;
uint16_t Number;
uint8_t Selection;
- uint8_t unused[3];
+ char unused[3];
+ };
+
+ struct AuxiliaryCLRToken {
+ uint8_t AuxType;
+ uint8_t unused1;
+ uint32_t SymbolTableIndex;
+ char unused2[12];
};
union Auxiliary {
diff --git a/include/llvm/Support/YAMLTraits.h b/include/llvm/Support/YAMLTraits.h
index e704bf17fe..ea217c39fc 100644
--- a/include/llvm/Support/YAMLTraits.h
+++ b/include/llvm/Support/YAMLTraits.h
@@ -13,6 +13,7 @@
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseMapInfo.h"
+#include "llvm/ADT/Optional.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringMap.h"
#include "llvm/ADT/StringRef.h"
@@ -421,6 +422,11 @@ public:
}
template <typename T>
+ void mapOptional(const char* Key, Optional<T> &Val) {
+ processKeyWithDefault(Key, Val, Optional<T>(), /*Required=*/false);
+ }
+
+ template <typename T>
typename std::enable_if<!has_SequenceTraits<T>::value,void>::type
mapOptional(const char* Key, T& Val) {
this->processKey(Key, Val, false);
@@ -433,6 +439,26 @@ public:
private:
template <typename T>
+ void processKeyWithDefault(const char *Key, Optional<T> &Val,
+ const Optional<T> &DefaultValue, bool Required) {
+ assert(DefaultValue.hasValue() == false &&
+ "Optional<T> shouldn't have a value!");
+ void *SaveInfo;
+ bool UseDefault;
+ const bool sameAsDefault = outputting() && !Val.hasValue();
+ if (!outputting() && !Val.hasValue())
+ Val = T();
+ if (this->preflightKey(Key, Required, sameAsDefault, UseDefault,
+ SaveInfo)) {
+ yamlize(*this, Val.getValue(), Required);
+ this->postflightKey(SaveInfo);
+ } else {
+ if (UseDefault)
+ Val = DefaultValue;
+ }
+ }
+
+ template <typename T>
void processKeyWithDefault(const char *Key, T &Val, const T& DefaultValue,
bool Required) {
void *SaveInfo;