r212767 - Be more specific about return types of some methods.
Alexey Samsonov
vonosmas at gmail.com
Thu Jul 10 15:18:36 PDT 2014
Author: samsonov
Date: Thu Jul 10 17:18:36 2014
New Revision: 212767
URL: http://llvm.org/viewvc/llvm-project?rev=212767&view=rev
Log:
Be more specific about return types of some methods.
This would allow to call addCompilerUsedGlobal on some
Clang-generated globals.
Modified:
cfe/trunk/lib/CodeGen/CodeGenModule.cpp
cfe/trunk/lib/CodeGen/CodeGenModule.h
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=212767&r1=212766&r2=212767&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Thu Jul 10 17:18:36 2014
@@ -2770,7 +2770,7 @@ GenerateStringLiteral(llvm::Constant *C,
/// GetAddrOfConstantStringFromLiteral - Return a pointer to a
/// constant array for the given string literal.
-llvm::Constant *
+llvm::GlobalVariable *
CodeGenModule::GetAddrOfConstantStringFromLiteral(const StringLiteral *S) {
auto Alignment =
getContext().getAlignOfGlobalVarInChars(S->getType()).getQuantity();
@@ -2816,7 +2816,7 @@ CodeGenModule::GetAddrOfConstantStringFr
/// GetAddrOfConstantStringFromObjCEncode - Return a pointer to a constant
/// array for the given ObjCEncodeExpr node.
-llvm::Constant *
+llvm::GlobalVariable *
CodeGenModule::GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *E) {
std::string Str;
getContext().getObjCEncodingForType(E->getEncodedType(), Str);
@@ -2847,9 +2847,8 @@ llvm::StringMapEntry<llvm::GlobalVariabl
/// GetAddrOfConstantCString - Returns a pointer to a character array containing
/// the literal and a terminating '\0' character.
/// The result has pointer to array type.
-llvm::Constant *CodeGenModule::GetAddrOfConstantCString(const std::string &Str,
- const char *GlobalName,
- unsigned Alignment) {
+llvm::GlobalVariable *CodeGenModule::GetAddrOfConstantCString(
+ const std::string &Str, const char *GlobalName, unsigned Alignment) {
StringRef StrWithNull(Str.c_str(), Str.size() + 1);
if (Alignment == 0) {
Alignment = getContext()
Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=212767&r1=212766&r2=212767&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Thu Jul 10 17:18:36 2014
@@ -760,19 +760,22 @@ public:
llvm::Constant *GetConstantArrayFromStringLiteral(const StringLiteral *E);
/// Return a pointer to a constant array for the given string literal.
- llvm::Constant *GetAddrOfConstantStringFromLiteral(const StringLiteral *S);
+ llvm::GlobalVariable *
+ GetAddrOfConstantStringFromLiteral(const StringLiteral *S);
/// Return a pointer to a constant array for the given ObjCEncodeExpr node.
- llvm::Constant *GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *);
+ llvm::GlobalVariable *
+ GetAddrOfConstantStringFromObjCEncode(const ObjCEncodeExpr *);
/// Returns a pointer to a character array containing the literal and a
/// terminating '\0' character. The result has pointer to array type.
///
/// \param GlobalName If provided, the name to use for the global (if one is
/// created).
- llvm::Constant *GetAddrOfConstantCString(const std::string &str,
- const char *GlobalName = nullptr,
- unsigned Alignment = 0);
+ llvm::GlobalVariable *
+ GetAddrOfConstantCString(const std::string &Str,
+ const char *GlobalName = nullptr,
+ unsigned Alignment = 0);
/// Returns a pointer to a constant global variable for the given file-scope
/// compound literal expression.
More information about the cfe-commits
mailing list