r174246 - Basics

David Blaikie dblaikie at gmail.com
Fri Feb 1 16:34:17 PST 2013


Author: dblaikie
Date: Fri Feb  1 18:34:16 2013
New Revision: 174246

URL: http://llvm.org/viewvc/llvm-project?rev=174246&view=rev
Log:
Basics

Modified:
    cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
    cfe/trunk/lib/CodeGen/CGDebugInfo.h
    cfe/trunk/lib/CodeGen/CGDecl.cpp
    cfe/trunk/lib/CodeGen/CodeGenFunction.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=174246&r1=174245&r2=174246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Fri Feb  1 18:34:16 2013
@@ -111,6 +111,9 @@ llvm::DIDescriptor CGDebugInfo::getConte
       return llvm::DIDescriptor(Ty);
     }
   }
+
+  if (!LexicalBlockStack.empty())
+    return llvm::DIDescriptor(LexicalBlockStack.back());
   return TheCU;
 }
 
@@ -2822,6 +2825,12 @@ void CGDebugInfo::EmitGlobalVariable(con
                                 getStaticDataMemberDeclaration(VD));
 }
 
+void CGDebugInfo::EmitUsingDirectiveDecl(const UsingDirectiveDecl &UD) {
+  SourceLocation Loc = UD.getNamespaceKeyLocation();
+  llvm::DIFile Unit = getOrCreateFile(Loc);
+  DBuilder.createUsingDirective(getContextDescriptor(&UD), Unit, getLineNumber(Loc), getOrCreateNameSpace(UD.getNominatedNamespace()));
+}
+
 /// getOrCreateNamesSpace - Return namespace descriptor for the given
 /// namespace decl.
 llvm::DINameSpace 

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=174246&r1=174245&r2=174246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Fri Feb  1 18:34:16 2013
@@ -34,6 +34,7 @@ namespace clang {
   class ObjCInterfaceDecl;
   class ClassTemplateSpecializationDecl;
   class GlobalDecl;
+  class UsingDirectiveDecl;
 
 namespace CodeGen {
   class CodeGenModule;
@@ -247,6 +248,9 @@ public:
   /// EmitGlobalVariable - Emit global variable's debug info.
   void EmitGlobalVariable(const ValueDecl *VD, llvm::Constant *Init);
 
+  /// \brief Emit a C++ using directive.
+  void EmitUsingDirectiveDecl(const UsingDirectiveDecl &UD);
+
   /// getOrCreateRecordType - Emit record type's standalone debug info. 
   llvm::DIType getOrCreateRecordType(QualType Ty, SourceLocation L);
 

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=174246&r1=174245&r2=174246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Fri Feb  1 18:34:16 2013
@@ -78,14 +78,18 @@ void CodeGenFunction::EmitDecl(const Dec
   case Decl::CXXRecord: // struct/union/class X; [C++]
   case Decl::Using:          // using X; [C++]
   case Decl::UsingShadow:
-  case Decl::UsingDirective: // using namespace X; [C++]
   case Decl::NamespaceAlias:
   case Decl::StaticAssert: // static_assert(X, ""); [C++0x]
   case Decl::Label:        // __label__ x;
   case Decl::Import:
     // None of these decls require codegen support.
     return;
-
+  case Decl::UsingDirective: { // using namespace X; [C++]
+    if (CGDebugInfo *DI = getDebugInfo()) {
+      DI->EmitUsingDirectiveDecl(cast<UsingDirectiveDecl>(D));
+    }
+    return;
+  }
   case Decl::Var: {
     const VarDecl &VD = cast<VarDecl>(D);
     assert(VD.isLocalVarDecl() &&

Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=174246&r1=174245&r2=174246&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Fri Feb  1 18:34:16 2013
@@ -191,6 +191,7 @@ void CodeGenFunction::FinishFunction(Sou
   // Emit debug descriptor for function end.
   if (CGDebugInfo *DI = getDebugInfo()) {
     DI->EmitFunctionEnd(Builder);
+    DI->setLocation(EndLoc);
   }
 
   EmitFunctionEpilog(*CurFnInfo);





More information about the cfe-commits mailing list