aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaDecl.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-17 03:23:10 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-17 03:23:10 +0000
commit9add31798f621f843233dbff8bba103fca64447b (patch)
tree231b324f975bfb9bd2db0e66c3f6d3b6d0440b4e /lib/Sema/SemaDecl.cpp
parent85b2a47ec0450ee78b2c36ec482179cb4743bff7 (diff)
Static variables and functions won't collide with standard library
functions, so if we're declaring a static we should implicitly declare a library function by the same name (e.g., malloc, strdup). Fixes PR3592. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64736 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaDecl.cpp')
-rw-r--r--lib/Sema/SemaDecl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaDecl.cpp b/lib/Sema/SemaDecl.cpp
index 7b8373ca39..bf6a637ac2 100644
--- a/lib/Sema/SemaDecl.cpp
+++ b/lib/Sema/SemaDecl.cpp
@@ -1304,7 +1304,9 @@ Sema::ActOnDeclarator(Scope *S, Declarator &D, DeclTy *lastDecl,
// See if this is a redefinition of a variable in the same scope.
if (!D.getCXXScopeSpec().isSet() && !D.getCXXScopeSpec().isInvalid()) {
DC = CurContext;
- PrevDecl = LookupName(S, Name, LookupOrdinaryName, true, true,
+ PrevDecl = LookupName(S, Name, LookupOrdinaryName, true,
+ D.getDeclSpec().getStorageClassSpec() !=
+ DeclSpec::SCS_static,
D.getIdentifierLoc());
} else { // Something like "int foo::x;"
DC = static_cast<DeclContext*>(D.getCXXScopeSpec().getScopeRep());