[llvm-branch-commits] [llvm-gcc-branch] r96547 - /llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp
Devang Patel
dpatel at apple.com
Wed Feb 17 17:05:33 PST 2010
Author: dpatel
Date: Wed Feb 17 19:05:33 2010
New Revision: 96547
URL: http://llvm.org/viewvc/llvm-project?rev=96547&view=rev
Log:
Merge from mainline.
$ svn merge -c 96543 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r96543 into '.':
U gcc/llvm-debug.cpp
Modified:
llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp
Modified: llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp?rev=96547&r1=96546&r2=96547&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-debug.cpp Wed Feb 17 19:05:33 2010
@@ -458,10 +458,13 @@
// Construct variable.
DIScope VarScope = DIScope(cast<MDNode>(RegionStack.back()));
+ DIType Ty = getOrCreateType(type);
+ if (DECL_ARTIFICIAL (decl))
+ Ty = DebugFactory.CreateArtificialType(Ty);
llvm::DIVariable D =
DebugFactory.CreateVariable(Tag, VarScope,
Name, getOrCreateCompileUnit(Loc.file),
- Loc.line, getOrCreateType(type));
+ Loc.line, Ty);
// Insert an llvm.dbg.declare into the current block.
Instruction *Call = DebugFactory.InsertDeclare(AI, D,
@@ -603,6 +606,21 @@
0, 0, Encoding);
}
+/// isArtificialArgumentType - Return true if arg_type represents artificial,
+/// i.e. "this" in c++, argument.
+static bool isArtificialArgumentType(tree arg_type, tree method_type) {
+ if (TREE_CODE (method_type) != METHOD_TYPE) return false;
+ if (TREE_CODE (arg_type) != POINTER_TYPE) return false;
+ if (TREE_TYPE (arg_type) == TYPE_METHOD_BASETYPE (method_type))
+ return true;
+ if (TYPE_MAIN_VARIANT (TREE_TYPE (arg_type))
+ && TYPE_MAIN_VARIANT (TREE_TYPE (arg_type)) != TREE_TYPE (arg_type)
+ && (TYPE_MAIN_VARIANT (TREE_TYPE (arg_type))
+ == TYPE_METHOD_BASETYPE (method_type)))
+ return true;
+ return false;
+}
+
/// createMethodType - Create MethodType.
DIType DebugInfo::createMethodType(tree type) {
@@ -629,18 +647,18 @@
EltTys.push_back(getOrCreateType(TREE_TYPE(type)));
// Set up remainder of arguments.
+ bool ProcessedFirstArg = false;
for (tree arg = TYPE_ARG_TYPES(type); arg; arg = TREE_CHAIN(arg)) {
tree formal_type = TREE_VALUE(arg);
if (formal_type == void_type_node) break;
llvm::DIType FormalType = getOrCreateType(formal_type);
- if (TREE_CODE (type) == METHOD_TYPE
- && TREE_CODE (formal_type) == POINTER_TYPE
- && TREE_TYPE (formal_type) == TYPE_METHOD_BASETYPE (type)) {
+ if (!ProcessedFirstArg && isArtificialArgumentType(formal_type, type)) {
DIType AFormalType = DebugFactory.CreateArtificialType(FormalType);
EltTys.push_back(AFormalType);
- TypeCache[formal_type] = WeakVH(AFormalType.getNode());
} else
EltTys.push_back(FormalType);
+ if (!ProcessedFirstArg)
+ ProcessedFirstArg = true;
}
llvm::DIArray EltTypeArray =
More information about the llvm-branch-commits
mailing list