diff options
author | Nate Begeman <natebegeman@mac.com> | 2007-01-29 21:20:42 +0000 |
---|---|---|
committer | Nate Begeman <natebegeman@mac.com> | 2007-01-29 21:20:42 +0000 |
commit | 1257c855d7546afc2705463d9ca913d405724738 (patch) | |
tree | a9e66a989b14c4a5ba89ed2d4cbec0b736563700 /include | |
parent | 1b340dc8e20dc1ce204ebdcc2ff11c3dd36888f1 (diff) | |
download | llvm-1257c855d7546afc2705463d9ca913d405724738.tar.gz llvm-1257c855d7546afc2705463d9ca913d405724738.tar.bz2 llvm-1257c855d7546afc2705463d9ca913d405724738.tar.xz |
Properly support cstrings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33629 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/CodeGen/MachOWriter.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/include/llvm/CodeGen/MachOWriter.h b/include/llvm/CodeGen/MachOWriter.h index 0d13c909a9..0de04c0407 100644 --- a/include/llvm/CodeGen/MachOWriter.h +++ b/include/llvm/CodeGen/MachOWriter.h @@ -14,6 +14,7 @@ #ifndef LLVM_CODEGEN_MACHOWRITER_H #define LLVM_CODEGEN_MACHOWRITER_H +#include "llvm/Constants.h" #include "llvm/DerivedTypes.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/MachineRelocation.h" @@ -486,8 +487,13 @@ namespace llvm { MachOSection *getDataSection() { return getSection("__DATA", "__data"); } - MachOSection *getConstSection(const Type *Ty) { - // FIXME: support cstring literals and pointer literal + MachOSection *getConstSection(Constant *C) { + const ConstantArray *CVA = dyn_cast<ConstantArray>(C); + if (CVA && CVA->isCString()) + return getSection("__TEXT", "__cstring", + MachOSection::S_CSTRING_LITERALS); + + const Type *Ty = C->getType(); if (Ty->isPrimitiveType() || Ty->isInteger()) { unsigned Size = TM.getTargetData()->getTypeSize(Ty); switch(Size) { |