[Lldb-commits] [lldb] r143000 - in /lldb/trunk: include/lldb/Symbol/VerifyDecl.h lldb.xcodeproj/project.pbxproj source/Symbol/ClangASTContext.cpp source/Symbol/VerifyDecl.cpp

Sean Callanan scallanan at apple.com
Tue Oct 25 18:06:27 PDT 2011


Author: spyffe
Date: Tue Oct 25 20:06:27 2011
New Revision: 143000

URL: http://llvm.org/viewvc/llvm-project?rev=143000&view=rev
Log:
Added VerifyDecl, a function that, when LLDB is
linked against a debug LLVM, runs a variety of
functions -- currently just one -- that verify
that the Decls we create are valid.

ClangASTContext now calls this verifier whenever
it adds a Decl to a DeclContext, and the verifier
checks that the AccessSpecifier is sane.

Added:
    lldb/trunk/include/lldb/Symbol/VerifyDecl.h
    lldb/trunk/source/Symbol/VerifyDecl.cpp
Modified:
    lldb/trunk/lldb.xcodeproj/project.pbxproj
    lldb/trunk/source/Symbol/ClangASTContext.cpp

Added: lldb/trunk/include/lldb/Symbol/VerifyDecl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/VerifyDecl.h?rev=143000&view=auto
==============================================================================
--- lldb/trunk/include/lldb/Symbol/VerifyDecl.h (added)
+++ lldb/trunk/include/lldb/Symbol/VerifyDecl.h Tue Oct 25 20:06:27 2011
@@ -0,0 +1,23 @@
+//===-- VerifyDecl.h --------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef lldb_VariableList_h_
+#define lldb_VariableList_h_
+
+namespace clang
+{
+    class Decl;
+}
+
+namespace lldb_private
+{
+    void VerifyDecl (clang::Decl *decl);
+}
+
+#endif

Modified: lldb/trunk/lldb.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/lldb.xcodeproj/project.pbxproj?rev=143000&r1=142999&r2=143000&view=diff
==============================================================================
--- lldb/trunk/lldb.xcodeproj/project.pbxproj (original)
+++ lldb/trunk/lldb.xcodeproj/project.pbxproj Tue Oct 25 20:06:27 2011
@@ -398,6 +398,7 @@
 		26F5C37510F3F61B009D5894 /* libobjc.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C37410F3F61B009D5894 /* libobjc.dylib */; };
 		26F5C39110F3FA26009D5894 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 26F5C39010F3FA26009D5894 /* CoreFoundation.framework */; };
 		26F73062139D8FDB00FD51C7 /* History.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26F73061139D8FDB00FD51C7 /* History.cpp */; };
+		494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 494260D914579144003C1C78 /* VerifyDecl.cpp */; };
 		496B015B1406DEB100F830D5 /* IRInterpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = 496B015A1406DEB100F830D5 /* IRInterpreter.h */; };
 		49A1CAC51430E8DE00306AC9 /* ExpressionSourceCode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49A1CAC31430E8BD00306AC9 /* ExpressionSourceCode.cpp */; };
 		49A71FE7141FFA5C00D59478 /* IRInterpreter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 496B01581406DE8900F830D5 /* IRInterpreter.cpp */; };
@@ -1153,6 +1154,8 @@
 		491193501226386000578B7F /* ASTStructExtractor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ASTStructExtractor.cpp; path = source/Expression/ASTStructExtractor.cpp; sourceTree = "<group>"; };
 		49307AAD11DEA4D90081F992 /* IRForTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IRForTarget.cpp; path = source/Expression/IRForTarget.cpp; sourceTree = "<group>"; };
 		49307AB111DEA4F20081F992 /* IRForTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRForTarget.h; path = include/lldb/Expression/IRForTarget.h; sourceTree = "<group>"; };
+		494260D7145790D5003C1C78 /* VerifyDecl.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = VerifyDecl.h; path = include/lldb/Symbol/VerifyDecl.h; sourceTree = "<group>"; };
+		494260D914579144003C1C78 /* VerifyDecl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = VerifyDecl.cpp; path = source/Symbol/VerifyDecl.cpp; sourceTree = "<group>"; };
 		49445C2512245E3600C11A81 /* ClangExpressionParser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangExpressionParser.cpp; path = source/Expression/ClangExpressionParser.cpp; sourceTree = "<group>"; };
 		49445C2912245E5500C11A81 /* ClangExpressionParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangExpressionParser.h; path = include/lldb/Expression/ClangExpressionParser.h; sourceTree = "<group>"; };
 		49445E341225AB6A00C11A81 /* ClangUserExpression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangUserExpression.h; path = include/lldb/Expression/ClangUserExpression.h; sourceTree = "<group>"; };
@@ -2266,6 +2269,8 @@
 				26BC7F2210F1B8EC00F91463 /* Variable.cpp */,
 				26BC7C6810F1B6E900F91463 /* VariableList.h */,
 				26BC7F2310F1B8EC00F91463 /* VariableList.cpp */,
+				494260D7145790D5003C1C78 /* VerifyDecl.h */,
+				494260D914579144003C1C78 /* VerifyDecl.cpp */,
 			);
 			name = Symbol;
 			sourceTree = "<group>";
@@ -3505,6 +3510,7 @@
 				49A71FE8141FFACF00D59478 /* DataEncoder.cpp in Sources */,
 				B207C4931429607D00F36E4E /* CommandObjectWatchpoint.cpp in Sources */,
 				49A1CAC51430E8DE00306AC9 /* ExpressionSourceCode.cpp in Sources */,
+				494260DA14579144003C1C78 /* VerifyDecl.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: lldb/trunk/source/Symbol/ClangASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTContext.cpp?rev=143000&r1=142999&r2=143000&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTContext.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTContext.cpp Tue Oct 25 20:06:27 2011
@@ -61,6 +61,7 @@
 #include "lldb/Core/Log.h"
 #include "lldb/Core/RegularExpression.h"
 #include "lldb/Expression/ASTDumper.h"
+#include "lldb/Symbol/VerifyDecl.h"
 #include "lldb/Target/ExecutionContext.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Target/ObjCLanguageRuntime.h"
@@ -1182,7 +1183,13 @@
                                                      NULL);
     
     if (class_template_decl)
+    {
         decl_ctx->addDecl (class_template_decl);
+        
+#ifdef LLDB_CONFIGURATION_DEBUG
+        VerifyDecl(class_template_decl);
+#endif
+    }
 
     return class_template_decl;
 }
@@ -1691,6 +1698,10 @@
     cxx_method_decl->setParams (ArrayRef<ParmVarDecl*>(params));
     
     cxx_record_decl->addDecl (cxx_method_decl);
+    
+#ifdef LLDB_CONFIGURATION_DEBUG
+    VerifyDecl(cxx_method_decl);
+#endif
 
 //    printf ("decl->isPolymorphic()             = %i\n", cxx_record_decl->isPolymorphic());
 //    printf ("decl->isAggregate()               = %i\n", cxx_record_decl->isAggregate());
@@ -1756,6 +1767,10 @@
             if (field)
             {
                 record_decl->addDecl(field);
+                
+#ifdef LLDB_CONFIGURATION_DEBUG
+                VerifyDecl(field);
+#endif
             }
         }
         else
@@ -2019,6 +2034,11 @@
                 if (field)
                 {
                     class_interface_decl->addDecl(field);
+                    
+#ifdef LLDB_CONFIGURATION_DEBUG
+                    VerifyDecl(field);
+#endif
+                    
                     return true;
                 }
             }
@@ -2191,6 +2211,9 @@
     
     class_interface_decl->addDecl (objc_method_decl);
 
+#ifdef LLDB_CONFIGURATION_DEBUG
+    VerifyDecl(objc_method_decl);
+#endif
 
     return objc_method_decl;
 }
@@ -4269,6 +4292,10 @@
         namespace_decl = NamespaceDecl::Create(*ast, decl_ctx, SourceLocation(), SourceLocation(), &identifier_info);
         
         decl_ctx->addDecl (namespace_decl);
+        
+#ifdef LLDB_CONFIGURATION_DEBUG
+        VerifyDecl(namespace_decl);
+#endif
     }
     return namespace_decl;
 }
@@ -4312,6 +4339,11 @@
     }
     if (func_decl)
         decl_ctx->addDecl (func_decl);
+    
+#ifdef LLDB_CONFIGURATION_DEBUG
+    VerifyDecl(func_decl);
+#endif
+    
     return func_decl;
 }
 
@@ -4579,6 +4611,11 @@
                 if (enumerator_decl)
                 {
                     enum_type->getDecl()->addDecl(enumerator_decl);
+                    
+#ifdef LLDB_CONFIGURATION_DEBUG
+                    VerifyDecl(enumerator_decl);
+#endif
+                    
                     return true;
                 }
             }

Added: lldb/trunk/source/Symbol/VerifyDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/VerifyDecl.cpp?rev=143000&view=auto
==============================================================================
--- lldb/trunk/source/Symbol/VerifyDecl.cpp (added)
+++ lldb/trunk/source/Symbol/VerifyDecl.cpp Tue Oct 25 20:06:27 2011
@@ -0,0 +1,16 @@
+//===-- VerifyDecl.cpp ------------------------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+#include "lldb/Symbol/VerifyDecl.h"
+#include "clang/AST/DeclBase.h"
+
+void lldb_private::VerifyDecl (clang::Decl *decl)
+{
+    decl->getAccess();
+}





More information about the lldb-commits mailing list