]> granicus.if.org Git - clang/log
clang
14 years agoIntroduce the notion of a single "delayed" diagnostic into the
Douglas Gregor [Mon, 22 Mar 2010 15:10:57 +0000 (15:10 +0000)]
Introduce the notion of a single "delayed" diagnostic into the
Diagnostic subsystem, which is used in the rare case where we find a
serious problem (i.e., an inconsistency in the file system) while
we're busy formatting another diagnostic. In this case, the delayed
diagnostic will be emitted after we're done with the other
diagnostic. This is only to be used for fatal conditions detected at
very inconvenient times, where we can neither stop the current
diagnostic in flight nor can we suppress the second error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99175 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen handling a TSK_ExplicitInstantiationDefinition after a
Rafael Espindola [Mon, 22 Mar 2010 14:43:41 +0000 (14:43 +0000)]
When handling a TSK_ExplicitInstantiationDefinition after a
TSK_ExplicitInstantiationDeclaration make sure we call
MaybeMarkVirtualMembersReferenced with a method attached to the definition.

Remove the hack that forced vtable emition with declarations.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99174 91177308-0d34-0410-b5e6-96231b3b80d8

14 years ago-Wshadow should only warn about parameter declarations when we're
John McCall [Mon, 22 Mar 2010 09:20:08 +0000 (09:20 +0000)]
-Wshadow should only warn about parameter declarations when we're
entering a function or block definition, not on every single declaration.
Unfortunately we don't have previous-lookup results around when it's time
to make this decision, so we have to redo the lookup.  The alternative is
to use delayed diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99172 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd very limited support for GCC's '-B' flag. This allows us to support unusual
Chandler Carruth [Mon, 22 Mar 2010 01:52:07 +0000 (01:52 +0000)]
Add very limited support for GCC's '-B' flag. This allows us to support unusual
toolchain configurations and is a small step toward FreeBSD support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99159 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR6618.
Rafael Espindola [Sun, 21 Mar 2010 22:56:43 +0000 (22:56 +0000)]
Fix PR6618.

If a struct has an invalid field, mark it as invalid. Also avoid producing
errors about incomplete types that are invalid.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99150 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoKeep track of the size/modification time of each file source-location
Douglas Gregor [Sun, 21 Mar 2010 22:49:54 +0000 (22:49 +0000)]
Keep track of the size/modification time of each file source-location
entry in a precompiled header, so that we can detect modified files
even when we miss in the stat cache.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99149 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAddThunk should take a const reference.
Anders Carlsson [Sun, 21 Mar 2010 20:27:14 +0000 (20:27 +0000)]
AddThunk should take a const reference.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99140 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR6648 by not creating a temporary with the type of a
Rafael Espindola [Sun, 21 Mar 2010 17:11:05 +0000 (17:11 +0000)]
Fix PR6648 by not creating a temporary with the type of a
CXXExprWithTemporaries.

Not emitting the expression as an aggregate might be the right thing to do,
but is orthogonal. Emitting it as an scalar expression will still try to
create a temporary for the incomplete type of the CXXExprWithTemporaries and
fail.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99134 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDelete the new visitor if an old one already exists.
Ted Kremenek [Sun, 21 Mar 2010 04:38:40 +0000 (04:38 +0000)]
Delete the new visitor if an old one already exists.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99114 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotests: Mangle '-vg' onto the end of the triple when running under valgrind, so
Daniel Dunbar [Sat, 20 Mar 2010 21:13:08 +0000 (21:13 +0000)]
tests: Mangle '-vg' onto the end of the triple when running under valgrind, so
we can use the standard XFAIL and XTARGET to conditional tests based on
valgrind.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99089 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't bother running the analysis for CFG-based warnings if the
Ted Kremenek [Sat, 20 Mar 2010 21:11:09 +0000 (21:11 +0000)]
Don't bother running the analysis for CFG-based warnings if the
declaration is in a system header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99087 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRefactor CFG-based warnings in Sema to be run by a worked object called AnalysisBased...
Ted Kremenek [Sat, 20 Mar 2010 21:06:02 +0000 (21:06 +0000)]
Refactor CFG-based warnings in Sema to be run by a worked object called AnalysisBasedWarnings.
This object controls when the warnings are executed, allowing the client code
in Sema to selectively disable warnings as needed.

Centralizing the logic for analysis-based warnings allows us to optimize
when and how they are run.

Along the way, remove the redundant logic for the 'check fall-through' warning
for blocks; now the same logic is used for both blocks and functions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99085 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFixed synthesizing properties declared in properties (GNU runtime).
David Chisnall [Sat, 20 Mar 2010 19:53:29 +0000 (19:53 +0000)]
Fixed synthesizing properties declared in properties (GNU runtime).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99077 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReapply r99024 (but with the memory issue now fixed).
Ted Kremenek [Sat, 20 Mar 2010 18:02:01 +0000 (18:02 +0000)]
Reapply r99024 (but with the memory issue now fixed).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99064 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCheck if a BugReporterVisitor has already been added to a BugReporterContext.
Ted Kremenek [Sat, 20 Mar 2010 18:01:57 +0000 (18:01 +0000)]
Check if a BugReporterVisitor has already been added to a BugReporterContext.
This avoids redundant diagnostics.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99063 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix use-of-invalid-memory found by Valgrind and Windows buildbots.
Ted Kremenek [Sat, 20 Mar 2010 15:45:06 +0000 (15:45 +0000)]
Fix use-of-invalid-memory found by Valgrind and Windows buildbots.
We were inserting a value into a std::vector<> while iterating over
it, which could cause the underlying memory to get deallocated
and reallocated.  While not the best solution, use an llvm::ImmutableList
for now as it is safely supports insertions during iteration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99058 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Fix thinkos that prevented Clang from picking the right deployment
Daniel Dunbar [Sat, 20 Mar 2010 08:47:42 +0000 (08:47 +0000)]
Driver: Fix thinkos that prevented Clang from picking the right deployment
target when both {MACOSX,IPHONEOS}_DEPLOYMENT_TARGET were set.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99055 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Support CC_PRINT_OPTIONS, used for logging the compile commands (in -v style...
Daniel Dunbar [Sat, 20 Mar 2010 08:01:59 +0000 (08:01 +0000)]
Driver: Support CC_PRINT_OPTIONS, used for logging the compile commands (in -v style) to a file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99054 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Fix -### to quote shell special characters, following gcc.
Daniel Dunbar [Sat, 20 Mar 2010 08:01:53 +0000 (08:01 +0000)]
Driver: Fix -### to quote shell special characters, following gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99053 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd sse4.2 support to this test.
Eric Christopher [Sat, 20 Mar 2010 07:48:45 +0000 (07:48 +0000)]
Add sse4.2 support to this test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99052 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd sse4.2 header and builtin support.
Eric Christopher [Sat, 20 Mar 2010 07:43:28 +0000 (07:43 +0000)]
Add sse4.2 header and builtin support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99051 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
Daniel Dunbar [Sat, 20 Mar 2010 07:04:11 +0000 (07:04 +0000)]
IRgen: Wrap atomic intrinsics with memory barriers, to ensure we honor the semantics.
 - This should be conservatively correct, we eventually should have target hooks for platforms that are less strict.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99050 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEvaluate: Fix a subtle bug in the pointer evaluator in which we would do an
Daniel Dunbar [Sat, 20 Mar 2010 05:53:45 +0000 (05:53 +0000)]
Evaluate: Fix a subtle bug in the pointer evaluator in which we would do an
expression computation in the wrong bit-width, and end up generating a totally
bogus array reference (_g0+8589934546).
 - This showed up on Prolangs/cdecl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99042 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Fix a number of -fapple-kext issues:
Daniel Dunbar [Sat, 20 Mar 2010 04:52:14 +0000 (04:52 +0000)]
Driver: Fix a number of -fapple-kext issues:
 - Disable RTTI.
 - Disable use of __cxa_atexit.
 - Disable unwind tables.
 - Enable freestanding mode.

Also, honor -fhosted correctly.

<rdar://problem/7515383> C++ support: -fapple-kext not honored

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99041 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert r99024, "Augment path diagnostics to include displaying when a message
Daniel Dunbar [Sat, 20 Mar 2010 04:28:39 +0000 (04:28 +0000)]
Revert r99024, "Augment path diagnostics to include displaying when a message
expression", statistical evidence indicates it has some kind of memory error.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99040 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoC++: Add support for -fno-use-cxa-atexit.
Daniel Dunbar [Sat, 20 Mar 2010 04:15:41 +0000 (04:15 +0000)]
C++: Add support for -fno-use-cxa-atexit.
 - So much typing, so little gain...

Also, rename the __cxx_global_initialization function just to match llvm-gcc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99039 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIRgen: Inline GenerateCXXGlobal[VarDecl]InitFunc into sole caller.
Daniel Dunbar [Sat, 20 Mar 2010 04:15:29 +0000 (04:15 +0000)]
IRgen: Inline GenerateCXXGlobal[VarDecl]InitFunc into sole caller.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99038 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement -Wshadow for parameter declarations as well.
John McCall [Sat, 20 Mar 2010 04:12:52 +0000 (04:12 +0000)]
Implement -Wshadow for parameter declarations as well.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99037 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a newline at the end of the file.
Eric Christopher [Sat, 20 Mar 2010 01:19:04 +0000 (01:19 +0000)]
Add a newline at the end of the file.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99026 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor legacy compatibility add a varargs.h header.
Eric Christopher [Sat, 20 Mar 2010 01:18:30 +0000 (01:18 +0000)]
For legacy compatibility add a varargs.h header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99025 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAugment path diagnostics to include displaying when a message expression
Ted Kremenek [Sat, 20 Mar 2010 01:17:30 +0000 (01:17 +0000)]
Augment path diagnostics to include displaying when a message expression
is not evaluated because the receiver is nil.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99024 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Force joining of "-l" "foo", the linker doesn't eat that format.
Daniel Dunbar [Sat, 20 Mar 2010 01:12:03 +0000 (01:12 +0000)]
Driver: Force joining of "-l" "foo", the linker doesn't eat that format.

<rdar://problem/7641151> clang must eat spaces after -l

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99023 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.
Daniel Dunbar [Sat, 20 Mar 2010 01:12:00 +0000 (01:12 +0000)]
Driver: Allow Render{Separate,Joined} option flags on JoinedOrSeparate option types.

Also, simplify/fix SeparateArg::render with forced join.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99022 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix unused variable warning.
Daniel Dunbar [Sat, 20 Mar 2010 01:11:56 +0000 (01:11 +0000)]
Fix unused variable warning.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99021 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMigrate typedefs to the top level of xmmintrin.h and remove the same
Eric Christopher [Sat, 20 Mar 2010 01:08:47 +0000 (01:08 +0000)]
Migrate typedefs to the top level of xmmintrin.h and remove the same
one from emmintrin.h.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99020 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd include for smmintrin.h to this test.
Eric Christopher [Sat, 20 Mar 2010 01:06:48 +0000 (01:06 +0000)]
Add include for smmintrin.h to this test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99019 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDriver: Fix possible crash when targetting an unknown (unsupported) Darwin
Daniel Dunbar [Sat, 20 Mar 2010 00:50:21 +0000 (00:50 +0000)]
Driver: Fix possible crash when targetting an unknown (unsupported) Darwin
platform, e.g. ppc.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99016 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoOptimize region-of-interest based cursor walks through the
Douglas Gregor [Sat, 20 Mar 2010 00:41:21 +0000 (00:41 +0000)]
Optimize region-of-interest based cursor walks through the
preprocessed entities by grouping preprocessed entities by file
ID. This drastically improves performance of repeated
clang_getCursor() calls local tests, although it is a bit ugly.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99015 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoChange CodeGenModule to rely on the Module's symbol table instead of
John McCall [Fri, 19 Mar 2010 23:29:14 +0000 (23:29 +0000)]
Change CodeGenModule to rely on the Module's symbol table instead of
shadowing it in the GlobalDeclMap.  Eliminates the string-uniquing
requirement for mangled names, which should help C++ codegen times a little.
Forces us to do string lookups instead of pointer lookups, which might hurt
codegen times a little across the board.  We'll see how it plays out.

Removing the string-uniquing requirement implicitly fixes any bugs like
PR6635 which arose from the fact that we had multiple uniquing tables for
different kinds of identifiers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99012 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove the capture, serialization, and deserialization of comment
Douglas Gregor [Fri, 19 Mar 2010 22:13:20 +0000 (22:13 +0000)]
Remove the capture, serialization, and deserialization of comment
ranges as part of the ASTContext. This code is not and was never used,
but contributes ~250k to the size of the Cocoa.h precompiled
header.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99007 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRobustify PreprocessingRecord slightly, by only creating macro
Douglas Gregor [Fri, 19 Mar 2010 21:58:23 +0000 (21:58 +0000)]
Robustify PreprocessingRecord slightly, by only creating macro
instantiations when we have the corresponding macro definition and by
removing macro definition information from our table when the macro is
undefined.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99004 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement serialization and lazy deserialization of the preprocessing
Douglas Gregor [Fri, 19 Mar 2010 21:51:54 +0000 (21:51 +0000)]
Implement serialization and lazy deserialization of the preprocessing
record (which includes all macro instantiations and definitions). As
with all lay deserialization, this introduces a new external source
(here, an external preprocessing record source) that loads all of the
preprocessed entities prior to iterating over the entities.

The preprocessing record is an optional part of the precompiled header
that is disabled by default (enabled with
-detailed-preprocessing-record). When the preprocessor given to the
PCH writer has a preprocessing record, that record is written into the
PCH file. When the PCH reader is given a PCH file that contains a
preprocessing record, it will be lazily loaded (which, effectively,
implicitly adds -detailed-preprocessing-record). This is the first
case where we have sections of the precompiled header that are
added/removed based on a compilation flag, which is
unfortunate. However, this data consumes ~550k in the PCH file for
Cocoa.h (out of ~9.9MB), and there is a non-trivial cost to gathering
this detailed preprocessing information, so it's too expensive to turn
on by default. In the future, we should investigate a better encoding
of this information.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@99002 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore coherent diagnostics when ivar is placed n categories.
Fariborz Jahanian [Fri, 19 Mar 2010 21:25:51 +0000 (21:25 +0000)]
More coherent diagnostics when ivar is placed n categories.
(related to radar 7538989).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98993 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach clang_getCursorKindSpelling() about CXCursor_InvalidCode.
Ted Kremenek [Fri, 19 Mar 2010 20:39:05 +0000 (20:39 +0000)]
Teach clang_getCursorKindSpelling() about CXCursor_InvalidCode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98982 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake the CIndex API more resilient to being used on invalid code.
Ted Kremenek [Fri, 19 Mar 2010 20:39:03 +0000 (20:39 +0000)]
Make the CIndex API more resilient to being used on invalid code.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98981 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd test case for <rdar://problem/7770737>.
Ted Kremenek [Fri, 19 Mar 2010 19:45:03 +0000 (19:45 +0000)]
Add test case for  <rdar://problem/7770737>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98979 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoclang -cc1: Kill off -empty-input only, and replace with -init-only which is an
Daniel Dunbar [Fri, 19 Mar 2010 19:44:04 +0000 (19:44 +0000)]
clang -cc1: Kill off -empty-input only, and replace with -init-only which is an
actual action.
 - This is easier to use, and more reliable for timing the thing this was
   actually meant to be useful for.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98978 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPromote enum types during -Wsign-compare. Fixes some spurious warnings,
John McCall [Fri, 19 Mar 2010 18:53:26 +0000 (18:53 +0000)]
Promote enum types during -Wsign-compare.  Fixes some spurious warnings,
mostly during conditional expressions.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98975 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDiagnose conversion of 'Class' to/from objective-c
Fariborz Jahanian [Fri, 19 Mar 2010 18:06:10 +0000 (18:06 +0000)]
Diagnose conversion of 'Class' to/from objective-c
object pointer types.
Fixes radar 7634850.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98970 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake the preprocessing record a PPCallbacks subclass itself,
Douglas Gregor [Fri, 19 Mar 2010 17:12:43 +0000 (17:12 +0000)]
Make the preprocessing record a PPCallbacks subclass itself,
eliminating the extra PopulatePreprocessingRecord object. This will
become useful once we start writing the preprocessing record to
precompiled headers.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98966 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoOptionally store a PreprocessingRecord in the preprocessor itself, and
Douglas Gregor [Fri, 19 Mar 2010 16:15:56 +0000 (16:15 +0000)]
Optionally store a PreprocessingRecord in the preprocessor itself, and
tie its creation to a CC1 flag -detailed-preprocessing-record.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98963 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTry to improve computation of the main file name for debug
Douglas Gregor [Fri, 19 Mar 2010 14:49:09 +0000 (14:49 +0000)]
Try to improve computation of the main file name for debug
information, to address recent gdb failures.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98959 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPretty-print anonymous types using their kind and presumed location.
John McCall [Fri, 19 Mar 2010 07:56:44 +0000 (07:56 +0000)]
Pretty-print anonymous types using their kind and presumed location.
Fixes PR6643.  Patch by Mike M!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98946 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemember the "found declaration" for an overload candidate, which is the
John McCall [Fri, 19 Mar 2010 07:35:19 +0000 (07:35 +0000)]
Remember the "found declaration" for an overload candidate, which is the
entity (if applicable) which was actually looked up.  If a candidate was found
via a using declaration, this is the UsingShadowDecl;  otherwise, if
the candidate is template specialization, this is the template;  otherwise,
this is the function.

The point of this exercise is that "found declarations" are the entities
we do access control for, not their underlying declarations.  Broadly speaking,
this patch fixes access control for using declarations.

There is a *lot* of redundant code calling into the overload-resolution APIs;
we really ought to clean that up.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98945 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a longstanding (but previously unknown) bug in the lazy
Douglas Gregor [Fri, 19 Mar 2010 06:12:06 +0000 (06:12 +0000)]
Fix a longstanding (but previously unknown) bug in the lazy
deserialization of precompiled headers, where the deserialization of
the source location entry for a buffer (e.g., macro instantiation
scratch space) would overwrite a one-element FileID cache in the
source manager. When tickled at the wrong time, we would return the
wrong decomposed source location and eventually cause c-index-test to
crash.

Found by dumb luck. It's amazing this hasn't shown up before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98940 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoVisit preprocessing elements (macro instantiations and macro
Douglas Gregor [Fri, 19 Mar 2010 05:22:59 +0000 (05:22 +0000)]
Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98935 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert 98907 since it is breaking buildbots.
Bob Wilson [Fri, 19 Mar 2010 03:57:57 +0000 (03:57 +0000)]
Revert 98907 since it is breaking buildbots.
--- Reverse-merging r98907 into '.':
D    test/Index/c-index-getCursor-pp.c
U    tools/CIndex/CIndex.cpp

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98929 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoVisit preprocessing elements (macro instantiations and macro
Douglas Gregor [Fri, 19 Mar 2010 00:18:31 +0000 (00:18 +0000)]
Visit preprocessing elements (macro instantiations and macro
definitions) as part of the translation unit, so that normal
visitation, token-annotation, and cursor-at retrieval all see
preprocessing elements.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98907 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen elevating access along an inheritance path, initialize the computed
John McCall [Thu, 18 Mar 2010 23:49:19 +0000 (23:49 +0000)]
When elevating access along an inheritance path, initialize the computed
access to the (elevated) access of the accessed declaration, if applicable,
rather than plunking that access onto the end after we've calculated the
inheritance access.

Also, being a friend of a derived class gives you public access to its
members (subject to later modification by further inheritance);  it does
not simply ignore a single location of restricted inheritance.

Also, when computing the best unprivileged path to a subobject, preserve
the information that the worst path might be AS_none (forbidden) rather
than a minimum of AS_private.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98899 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFor debug information, get the main file name from the source manager
Douglas Gregor [Thu, 18 Mar 2010 23:46:43 +0000 (23:46 +0000)]
For debug information, get the main file name from the source manager
rather than from the -main-file-name flag, since the source manager
has proper path information. Fixes <rdar://problem/7769538>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98898 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTry to appease MSVC's standard library
Douglas Gregor [Thu, 18 Mar 2010 21:28:30 +0000 (21:28 +0000)]
Try to appease MSVC's standard library

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98878 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTry to appease MSVC
Douglas Gregor [Thu, 18 Mar 2010 21:25:12 +0000 (21:25 +0000)]
Try to appease MSVC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98875 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake PredefinedExpr::ComputeName() more robust to incorrect
Ted Kremenek [Thu, 18 Mar 2010 21:23:08 +0000 (21:23 +0000)]
Make PredefinedExpr::ComputeName() more robust to incorrect
code when we are printing the name of an Objective-C method
whose class has not been declared.  Fixes <rdar://problem/7495713>.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98874 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd bounds check in PCHReader. when reading source file entry record
Ted Kremenek [Thu, 18 Mar 2010 21:23:05 +0000 (21:23 +0000)]
Add bounds check in PCHReader. when reading source file entry record

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98873 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSome cleanup, change diagnostic when assigning to
Fariborz Jahanian [Thu, 18 Mar 2010 18:50:41 +0000 (18:50 +0000)]
Some cleanup, change diagnostic when assigning to
a property which is not lvalue.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98848 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoExplicitly link macro instantiations to macro definitions in the
Douglas Gregor [Thu, 18 Mar 2010 18:23:03 +0000 (18:23 +0000)]
Explicitly link macro instantiations to macro definitions in the
preprocessing record. Use that link with clang_getCursorReferenced()
and clang_getCursorDefinition() to match instantiations of a macro to
the definition of the macro.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98842 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoExpose macro definitions as CIndex cursors. These can still only be
Douglas Gregor [Thu, 18 Mar 2010 18:04:21 +0000 (18:04 +0000)]
Expose macro definitions as CIndex cursors. These can still only be
generated by clang_annotateTokens().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98837 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIntroduce the notion of a "preprocessing record", which keeps track of
Douglas Gregor [Thu, 18 Mar 2010 17:52:52 +0000 (17:52 +0000)]
Introduce the notion of a "preprocessing record", which keeps track of
the macro definitions and macro instantiations that are found
during preprocessing. Preprocessing records are *not* generated by
default; rather, we provide a PPCallbacks subclass that hooks into the
existing callback mechanism to record this activity.

The only client of preprocessing records is CIndex, which keeps track
of macro definitions and instantations so that they can be exposed via
cursors. At present, only token annotation uses these facilities, and
only for macro instantiations; both will change in the near
future. However, with this change, token annotation properly annotates
macro instantiations that do not produce any tokens and instantiations
of macros that are later undef'd, improving our consistency.

Preprocessing directives that are not macro definitions are still
handled by clang_annotateTokens() via re-lexing, so that we don't have
to track every preprocessing directive in the preprocessing record.

Performance impact of preprocessing records is still TBD, although it
is limited to CIndex and therefore out of the path of the main compiler.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98836 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReplace some SmallVectors with arrays.
Benjamin Kramer [Thu, 18 Mar 2010 16:59:57 +0000 (16:59 +0000)]
Replace some SmallVectors with arrays.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98833 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDefang
Douglas Gregor [Thu, 18 Mar 2010 15:37:47 +0000 (15:37 +0000)]
Defang

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98827 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore token-annotation experimentation, preprocessing the annotated
Douglas Gregor [Thu, 18 Mar 2010 15:23:44 +0000 (15:23 +0000)]
More token-annotation experimentation, preprocessing the annotated
token sequence to detect macro instantiations (that produce at least
token). WIP.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98826 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDefang a test that's failing intermittently on windows
Douglas Gregor [Thu, 18 Mar 2010 14:59:12 +0000 (14:59 +0000)]
Defang a test that's failing intermittently on windows

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98825 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix 80 col violation
Kovarththanan Rajaratnam [Thu, 18 Mar 2010 13:56:20 +0000 (13:56 +0000)]
Fix 80 col violation

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98823 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimply tags target
Kovarththanan Rajaratnam [Thu, 18 Mar 2010 13:52:43 +0000 (13:52 +0000)]
Simply tags target

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98822 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofrom code inspection, we were treating placement news with one argument as
John McCall [Thu, 18 Mar 2010 08:19:33 +0000 (08:19 +0000)]
from code inspection, we were treating placement news with one argument as
non-placement news when selecting the corresponding operator delete;  this is
fixed.
Access and ambiguity control for calls to operator new and delete.  Also AFAICT

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98818 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMake some typedefs private
Kovarththanan Rajaratnam [Thu, 18 Mar 2010 07:45:30 +0000 (07:45 +0000)]
Make some typedefs private

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98817 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRename variable to indicate what it is being used for
Kovarththanan Rajaratnam [Thu, 18 Mar 2010 07:18:10 +0000 (07:18 +0000)]
Rename variable to indicate what it is being used for

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98816 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRedeclaration lookups for parameter names should be flagged as redeclaration lookups
John McCall [Thu, 18 Mar 2010 06:42:38 +0000 (06:42 +0000)]
Redeclaration lookups for parameter names should be flagged as redeclaration lookups
so they don't trigger diagnostics like (say) access control.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98806 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoBump clang minor version (1.5).
Ted Kremenek [Thu, 18 Mar 2010 04:39:55 +0000 (04:39 +0000)]
Bump clang minor version (1.5).

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98801 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRefactor argument checking in CallAndMessageChecker to be the same
Ted Kremenek [Thu, 18 Mar 2010 03:22:29 +0000 (03:22 +0000)]
Refactor argument checking in CallAndMessageChecker to be the same
for both CallExprs and ObjCMessageExprs.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98800 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWhen dumping vtables, also dump the thunks.
Anders Carlsson [Thu, 18 Mar 2010 02:44:19 +0000 (02:44 +0000)]
When dumping vtables, also dump the thunks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98799 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDetect pass-by-value arguments that are structs that contain
Ted Kremenek [Thu, 18 Mar 2010 02:17:27 +0000 (02:17 +0000)]
Detect pass-by-value arguments that are structs that contain
uninitialized data.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98796 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTweak dead stores checker to not emit a warning when initialization
Ted Kremenek [Thu, 18 Mar 2010 01:22:39 +0000 (01:22 +0000)]
Tweak dead stores checker to not emit a warning when initialization
a scalar variable with a scalar parameter.  This is a
form of defensive programming.  If the variable is unused,
it will be caused by -Wunused-variable.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98795 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify code (and remove 'dyn_cast') by using ObjCProperyDecl::findPropertyDecl().
Ted Kremenek [Thu, 18 Mar 2010 01:22:36 +0000 (01:22 +0000)]
Simplify code (and remove 'dyn_cast') by using ObjCProperyDecl::findPropertyDecl().

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98794 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTurn several PCH reader assertions into compiler errors, thus making
Ted Kremenek [Thu, 18 Mar 2010 00:56:54 +0000 (00:56 +0000)]
Turn several PCH reader assertions into compiler errors, thus making
the PCHReader more robust to corrupt or invalid PCH files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98788 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoExperimental stab at using relexing to identify preprocessor
Douglas Gregor [Thu, 18 Mar 2010 00:42:48 +0000 (00:42 +0000)]
Experimental stab at using relexing to identify preprocessor
directives while annotating tokens in CIndex. This functionality
should probably be factored out of this routine, but we're not there
yet.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98786 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMore work on thunks.
Anders Carlsson [Wed, 17 Mar 2010 20:06:32 +0000 (20:06 +0000)]
More work on thunks.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98765 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement non-dependent friend functions and classes.
John McCall [Wed, 17 Mar 2010 20:01:29 +0000 (20:01 +0000)]
Implement non-dependent friend functions and classes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98764 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoActOnTagDefinitionError is supposed to 'unwind' ActOnTagStartDefinition, not
John McCall [Wed, 17 Mar 2010 19:25:57 +0000 (19:25 +0000)]
ActOnTagDefinitionError is supposed to 'unwind' ActOnTagStartDefinition, not
ActOnStartCXXMemberDeclaration.  We haven't started the field collector on this
class yet, so don't stop it.  Fixes a crash in the VS buildbot and a memory error
on all the others.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98760 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoReduce the default alignment for ASTContext and Stmt/Expr allocation
Douglas Gregor [Wed, 17 Mar 2010 18:46:59 +0000 (18:46 +0000)]
Reduce the default alignment for ASTContext and Stmt/Expr allocation
from 16 bytes to 8 bytes, since we don't ever use those low 4
bits. Should save some storage.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98754 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoXFAIL this test on that silly Windows platform. Grrr
Douglas Gregor [Wed, 17 Mar 2010 18:28:02 +0000 (18:28 +0000)]
XFAIL this test on that silly Windows platform. Grrr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98750 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove this test. It is causing problems has has relatively little value
Douglas Gregor [Wed, 17 Mar 2010 16:04:04 +0000 (16:04 +0000)]
Remove this test. It is causing problems has has relatively little value

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98730 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove warning about shadowing a built-in; built-ins aren't actually
Douglas Gregor [Wed, 17 Mar 2010 16:03:44 +0000 (16:03 +0000)]
Remove warning about shadowing a built-in; built-ins aren't actually
considered to be a part of the translation unit unless they're named
in a way that brings them into existence.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98729 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoEntering the main source file in the preprocessor can fail if the
Douglas Gregor [Wed, 17 Mar 2010 15:44:30 +0000 (15:44 +0000)]
Entering the main source file in the preprocessor can fail if the
source file has been changed. Handle that failure more gracefully.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98727 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCheck the inode in addition to size and modification time to determine
Douglas Gregor [Wed, 17 Mar 2010 15:33:06 +0000 (15:33 +0000)]
Check the inode in addition to size and modification time to determine
whether a file has changed since it was originally read.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98726 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse a simple diagnostic (file modified) when we detect that a file has
Douglas Gregor [Wed, 17 Mar 2010 15:30:15 +0000 (15:30 +0000)]
Use a simple diagnostic (file modified) when we detect that a file has
changed, rather than trying to point out how it changed. The "why"
doesn't matter.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98725 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify error path using OwningPtr
Kovarththanan Rajaratnam [Wed, 17 Mar 2010 09:47:30 +0000 (09:47 +0000)]
Simplify error path using OwningPtr

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98722 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSimplify ProcessWarningOptions since it can't fail
Kovarththanan Rajaratnam [Wed, 17 Mar 2010 09:36:02 +0000 (09:36 +0000)]
Simplify ProcessWarningOptions since it can't fail

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98721 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove useless forward decl.
Kovarththanan Rajaratnam [Wed, 17 Mar 2010 09:25:49 +0000 (09:25 +0000)]
Remove useless forward decl.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98720 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoIssue a proper diagnostic if we couldn't open dump file
Kovarththanan Rajaratnam [Wed, 17 Mar 2010 09:24:48 +0000 (09:24 +0000)]
Issue a proper diagnostic if we couldn't open dump file

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98719 91177308-0d34-0410-b5e6-96231b3b80d8