]> granicus.if.org Git - clang/commitdiff
Emit debug info for objc getters and setters.
authorDevang Patel <dpatel@apple.com>
Mon, 5 Apr 2010 21:09:15 +0000 (21:09 +0000)
committerDevang Patel <dpatel@apple.com>
Mon, 5 Apr 2010 21:09:15 +0000 (21:09 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100462 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CGDebugInfo.cpp
lib/CodeGen/CGObjC.cpp
test/CodeGenObjC/property-dbg.m [new file with mode: 0644]

index 4f14f94388fc2a5256413828c43647ff743914d4..bcbda8a0a747b1e979c48e716a233a17a83b85a2 100644 (file)
@@ -1380,7 +1380,9 @@ void CGDebugInfo::EmitStopPoint(llvm::Function *Fn, CGBuilderTy &Builder) {
        || (SM.getInstantiationLineNumber(CurLoc) ==
            SM.getInstantiationLineNumber(PrevLoc)
            && SM.isFromSameFile(CurLoc, PrevLoc)))
-    return;
+    // New Builder may not be in sync with CGDebugInfo.
+    if (!Builder.getCurrentDebugLocation().isUnknown())
+      return;
 
   // Update last state.
   PrevLoc = CurLoc;
index 9eaf57c445edc3795a0782dc13b5210a74a47399..206d438ced676811292411e6fb0c585c833e89ce 100644 (file)
@@ -108,6 +108,10 @@ RValue CodeGenFunction::EmitObjCMessageExpr(const ObjCMessageExpr *E) {
 void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD,
                                       const ObjCContainerDecl *CD) {
   FunctionArgList Args;
+  // Check if we should generate debug info for this method.
+  if (CGM.getDebugInfo() && !OMD->hasAttr<NoDebugAttr>())
+    DebugInfo = CGM.getDebugInfo();
+
   llvm::Function *Fn = CGM.getObjCRuntime().GenerateMethod(OMD, CD);
 
   const CGFunctionInfo &FI = CGM.getTypes().getFunctionInfo(OMD);
@@ -128,9 +132,6 @@ void CodeGenFunction::StartObjCMethod(const ObjCMethodDecl *OMD,
 /// Generate an Objective-C method.  An Objective-C method is a C function with
 /// its pointer, name, and types registered in the class struture.
 void CodeGenFunction::GenerateObjCMethod(const ObjCMethodDecl *OMD) {
-  // Check if we should generate debug info for this method.
-  if (CGM.getDebugInfo() && !OMD->hasAttr<NoDebugAttr>())
-    DebugInfo = CGM.getDebugInfo();
   StartObjCMethod(OMD, OMD->getClassInterface());
   EmitStmt(OMD->getBody());
   FinishFunction(OMD->getBodyRBrace());
diff --git a/test/CodeGenObjC/property-dbg.m b/test/CodeGenObjC/property-dbg.m
new file mode 100644 (file)
index 0000000..5bbb046
--- /dev/null
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -S -g -masm-verbose -x objective-c < %s | grep setI | grep DW_AT_name
+@interface Foo {
+  int i;
+}
+@property int i;
+@end
+
+@implementation Foo
+@synthesize i;
+@end
+
+int bar(Foo *f) {
+  int i = 1;
+  f.i = 2;
+  i = f.i;
+  return i;
+}