]> granicus.if.org Git - clang/log
clang
13 years agoANSI C requires that a call to an unprototyped function type succeed
John McCall [Wed, 21 Sep 2011 08:08:30 +0000 (08:08 +0000)]
ANSI C requires that a call to an unprototyped function type succeed
if the definition has a non-variadic prototype with compatible
parameters.  Therefore, the default rule for such calls must be to
use a non-variadic convention.  Achieve this by casting the callee to
the function type with which it is required to be compatible, unless
the target specifically opts out and insists that unprototyped calls
should use the variadic rules.  The only case of that I'm aware of is
the x86-64 convention, which passes arguments the same way in both
cases but also sets a small amount of extra information;  here we seek
to maintain compatibility with GCC, which does set this when calling
an unprototyped function.

Addresses PR10810 and PR10713.

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

13 years ago[microsoft] Move missing typename warning from -fms-extensions to -fms-compatibility...
Francois Pichet [Wed, 21 Sep 2011 07:59:49 +0000 (07:59 +0000)]
[microsoft] Move missing typename warning from -fms-extensions to -fms-compatibility. Also allow the missing typename warning at function scope.

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

13 years agoFix MSVC9 build by providing a full comparator object to lower_bound.
Benjamin Kramer [Wed, 21 Sep 2011 06:42:26 +0000 (06:42 +0000)]
Fix MSVC9 build by providing a full comparator object to lower_bound.

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

13 years agoChange:
Richard Trieu [Wed, 21 Sep 2011 02:50:14 +0000 (02:50 +0000)]
Change:

  assert(!"error message");

To:

  assert(0 && "error message");

which is more consistant across the code base.

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

13 years agoChange "ivar" to true for a boolean function argument. Since string literals are...
Richard Trieu [Wed, 21 Sep 2011 02:46:06 +0000 (02:46 +0000)]
Change "ivar" to true for a boolean function argument.  Since string literals are cast to true, this should no effect on behavior.

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

13 years agoAdd case labels for Mips64 architectures.
Akira Hatanaka [Wed, 21 Sep 2011 02:13:07 +0000 (02:13 +0000)]
Add case labels for Mips64 architectures.

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

13 years ago[analyzer] Fix a bug where PathDiagnosticLocation did not generate a valid range...
Anna Zaks [Wed, 21 Sep 2011 00:35:58 +0000 (00:35 +0000)]
[analyzer] Fix a bug where PathDiagnosticLocation did not generate a valid range and add asserts to check validity of locations early on. Ignore invalid ranges in PathDiagnosticPiece (they could be added by checker writers).

Addresses radar://10124836 and radar://radar10102244.

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

13 years ago[ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.
Argyrios Kyrtzidis [Tue, 20 Sep 2011 23:49:22 +0000 (23:49 +0000)]
[ARC] Allow forming 'id*' in an unevaluated context. Fixes rdar://10148540.

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

13 years ago[PCH] Don't store the source range for each preprocessed entity since
Argyrios Kyrtzidis [Tue, 20 Sep 2011 23:27:41 +0000 (23:27 +0000)]
[PCH] Don't store the source range for each preprocessed entity since
we already have the range in the PPEntityOffsets array.

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

13 years ago[PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntity
Argyrios Kyrtzidis [Tue, 20 Sep 2011 23:27:38 +0000 (23:27 +0000)]
[PCH] Merge ASTReader::LoadPreprocessedEntity with ReadPreprocessedEntity
and don't store the ID for each preprocessed entity.

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

13 years ago[libclang] When pointing at a macro expansion inside a macro argument,
Argyrios Kyrtzidis [Tue, 20 Sep 2011 23:27:33 +0000 (23:27 +0000)]
[libclang] When pointing at a macro expansion inside a macro argument,
return a cursor for the inner macro.

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Remove SourceRange member from PathDiagno...
Anna Zaks [Tue, 20 Sep 2011 23:27:32 +0000 (23:27 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Remove SourceRange member from PathDiagnosticLocation - FullSourceLoc Loc and PathDiagnosticRange Range are sufficient.

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Add comments. Remove the last constructor...
Anna Zaks [Tue, 20 Sep 2011 22:43:32 +0000 (22:43 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Add comments. Remove the last constructor which could allow invalid locations to slip in.

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

13 years ago[analyzer] Remove dead code. (This code is trying to implement the idea that PathDiag...
Anna Zaks [Tue, 20 Sep 2011 22:30:48 +0000 (22:30 +0000)]
[analyzer] Remove dead code. (This code is trying to implement the idea that PathDiagnosticClient could implement DiagnosticClient and has been dead for a while).

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

13 years agoIn SourceManager::translateLineCol, handle the case where we are pointing
Argyrios Kyrtzidis [Tue, 20 Sep 2011 22:14:54 +0000 (22:14 +0000)]
In SourceManager::translateLineCol, handle the case where we are pointing
directly at the end of the source file.

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

13 years agoRemove PreprocessingDirectiveKind since it's not necessary.
Argyrios Kyrtzidis [Tue, 20 Sep 2011 22:14:52 +0000 (22:14 +0000)]
Remove PreprocessingDirectiveKind since it's not necessary.

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

13 years agoThe location of the name in MacroDefinition is the beginning of its range,
Argyrios Kyrtzidis [Tue, 20 Sep 2011 22:14:48 +0000 (22:14 +0000)]
The location of the name in MacroDefinition is the beginning of its range,
don't store an extra location for it.

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

13 years agoMove Microsoft access specifier bug emulation from -fms-extensions to -fm-compatibility.
Francois Pichet [Tue, 20 Sep 2011 22:08:26 +0000 (22:08 +0000)]
Move Microsoft access specifier bug emulation from -fms-extensions to -fm-compatibility.

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

13 years agoFor i386 kext fallback to llvm-gcc, search paths for several Darwin versions.
Bob Wilson [Tue, 20 Sep 2011 22:00:38 +0000 (22:00 +0000)]
For i386 kext fallback to llvm-gcc, search paths for several Darwin versions.

This replaces the hack to read UNAME_RELEASE from the environment when
identifying the OS version on Darwin, and it's more flexible.  It's also
horribly ugly, but at least this consolidates the ugliness to touch less of
the code so that it will be easier to rip out later.

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Make PathDiagnosticLocation(SourceLocatio...
Anna Zaks [Tue, 20 Sep 2011 21:38:35 +0000 (21:38 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Make PathDiagnosticLocation(SourceLocation...) private. Most of the effort here goes to making BugReport refer to a PathDiagnosticLocation instead of FullSourceLocation.

(Another step closer to the goal of having Diagnostics which can recover from invalid SourceLocations.)

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Use the pre-computed Range and Location...
Anna Zaks [Tue, 20 Sep 2011 21:25:00 +0000 (21:25 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Use the pre-computed Range and Location for profile.

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

13 years ago[driver] Default to arm mode when using the integrated assembler.
Chad Rosier [Tue, 20 Sep 2011 20:44:06 +0000 (20:44 +0000)]
[driver] Default to arm mode when using the integrated assembler.
rdar://10125227

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

13 years agoFix a problem in digraph handling where "[:" might be treated as "<::" and
Richard Trieu [Tue, 20 Sep 2011 20:03:50 +0000 (20:03 +0000)]
Fix a problem in digraph handling where "[:" might be treated as "<::" and
erronously trigger the digraph correction fix-it.  Include a new test to catch
this in the future.

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

13 years agoDefine Mips64 TargetInfo classes.
Akira Hatanaka [Tue, 20 Sep 2011 19:21:49 +0000 (19:21 +0000)]
Define Mips64 TargetInfo classes.

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

13 years agoSort exports list.
Ted Kremenek [Tue, 20 Sep 2011 19:02:45 +0000 (19:02 +0000)]
Sort exports list.

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

13 years agoClean up TargetInfo class hierarchy. Define a base class from which TargetInfos
Akira Hatanaka [Tue, 20 Sep 2011 19:00:23 +0000 (19:00 +0000)]
Clean up TargetInfo class hierarchy. Define a base class from which TargetInfos
of Mips32 big and little endian derive.

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

13 years agoCreate a MipsTargetCodeGenInfo object for mips64/mips64el. The size of the
Akira Hatanaka [Tue, 20 Sep 2011 18:30:57 +0000 (18:30 +0000)]
Create a MipsTargetCodeGenInfo object for mips64/mips64el. The size of the
UnwindException structure is 32 for mips64.

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Use PointerUnion of LocationContext and...
Anna Zaks [Tue, 20 Sep 2011 18:23:52 +0000 (18:23 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Use PointerUnion of LocationContext and AnalysisContext to support creation of PathDiagnosticLocations for checkers which no context sensitivity.

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

13 years agoAdd a parameter to MipsTargetCodeGenInfo's constructor.
Akira Hatanaka [Tue, 20 Sep 2011 18:23:28 +0000 (18:23 +0000)]
Add a parameter to MipsTargetCodeGenInfo's constructor.

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

13 years agoIntroduce an egregious hack for modules to cope with headers that come
Douglas Gregor [Tue, 20 Sep 2011 18:13:03 +0000 (18:13 +0000)]
Introduce an egregious hack for modules to cope with headers that come
from unfriendly (== not at all modularized) directories. This is
temporary, and it only affects module construction until I'll figured
out how to deal with system headers.

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

13 years agoRemove __WCHAR_UNSIGNED__ and anything that used it.
Eric Christopher [Tue, 20 Sep 2011 18:05:01 +0000 (18:05 +0000)]
Remove __WCHAR_UNSIGNED__ and anything that used it.

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

13 years agoTest commit
DeLesley Hutchins [Tue, 20 Sep 2011 17:25:59 +0000 (17:25 +0000)]
Test commit

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Lazily query LocationContext for a Parent...
Anna Zaks [Tue, 20 Sep 2011 16:37:36 +0000 (16:37 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Lazily query LocationContext for a ParentMap as needed.

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

13 years ago[analyzer] Remove LocationContext and a dependency from PathDiagnosticLoaction.
Anna Zaks [Tue, 20 Sep 2011 16:23:37 +0000 (16:23 +0000)]
[analyzer] Remove LocationContext and a dependency from PathDiagnosticLoaction.

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

13 years agoClarify PNaCl target characteristics: set LongDoubleWidth, PtrDiffType, IntPtrType,
Ivan Krasin [Tue, 20 Sep 2011 14:56:54 +0000 (14:56 +0000)]
Clarify PNaCl target characteristics: set LongDoubleWidth, PtrDiffType, IntPtrType,
change __builtin_va_list to from a structure to int[4] (same alignment
and size, but with a simpler representation). Patch by David Meyer!

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

13 years agoRemove redundant break statements, and replace asserts with llvm_unreachable
Peter Collingbourne [Tue, 20 Sep 2011 12:40:26 +0000 (12:40 +0000)]
Remove redundant break statements, and replace asserts with llvm_unreachable

Per John's review comments for r140068.

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

13 years agoFix a crash-on-invalid with bad CV-qualification on 'this' in the
John McCall [Tue, 20 Sep 2011 06:21:28 +0000 (06:21 +0000)]
Fix a crash-on-invalid with bad CV-qualification on 'this' in the
presence of an implicit move assignment operator.  I think the implicit
copy assignment operator case was also wrong, but just in a "displaying
the wrong diagnostic" way.

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

13 years agoFix a pretty nasty bug in noreturn destructors that cascaded into lots
Chandler Carruth [Tue, 20 Sep 2011 04:55:26 +0000 (04:55 +0000)]
Fix a pretty nasty bug in noreturn destructors that cascaded into lots
of false positive warnings that depend on noreturn destructors pruning
the CFGs, but only in C++0x mode!

This was really surprising as the debugger quickly reveals that the
attributes are parsed correctly (and using the same code) in both modes.
The warning fires in the same way in both modes. But between parsing and
building the destructor declaration with the noreturn attribute and the
warning, it magically disappears. The key? The 'noexcept' appears!

When we were rebuilding the destructor type with the computed implicit
noexcept we completely dropped the old type on the floor. This almost
makes sense (as the arguments and return type to a destructor aren't
exactly unpredictable), but lost any function type attributes as well.
The fix is simple, we build the new type off of the old one rather than
starting fresh.

Testing this is a bit awkward. I've done it by running the
noreturn-sensitive tests in both modes, which previous failed and now
passes, but if anyone has ideas about how to more specifically and
thoroughly test that the extended info on a destructor is preserved when
adding noexcept, I'm all ears.

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

13 years ago[analyzer] Refactor PathDiagnosticLocation: Pre-compute Range and Location with gen...
Anna Zaks [Tue, 20 Sep 2011 01:51:40 +0000 (01:51 +0000)]
[analyzer] Refactor PathDiagnosticLocation: Pre-compute Range and Location with gen methods on object creation instead of computing on demand. This would allow to remove dependency on the other members which help with construction and might not even be valid at later stages (to be removed later on).

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

13 years ago[analyzer] Use more create methods in the PathDiagnostic, cleanup.
Anna Zaks [Tue, 20 Sep 2011 01:38:47 +0000 (01:38 +0000)]
[analyzer] Use more create methods in the PathDiagnostic, cleanup.

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

13 years agoDon't assume that the clause is a GlobalVariable. It could be a constant.
Bill Wendling [Tue, 20 Sep 2011 00:40:19 +0000 (00:40 +0000)]
Don't assume that the clause is a GlobalVariable. It could be a constant.

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

13 years ago[analyzer] BugReport has a profile method, so reuse it here.
Anna Zaks [Mon, 19 Sep 2011 23:44:31 +0000 (23:44 +0000)]
[analyzer] BugReport has a profile method, so reuse it here.

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

13 years ago[analyzer] Add a convinience method.
Anna Zaks [Mon, 19 Sep 2011 23:18:44 +0000 (23:18 +0000)]
[analyzer] Add a convinience method.

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

13 years ago[analyzer] Constify a method.
Anna Zaks [Mon, 19 Sep 2011 23:17:48 +0000 (23:17 +0000)]
[analyzer] Constify a method.

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

13 years agoAdd list initialization for complex numbers in C. Essentially, this allows "_Complex...
Eli Friedman [Mon, 19 Sep 2011 23:17:44 +0000 (23:17 +0000)]
Add list initialization for complex numbers in C.  Essentially, this allows "_Complex float x = {1.0f, 2.0f};".  See changes to docs/LanguageExtensions.html for a longer description.

<rdar://problem/9397672>.

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

13 years agoThe eh.selector intrinsic isn't used anymore. Replace the check here with a
Bill Wendling [Mon, 19 Sep 2011 22:08:36 +0000 (22:08 +0000)]
The eh.selector intrinsic isn't used anymore. Replace the check here with a
check for the landingpad instruction instead. This check looks at each of the
clauses in the landingpad instruction. If it's a catch clause, it compares the
name directly with the global. If it's a filter clause, it has to look through
each value in the filer to see if any have the prefix.

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

13 years agoFix gcc build.
Argyrios Kyrtzidis [Mon, 19 Sep 2011 22:02:08 +0000 (22:02 +0000)]
Fix gcc build.

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

13 years agoOpenCL: introduce support for function scope __local variables
Peter Collingbourne [Mon, 19 Sep 2011 21:14:35 +0000 (21:14 +0000)]
OpenCL: introduce support for function scope __local variables

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

13 years ago[PCH] The range map for SLoc offsets is a reversed one, not negated.
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:54:44 +0000 (20:54 +0000)]
[PCH] The range map for SLoc offsets is a reversed one, not negated.

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

13 years agoIn libclang, when visiting preprocessed entities in a source range, use
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:48 +0000 (20:40 +0000)]
In libclang, when visiting preprocessed entities in a source range, use
PreprocessingRecord's getPreprocessedEntitiesInRange.

Also remove all the stuff that were added in ASTUnit that are unnecessary now
that we do a binary search for preprocessed entities and deserialize only
what is necessary.

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

13 years agoIntroduce local_begin()/local_end() methods in PreprocessingRecord which
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:42 +0000 (20:40 +0000)]
Introduce local_begin()/local_end() methods in PreprocessingRecord which
return iterators for local, non-loaded, preprocessed entities.

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

13 years agoIn CodeGenAction::ExecuteAction() use SourceManager::translateFileLineCol()
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:38 +0000 (20:40 +0000)]
In CodeGenAction::ExecuteAction() use SourceManager::translateFileLineCol()
instead of getLocation() since we don't care about expanded macro arguments.

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

13 years ago[libclang] When getting a source location from a file:line:col triplet
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:35 +0000 (20:40 +0000)]
[libclang] When getting a source location from a file:line:col triplet
check whether the requested location points inside the precompiled preamble,
in which case the returned source location will be a "loaded" one.

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

13 years agoBreak SourceManager::translateFileLineCol into translateLineCol that returns the
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:29 +0000 (20:40 +0000)]
Break SourceManager::translateFileLineCol into translateLineCol that returns the
source location of line:col of a specific FileID.

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

13 years agoIntroduce PreprocessingRecord::getPreprocessedEntitiesInRange()
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:25 +0000 (20:40 +0000)]
Introduce PreprocessingRecord::getPreprocessedEntitiesInRange()
which will do a binary search and return a pair of iterators
for preprocessed entities in the given source range.

Source ranges of preprocessed entities are stored twice currently in
the PCH/Module file but this will be fixed in a subsequent commit.

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

13 years agoRename SourceLocation::getFileLocWithOffset -> getLocWithOffset.
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:19 +0000 (20:40 +0000)]
Rename SourceLocation::getFileLocWithOffset -> getLocWithOffset.

It already works (and is useful with) macro locs as well.

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

13 years agoMake ASTReader/ASTWriter friends of SourceLocation. They already
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:08 +0000 (20:40 +0000)]
Make ASTReader/ASTWriter friends of SourceLocation. They already
depend on internal knowledge of SourceLocation.

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

13 years agoIntroduce isLoadedSourceLocation() and isLocalSourceLocation() methods in SourceManager.
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:05 +0000 (20:40 +0000)]
Introduce isLoadedSourceLocation() and isLocalSourceLocation() methods in SourceManager.

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

13 years agoConst-ify some methods in ASTReader.
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:40:02 +0000 (20:40 +0000)]
Const-ify some methods in ASTReader.

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

13 years agoFor SourceManager::isBeforeInTranslationUnit, a location pointing
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:39:57 +0000 (20:39 +0000)]
For SourceManager::isBeforeInTranslationUnit, a location pointing
inside a macro argument should be regarded as coming before
the location of the expanded tokens.

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

13 years ago[PCH] Preload the PreloadSLocEntries through the SourceManager and
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:39:54 +0000 (20:39 +0000)]
[PCH] Preload the PreloadSLocEntries through the SourceManager and
don't call ReadSLocEntryRecord() directly because the entry may have
already been loaded in which case calling ReadSLocEntryRecord()
directly would trigger an assertion in SourceManager.

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

13 years agoFor SourceManager::isBeforeInTranslationUnit, when one location
Argyrios Kyrtzidis [Mon, 19 Sep 2011 20:39:51 +0000 (20:39 +0000)]
For SourceManager::isBeforeInTranslationUnit, when one location
points at the inclusion/expansion point of the other, regard this
as coming before the other.

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

13 years agoThrow the switch to convert clang to the new exception handling model!
Bill Wendling [Mon, 19 Sep 2011 20:31:14 +0000 (20:31 +0000)]
Throw the switch to convert clang to the new exception handling model!

This model uses the 'landingpad' instruction, which is pinned to the top of the
landing pad. (A landing pad is defined as the destination of the unwind branch
of an invoke instruction.) All of the information needed to generate the correct
exception handling metadata during code generation is encoded into the
landingpad instruction.

The new 'resume' instruction takes the place of the llvm.eh.resume intrinsic
call. It's lowered in much the same way as the intrinsic is.

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

13 years agoChanges to the name lookup have caused a regression in the digraph fix-it hint.
Richard Trieu [Mon, 19 Sep 2011 19:01:00 +0000 (19:01 +0000)]
Changes to the name lookup have caused a regression in the digraph fix-it hint.
For instance:

template <class T> void E() {};
class F {};

void test() {
 ::E<::F>();
 E<::F>();
}

Gives the following error messages:

error: found '<::' after a template name which forms the
     digraph '<:' (aka '[') and a ':', did you mean '< ::'?
 ::E<::F>();
    ^~~
    < ::
error: expected expression
 E<::F>();
    ^
error: expected ']'
note: to match this '['
 E<::F>();

This patch adds the digraph fix-it check right before the name lookup,
moves the shared checking code to a new function, and adds new
tests to catch future regressions.

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

13 years agoTighten check to match an ivar with corresponding property by using ObjCImplementatio...
Devang Patel [Mon, 19 Sep 2011 18:54:16 +0000 (18:54 +0000)]
Tighten check to match an ivar with corresponding property by using ObjCImplementationDecl.
Radar 10139522 - Part 1.

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

13 years agoFix a QoI bug with overloaded operators inside macros.
Matt Beaumont-Gay [Mon, 19 Sep 2011 18:51:20 +0000 (18:51 +0000)]
Fix a QoI bug with overloaded operators inside macros.

We were failing to set source locations and ranges in isUnusedResultAWarning
for CXXOperatorCallExprs, leading to an "expression result unused" warning
with absolutely no context if the expression was inside a macro.

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

13 years agoobjc - some refactoring of my last 'self' patch.
Fariborz Jahanian [Mon, 19 Sep 2011 18:06:07 +0000 (18:06 +0000)]
objc - some refactoring of my last 'self' patch.

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

13 years agoIn apple-kext mode, use external linkage for explicit template instantiations
John McCall [Mon, 19 Sep 2011 18:05:26 +0000 (18:05 +0000)]
In apple-kext mode, use external linkage for explicit template instantiations
instead of internal linkage.

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

13 years agoCurContext cannot be null ever.
Fariborz Jahanian [Mon, 19 Sep 2011 16:32:32 +0000 (16:32 +0000)]
CurContext cannot be null ever.

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

13 years agoRemoved an unused field and its accessors methods.
Erik Verbruggen [Mon, 19 Sep 2011 15:10:40 +0000 (15:10 +0000)]
Removed an unused field and its accessors methods.

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

13 years agoFirst test commit.
Erik Verbruggen [Mon, 19 Sep 2011 15:03:11 +0000 (15:03 +0000)]
First test commit.

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

13 years agoIn constructors, don't generate implicit initializers for members of anonymous struct...
Richard Smith [Mon, 19 Sep 2011 13:34:43 +0000 (13:34 +0000)]
In constructors, don't generate implicit initializers for members of anonymous structs contained within anonymous unions.

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

13 years agoRemove function which is unused as of r139996. Thanks to David Blaikie for bringing...
Richard Smith [Mon, 19 Sep 2011 11:19:27 +0000 (11:19 +0000)]
Remove function which is unused as of r139996. Thanks to David Blaikie for bringing this to my attention.

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

13 years agoDo not use builtin includes if -fms-compatibility is specified. Some MSVC header...
Francois Pichet [Mon, 19 Sep 2011 05:15:54 +0000 (05:15 +0000)]
Do not use builtin includes if -fms-compatibility is specified. Some MSVC header files have the same name as clang's builtins, this creates clash.

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

13 years agoMove the "jump bypasses variable initialization" error -> warning downgrade from...
Francois Pichet [Sun, 18 Sep 2011 21:48:27 +0000 (21:48 +0000)]
Move the "jump bypasses variable initialization" error -> warning downgrade from -fms-extensions to -fms-compatibility.

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

13 years agoIn Microsoft mode(-fms-compatibility), prefer an integral conversion to a floating...
Francois Pichet [Sun, 18 Sep 2011 21:37:37 +0000 (21:37 +0000)]
In Microsoft mode(-fms-compatibility), prefer an integral conversion to a floating-to-integral conversion if the integral conversion is between types of the same size.

For example:
 void f(float);
 void f(int);
 int main {
    long a;
    f(a);
 }
Here, MSVC will call f(int) instead of generating a compile error as clang will do in standard mode.
This fixes a few errors when parsing MFC code with clang.

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

13 years agoPR10304: Do not call destructors for data members from union destructors. Prior to...
Richard Smith [Sun, 18 Sep 2011 12:11:43 +0000 (12:11 +0000)]
PR10304: Do not call destructors for data members from union destructors. Prior to C++11, this
has no effect since any such destructors must be trivial, and in C++11 such destructors must not
be called.

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

13 years agoPR10954: variant members should not be implicitly initialized in constructors if no
Richard Smith [Sun, 18 Sep 2011 11:14:50 +0000 (11:14 +0000)]
PR10954: variant members should not be implicitly initialized in constructors if no
mem-initializer is specified for them, unless an in-class initializer is specified.

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

13 years agoFix PR10531. Attach an initializer to anonymous unions, since the default constructor...
Richard Smith [Sun, 18 Sep 2011 00:06:34 +0000 (00:06 +0000)]
Fix PR10531. Attach an initializer to anonymous unions, since the default constructor might not be trivial (if there is an in-class initializer for some member) and might be deleted.

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

13 years agoLet -Warray-bounds handle casted array types without false positives.
Nico Weber [Sat, 17 Sep 2011 22:59:41 +0000 (22:59 +0000)]
Let -Warray-bounds handle casted array types without false positives.

Fixes PR10771.

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

13 years agoobjc - Treat type of 'self' in class methods as root of
Fariborz Jahanian [Sat, 17 Sep 2011 19:23:40 +0000 (19:23 +0000)]
objc - Treat type of 'self' in class methods as root of
class of this method. // rdar://10109725

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

13 years agoobjc: Don't crash with decl context for property impl.
Fariborz Jahanian [Sat, 17 Sep 2011 18:48:50 +0000 (18:48 +0000)]
objc: Don't crash with decl context for property impl.
is missing. // rdar//10127639

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

13 years agoRename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that...
Francois Pichet [Sat, 17 Sep 2011 17:15:52 +0000 (17:15 +0000)]
Rename LangOptions::Microsoft to LangOptions::MicrosoftExt to make it clear that this flag must be used only for Microsoft extensions and not emulation; to avoid confusion with the new LangOptions::MicrosoftMode flag.

Many of the code now under LangOptions::MicrosoftExt will eventually be moved under the LangOptions::MicrosoftMode flag.

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

13 years agoWhen we load header file information from the external source (i.e.,
Douglas Gregor [Sat, 17 Sep 2011 05:35:18 +0000 (05:35 +0000)]
When we load header file information from the external source (i.e.,
the AST reader), merge that header file information with whatever
header file information we already have. Otherwise, we might forget
something we already knew (e.g., that the header was #import'd already).

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

13 years agoAs per discussion with Doug Gregor on the IRC channel, introduce a new compiler switc...
Francois Pichet [Sat, 17 Sep 2011 04:32:15 +0000 (04:32 +0000)]
As per discussion with Doug Gregor on the IRC channel, introduce a new compiler switch: -fms-compatility.

Microsoft specific tweaking will now fall into 2 categories:

    - fms-extension: Microsoft specific extensions that should never change the meaning of an otherwise well formed code. Currently map to LangOptions::Microsoft. (To be clearer, I am planning to change the name to LangOptions::MicrosoftExt).

    - fms-compatibility: Really a MSVC emulation mode. Map to LangOptions::MicrosoftMode. Can change the meaning of an otherwise standard conformant program.

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

13 years agoPass -fmodule-cache-path along to -cc1 properly
Douglas Gregor [Sat, 17 Sep 2011 02:20:28 +0000 (02:20 +0000)]
Pass -fmodule-cache-path along to -cc1 properly

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

13 years agoWith modules, we can end up loading a new module after we've seen an
Douglas Gregor [Sat, 17 Sep 2011 00:05:03 +0000 (00:05 +0000)]
With modules, we can end up loading a new module after we've seen an
arbitrary amount of code. This forces us to stage the AST writer more
strictly, ensuring that we don't assign a declaration ID to a
declaration until after we're certain that no more modules will get
loaded.

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

13 years agoIn Microsoft mode, warn if an indirect goto jump over a variable initialization.
Francois Pichet [Fri, 16 Sep 2011 23:15:32 +0000 (23:15 +0000)]
In Microsoft mode, warn if an indirect goto jump over a variable initialization.
Also add a test case for the non Microsoft case because such test didn't exist.

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

13 years agoFix massive LiveVariables regression (due to LiveVariables rewrite) by addressing...
Ted Kremenek [Fri, 16 Sep 2011 23:01:39 +0000 (23:01 +0000)]
Fix massive LiveVariables regression (due to LiveVariables rewrite) by addressing two performance problems:

- Speed of "merge()", which merged data flow facts.  This was doing a set canonicalization on every insertion, which was super slow.
  To fix this, we use ImmutableSetRef.

- Visit CFGBlocks in reverse postorder.  This is a huge speedup, as on some test cases the algorithm would take many iterations
  to converge.

This contains a bunch of copy-paste from UninitializedValues.cpp and ThreadSafety.cpp.  The idea
was to get something working first, and then refactor the common logic for all three files into
a separate analysis/library entry point.

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

13 years agoFix search paths for Ubuntu 11.04 x86. Patch by Stepan Dyatkovskiy.
Eli Friedman [Fri, 16 Sep 2011 21:04:38 +0000 (21:04 +0000)]
Fix search paths for Ubuntu 11.04 x86.  Patch by Stepan Dyatkovskiy.

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

13 years ago[analyzer] Refactor: make PathDiagnosticLocation responsible for validation of Source...
Anna Zaks [Fri, 16 Sep 2011 19:18:30 +0000 (19:18 +0000)]
[analyzer] Refactor: make PathDiagnosticLocation responsible for validation of SourceLocations (commit 5 of ?):
 - Get rid of PathDiagnosticLocation(SourceRange r,..) constructor by providing a bunch of create methods.
 - The PathDiagnosticLocation(SourceLocation L,..), which is used by crate methods, will eventually become private.
 - Test difference is in the case when the report starts at the beginning of the function. We used to represent that point as a range of the very first token in the first statement. Now, it's just a single location representing the first character of the first statement.

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

13 years agotest/CodeGen/sse-builtins.c: Make this host-independent to unbreak posix-unlike hosts.
NAKAMURA Takumi [Fri, 16 Sep 2011 03:55:36 +0000 (03:55 +0000)]
test/CodeGen/sse-builtins.c: Make this host-independent to unbreak posix-unlike hosts.

Without -ffreestanding, clang tries to seek /usr/include/stdlib.h in host filesystem, even on Windows hosts.

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

13 years agoMoves calls of checkArithmeticNull() from CreateBuiltinBinOp() into the individual...
Richard Trieu [Fri, 16 Sep 2011 00:53:10 +0000 (00:53 +0000)]
Moves calls of checkArithmeticNull() from CreateBuiltinBinOp() into the individual Check*Operands() functions.

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

13 years agoThread safety: Adding FIXMEs and a couple cleanups
Caitlin Sadowski [Fri, 16 Sep 2011 00:35:54 +0000 (00:35 +0000)]
Thread safety: Adding FIXMEs and a couple cleanups

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

13 years agoTweak the module auto-import heuristics a bit
Douglas Gregor [Fri, 16 Sep 2011 00:22:46 +0000 (00:22 +0000)]
Tweak the module auto-import heuristics a bit

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

13 years agoRemove no longer needed LHSType and RHSType from checkArithmeticNull()
Richard Trieu [Thu, 15 Sep 2011 23:57:21 +0000 (23:57 +0000)]
Remove no longer needed LHSType and RHSType from checkArithmeticNull()

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

13 years agoChange checkArithmeticNull() to use a NonNullType, instead of checking both the
Richard Trieu [Thu, 15 Sep 2011 23:51:29 +0000 (23:51 +0000)]
Change checkArithmeticNull() to use a NonNullType, instead of checking both the
LHSType and RHSType for everything.

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

13 years agoRemove standard library includes from test; they explode on Windows.
Eli Friedman [Thu, 15 Sep 2011 23:24:35 +0000 (23:24 +0000)]
Remove standard library includes from test; they explode on Windows.

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

13 years agoTweak *mmintrin.h so that they don't make any bad assumptions about alignment (which...
Eli Friedman [Thu, 15 Sep 2011 23:15:27 +0000 (23:15 +0000)]
Tweak *mmintrin.h so that they don't make any bad assumptions about alignment (which probably has little effect in practice, but better to get it right).  Make the load in _mm_loadh_pi and _mm_loadl_pi a single LLVM IR instruction to make optimizing easier for CodeGen.

rdar://10054986

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

13 years agoAdd an experimental flag -fauto-module-import that automatically turns
Douglas Gregor [Thu, 15 Sep 2011 22:00:41 +0000 (22:00 +0000)]
Add an experimental flag -fauto-module-import that automatically turns
#include or #import direcctives of framework headers into module
imports of the corresponding framework module.

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