aboutsummaryrefslogtreecommitdiff
path: root/lib/Sema/SemaLookup.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-01-03 09:37:44 +0000
committerDouglas Gregor <dgregor@apple.com>2011-01-03 09:37:44 +0000
commit6b9109e9d5446f213b12d2a6b76495bffb06b794 (patch)
treeebdb71e3c2e4ad3b7e8fcda7a717a23a3a479f3c /lib/Sema/SemaLookup.cpp
parenta96022c365a183f89ea81fa3f294ee7f436556b9 (diff)
When we attempt to create a built-in that involves a library type we
don't have access to (e.g., fprintf, which needs the library type FILE), fail with a warning and forget about the builtin entirely. Previously, we would actually provide an error, which breaks autoconf's super-lame checks for fprintf, longjmp, etc. Fixes PR8316. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122744 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaLookup.cpp')
-rw-r--r--lib/Sema/SemaLookup.cpp19
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Sema/SemaLookup.cpp b/lib/Sema/SemaLookup.cpp
index 6972536e8c..5ed973b1a8 100644
--- a/lib/Sema/SemaLookup.cpp
+++ b/lib/Sema/SemaLookup.cpp
@@ -483,12 +483,21 @@ static bool LookupBuiltin(Sema &S, LookupResult &R) {
S.Context.BuiltinInfo.isPredefinedLibFunction(BuiltinID))
return false;
- NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II, BuiltinID,
- S.TUScope, R.isForRedeclaration(),
- R.getNameLoc());
- if (D)
+ if (NamedDecl *D = S.LazilyCreateBuiltin((IdentifierInfo *)II,
+ BuiltinID, S.TUScope,
+ R.isForRedeclaration(),
+ R.getNameLoc())) {
R.addDecl(D);
- return (D != NULL);
+ return true;
+ }
+
+ if (R.isForRedeclaration()) {
+ // If we're redeclaring this function anyway, forget that
+ // this was a builtin at all.
+ S.Context.BuiltinInfo.ForgetBuiltin(BuiltinID, S.Context.Idents);
+ }
+
+ return false;
}
}
}