[llvm] r177547 - DIBuilder: allow linkage name to be specified for global variables
David Blaikie
dblaikie at gmail.com
Wed Mar 20 10:49:49 PDT 2013
Author: dblaikie
Date: Wed Mar 20 12:49:48 2013
New Revision: 177547
URL: http://llvm.org/viewvc/llvm-project?rev=177547&view=rev
Log:
DIBuilder: allow linkage name to be specified for global variables
Patch by Kai Nacke (kai at redstar.de)
Modified:
llvm/trunk/include/llvm/DIBuilder.h
llvm/trunk/lib/IR/DIBuilder.cpp
Modified: llvm/trunk/include/llvm/DIBuilder.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DIBuilder.h?rev=177547&r1=177546&r2=177547&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DIBuilder.h (original)
+++ llvm/trunk/include/llvm/DIBuilder.h Wed Mar 20 12:49:48 2013
@@ -407,6 +407,19 @@ namespace llvm {
createGlobalVariable(StringRef Name, DIFile File, unsigned LineNo,
DIType Ty, bool isLocalToUnit, llvm::Value *Val);
+ /// \brief Create a new descriptor for the specified global.
+ /// @param Name Name of the variable.
+ /// @param LinkageName Mangled variable name.
+ /// @param File File where this variable is defined.
+ /// @param LineNo Line number.
+ /// @param Ty Variable Type.
+ /// @param isLocalToUnit Boolean flag indicate whether this variable is
+ /// externally visible or not.
+ /// @param Val llvm::Value of the variable.
+ DIGlobalVariable
+ createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile File,
+ unsigned LineNo, DIType Ty, bool isLocalToUnit,
+ llvm::Value *Val);
/// createStaticVariable - Create a new descriptor for the specified
/// variable.
Modified: llvm/trunk/lib/IR/DIBuilder.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DIBuilder.cpp?rev=177547&r1=177546&r2=177547&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DIBuilder.cpp (original)
+++ llvm/trunk/lib/IR/DIBuilder.cpp Wed Mar 20 12:49:48 2013
@@ -773,17 +773,18 @@ DISubrange DIBuilder::getOrCreateSubrang
return DISubrange(MDNode::get(VMContext, Elts));
}
-/// createGlobalVariable - Create a new descriptor for the specified global.
+/// \brief Create a new descriptor for the specified global.
DIGlobalVariable DIBuilder::
-createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber,
- DIType Ty, bool isLocalToUnit, Value *Val) {
+createGlobalVariable(StringRef Name, StringRef LinkageName, DIFile F,
+ unsigned LineNumber, DIType Ty, bool isLocalToUnit,
+ Value *Val) {
Value *Elts[] = {
GetTagConstant(VMContext, dwarf::DW_TAG_variable),
Constant::getNullValue(Type::getInt32Ty(VMContext)),
NULL, // TheCU,
MDString::get(VMContext, Name),
MDString::get(VMContext, Name),
- MDString::get(VMContext, Name),
+ MDString::get(VMContext, LinkageName),
F,
ConstantInt::get(Type::getInt32Ty(VMContext), LineNumber),
Ty,
@@ -797,6 +798,14 @@ createGlobalVariable(StringRef Name, DIF
return DIGlobalVariable(Node);
}
+/// \brief Create a new descriptor for the specified global.
+DIGlobalVariable DIBuilder::
+createGlobalVariable(StringRef Name, DIFile F, unsigned LineNumber,
+ DIType Ty, bool isLocalToUnit, Value *Val) {
+ return createGlobalVariable(Name, Name, F, LineNumber, Ty, isLocalToUnit,
+ Val);
+}
+
/// createStaticVariable - Create a new descriptor for the specified static
/// variable.
DIGlobalVariable DIBuilder::
More information about the llvm-commits
mailing list