]> granicus.if.org Git - clang/commitdiff
add a new isNull() method to DeclGroupRef.
authorChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 20:13:14 +0000 (20:13 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 12 Apr 2009 20:13:14 +0000 (20:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68909 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/DeclGroup.h
lib/Sema/SemaStmt.cpp

index 1a8546339b873527634e81a26ec85b0077df21d6..65666899e2e38d682b1f205567b68d336b9bcf05 100644 (file)
@@ -84,6 +84,7 @@ public:
   typedef Decl** iterator;
   typedef Decl* const * const_iterator;
   
+  bool isNull() const { return D == 0; }
   bool isSingleDecl() const { return getKind() == SingleDeclKind; }
   bool isDeclGroup() const { return getKind() == DeclGroupKind; }
 
index d2e158658c506fdaf39815dcce05426c874429e9..1428c488471866c21b6aa3ee159a357bd07ee863 100644 (file)
@@ -40,10 +40,11 @@ Sema::OwningStmtResult Sema::ActOnNullStmt(SourceLocation SemiLoc) {
 Sema::OwningStmtResult Sema::ActOnDeclStmt(DeclGroupPtrTy dg,
                                            SourceLocation StartLoc,
                                            SourceLocation EndLoc) {
+  DeclGroupRef DG = dg.getAsVal<DeclGroupRef>();
+  
   // If we have an invalid decl, just return an error.
-  if (!dg) return StmtError();
+  if (DG.isNull()) return StmtError();
   
-  DeclGroupRef DG = dg.getAsVal<DeclGroupRef>();
   return Owned(new (Context) DeclStmt(DG, StartLoc, EndLoc));
 }