diff options
| author | Douglas Gregor <dgregor@apple.com> | 2009-02-17 03:23:10 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2009-02-17 03:23:10 +0000 |
| commit | a908e7fcccf038abcb665be9192a71a7ec0b8394 (patch) | |
| tree | 38a3e4a3d813860f8f57242fd4b102607a9c5873 /clang/lib/AST | |
| parent | b317efdf818b7cbbb5fb3f707d2c7113a26c182a (diff) | |
| download | bcm5719-llvm-a908e7fcccf038abcb665be9192a71a7ec0b8394.tar.gz bcm5719-llvm-a908e7fcccf038abcb665be9192a71a7ec0b8394.zip | |
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.
llvm-svn: 64736
Diffstat (limited to 'clang/lib/AST')
| -rw-r--r-- | clang/lib/AST/Decl.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index ca1fa0c1e12..387f79a013f 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -271,6 +271,10 @@ unsigned FunctionDecl::getBuiltinID(ASTContext &Context) const { // function. Determine whether it actually refers to the C library // function or whether it just has the same name. + // If this is a static function, it's not a builtin. + if (getStorageClass() == Static) + return 0; + // If this function is at translation-unit scope and we're not in // C++, it refers to the C library function. if (!Context.getLangOptions().CPlusPlus && |

