[llvm-commits] [gcc-plugin] r81245 - /gcc-plugin/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Tue Sep 8 12:46:11 PDT 2009


Author: baldrick
Date: Tue Sep  8 14:46:11 2009
New Revision: 81245

URL: http://llvm.org/viewvc/llvm-project?rev=81245&view=rev
Log:
Only static variables should have already been declared here.
Testing for staticness is a stronger sanity check than the
previous check and is also more efficient.

Modified:
    gcc-plugin/trunk/llvm-convert.cpp

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81245&r1=81244&r2=81245&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Tue Sep  8 14:46:11 2009
@@ -625,13 +625,14 @@
     // Not supported yet.
   }
 
-  // Emit all local variables.
+  // Emit all automatic variables.
   for (tree vars = DECL_STRUCT_FUNCTION(FnDecl)->local_decls; vars;
        vars = TREE_CHAIN(vars)) {
     tree var = TREE_VALUE (vars);
-    // Static variables may already have been declared.
-    if (!DECL_LLVM_SET_P(var))
-      EmitAutomaticVariableDecl(var);
+    // Static variables are treated as global variables.
+    if (TREE_STATIC(var))
+      continue;
+    EmitAutomaticVariableDecl(var);
   }
 
   // Create a new block for the return node, but don't insert it yet.





More information about the llvm-commits mailing list