diff options
| -rw-r--r-- | clang/include/clang/AST/Decl.h | 4 | ||||
| -rw-r--r-- | clang/test/Sema/init.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/clang/include/clang/AST/Decl.h b/clang/include/clang/AST/Decl.h index fa1b3a7ad97..a1bb625dda3 100644 --- a/clang/include/clang/AST/Decl.h +++ b/clang/include/clang/AST/Decl.h @@ -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 diff --git a/clang/test/Sema/init.c b/clang/test/Sema/init.c index 2f6df64d091..bbad04cd734 100644 --- a/clang/test/Sema/init.c +++ b/clang/test/Sema/init.c @@ -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; + |

