]> granicus.if.org Git - clang/commitdiff
all filevar's have static storage. Previously a global with
authorChris Lattner <sabre@nondot.org>
Sun, 2 Dec 2007 07:47:49 +0000 (07:47 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 2 Dec 2007 07:47:49 +0000 (07:47 +0000)
extern storage class was returning false from hasStaticStorage.
Ted, please review this.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44515 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/AST/Decl.h
test/Sema/init.c

index fa1b3a7ad97881702ae5ccbb7b77b8a8f73a92ed..a1bb625dda3c448ca2fcf854b2e3fb0a3bb30f8e 100644 (file)
@@ -304,8 +304,8 @@ public:
   //  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
index 2f6df64d091bcec82359a3809b5d65e515eb92c6..bbad04cd7340502401c2e89de1cc4683d5bddb5f 100644 (file)
@@ -8,3 +8,8 @@ int myArray[5] = {1, 2, 3, 4, 5};
 int *myPointer2 = myArray;
 int *myPointer = &(myArray[2]);
 
+
+extern int x;
+void *g = &x;
+int *h = &x;
+