Alp Toker [Sun, 5 Jan 2014 06:38:18 +0000 (06:38 +0000)]
Pre-declare '::type_info' in MicrosoftMode only, not MicrosoftExt
It was previously enabled in both but should only have been part of the drop-in
quirks mode that is 'MicrosoftMode' given that it's only useful for
compatibility with the Microsoft headers/runtime.
Alp Toker [Sun, 5 Jan 2014 04:17:27 +0000 (04:17 +0000)]
Tweak the parse recovery in r198540
Cover a hypothetical case when we might not have reached the final argument
declaration for some reason during recovery, and split out for readability.
Alp Toker [Sun, 5 Jan 2014 03:27:57 +0000 (03:27 +0000)]
Fix bungled parse recovery in K&R function declarations
void knrNoSemi(i) int i { }
Adherents of The C Programming Language unfortunate enough to miss a semicolon
as above would be met with a cascade of errors spanning the remainder of the
TU.
This patch introduces a beautiful parse error recovery, complete with helpful
FixIt to restore sanity.
Before (output redacted for brevity):
error: 'error' diagnostics seen but not expected:
File declarators.c Line 119: declaration does not declare a parameter
File declarators.c Line 123: declaration does not declare a parameter
File declarators.c Line 127: parameter named 'func_E12' is missing
File declarators.c Line 127: expected ';' at end of declaration
File declarators.c Line 133: parameter named 'func_E13' is missing
File declarators.c Line 133: expected ';' at end of declaration
File declarators.c Line 139: parameter named 'func_E14' is missing
File declarators.c Line 139: expected ';' at end of declaration
File declarators.c Line 145: parameter named 'func_E15' is missing
File declarators.c Line 145: expected ';' at end of declaration
File declarators.c Line 150: expected function body after function declarator
File declarators.c Line 119: declaration of 'enum E11' will not be visible outside of this function
File declarators.c Line 123: declaration of 'enum E12' will not be visible outside of this function
File declarators.c Line 133: ISO C forbids forward references to 'enum' types
File declarators.c Line 133: declaration of 'enum E13' will not be visible outside of this function
File declarators.c Line 139: ISO C forbids forward references to 'enum' types
File declarators.c Line 139: declaration of 'enum E14' will not be visible outside of this function
File declarators.c Line 145: ISO C forbids forward references to 'enum' types
File declarators.c Line 145: declaration of 'enum E15' will not be visible outside of this function
...
After:
declarators.c:103:24: error: expected ';' at end of declaration
void knrNoSemi(i) int i { }
^
;
Patch found in a sealed envelope dated 1978 with the message "Do not open until
January 2014"
Alp Toker [Sat, 4 Jan 2014 15:25:02 +0000 (15:25 +0000)]
Move MS predefined type_info out of InitializePredefinedMacros
Instead of keeping it in amongst the macros, build the declaration at Sema init
the same way we do with other predeclared and builtin types.
In practice this means the declaration is marked implicit and therefore won't
show up as an unwanted user-declared type in tooling which has been a
frequently reported issue (though I haven't been able to cook up a test).
Alp Toker [Sat, 4 Jan 2014 13:47:14 +0000 (13:47 +0000)]
Only mark dump() function definitions 'used' in debug builds
This has the dual effect of (1) enabling more dead-stripping in release builds
and (2) ensuring that debug helper functions aren't stripped away in debug
builds, as they're intended to be called from the debugger.
Note that the attribute is applied to definitions rather than declarations in
headers going forward because it's now conditional on NDEBUG:
/// \brief Mark debug helper function definitions like dump() that should not be
/// stripped from debug builds.
Requires corresponding macro added in LLVM r198456.
Ted Kremenek [Sat, 4 Jan 2014 05:52:11 +0000 (05:52 +0000)]
[analyzer] Remove IdempotentOperations checker.
This checker has not been updated to work with interprocedural analysis,
and actually contains both logical correctness issues but also
memory bugs. We can resuscitate it from version control once there
is focused interest in making it a real viable checker again.
Reid Kleckner [Fri, 3 Jan 2014 23:42:00 +0000 (23:42 +0000)]
[ms-cxxabi] Improve vbtable name mangling accuracy
Summary:
This makes us more compatible with MSVC 2012+ and fixes PR17748 where we
would give two tables the same name.
Rather than doing a fresh depth-first traversal of the inheritance graph
for every record's vbtables, now we memoize vbtable paths for each
record. By doing memoization, we end up considering virtual bases of
subobjects that come later in the depth-first traversal. Where
previously we would have ignored a virtual base that we'd already seen,
we now consider it for name mangling purposes without emitting a
duplicate vbtable for it.
Adrian Prantl [Fri, 3 Jan 2014 23:34:30 +0000 (23:34 +0000)]
Debug info: Ensure that the last stop point in a function is still within
the lexical block formed by the compound statement that is the function
body.
Aaron Ballman [Fri, 3 Jan 2014 20:10:54 +0000 (20:10 +0000)]
Refactored Builtin::Context::isPrintfLike and isScanfLike into a helper function. The implementations are identical, except for the format arguments being searched for.
Aaron Ballman [Fri, 3 Jan 2014 18:42:48 +0000 (18:42 +0000)]
Removed one of the string versions of getQualifiedNameAsString, and switched over to using printQualifiedName where possible. No functional changes intended.
[objc] Refactor and improve functionality for the -Wunused-property-ivar warning.
- Remove the additions to ObjCMethodDecl & ObjCIVarDecl that were getting de/serialized and consolidate
all functionality for the checking for this warning in Sema::DiagnoseUnusedBackingIvarInAccessor
- Don't check immediately after the method body is finished, check when the @implementation is finished.
This is so we can see if the ivar was referenced by any other method, even if the method was defined after the accessor.
- Don't silence the warning if any method is called from the accessor silence it if the accessor delegates to another method via self.
Aaron Ballman [Fri, 3 Jan 2014 16:23:46 +0000 (16:23 +0000)]
Simplifying the mutual exclusion check now that the diagnostics engine knows how to handle Attr objects directly. Updates an associated test case due to the attribute name being properly quoted again.
Reid Kleckner [Fri, 3 Jan 2014 00:14:35 +0000 (00:14 +0000)]
[ms-cxxabi] Move VBTableBuilder from CodeGen over to AST/VTableBuilder.cpp
Summary:
No functionality change.
This code should live here long-term because we should be able to use it
to compute correct vftable names.
It turns out that the most natural way to implement the naming algorithm
is to use a caching layer similar to what we already have for virtual
table info in VTableContext. Subsequent changes will take advantage of
this to fix PR17748, where we have a vbtable name collision.
Aaron Ballman [Thu, 2 Jan 2014 23:22:40 +0000 (23:22 +0000)]
This diagnostic should not have had the manual quotation marks. Its only usage passed in an Attr object, which was already quoted when printing the diagnostic. However, there was no test case that caught this bug -- one has been added.
Aaron Ballman [Thu, 2 Jan 2014 23:15:58 +0000 (23:15 +0000)]
Removing some more unnecessary manual quotes from attribute diagnostics. Updated the associated testcase because QualType pretty printing was an improvement.
ObjectiveC. Remove false positive warning for missing property
backing ivar by not issuing this warning if ivar is referenced
somewhere and accessor makes method calls. // rdar://15727325
ObjectiveC. Class methods must be ignored when looking for
property accessor's missing backing ivar. This eliminates
the bogus warning being issued. // rdar://15728901
Douglas Gregor [Thu, 2 Jan 2014 17:11:02 +0000 (17:11 +0000)]
CMake: Unbreak separated LLVM/Clang project builds for Xcode.
The separate Xcode project generated for Clang is putting the clang
executables into the same location where the LLVM executables are
going. This is wrong, and breaks the Clang build because we try to
create clang++ and clang-cl symlinks in the wrong place and to the
wrong place.
As a stop-gap to get these builds working again, teach the symlink
generation to point into the LLVM executable directory instead.
Alp Toker [Wed, 1 Jan 2014 03:08:43 +0000 (03:08 +0000)]
ExpectAndConsume: Diagnose errors automatically
1) Teach ExpectAndConsume() to emit expected and expected-after diagnostics
using the generic diagnostic descriptions added in r197972, eliminating another
set of trivial err_expected_* variations while maintaining existing behaviour.
2) Lift SkipUntil() recovery out of ExpectAndConsume(). The Expect/Consume
family of functions are primitive parser operations that now have the
well-defined property of operating on single tokens. Factoring out recovery
exposes opportunities for more consistent and tailored error recover at the
call sites instead of just relying on a bottled SkipUntil formula.
Alp Toker [Tue, 31 Dec 2013 03:16:57 +0000 (03:16 +0000)]
Silence g++ 4.9 build issue
lib/ASTMatchers/ASTMatchFinder.cpp:276:28: error: typedef 'traverse_can_only_be_instantiated_with_base_type' locally defined but not used [-Werror=unused-local-typedefs]
traverse_can_only_be_instantiated_with_base_type);
Update RecursiveASTVisitor so that it visits attributes. This is currently
important for thread safety attributes, which contain expressions that were
not being visited, and were thus invisible to various tools. There are now
Visit*Attr methods that can be overridden for every attribute.
NAKAMURA Takumi [Mon, 30 Dec 2013 06:48:30 +0000 (06:48 +0000)]
[CMake][VS][XCode] Restruct the output directory layout more comfortable, ${BINARY_DIR}/${BUILD_MODE}/(bin|lib)
We have been seeing nasty directory layout with CMake multiconfig, such as,
bin/Release/clang.exe
lib/clang/3.x/...
lib/Release/clang/3.x/.. (duplicated)
Move the layout similar to autoconf's;
Release/bin/clang.exe
Release/lib/clang/3.x/...
Checked on Visual Studio 10. Could you guys please confirm my change on XCode(and other multiconfig builders)?
Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, or a certain builder, for eaxample, msbuild.exe, would be confused.
Nico Weber [Mon, 30 Dec 2013 03:43:30 +0000 (03:43 +0000)]
Port r198088 (set NO_DEAD_STRIP for clang) from make to cmake.
Also stop setting passing -dead_strip explicitly for libclang and instead
rely on this now happening by default. (And make it happen by default for
add_clang_library, which doesn't use the library cmake functions from llvm.)
Aaron Ballman [Sun, 29 Dec 2013 18:59:54 +0000 (18:59 +0000)]
Fixing a compile error that recently started happening for me in MSVC 2013. CFGTerminator has an explicit conversion to bool operator that we can make use of instead of using == 0.
Bob Wilson [Sat, 28 Dec 2013 05:26:14 +0000 (05:26 +0000)]
Propagate "-arch x86_64h" setting to the linker. <rdar://problem/15711488>
This is a follow-up to r194907, which added a new -arch setting to make it
easier to specify AVX2 targets. The "-arch x86_64h" option needs to be passed
on to the linker, but it was getting canonicalized to x86_64 by the code
in getArchTypeForDarwinArchName.