]> granicus.if.org Git - clang/commitdiff
Attach aritifical attribute with implicit parameters.
authorDevang Patel <dpatel@apple.com>
Wed, 29 Sep 2010 23:09:21 +0000 (23:09 +0000)
committerDevang Patel <dpatel@apple.com>
Wed, 29 Sep 2010 23:09:21 +0000 (23:09 +0000)
Radar 8493141.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@115104 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
test/CodeGenObjC/debug-info-self.m [new file with mode: 0644]

index e2ad3e1b56c0f68a625f0e974e2fe85f9f3bfcdd..45a887b1bbb80770c35908ef288b4b1b76521c95 100644 (file)
@@ -1729,12 +1729,15 @@ void CGDebugInfo::EmitDeclare(const VarDecl *VD, unsigned Tag,
   // Get location information.
   unsigned Line = getLineNumber(VD->getLocation());
   unsigned Column = getColumnNumber(VD->getLocation());
-
+  unsigned Flags = 0;
+  if (VD->isImplicit())
+    Flags |= llvm::DIDescriptor::FlagArtificial;
   // Create the descriptor for the variable.
   llvm::DIVariable D =
     DebugFactory.CreateVariable(Tag, llvm::DIDescriptor(RegionStack.back()),
-                                VD->getName(),
-                                Unit, Line, Ty, CGM.getLangOptions().Optimize);
+                                VD->getName(), Unit, Line, Ty, 
+                                CGM.getLangOptions().Optimize, Flags);
+
   // Insert an llvm.dbg.declare into the current block.
   llvm::Instruction *Call =
     DebugFactory.InsertDeclare(Storage, D, Builder.GetInsertBlock());
diff --git a/test/CodeGenObjC/debug-info-self.m b/test/CodeGenObjC/debug-info-self.m
new file mode 100644 (file)
index 0000000..9146ab3
--- /dev/null
@@ -0,0 +1,16 @@
+// RUN: %clang -fverbose-asm -g -S %s -o - | grep DW_AT_artificial | count 3
+// self and _cmd are marked as DW_AT_artificial. 
+// abbrev code emits another DT_artificial comment.
+// myarg is not marked as DW_AT_artificial.
+
+@interface MyClass {
+}
+- (id)init:(int) myarg;
+@end
+
+@implementation MyClass
+- (id) init:(int) myarg
+{
+    return self;
+}
+@end