Sebastian Redl [Sat, 12 Mar 2011 11:50:43 +0000 (11:50 +0000)]
Propagate the new exception information to FunctionProtoType.
Change the interface to expose the new information and deal with the enormous fallout.
Introduce the new ExceptionSpecificationType value EST_DynamicNone to more easily deal with empty throw specifications.
Update the tests for noexcept and fix the various bugs uncovered, such as lack of tentative parsing support.
Douglas Gregor [Sat, 12 Mar 2011 00:14:31 +0000 (00:14 +0000)]
When we're determining whether to complain about a conversion from one
enumeration type to another in C, classify enumeration constants as if
they had the type of their enclosing enumeration. Fixes
<rdar://problem/9116337>.
Douglas Gregor [Fri, 11 Mar 2011 23:27:41 +0000 (23:27 +0000)]
Don't ask if a depenendent CXXRecordDecl has any dependent bases
unless we already know that it has a definition. Fixes
PR9449/<rdar://problem/9115785>.
Douglas Gregor [Fri, 11 Mar 2011 23:10:44 +0000 (23:10 +0000)]
Implement a hack intended to allow Clang to parse libstdc++ 4.5's
headers, which use C++0x generalized initializer lists. Per PR7069, it
appears that the only use is as the return type of a function, so this
commit enables this extension just in that narrow case. If it's enough
for libstdc++ 4.5, or if it can be trivially extended to work with
libstdc++ 4.5, we'll keep it. Otherwise, or if this breaks anything,
we'll revert and wait for the real feature.
Ted Kremenek [Thu, 10 Mar 2011 20:03:42 +0000 (20:03 +0000)]
Profiling showed that 'CheckImplicitConversions' was very slow because of the call to getSpellingLoc(). On 'aes.c'
in the LLVM test suite, this function was consuming 7.4% of -fsyntax-only time. This change fixes this issue
by delaying the check that the warning would be issued within a system macro by as long as possible. The
main negative of this change is now the logic for this check is done in multiple places in this function instead
of just in one place up front.
NAKAMURA Takumi [Thu, 10 Mar 2011 14:02:21 +0000 (14:02 +0000)]
lib/CodeGen/CGCall.cpp: Don't invoke multiple Builder.CreateBitCast() on Builder.CreateMemCpy. Or we would see sideeffect incompatibility among gcc and clang.
Ted Kremenek [Thu, 10 Mar 2011 03:50:34 +0000 (03:50 +0000)]
When doing reachability analysis for warnings issued under DiagRuntimeBehavior, don't construct a ParentMap or CFGStmtMap.
Instead, create a small set of Stmt* -> CFGBlock* mappings during CFG construction for only the statements we care about
relating to the diagnostics we want to check for reachability.
Ted Kremenek [Thu, 10 Mar 2011 01:14:05 +0000 (01:14 +0000)]
Rework interaction between AnalysisContext and CFG::BuildOptions to keep a BuildOptions object around instead of keeping a copy of the flags.
Moreover, change AnalysisContext to use an OwningPtr for created analysis objects instead
of directly managing them.
Finally, add a 'forcedBlkExprs' entry to CFG::BuildOptions that will be used by the
CFGBuilder to force specific expressions to be block-level expressions.
Introduce '-chain-include' option to specify headers that will be converted to chained PCHs in memory
without having to use multiple runs and intermediate files.
John McCall [Wed, 9 Mar 2011 04:27:21 +0000 (04:27 +0000)]
Use the "undergoes default argument promotion" bit on parameters to
simplify the logic of initializing function parameters so that we don't need
both a variable declaration and a type in FunctionArgList. This also means
that we need to propagate the CGFunctionInfo down in a lot of places rather
than recalculating it from the FAL. There's more we can do to eliminate
redundancy here, and I've left FIXMEs behind to do it.
NAKAMURA Takumi [Wed, 9 Mar 2011 03:02:28 +0000 (03:02 +0000)]
c-index-test.c: Fix cygwin warning not to pass signed char to islower(c).
Cygwin's ctype.h says;
/* These macros are intentionally written in a manner that will trigger
a gcc -Wall warning if the user mistakenly passes a 'char' instead
of an int containing an 'unsigned char'.
(snip) */
Add 'OverridenFilesKeepOriginalName' field in SourceManager which if true the SourceManager
should report the original file name for contents of files that were overriden by other files,
otherwise it should report the name of the new file. Default is true.
Also add similar field in PreprocessorOptions and pass similar parameter in ASTUnit::LoadFromCommandLine.
John McCall [Tue, 8 Mar 2011 07:59:04 +0000 (07:59 +0000)]
Fix my earlier commit to work with escaped newlines and leave breadcrumbs
in case we want to make a world where we can check intermediate instantiations
for this kind of breadcrumb.
John McCall [Tue, 8 Mar 2011 04:17:03 +0000 (04:17 +0000)]
objc_gc wants a pointer type, not a function type; give it a more appropriate
diagnostic. Also, these attributes are commonly written with macros which we
actually pre-define, so instead of expanding the macro location, refer to the
instantiation location and name it using the macro loc.
Bill Wendling [Mon, 7 Mar 2011 22:47:14 +0000 (22:47 +0000)]
When we adjust the inline ASM type, we need to take into account an early
clobber with the 'y' constraint. Otherwise, we get the wrong return type and an
assert, because it created a '<1 x i64>' vector type instead of the x86_mmx
type.
Devang Patel [Mon, 7 Mar 2011 18:45:56 +0000 (18:45 +0000)]
DebugInfo can be enabled or disabled at function level (e.g. using an attribute). However, at module level it is determined by command line option and the state of command line option does not change during compilation. Make this layering explicit and fix accidental cases where the code generator was checking whether module has debug info enabled instead of checking whether debug info is enabled for this function or not.
Douglas Gregor [Mon, 7 Mar 2011 16:54:27 +0000 (16:54 +0000)]
Support explicit template specialization and instantiation for members
of a C++0x inline namespace within enclosing namespaces, as noted in
C++0x [namespace.def]p8.
Fixes <rdar://problem/9006349>, a libc++ failure where Clang was
rejected an explicit specialization of std::swap (since libc++ puts it
into an inline, versioned namespace std::__1).
Douglas Gregor [Mon, 7 Mar 2011 15:13:34 +0000 (15:13 +0000)]
When rebuilding a dependent template specialization type to another
dependent template specialization type, make sure to set the keyword
location. Fixes some valgrind issues introduced in r127150.
Douglas Gregor [Mon, 7 Mar 2011 02:33:33 +0000 (02:33 +0000)]
When transforming a dependent template specialization type, make sure
to set the source-location information for the template arguments to
the *transformed* source-location information, not the original
source-location information. Fixes <rdar://problem/8986308> (a libc++
SFINAE issue) and the Boost.Polygon failure.
John McCall [Mon, 7 Mar 2011 01:52:56 +0000 (01:52 +0000)]
An operator new with an empty exception specifier returns null on a bad
allocation and therefore requires a null-check. We were doing that, but
we weren't treating the new-initializer as being conditionally executed,
which means it was possible to get ill-formed IR as in PR9298.
Redo part of r127137:
Pass down the correct C->getArgs, but keep it with the original
DerivedArgList type. Slightly adjust the MakeIndex call for the
different base type. This unbreaks the handling of --no-mangle on Darwin.
Douglas Gregor [Mon, 7 Mar 2011 01:03:30 +0000 (01:03 +0000)]
Remove the AST printer (-ast-print-xml), which is too incomplete and
too low-level to actually be useful but is just interesting enough for
people to try to use it (which won't actually work beyond toy examples).
To bring back the AST printer, it needs to be:
- Complete, covering all of C/C++/Objective-C
- Documented, with appropriate Schema against which we can validate
the output
- Designed for C/C++/Objective-C, not Clang's specific ASTs
- Stable across Clang versions
- Well-tested