[cfe-commits] r44515 - in /cfe/trunk: include/clang/AST/Decl.h test/Sema/init.c

Chris Lattner sabre at nondot.org
Sat Dec 1 23:47:49 PST 2007


Author: lattner
Date: Sun Dec  2 01:47:49 2007
New Revision: 44515

URL: http://llvm.org/viewvc/llvm-project?rev=44515&view=rev
Log:
all filevar's have static storage.  Previously a global with
extern storage class was returning false from hasStaticStorage.
Ted, please review this.

Modified:
    cfe/trunk/include/clang/AST/Decl.h
    cfe/trunk/test/Sema/init.c

Modified: cfe/trunk/include/clang/AST/Decl.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Decl.h?rev=44515&r1=44514&r2=44515&view=diff

==============================================================================
--- cfe/trunk/include/clang/AST/Decl.h (original)
+++ cfe/trunk/include/clang/AST/Decl.h Sun Dec  2 01:47:49 2007
@@ -304,8 +304,8 @@
   //  function) that lack a storage keyword are implicitly "static,"
   //  but are represented internally with a storage class of "None".
   bool hasStaticStorage() const {
-    return getStorageClass() == Static ||
-          (getStorageClass() == None && getKind() == FileVar);
+    if (getStorageClass() == Static) return true;
+    return getKind() == FileVar;
   }
       
   // hasLocalStorage - Returns true if a variable with function scope

Modified: cfe/trunk/test/Sema/init.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/init.c?rev=44515&r1=44514&r2=44515&view=diff

==============================================================================
--- cfe/trunk/test/Sema/init.c (original)
+++ cfe/trunk/test/Sema/init.c Sun Dec  2 01:47:49 2007
@@ -8,3 +8,8 @@
 int *myPointer2 = myArray;
 int *myPointer = &(myArray[2]);
 
+
+extern int x;
+void *g = &x;
+int *h = &x;
+





More information about the cfe-commits mailing list