Daniel Dunbar [Sun, 13 Dec 2009 02:00:23 +0000 (02:00 +0000)]
Tests: Fix some bugs in clang_f_opts, options were out of order but it worked
because it had two inputs, except on Win32 where /dev/null doesn't exist.
Douglas Gregor [Sat, 12 Dec 2009 18:16:41 +0000 (18:16 +0000)]
Rework the way we handle template instantiation for
implicitly-generated AST nodes. We previously built instantiated nodes
for each of these AST nodes, then passed them on to Sema, which was
not prepared to see already-type-checked nodes (see PR5755). In some
places, we had ugly workarounds to try to avoid re-type-checking
(e.g., in VarDecl initializer instantiation).
Now, we skip implicitly-generated nodes when performing instantiation,
preferring instead to build just the AST nodes that directly reflect
what was written in the source code. This has several advantages:
- We don't need to instantiate anything that doesn't have a direct
correlation to the source code, so we can have better location
information.
- Semantic analysis sees the same thing at template instantiation
time that it would see for a non-template.
- At least one ugly hack (VarDecl initializers) goes away.
Douglas Gregor [Sat, 12 Dec 2009 07:57:52 +0000 (07:57 +0000)]
When certain diagnostics involving run-time behavior would be emitted
in a potentially potentially evaluated context, queue those
diagnostics and only emit them if the context ends up being
potentially evaluated. This completes the fix for PR5761.
Douglas Gregor [Sat, 12 Dec 2009 07:25:49 +0000 (07:25 +0000)]
Suppress warnings and errors about certain uses of non-POD types (in
__builtin_offsetof, passing through an ellipsis) when we're in an
unevaluated context. This is the first part of the fix to PR5761,
which deals with the simple case of an unevaluated context.
Ted Kremenek [Sat, 12 Dec 2009 00:38:18 +0000 (00:38 +0000)]
Make using '-fshort-enums' an error until it is actually implemented (changes the ABI, so it is dangerous to not error out if we don't support it). Fixes <rdar://problem/7461006>.
Ted Kremenek [Fri, 11 Dec 2009 23:22:52 +0000 (23:22 +0000)]
scan-build: when the build command is 'make', override the CC and CXX options by passing them as arguments to make. This fixes <rdar://problem/6790224>.
Daniel Dunbar [Fri, 11 Dec 2009 22:52:03 +0000 (22:52 +0000)]
Tests: Change substitution to automagically use 'clang -cc1' instead of 'clang-cc'. I still plan to eventually rewrite the tests to clarify the magic (I will probably actually rewrite them to %clang so it is more obvious this is a variable that gets substituted).
John McCall [Fri, 11 Dec 2009 20:04:54 +0000 (20:04 +0000)]
Don't enter a new scope for a namespace-qualified declarator unless we're
in a file context. In well-formed code, only happens with friend functions.
Fixes PR 5760.
Douglas Gregor [Fri, 11 Dec 2009 17:31:05 +0000 (17:31 +0000)]
Tweak code-completion results by suppressing class template
specializations and class template partial specializations (they're
never named directly). Also, member access expressions only refer to
value declarations (fields, functions, enumerators, etc.) and
Objective-C property declarations; filter out everything else.
Anders Carlsson [Fri, 11 Dec 2009 02:46:30 +0000 (02:46 +0000)]
Improve linkage of RTTI data structures. Introduce CodeGenModule::GetAddrOfRTTI which figures out the right linkage of the RTTI information for the given type and whether it should be defined or not. I will migrate clients over to GetAddrOfRTTI in subsequent commits (with tests).
John McCall [Fri, 11 Dec 2009 02:33:26 +0000 (02:33 +0000)]
Check if the target of a using decl is already declared in this scope before
doing any of the other redeclaration checks. We were missing a few cases.
Fixes PR 5752.
John McCall [Fri, 11 Dec 2009 02:10:03 +0000 (02:10 +0000)]
Implement access declarations. Most of the work here is parsing them, which
is difficult because they're so terribly, terribly ambiguous.
We implement access declarations in terms of using declarations, which is
quite reasonable. However, we should really persist the access/using
distinction in the AST and use the appropriate name in diagnostics. This
isn't a priority, so I'll just file a PR and hope someone else does it. :)
Chris Lattner [Fri, 11 Dec 2009 01:52:50 +0000 (01:52 +0000)]
Give the "cannot pass object of non-POD type 'class C' through variadic constructor; call will abort at runtime" warning a -W flag (non-pod-varargs) and default it being an error by default. There is no good reason to allow users to get bitten by this sort of thing by default.
Anders Carlsson [Fri, 11 Dec 2009 01:00:09 +0000 (01:00 +0000)]
When extending the lifetime of a temporary, make sure to emit a branch to the cleanup exit block. This fixes a broken module error in LLVMCConfigurationEmitter.cpp.
Daniel Dunbar [Fri, 11 Dec 2009 00:27:20 +0000 (00:27 +0000)]
FileManager: Do not cache failed stats, it is easy to construct common
inconsistent situations if we do, and they are not important for PCH performance
(which currently only needs the stats to construct the initial FileManager
entries).
- No test case, sorry, the machinations are too involved.
This occurs when, for example, the build makes a PCH file and has a header map
or a -I for a directory that does not yet exist. It is possible we will cache
the negative stat on that directory, and then in the build we will never find
header files inside that dir.
For PCH we don't need these stats anyway for performance, so this also makes PCH
files smaller w/ no loss. I hope to eventually eliminate the stat cache
entirely.
Mike Stump [Thu, 10 Dec 2009 22:57:48 +0000 (22:57 +0000)]
Don't complain about falling off the end of a function with an asm
block, if the function is supposed to return a value as we don't know
exactly what the asm code does.
Douglas Gregor [Thu, 10 Dec 2009 22:08:55 +0000 (22:08 +0000)]
Beef up Clang-on-LLVM testing a bit, by making LLVM-Syntax recursive
(since we now parse all of the headers appropriately) and teaching
LLVM-Code-Syntax about the extra paths needed to parse the backends.
John McCall [Thu, 10 Dec 2009 21:17:25 +0000 (21:17 +0000)]
Actually try to trigger the last diagnostic in the declaration-collision test case.
Surprisingly, we *do* diagnose one of them. Since we don't really track scopes into
instantiation, this has to signal some kind of bug.
John McCall [Thu, 10 Dec 2009 19:51:03 +0000 (19:51 +0000)]
Improve the diagnostic when a new declaration conflicts with a using shadow
declaration. Rename note_using_decl to note_using, which is possibly less confusing.
Add a test for non-class-scope using decl collisions and be sure to note the case
we can't diagnose yet.
John McCall [Thu, 10 Dec 2009 09:41:52 +0000 (09:41 +0000)]
Implement redeclaration checking and hiding semantics for using declarations. There
are a couple of O(n^2) operations in this, some analogous to the usual O(n^2)
redeclaration problem and some not. In particular, retroactively removing
shadow declarations when they're hidden by later decls is pretty unfortunate.
I'm not yet convinced it's worse than the alternative, though.