Ben Langmuir [Mon, 10 Mar 2014 23:17:14 +0000 (23:17 +0000)]
Add -fmodules-cache-path to test/Headers/c11.c
This started failing for me the last time someone modified the AST file
format. It would be nice if we could just have lit take care of the
module cache used during testing for us, but this helps in the meantime.
Ben Langmuir [Mon, 10 Mar 2014 22:34:23 +0000 (22:34 +0000)]
Turn on the uncovered umbrella header warning by default
This warning (under -Wincomplete-umbrella) diagnoses cases that are
difficult to understand without the compiler's help, since the symptom
is likely to be that you are missing the contents of headers that are
mistakenly omitted from a module. This seems like a good thing to have
on by default (with the usual caveat for -Wsystem-headers).
John McCall [Mon, 10 Mar 2014 22:27:33 +0000 (22:27 +0000)]
RTTI symbols for visible local types may need weak linkage.
Previously, we would always emit them with internal linkage,
but with hidden visibility when the function was hidden, which
is an illegal combination, which could lead LLVM to actually
emit them as strong hidden symbols with hilarious results.
Aaron Ballman [Mon, 10 Mar 2014 17:08:28 +0000 (17:08 +0000)]
[C++11] Replacing DeclBase iterators specific_attr_begin() and specific_attr_end() with iterator_range specific_attrs(). Updating all of the usages of the iterators with range-based for loops.
Samuel Benzaquen [Mon, 10 Mar 2014 15:40:23 +0000 (15:40 +0000)]
Add loc() to the dynamic registry.
Summary:
Add loc() to the dynamic registry.
Other fixes:
- Fix the polymorphic variant value to accept an exact match, even if
there are other possible conversions.
- Fix specifiesTypeLoc() to not crash on an empty
NestedNameSpecifierLoc.
Richard Smith [Mon, 10 Mar 2014 00:04:29 +0000 (00:04 +0000)]
When a type's definition is instantiated, the definition becomes visible, even
if the type's declaration was previously instantiated in an unimported module.
(For an imported type definition, this already worked, because the source
location is set to the location of the definition, but for locally-instantiated
type definitions, it did not.)
Logan Chien [Sun, 9 Mar 2014 16:21:03 +0000 (16:21 +0000)]
Fix uninitialized value in AttributedTypeLoc.
Clang might crash while reading the precompiled headers if
we don't initialize the AttrEnumOperandLoc properly.
This commit fixes the combination of string attribute
operand and enum operand. Besides, this commit also adds
several assertions to avoid unexpected operand kind.
[C++11] Update Clang for the change to LLVM's Use-Def chain iterators in
r203364: what was use_iterator is now user_iterator, and there is
a use_iterator for directly iterating over the uses.
This also switches to use the range-based APIs where appropriate.
Aaron Ballman [Sat, 8 Mar 2014 22:19:01 +0000 (22:19 +0000)]
[C++11] Replacing Decl iterators attr_begin() and attr_end() with iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops.
This is a reapplication of r203236 with modifications to the definition of attrs() and following the new style guidelines on auto usage.
Aaron Ballman [Sat, 8 Mar 2014 20:12:42 +0000 (20:12 +0000)]
[C++11] Replacing RecordDecl iterators field_begin() and field_end() with iterator_range fields(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Sat, 8 Mar 2014 18:45:14 +0000 (18:45 +0000)]
[C++11] Replacing EnumDecl iterators enumerator_begin() and enumerator_end() with iterator_range enumerators(). Updating all of the usages of the iterators with range-based for loops.
Ted Kremenek [Sat, 8 Mar 2014 02:22:32 +0000 (02:22 +0000)]
[-Wunreachabe-code] Don't warn about unreachable destructors for temporaries.
This can possibly be refined later, but right now the experience
is so incomprehensible for a user to understand what is going on
this isn't a useful warning.
Richard Smith [Sat, 8 Mar 2014 00:03:56 +0000 (00:03 +0000)]
Module [extern_c] attribute: inherit to submodules, don't write 'extern "C"'
blocks when building in C mode, and serialize and deserialize the attribute.
Aaron Ballman [Fri, 7 Mar 2014 22:17:20 +0000 (22:17 +0000)]
In my tests, I'm finding that declaring iterators in terms of ranges can sometimes have dangerous side-effects where the range temporary is destroyed, taking the underlying iterators out with it.
This changes the iterators so that they are no longer implemented in terms of ranges (so it's a very partial revert of the existing rangification efforts).
Aaron Ballman [Fri, 7 Mar 2014 19:56:05 +0000 (19:56 +0000)]
[C++11] Replacing DeclBase iterators decls_begin() and decls_end() with iterator_range decls(). The same is true for the noload versions of these APIs. Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 18:11:58 +0000 (18:11 +0000)]
[C++11] Replacing IndirectFieldDecl iterators chain_begin() and chain_end() with iterator_range chains(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 17:50:17 +0000 (17:50 +0000)]
[C++11] Replacing ObjCMethodDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 16:40:17 +0000 (16:40 +0000)]
[C++11] Adding an iterator_range accessor for parameter declarations to the CaptureDecl class; however, the only usage of the iterators cannot be converted to using the range yet. This change is for consistency with other Decls exposing parameters.
Aaron Ballman [Fri, 7 Mar 2014 16:09:59 +0000 (16:09 +0000)]
[C++11] Replacing BlockDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 15:12:56 +0000 (15:12 +0000)]
[C++11] Replacing FunctionDecl iterators param_begin() and param_end() with iterator_range params(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 14:09:15 +0000 (14:09 +0000)]
[C++11] Replacing iterators ddiag_begin() and ddiag_end() with iterator_range ddiags(). Updating all of the usages of the iterators with range-based for loops.
Aaron Ballman [Fri, 7 Mar 2014 12:50:00 +0000 (12:50 +0000)]
[C++11] Replacing iterators attr_begin() and attr_end() with iterator_range attrs(). Updating all of the usages of the iterators with range-based for loops.
Ted Kremenek [Fri, 7 Mar 2014 07:14:36 +0000 (07:14 +0000)]
Fix recent regressions in -Wreturn-type caused by heuristics to -Wunreachable-code.
I had forgotten that the same reachability code is used by both -Wreturn-type
and -Wunreachable-code, so the heuristics applied to the latter were indirectly
impacting the former.
To address this, the reachability code is more refactored so that whiled
the logic at its core is shared, the intention of the clients are better
captured and segregated in helper APIs.
Fixes PR19074, and also some false positives reported offline to me
by Nick Lewycky.
Ben Langmuir [Fri, 7 Mar 2014 06:40:32 +0000 (06:40 +0000)]
Add dependencies from imported modules with -MD
Add module dependencies to the dependency files created by -MD/-MMD/etc.
by attaching an ASTReaderListener that will call into the dependency
file generator when a module input file is seen in the serialized AST.
Yunzhong Gao [Fri, 7 Mar 2014 00:23:36 +0000 (00:23 +0000)]
The Visual Studio IDE changed behavior in VS2012. It used to be the case that
the clang diagnostic has to report a column number one less than the correct
value in order for the IDE to move the cursor to the expected location. This
behavior is changed in VS2012 and VS2013 so that the IDE is now expecting the
column number to match the actual source location.
Before: source(line, column-1): type: message
After: source(line, column): type: message
This patch changes -fdiagnostics-format=msvc to match the new VS2012 and VS2013
when fmsc-version is 1700 or greater.
Aaron Ballman [Fri, 7 Mar 2014 00:10:58 +0000 (00:10 +0000)]
Partial revert of r203179. The build bots are telling me that some out-of-tree builds are using redecls_begin()/redecls_end(), so adding some machinery back in to support them.
Aaron Ballman [Thu, 6 Mar 2014 23:45:36 +0000 (23:45 +0000)]
[C++11] Replacing iterators redecls_begin() and redecls_end() with iterator_range redecls(). Updating all of the usages of the iterators with range-based for loops, which allows the begin/end forms to be removed entirely.
C. Compare vector sizes using their raw element size instead of
getTypeSize (which rounds up sizes) in order to issue diagnostics
when casting to mismatched vector sizes; instead of crashing in IRGen.
// rdar:// 16196902. Reviewed offline by John McCall.
Use llvm.compiler.used instead of llvm.used for objc symbols.
LLVM currently has a hack (shouldEmitUsedDirectiveFor) that causes it to not
print no_dead_strip for symbols starting with 'l' or 'L'. These are exactly the
ones that the clang's objc codegen is producing. The net result, is that it is
equivalent to llvm.compiler.used.
The need for putting the private symbol in llvm.compiler.used should be clear
(the objc runtime uses them). The reason for also putting the weak symbols in
it is for LTO: ld64 will not ask us to preserve the it.