Re: [PATCH] D11815: Pass subtarget feature "force-align-stack"

2015-09-01 Thread Akira Hatanaka via cfe-commits
ahatanak added a comment.

In http://reviews.llvm.org/D11815#236368, @vkalintiris wrote:

> In http://reviews.llvm.org/D11815#235394, @ahatanak wrote:
>
> >
>




> For example, on a Mips target, where the O32 ABI requires either way an 
> 8-byte alignment, we would generate redundant code for realigning the stack 
> to a 4-byte alignment if a function contains objects with maximum alignment 
> of 4-bytes (see attached files to get an idea).


I wonder if there is a target or a use case that requires or prefers realigning 
the stack to an alignment that is smaller than the default stack alignment.  If 
there is no such target or use case, I think we can just using the existing 
attribute StackAlignment (with value 0) rather than adding a new function 
attribute "stackrealign", which will ensure the stack is at least aligned to 
the default value and force realigning the stack.


http://reviews.llvm.org/D11815



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Aaron Ballman via cfe-commits
On Tue, Sep 1, 2015 at 12:43 PM, Renato Golin  wrote:
> On 1 September 2015 at 15:49, Aaron Ballman via cfe-commits
>  wrote:
>> Author: aaronballman
>> Date: Tue Sep  1 09:49:24 2015
>> New Revision: 246548
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=246548=rev
>> Log:
>> Add a new frontend warning for referencing members from the handler of a 
>> constructor or destructor function-try-block, which is UB in C++.
>
> Hi Aaron,
>
> Could this be yours?
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/3246
>
> Seems like bad codegen, possibly a 32-bit issue? This is ok on the
> AArch64 bots, have you seen any problem in x86-32 ones?

It seems unlikely as this shouldn't effect codegen. None of the other
bots seem to be red because it either. FWIW, my tests were 32-bit x86
on Windows 10 with MSVC 2015.

This was the only failure report I've received thus far, but I'll
definitely keep my eyes open to see if there's a pattern somewhere.

~Aaron

>
> cheers,
> --renato
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r246575 - Add \n to the regex in clang-tidy-diff.py in order to fix http://llvm.org/PR24637,

2015-09-01 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Tue Sep  1 14:08:17 2015
New Revision: 246575

URL: http://llvm.org/viewvc/llvm-project?rev=246575=rev
Log:
Add \n to the regex in clang-tidy-diff.py in order to fix 
http://llvm.org/PR24637,
git usecase for multiple files diff.


Modified:
clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py

Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=246575=246574=246575=diff
==
--- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
+++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Tue Sep  1 
14:08:17 2015
@@ -67,7 +67,7 @@ def main():
   filename = None
   lines_by_file = {}
   for line in sys.stdin:
-match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)
+match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\n\"]*)' % args.p, line)
 if match:
   filename = match.group(2)
 if filename == None:


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246565 - Pull initFeatureMap out of line now that it's used in multiple places.

2015-09-01 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Tue Sep  1 13:13:20 2015
New Revision: 246565

URL: http://llvm.org/viewvc/llvm-project?rev=246565=rev
Log:
Pull initFeatureMap out of line now that it's used in multiple places.

Modified:
cfe/trunk/include/clang/Basic/TargetInfo.h
cfe/trunk/lib/Basic/TargetInfo.cpp

Modified: cfe/trunk/include/clang/Basic/TargetInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetInfo.h?rev=246565=246564=246565=diff
==
--- cfe/trunk/include/clang/Basic/TargetInfo.h (original)
+++ cfe/trunk/include/clang/Basic/TargetInfo.h Tue Sep  1 13:13:20 2015
@@ -746,15 +746,7 @@ public:
   /// \return False on error (invalid features).
   virtual bool initFeatureMap(llvm::StringMap ,
   DiagnosticsEngine , StringRef CPU,
-  std::vector ) const {
-for (const auto  : FeatureVec) {
-  const char *Name = F.c_str();
-  // Apply the feature via the target.
-  bool Enabled = Name[0] == '+';
-  setFeatureEnabled(Features, Name + 1, Enabled);
-}
-return true;
-  }
+  std::vector ) const;
 
   /// \brief Get the ABI currently in use.
   virtual StringRef getABI() const { return StringRef(); }

Modified: cfe/trunk/lib/Basic/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/TargetInfo.cpp?rev=246565=246564=246565=diff
==
--- cfe/trunk/lib/Basic/TargetInfo.cpp (original)
+++ cfe/trunk/lib/Basic/TargetInfo.cpp Tue Sep  1 13:13:20 2015
@@ -311,6 +311,18 @@ void TargetInfo::adjust(const LangOption
   }
 }
 
+bool TargetInfo::initFeatureMap(llvm::StringMap ,
+DiagnosticsEngine , StringRef CPU,
+std::vector ) const {
+  for (const auto  : FeatureVec) {
+const char *Name = F.c_str();
+// Apply the feature via the target.
+bool Enabled = Name[0] == '+';
+setFeatureEnabled(Features, Name + 1, Enabled);
+  }
+  return true;
+}
+
 
//===--===//
 
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r245683 - Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.

2015-09-01 Thread Yaron Keren via cfe-commits
Hi,

In the other thread (search for ... 0ca9a2b from bartek-w) he provided a
regex with two more changes beyond adding \n.
Here are all three regexes:

pre-r245683
 match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
r245683
 match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)
bartek-w
 match = re.search('^+++\ \"?(.?/){%s}([^ \t\"\n])' % args.p, line)

in bartek-w version, + are not escaped which I do not understand why as +
is a special character in Python regex (see
https://docs.python.org/2/library/re.html) and  and the star after [^
\t\"\n] is missing.
Not wishing to break any working code I asked for the broken diff example
to test against before comitting and so far didn't get a reply.

Anyhow, adding the \n is safe and I've commited it now on r246575 but I'm
still not clear about the other two regex changes.
I'll update the bug report accordingly.

Yaron



2015-09-01 18:52 GMT+03:00 Alexander Kornienko :
>
> Looks like this patch broke handling of multiple files:
https://llvm.org/PR24637
>
> Can you take a look at this?
>
> On Fri, Aug 21, 2015 at 12:56 PM, Yaron Keren 
wrote:
>>
>> Whenever is any special character in the filename, such as space or
backslash (Windows), some examples:
>>
>> On Windows:
>> --- ".\\a.cpp"  2015-08-21 00:22:57.885370200 +0300
>> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>>
>> --- ./a.cpp 2015-08-21 00:22:57.885370200 +0300
>> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>>
>> --- "a a.cpp"   2015-08-21 00:22:57.885370200 +0300
>> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>>
>> On Linux:
>> ~$ diff -U0 ./a.cpp b\ b.cpp
>> --- ./a.cpp 2015-08-14 00:27:03.569276652 +0300
>> +++ "b b.cpp"   2015-08-21 13:54:26.787896719 +0300
>>
>> filename with space will break current clang-tidy-diff.py on all
platforms, the regular expression does not match quotes.
>> There is surely some Python package to process filenames correctly if
this ever become a problem.
>>
>>
>> 2015-08-21 13:37 GMT+03:00 Alexander Kornienko :
>>>
>>> On Fri, Aug 21, 2015 at 11:27 AM, Yaron Keren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

 Author: yrnkrn
 Date: Fri Aug 21 04:27:24 2015
 New Revision: 245683

 URL: http://llvm.org/viewvc/llvm-project?rev=245683=rev
 Log:
 Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput
>>>
>>>
>>> Out of curiosity, when does this happen? (I mean quotes around the file
name)
>>>




 Modified:
 clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py

 Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
 URL:
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683=245682=245683=diff

==
 --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
(original)
 +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri Aug
21 04:27:24 2015
 @@ -67,7 +67,7 @@ def main():
filename = None
lines_by_file = {}
for line in sys.stdin:
 -match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
 +match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p,
line)
  if match:
filename = match.group(2)
  if filename == None:


 ___
 cfe-commits mailing list
 cfe-commits@lists.llvm.org
 http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12453: [CUDA] Allow function overloads based on host/device attributes.

2015-09-01 Thread Eli Bendersky via cfe-commits
eliben accepted this revision.
eliben added a comment.
This revision is now accepted and ready to land.

The CUDA parts look very good. Someone else should approve the 
overloading-related logic



Comment at: include/clang/Sema/Sema.h:8605
@@ +8604,3 @@
+
+  CUDAFunctionPreference IdentifyCUDAPreference(const FunctionDecl *Caller,
+const FunctionDecl *Callee);

Document this function

[I realize the other CUDA functions are not documented here :-(, but hey this 
is new code so it should follow the rules]


Comment at: lib/Sema/SemaCUDA.cpp:98
@@ +97,3 @@
+  assert(Callee && "Callee must be valid.");
+  CUDAFunctionTarget CallerTarget =
+ Caller ? IdentifyCUDATarget(Caller) : Sema::CFT_Host,

Yes, I believe this is the accepted style when comparing pointers for 
null-ness. 


Comment at: lib/Sema/SemaCUDA.cpp:106
@@ +105,3 @@
+
+  // (a) Can't call global from global until we support dynamic execution.
+  if (CalleeTarget == CFT_Global &&

Not just global from global. global from device too, right? As for global from 
HD, the CUDA guide forbids it


Comment at: lib/Sema/SemaChecking.cpp:529
@@ -528,3 +528,3 @@
   // of the arch we are compiling for.
-  if (BuiltinID >= Builtin::FirstTSBuiltin) {
+  if (Context.BuiltinInfo.isTSBuiltin(BuiltinID)) {
 switch (Context.getTargetInfo().getTriple().getArch()) {

Is this part related to this patch?


http://reviews.llvm.org/D12453



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246534 - [modules] When emitting line tables, only emit filenames that are actually referenced by the entries that we emit.

2015-09-01 Thread Richard Smith via cfe-commits
On Tue, Sep 1, 2015 at 1:12 AM, NAKAMURA Takumi 
wrote:

> FYI,
>
> MultiOnDiskHashTable.h:108   delete T;
> It is crashing.
>
> Modules/cxx-templates.cpp can fail if target is i686-pc-win32.
>

Does this happen when building with Clang, or just when building with MSVC?


> On Tue, Sep 1, 2015 at 5:09 PM Yaron Keren via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Hi Richard,
>>
>> Since yesterday I see several clang test failures which *may* be related
>> to the series of patches of modules you comitted. These are:
>>  Clang :: Modules/cxx-templates.cpp
>>  Clang :: Modules/submodules-merge-defs.cpp
>>  Clang :: PCH/cxx-key-functions.cpp
>>  Clang :: PCH/cxx-templates.cpp
>>
>> (failing as of r246534)
>>
>> You can see these failing on clang-x64-ninja-win7 bot but you did not get
>> e-mail since it was masked by other test failing before them:
>>
>> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/4522
>>
>> or on Takumi bot:
>>
>> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2923
>>
>> The bots do not seem to printout details, so here is debug stack dump
>> with symbols for the three tests failing. The fourth one prints huge AST.
>>
>> Could you have a look?
>>
>>
>>   FAIL: Clang :: Modules/cxx-templates.cpp (4128 of 23311)
>> TEST 'Clang :: Modules/cxx-templates.cpp' FAILED
>> 
>>Script:
>>--
>>rm -rf
>> C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
>> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
>> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>>ery
>> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>> -I C:\
>>llvm-clean\tools\clang\test\Modules/Inputs
>> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>>-dump-lookups | C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE
>> C:\llvm-clean\tools\clang\test\Modul
>>es\cxx-templates.cpp --check-prefix=CHECK-GLOBAL
>>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
>> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
>> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>>ery
>> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>> -I C:\
>>llvm-clean\tools\clang\test\Modules/Inputs
>> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>>-dump-lookups -ast-dump-filter N |
>> C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\too
>>ls\clang\test\Modules\cxx-templates.cpp
>> --check-prefix=CHECK-NAMESPACE-N
>>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
>> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
>> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>>ery
>> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>> -I C:\
>>llvm-clean\tools\clang\test\Modules/Inputs
>> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>>-dump -ast-dump-filter SomeTemplate |
>> C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\
>>tools\clang\test\Modules\cxx-templates.cpp --check-prefix=CHECK-DUMP
>>C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
>> C:\llvm-clean\msvc\RELWITHDEBINFO
>>\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
>> -fmodules -fimplicit-module-maps -fno-modules-error-recovery
>>
>>  
>> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>> -I C:\llvm
>>-clean\tools\clang\test\Modules/Inputs
>> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
>>C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
>> C:\llvm-clean\msvc\RELWITHDEBINFO
>>\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
>> -fmodules -fimplicit-module-maps -fno-modules-error-recovery
>>
>>  
>> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>> -I C:\llvm
>>-clean\tools\clang\test\Modules/Inputs
>> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
>>-DEARLY_IMPORT
>>--
>>Exit Code: 2
>>
>>Command Output (stdout):
>>--
>>Command 0: "rm" "-rf"
>> "C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp"
>>Command 0 Result: 0
>>Command 0 Output:
>>
>>
>>Command 0 Stderr:
>>
>>
>>Command 1: "not" "C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE"
>> "-cc1" "-internal-isystem" "C:\llvm-c
>>

Re: r246546 - Reverting r246497 (which requires also reverting r246524 and r246521 to avoid merge conflicts). It broke the build on MSVC 2015. It also broke an MSVC 2013 bot with testing issues.

2015-09-01 Thread Yaron Keren via cfe-commits
Thanks!


2015-09-01 16:24 GMT+03:00 Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org>:

> Author: aaronballman
> Date: Tue Sep  1 08:24:39 2015
> New Revision: 246546
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246546=rev
> Log:
> Reverting r246497 (which requires also reverting r246524 and r246521 to
> avoid merge conflicts). It broke the build on MSVC 2015. It also broke an
> MSVC 2013 bot with testing issues.
>
> llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
> error C2065: 'Files': undeclared identifier
>
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2917
>
> Removed:
> cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h
> Modified:
> cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> cfe/trunk/include/clang/Serialization/ASTReader.h
> cfe/trunk/include/clang/Serialization/ASTWriter.h
> cfe/trunk/include/clang/Serialization/Module.h
> cfe/trunk/lib/Serialization/ASTReader.cpp
> cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
> cfe/trunk/lib/Serialization/ASTReaderInternals.h
> cfe/trunk/lib/Serialization/ASTWriter.cpp
> cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
> cfe/trunk/lib/Serialization/Module.cpp
> cfe/trunk/test/Modules/cxx-templates.cpp
> cfe/trunk/test/Modules/merge-using-decls.cpp
>
> Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=246546=246545=246546=diff
>
> ==
> --- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
> +++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Tue Sep  1
> 08:24:39 2015
> @@ -1530,23 +1530,4 @@ namespace clang {
>}
>  } // end namespace clang
>
> -namespace llvm {
> -  template <> struct
> DenseMapInfo {
> -static clang::serialization::DeclarationNameKey getEmptyKey() {
> -  return clang::serialization::DeclarationNameKey(-1, 1);
> -}
> -static clang::serialization::DeclarationNameKey getTombstoneKey() {
> -  return clang::serialization::DeclarationNameKey(-1, 2);
> -}
> -static unsigned
> -getHashValue(const clang::serialization::DeclarationNameKey ) {
> -  return Key.getHash();
> -}
> -static bool isEqual(const clang::serialization::DeclarationNameKey ,
> -const clang::serialization::DeclarationNameKey
> ) {
> -  return L == R;
> -}
> -  };
> -}
> -
>  #endif
>
> Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=246546=246545=246546=diff
>
> ==
> --- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
> +++ cfe/trunk/include/clang/Serialization/ASTReader.h Tue Sep  1 08:24:39
> 2015
> @@ -282,8 +282,9 @@ class ReadMethodPoolVisitor;
>
>  namespace reader {
>class ASTIdentifierLookupTrait;
> -  /// \brief The on-disk hash table(s) used for DeclContext name lookup.
> -  struct DeclContextLookupTable;
> +  /// \brief The on-disk hash table used for the DeclContext's Name
> lookup table.
> +  typedef
> llvm::OnDiskIterableChainedHashTable
> +ASTDeclContextNameLookupTable;
>  }
>
>  } // end namespace serialization
> @@ -506,10 +507,6 @@ private:
>/// \brief Map from the TU to its lexical contents from each module
> file.
>std::vector> TULexicalDecls;
>
> -  /// \brief Map from a DeclContext to its lookup tables.
> -  llvm::DenseMap - serialization::reader::DeclContextLookupTable> Lookups;
> -
>// Updates for visible decls can occur for other contexts than just the
>// TU, and when we read those update records, the actual context may not
>// be available yet, so have this pending map using the ID as a key. It
> @@ -517,6 +514,7 @@ private:
>struct PendingVisibleUpdate {
>  ModuleFile *Mod;
>  const unsigned char *Data;
> +unsigned BucketOffset;
>};
>typedef SmallVector DeclContextVisibleUpdates;
>
> @@ -1091,10 +1089,6 @@ public:
>  Visit(GetExistingDecl(ID));
>}
>
> -  /// \brief Get the loaded lookup tables for \p Primary, if any.
> -  const serialization::reader::DeclContextLookupTable *
> -  getLoadedLookupTables(DeclContext *Primary) const;
> -
>  private:
>struct ImportedModule {
>  ModuleFile *Mod;
> @@ -1876,13 +1870,6 @@ public:
>/// Note: overrides method in ExternalASTSource
>Module *getModule(unsigned ID) override;
>
> -  /// \brief Retrieve the module file with a given local ID within the
> specified
> -  /// ModuleFile.
> -  ModuleFile *getLocalModuleFile(ModuleFile , unsigned ID);
> -
> -  /// \brief Get an ID for the given module file.
> -  unsigned getModuleFileID(ModuleFile *M);
> -
>/// \brief Return a descriptor 

Re: [PATCH] D12247: [libc++] remove possible trailing padding from aligned_storage

2015-09-01 Thread Yiran Wang via cfe-commits
yiranwang added a comment.

Thanks for testing.
There is proof as the following, given that alignment of _Aligner is _Align 
(the whole purpose of _Aligner here, which we do not want to double check), and 
for any type, the "sizeof" is always multiple of "alignof", this change should 
be ABI compatible.
Are we good to go?


http://reviews.llvm.org/D12247



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246573 - Fix typo in test

2015-09-01 Thread Eli Bendersky via cfe-commits
Author: eliben
Date: Tue Sep  1 13:56:19 2015
New Revision: 246573

URL: http://llvm.org/viewvc/llvm-project?rev=246573=rev
Log:
Fix typo in test

Modified:
cfe/trunk/test/Preprocessor/init.c

Modified: cfe/trunk/test/Preprocessor/init.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Preprocessor/init.c?rev=246573=246572=246573=diff
==
--- cfe/trunk/test/Preprocessor/init.c (original)
+++ cfe/trunk/test/Preprocessor/init.c Tue Sep  1 13:56:19 2015
@@ -1,8 +1,8 @@
-/PtrDiffType / RUN: %clang_cc1 -E -dM -x assembler-with-cpp < /dev/null | 
FileCheck -check-prefix ASM %s
+// RUN: %clang_cc1 -E -dM -x assembler-with-cpp < /dev/null | FileCheck 
-check-prefix ASM %s
 //
 // ASM:#define __ASSEMBLER__ 1
 //
-// 
+//
 // RUN: %clang_cc1 -fblocks -E -dM < /dev/null | FileCheck -check-prefix 
BLOCKS %s
 //
 // BLOCKS:#define __BLOCKS__ 1


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Renato Golin via cfe-commits
On 1 September 2015 at 18:15, Aaron Ballman  wrote:
> It seems unlikely as this shouldn't effect codegen. None of the other
> bots seem to be red because it either. FWIW, my tests were 32-bit x86
> on Windows 10 with MSVC 2015.

Ok, I cleared the stage2 build directory, let's see how this build goes...

http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/3248

--reanto
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11664: [CUDA] Implemented additional processing steps needed to link with CUDA libdevice bitcode.

2015-09-01 Thread Eric Christopher via cfe-commits
echristo accepted this revision.
echristo added a comment.
This revision is now accepted and ready to land.

The ternary is a bit ugly, but LGTM. :)

-eric


http://reviews.llvm.org/D11664



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12262: [OpenMP] Capture global variables in target regions.

2015-09-01 Thread Samuel Antao via cfe-commits
sfantao added inline comments.


Comment at: lib/Sema/SemaOpenMP.cpp:702
@@ +701,3 @@
+  return true;
+}
+  }

Alexey, after rebasing this patch with the latest changes, I started having a 
regression related with how `DSAStack->hasDirective` works. In my understanding 
it requires that a valid scope exists in the stack, or alternatively  that 2 or 
more entries exist in the stack. In some cases `DSAStack->hasDirective` was 
being called with only one entry causing the iterators in there not to work 
properly. The fix for that was adding `DSAStack->getCurScope()`. It seems to be 
a harmless change, but still wanted to make sure you agree with that.

Thanks!


http://reviews.llvm.org/D12262



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12381: [Static Analyzer] Merge the Objective-C Generics Checker into Dynamic Type Propagation checker.

2015-09-01 Thread Gábor Horváth via cfe-commits
xazax.hun marked an inline comment as not done.


Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:81
@@ +80,3 @@
+initBugType();
+SmallString<64> Buf;
+llvm::raw_svector_ostream OS(Buf);

zaks.anna wrote:
> How do we know that the string is big enough?
When the string is not big enough, there will be an allocation. So this is not 
a correctness issue. However I checked that, and the error messages tend to be 
very long. I could either increase the size of this smallstring to something 
like 150 which should be enough for the common of the cases, or I could just 
make it a string. Which one do you prefer?


Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:179
@@ -178,3 @@
-  // We only track dynamic type info for regions.
-  const MemRegion *ToR = C.getSVal(CastE).getAsRegion();
-  if (!ToR)

zaks.anna wrote:
> This line used to be unconditional and now, it's only executed if we are 
> casting between ObjC Types.
It should not be a problem. The code bellow only executes for bitcasts, and 
getBetterObjCType only returns a valid value, when the cast was between Obj-C 
types.


Comment at: lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp:407
@@ +406,3 @@
+// Clean up the states stored by the generics checker.
+void DynamicTypePropagation::checkDeadSymbols(SymbolReaper ,
+  CheckerContext ) const {

zaks.anna wrote:
> Do you know if the info tracked by the DynamicTypeInfo checker gets cleaned 
> up for dead symbols?
That information is stored in DynamicTypeMap which is populated in 
lib/StaticAnalyzer/Core/ProgramState.cpp

I could not find any cleanup code. What do you think, what would be the best 
way to do the cleanup. Exposing a removeDynamicTypeInfo method from the 
ProgramState does not seem to be elegant, but it would work.


http://reviews.llvm.org/D12381



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11664: [CUDA] Implemented additional processing steps needed to link with CUDA libdevice bitcode.

2015-09-01 Thread Artem Belevich via cfe-commits
tra updated the summary for this revision.
tra updated this revision to Diff 33713.
tra added a comment.

Updated the patch to use bitcode linker to perform selective linking and 
internalizing.
Removed Internalize+GDCE passes.


http://reviews.llvm.org/D11664

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  lib/CodeGen/BackendUtil.cpp
  lib/CodeGen/CodeGenAction.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenCUDA/Inputs/device-code.ll
  test/CodeGenCUDA/link-device-bitcode.cu

Index: test/CodeGenCUDA/link-device-bitcode.cu
===
--- /dev/null
+++ test/CodeGenCUDA/link-device-bitcode.cu
@@ -0,0 +1,61 @@
+// Test for linking with CUDA's libdevice as outlined in
+// http://llvm.org/docs/NVPTXUsage.html#linking-with-libdevice
+//
+// REQUIRES: nvptx-registered-target
+//
+// Prepare bitcode file to link with
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -emit-llvm-bc -o %t.bc \
+// RUN:%S/Inputs/device-code.ll
+//
+// Make sure function in device-code gets linked in and internalized.
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
+// RUN:-mlink-bitcode-file %t.bc -fcuda-uses-libdevice -emit-llvm \
+// RUN:-disable-llvm-passes -o - %s \
+// RUN:| FileCheck %s -check-prefix CHECK-IR
+//
+// Make sure function in device-code gets linked but is not internalized
+// without -fcuda-uses-libdevice
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
+// RUN:-mlink-bitcode-file %t.bc -emit-llvm \
+// RUN:-disable-llvm-passes -o - %s \
+// RUN:| FileCheck %s -check-prefix CHECK-IR-NLD
+//
+// NVVMReflect is a target-specific pass runs after -emit-llvm prints
+// IR, so we need to check NVPTX to make sure that the pass did happen
+// and __nvvm_reflect calls were eliminated.
+// RUN: %clang_cc1 -triple nvptx-unknown-cuda -fcuda-is-device \
+// RUN:-mlink-bitcode-file %t.bc -fcuda-uses-libdevice -S -o - %s \
+// RUN:| FileCheck %s -check-prefix CHECK-PTX
+
+#include "Inputs/cuda.h"
+
+__device__ float device_mul_or_add(float a, float b);
+extern "C" __device__ double __nv_sin(double x);
+extern "C" __device__ double __nv_exp(double x);
+
+// CHECK-IR-LABEL: define void @_Z26should_not_be_internalizedPf(
+// CHECK-PTX-LABEL: .visible .func _Z26should_not_be_internalizedPf(
+__device__ void should_not_be_internalized(float *data) {}
+
+// Make sure kernel call has not been internalized.
+// CHECK-IR-LABEL: define void @_Z6kernelPfS_
+// CHECK-PTX-LABEL: .visible .entry _Z6kernelPfS_(
+__global__ __attribute__((used)) void kernel(float *out, float *in) {
+  *out = device_mul_or_add(in[0], in[1]);
+  *out += __nv_exp(__nv_sin(*out));
+  should_not_be_internalized(out);
+}
+
+// Make sure device_mul_or_add() is present in IR, is internal and
+// calls __nvvm_reflect().
+// CHECK-IR-LABEL: define internal float @_Z17device_mul_or_addff(
+// CHECK-IR-NLD-LABEL: define float @_Z17device_mul_or_addff(
+// CHECK-IR: call i32 @__nvvm_reflect
+// CHECK-IR: ret float
+
+// By the time device_mul_or_add() makes it to PTX, __nvvm_reflect references
+// should be gone.
+// CHECK-PTX-NOT: .visible
+// CHECK-PTX-LABEL: .func  (.param .b32 func_retval0) _Z17device_mul_or_addff(
+// CHECK-PTX-NOT: __nvvm_reflect
+// CHECK-PTX: ret;
Index: test/CodeGenCUDA/Inputs/device-code.ll
===
--- /dev/null
+++ test/CodeGenCUDA/Inputs/device-code.ll
@@ -0,0 +1,38 @@
+; Simple bit of IR to mimic CUDA's libdevice. We want to be
+; able to link with it and we need to make sure all __nvvm_reflect
+; calls are eliminated by the time PTX has been produced.
+
+target triple = "nvptx-unknown-cuda"
+
+declare i32 @__nvvm_reflect(i8*)
+
+@"$str" = private addrspace(1) constant [8 x i8] c"USE_MUL\00"
+
+define void @unused_subfunc(float %a) {
+   ret void
+}
+
+define void @used_subfunc(float %a) {
+   ret void
+}
+
+define float @_Z17device_mul_or_addff(float %a, float %b) {
+  %reflect = call i32 @__nvvm_reflect(i8* addrspacecast (i8 addrspace(1)* getelementptr inbounds ([8 x i8], [8 x i8] addrspace(1)* @"$str", i32 0, i32 0) to i8*))
+  %cmp = icmp ne i32 %reflect, 0
+  br i1 %cmp, label %use_mul, label %use_add
+
+use_mul:
+  %ret1 = fmul float %a, %b
+  br label %exit
+
+use_add:
+  %ret2 = fadd float %a, %b
+  br label %exit
+
+exit:
+  %ret = phi float [%ret1, %use_mul], [%ret2, %use_add]
+
+  call void @used_subfunc(float %ret)
+
+  ret float %ret
+}
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -1406,6 +1406,9 @@
   if (Args.hasArg(OPT_fcuda_is_device))
 Opts.CUDAIsDevice = 1;
 
+  if (Args.hasArg(OPT_fcuda_uses_libdevice))
+Opts.CUDAUsesLibDevice = 1;
+
   if (Args.hasArg(OPT_fcuda_allow_host_calls_from_host_device))
 

Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Aaron Ballman via cfe-commits
On Tue, Sep 1, 2015 at 2:10 PM, Renato Golin  wrote:
> On 1 September 2015 at 18:17, Renato Golin  wrote:
>> Ok, I cleared the stage2 build directory, let's see how this build goes...
>>
>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/3248
>
> Nah, there is something definitely wrong with that. I'll bisect here
> to make sure it wasn't your patch.
>
> For now, the other buildbots should cover for the other breakages, so
> we can keep this one failing until we're sure of it.

I just got a notice for a similar failure:
http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2130

Could this be some ARM-specific issue?

What's really weird is, the only practical change in this was to
Sema::BuildMemberReferenceExpr() to issue a warning diagnostic (and
not early return, continue as-normal). The rest of the changes were to
thread Scope * from the parser into Sema to accommodate. Very strange.

~Aaron
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Renato Golin via cfe-commits
On 1 September 2015 at 19:23, Aaron Ballman  wrote:
> On Tue, Sep 1, 2015 at 2:10 PM, Renato Golin  wrote:
>> On 1 September 2015 at 18:17, Renato Golin  wrote:
>>> Ok, I cleared the stage2 build directory, let's see how this build goes...
>>>
>>> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/3248
>>
>> Nah, there is something definitely wrong with that. I'll bisect here
>> to make sure it wasn't your patch.
>>
>> For now, the other buildbots should cover for the other breakages, so
>> we can keep this one failing until we're sure of it.
>
> I just got a notice for a similar failure:
> http://lab.llvm.org:8011/builders/clang-cmake-thumbv7-a15-full-sh/builds/2130
>
> Could this be some ARM-specific issue?
>
> What's really weird is, the only practical change in this was to
> Sema::BuildMemberReferenceExpr() to issue a warning diagnostic (and
> not early return, continue as-normal). The rest of the changes were to
> thread Scope * from the parser into Sema to accommodate. Very strange.

It could. I'm suspecting that this is related to the class alignment
problem that plagues ARM for at least one year.

If I'm right, than this is not a code gen fault at all, but a
misaligned structure in Clang that is getting the wrong value.

Ahmed and Reid could maye shed some light.

cheers,
--renato

PS: I'll continue to bisect anyway.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12262: [OpenMP] Capture global variables in target regions.

2015-09-01 Thread Samuel Antao via cfe-commits
sfantao updated this revision to Diff 33712.
sfantao added a comment.

Rebase on top of the last changes in http://reviews.llvm.org/D11361.


http://reviews.llvm.org/D12262

Files:
  include/clang/Basic/OpenMPKinds.h
  include/clang/Sema/Sema.h
  lib/Basic/OpenMPKinds.cpp
  lib/Sema/SemaExpr.cpp
  lib/Sema/SemaOpenMP.cpp
  test/OpenMP/target_codegen_global_capture.cpp

Index: test/OpenMP/target_codegen_global_capture.cpp
===
--- /dev/null
+++ test/OpenMP/target_codegen_global_capture.cpp
@@ -0,0 +1,186 @@
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple powerpc64le-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple powerpc64le-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple powerpc64le-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -verify -fopenmp -x c++ -triple i386-unknown-unknown -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple i386-unknown-unknown -emit-pch -o %t %s
+// RUN: %clang_cc1 -fopenmp -x c++ -triple i386-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
+// expected-no-diagnostics
+#ifndef HEADER
+#define HEADER
+
+
+// CHECK-DAG: [[GA:@.+]] = global double 1.00e+00
+// CHECK-DAG: [[GB:@.+]] = global double 2.00e+00
+// CHECK-DAG: [[GC:@.+]] = global double 3.00e+00
+// CHECK-DAG: [[GD:@.+]] = global double 4.00e+00
+// CHECK-DAG: [[FA:@.+]] = internal global float 5.00e+00
+// CHECK-DAG: [[FB:@.+]] = internal global float 6.00e+00
+// CHECK-DAG: [[FC:@.+]] = internal global float 7.00e+00
+// CHECK-DAG: [[FD:@.+]] = internal global float 8.00e+00
+// CHECK-DAG: [[BA:@.+]] = internal global float 9.00e+00
+// CHECK-DAG: [[BB:@.+]] = internal global float 1.00e+01
+// CHECK-DAG: [[BC:@.+]] = internal global float 1.10e+01
+// CHECK-DAG: [[BD:@.+]] = internal global float 1.20e+01
+double Ga = 1.0;
+double Gb = 2.0;
+double Gc = 3.0;
+double Gd = 4.0;
+
+// CHECK: define {{.*}} @{{.*}}foo{{.*}}(
+// CHECK-SAME: i16 {{[^,]*}}[[A:%[^,]+]],
+// CHECK-SAME: i16 {{[^,]*}}[[B:%[^,]+]],
+// CHECK-SAME: i16 {{[^,]*}}[[C:%[^,]+]],
+// CHECK-SAME: i16 {{[^,]*}}[[D:%[^,]+]])
+// CHECK: [[LA:%.+]] = alloca i16
+// CHECK: [[LB:%.+]] = alloca i16
+// CHECK: [[LC:%.+]] = alloca i16
+// CHECK: [[LD:%.+]] = alloca i16
+int foo(short a, short b, short c, short d){
+  static float Sa = 5.0;
+  static float Sb = 6.0;
+  static float Sc = 7.0;
+  static float Sd = 8.0;
+
+  // CHECK-DAG: [[REFB:%.+]] = bitcast i16* [[LB]] to i8*
+  // CHECK-DAG: store i8* [[REFB]], i8** [[GEPB:%.+]]
+  // CHECK-DAG: [[REFC:%.+]] = bitcast i16* [[LC]] to i8*
+  // CHECK-DAG: store i8* [[REFC]], i8** [[GEPC:%.+]]
+  // CHECK-DAG: [[REFD:%.+]] = bitcast i16* [[LD]] to i8*
+  // CHECK-DAG: store i8* [[REFD]], i8** [[GEPD:%.+]]
+  // CHECK-DAG: store i8* bitcast (double* [[GB]] to i8*), i8** [[GEPGB:%.+]]
+  // CHECK-DAG: store i8* bitcast (double* [[GC]] to i8*), i8** [[GEPGC:%.+]]
+  // CHECK-DAG: store i8* bitcast (double* [[GD]] to i8*), i8** [[GEPGD:%.+]]
+  // CHECK-DAG: store i8* bitcast (float* [[FB]] to i8*), i8** [[GEPFB:%.+]]
+  // CHECK-DAG: store i8* bitcast (float* [[FC]] to i8*), i8** [[GEPFC:%.+]]
+  // CHECK-DAG: store i8* bitcast (float* [[FD]] to i8*), i8** [[GEPFD:%.+]]
+  // CHECK-DAG: [[GEPB]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPC]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPD]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPGB]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPGC]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPGD]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPFB]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPFC]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK-DAG: [[GEPFD]] = getelementptr inbounds [9 x i8*], [9 x i8*]* %{{.+}}, i32 0, i32 {{.+}}
+  // CHECK: call i32 @__tgt_target
+  // CHECK: call void [[OFFLOADF:@.+]](
+  // Capture b, Gb, Sb, Gc, c, Sc, d, Gd, Sd
+  #pragma omp target if(Ga>0.0 && a>0 && Sa>0.0)
+  {
+b += 1;
+Gb += 1.0;
+Sb += 1.0;
+
+
+// CHECK: define internal void [[PARF:@.+]](i32* %{{.*}}, i32* %{{.*}},
+// CHECK: define internal void [[OFFLOADF]](
+
+// CHECK: alloca [[CCAPTY:%.+]],
+// CHECK: [[CAP:%.+]] = alloca [[CAPTY:%.+]],
+// CHECK: getelementptr inbounds [[CAPTY]], [[CAPTY]]* [[CAP]], i32 0, i32
+// CHECK: getelementptr inbounds [[CAPTY]], [[CAPTY]]* [[CAP]], i32 0, i32
+// CHECK: 

Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Renato Golin via cfe-commits
On 1 September 2015 at 18:17, Renato Golin  wrote:
> Ok, I cleared the stage2 build directory, let's see how this build goes...
>
> http://lab.llvm.org:8011/builders/clang-cmake-armv7-a15-selfhost-neon/builds/3248

Nah, there is something definitely wrong with that. I'll bisect here
to make sure it wasn't your patch.

For now, the other buildbots should cover for the other breakages, so
we can keep this one failing until we're sure of it.

cheers,
--renato
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246534 - [modules] When emitting line tables, only emit filenames that are actually referenced by the entries that we emit.

2015-09-01 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Sep  1 02:41:55 2015
New Revision: 246534

URL: http://llvm.org/viewvc/llvm-project?rev=246534=rev
Log:
[modules] When emitting line tables, only emit filenames that are actually 
referenced by the entries that we emit.

Modified:
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTWriter.cpp

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=246534=246533=246534=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Tue Sep  1 02:41:55 2015
@@ -1058,11 +1058,12 @@ bool ASTReader::ParseLineTable(ModuleFil
 
   // Parse the file names
   std::map FileIDs;
-  for (int I = 0, N = Record[Idx++]; I != N; ++I) {
+  for (unsigned I = 0; Record[Idx]; ++I) {
 // Extract the file name
 auto Filename = ReadPath(F, Record, Idx);
 FileIDs[I] = LineTable.getLineTableFilenameID(Filename);
   }
+  ++Idx;
 
   // Parse the line entries
   std::vector Entries;
@@ -1074,7 +1075,7 @@ bool ASTReader::ParseLineTable(ModuleFil
 
 // Extract the line entries
 unsigned NumEntries = Record[Idx++];
-assert(NumEntries && "Numentries is 0");
+assert(NumEntries && "no line entries for file ID");
 Entries.clear();
 Entries.reserve(NumEntries);
 for (unsigned I = 0; I != NumEntries; ++I) {

Modified: cfe/trunk/lib/Serialization/ASTWriter.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTWriter.cpp?rev=246534=246533=246534=diff
==
--- cfe/trunk/lib/Serialization/ASTWriter.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTWriter.cpp Tue Sep  1 02:41:55 2015
@@ -1981,10 +1981,19 @@ void ASTWriter::WriteSourceManagerBlock(
 LineTableInfo  = SourceMgr.getLineTable();
 
 Record.clear();
-// Emit the file names.
-Record.push_back(LineTable.getNumFilenames());
-for (unsigned I = 0, N = LineTable.getNumFilenames(); I != N; ++I)
-  AddPath(LineTable.getFilename(I), Record);
+
+// Emit the needed file names.
+llvm::DenseMap FilenameMap;
+for (const auto  : LineTable) {
+  if (L.first.ID < 0)
+continue;
+  for (auto  : L.second) {
+if (FilenameMap.insert(std::make_pair(LE.FilenameID,
+  FilenameMap.size())).second)
+  AddPath(LineTable.getFilename(LE.FilenameID), Record);
+  }
+}
+Record.push_back(0);
 
 // Emit the line entries
 for (LineTableInfo::iterator L = LineTable.begin(), LEnd = LineTable.end();
@@ -2003,11 +2012,12 @@ void ASTWriter::WriteSourceManagerBlock(
LE != LEEnd; ++LE) {
 Record.push_back(LE->FileOffset);
 Record.push_back(LE->LineNo);
-Record.push_back(LE->FilenameID);
+Record.push_back(FilenameMap[LE->FilenameID]);
 Record.push_back((unsigned)LE->FileKind);
 Record.push_back(LE->IncludeOffset);
   }
 }
+
 Stream.EmitRecord(SOURCE_MANAGER_LINE_TABLE, Record);
   }
 }


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12547: Add support for function attribute "disable_tail_calls"

2015-09-01 Thread Akira Hatanaka via cfe-commits
ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

There have been requests for a function attribute that disables tail call 
optimizations in the backend. This patch defines such an attribute.

http://reviews.llvm.org/D12547

Files:
  include/clang/Basic/Attr.td
  lib/CodeGen/CGCall.cpp
  lib/Sema/SemaDeclAttr.cpp
  test/CodeGen/attr-disable-tail-calls.c

Index: test/CodeGen/attr-disable-tail-calls.c
===
--- test/CodeGen/attr-disable-tail-calls.c
+++ test/CodeGen/attr-disable-tail-calls.c
@@ -1,11 +1,19 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm 
-mdisable-tail-calls -o - | FileCheck %s -check-prefix=CHECK 
-check-prefix=DISABLE
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | 
FileCheck %s -check-prefix=CHECK -check-prefix=ENABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm 
-mdisable-tail-calls -o - | FileCheck %s -check-prefix=DISABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | 
FileCheck %s -check-prefix=ENABLE
 
-// CHECK: define i32 @f1() [[ATTR:#[0-9]+]] {
+// DISABLE: define i32 @f1() [[ATTRTRUE:#[0-9]+]] {
+// DISABLE: define i32 @f2() [[ATTRTRUE]] {
+// ENABLE: define i32 @f1() [[ATTRFALSE:#[0-9]+]] {
+// ENABLE: define i32 @f2() [[ATTRTRUE:#[0-9]+]] {
 
 int f1() {
   return 0;
 }
 
-// DISABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="true" {{.*}} }
-// ENABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="false" {{.*}} }
+int f2() __attribute__((disable_tail_calls)) {
+  return 0;
+}
+
+// DISABLE: attributes [[ATTRTRUE]] = { {{.*}} "disable-tail-calls"="true" 
{{.*}} }
+// ENABLE: attributes [[ATTRFALSE]] = { {{.*}} "disable-tail-calls"="false" 
{{.*}} }
+// ENABLE: attributes [[ATTRTRUE]] = { {{.*}} "disable-tail-calls"="true" 
{{.*}} }
Index: lib/Sema/SemaDeclAttr.cpp
===
--- lib/Sema/SemaDeclAttr.cpp
+++ lib/Sema/SemaDeclAttr.cpp
@@ -4878,6 +4878,9 @@
   case AttributeList::AT_ReturnsTwice:
 handleSimpleAttribute(S, D, Attr);
 break;
+  case AttributeList::AT_DisableTailCalls:
+handleSimpleAttribute(S, D, Attr);
+break;
   case AttributeList::AT_Used:
 handleUsedAttr(S, D, Attr);
 break;
Index: lib/CodeGen/CGCall.cpp
===
--- lib/CodeGen/CGCall.cpp
+++ lib/CodeGen/CGCall.cpp
@@ -1474,8 +1474,12 @@
   FuncAttrs.addAttribute("no-frame-pointer-elim-non-leaf");
 }
 
-FuncAttrs.addAttribute("disable-tail-calls",
-   llvm::toStringRef(CodeGenOpts.DisableTailCalls));
+if ((TargetDecl && TargetDecl->hasAttr()) ||
+CodeGenOpts.DisableTailCalls)
+  FuncAttrs.addAttribute("disable-tail-calls", "true");
+else
+  FuncAttrs.addAttribute("disable-tail-calls", "false");
+
 FuncAttrs.addAttribute("less-precise-fpmad",
llvm::toStringRef(CodeGenOpts.LessPreciseFPMAD));
 FuncAttrs.addAttribute("no-infs-fp-math",
Index: include/clang/Basic/Attr.td
===
--- include/clang/Basic/Attr.td
+++ include/clang/Basic/Attr.td
@@ -891,6 +891,12 @@
   let Documentation = [Undocumented];
 }
 
+def DisableTailCalls : InheritableAttr {
+  let Spellings = [GNU<"disable_tail_calls">];
+  let Subjects = SubjectList<[Function]>;
+  let Documentation = [Undocumented];
+}
+
 def NoAlias : InheritableAttr {
   let Spellings = [Declspec<"noalias">];
   let Subjects = SubjectList<[Function]>;


Index: test/CodeGen/attr-disable-tail-calls.c
===
--- test/CodeGen/attr-disable-tail-calls.c
+++ test/CodeGen/attr-disable-tail-calls.c
@@ -1,11 +1,19 @@
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -mdisable-tail-calls -o - | FileCheck %s -check-prefix=CHECK -check-prefix=DISABLE
-// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECK -check-prefix=ENABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -mdisable-tail-calls -o - | FileCheck %s -check-prefix=DISABLE
+// RUN: %clang_cc1 -triple x86_64-apple-macosx10.7.0 %s -emit-llvm -o - | FileCheck %s -check-prefix=ENABLE
 
-// CHECK: define i32 @f1() [[ATTR:#[0-9]+]] {
+// DISABLE: define i32 @f1() [[ATTRTRUE:#[0-9]+]] {
+// DISABLE: define i32 @f2() [[ATTRTRUE]] {
+// ENABLE: define i32 @f1() [[ATTRFALSE:#[0-9]+]] {
+// ENABLE: define i32 @f2() [[ATTRTRUE:#[0-9]+]] {
 
 int f1() {
   return 0;
 }
 
-// DISABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="true" {{.*}} }
-// ENABLE: attributes [[ATTR]] = { {{.*}} "disable-tail-calls"="false" {{.*}} }
+int f2() __attribute__((disable_tail_calls)) {
+  return 0;
+}
+
+// DISABLE: attributes [[ATTRTRUE]] = { {{.*}} "disable-tail-calls"="true" {{.*}} }
+// ENABLE: 

Re: [PATCH] D12313: Introduce __builtin_nontemporal_store and __builtin_nontemporal_load.

2015-09-01 Thread Michael Zolotukhin via cfe-commits
mzolotukhin added a comment.

Gentle ping.


http://reviews.llvm.org/D12313



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool

2015-09-01 Thread Marshall Clow via cfe-commits
mclow.lists updated this revision to Diff 33770.
mclow.lists added a comment.

Updated based on Eric's comments.


http://reviews.llvm.org/D11380

Files:
  include/experimental/functional
  test/std/experimental/algorithms/alg.search/search.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore/default.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore/hash.pred.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore/pred.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/default.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/hash.pred.pass.cpp
  
test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp

Index: test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
===
--- test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
+++ test/std/experimental/func/func.searchers/func.searchers.boyer_moore_horspool/pred.pass.cpp
@@ -0,0 +1,130 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11
+
+// 
+
+// boyer_moore_horspool searcher
+// template::value_type>,
+//  class BinaryPredicate = equal_to<>>
+// class boyer_moore_horspool_searcher {
+// public:
+//   boyer_moore_horspool_searcher(RandomAccessIterator1 pat_first, RandomAccessIterator1 pat_last,
+// Hash hf = Hash(), BinaryPredicate pred = BinaryPredicate());
+// 
+//   template
+//   RandomAccessIterator2
+//   operator()(RandomAccessIterator2 first, RandomAccessIterator2 last) const;
+// 
+// private:
+//   RandomAccessIterator1 pat_first_; // exposition only
+//   RandomAccessIterator1 pat_last_;  // exposition only
+//   Hash  hash_;  // exposition only
+//   BinaryPredicate   pred_;  // exposition only
+// };
+
+#include 
+#include 
+#include 
+
+#include "test_iterators.h"
+
+struct count_equal
+{
+static unsigned count;
+template 
+bool operator()(const T& x, const T& y) const
+{++count; return x == y;}
+};
+
+unsigned count_equal::count = 0;
+
+template 
+void do_search(Iter1 b1, Iter1 e1, Iter2 b2, Iter2 e2, Iter1 result, unsigned max_count) {
+std::experimental::boyer_moore_horspool_searcher::type>, count_equal> s{b2, e2};
+count_equal::count = 0;
+assert(result == std::experimental::search(b1, e1, s));
+//assert(count_equal::count <= max_count);
+}
+
+template 
+void
+test()
+{
+int ia[] = {0, 1, 2, 3, 4, 5};
+const unsigned sa = sizeof(ia)/sizeof(ia[0]);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia),  Iter2(ia),Iter1(ia),  0);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia),  Iter2(ia+1),  Iter1(ia),  sa);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+1),Iter2(ia+2),  Iter1(ia+1),sa);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+2),Iter2(ia+2),  Iter1(ia),  0);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+2),Iter2(ia+3),  Iter1(ia+2),sa);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+2),Iter2(ia+3),  Iter1(ia+2),sa);
+do_search(Iter1(ia), Iter1(ia),  Iter2(ia+2),Iter2(ia+3),  Iter1(ia),  0);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+sa-1), Iter2(ia+sa), Iter1(ia+sa-1), sa);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia+sa-3), Iter2(ia+sa), Iter1(ia+sa-3), 3*sa);
+do_search(Iter1(ia), Iter1(ia+sa),   Iter2(ia),  Iter2(ia+sa), Iter1(ia),  sa*sa);
+do_search(Iter1(ia), Iter1(ia+sa-1), Iter2(ia),  Iter2(ia+sa), Iter1(ia+sa-1), (sa-1)*sa);
+do_search(Iter1(ia), Iter1(ia+1),Iter2(ia),  Iter2(ia+sa), Iter1(ia+1),sa);
+int ib[] = {0, 1, 2, 0, 1, 2, 3, 0, 1, 2, 3, 4};
+const unsigned sb = sizeof(ib)/sizeof(ib[0]);
+int ic[] = {1};
+do_search(Iter1(ib), Iter1(ib+sb), Iter2(ic), Iter2(ic+1), Iter1(ib+1), sb);
+int id[] = {1, 2};
+do_search(Iter1(ib), Iter1(ib+sb), Iter2(id), Iter2(id+2), Iter1(ib+1), sb*2);
+int ie[] = {1, 2, 3};
+do_search(Iter1(ib), Iter1(ib+sb), Iter2(ie), Iter2(ie+3), Iter1(ib+4), sb*3);
+int ig[] = {1, 2, 3, 4};
+do_search(Iter1(ib), Iter1(ib+sb), Iter2(ig), Iter2(ig+4), Iter1(ib+8), sb*4);
+int ih[] = {0, 1, 1, 1, 1, 2, 3, 

Re: [PATCH] D11380: Implement LFTS searchers. Boyer_Moore and Boyer_Moore_Horspool

2015-09-01 Thread Marshall Clow via cfe-commits
mclow.lists marked 3 inline comments as done.
mclow.lists added a comment.

http://reviews.llvm.org/D11380



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12444: [Sema] Avoid crash on tag-type mismatch (Fixes PR24610)

2015-09-01 Thread David Majnemer via cfe-commits
majnemer accepted this revision.
majnemer added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D12444



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246591 - [MS ABI] Switch to the CRC implementation in LLVM

2015-09-01 Thread David Majnemer via cfe-commits
Author: majnemer
Date: Tue Sep  1 16:24:07 2015
New Revision: 246591

URL: http://llvm.org/viewvc/llvm-project?rev=246591=rev
Log:
[MS ABI] Switch to the CRC implementation in LLVM

We now have an implementation of the CRC in LLVM's libSupport.  Let's
consolidate around that one.

Modified:
cfe/trunk/lib/AST/MicrosoftMangle.cpp

Modified: cfe/trunk/lib/AST/MicrosoftMangle.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/MicrosoftMangle.cpp?rev=246591=246590=246591=diff
==
--- cfe/trunk/lib/AST/MicrosoftMangle.cpp (original)
+++ cfe/trunk/lib/AST/MicrosoftMangle.cpp Tue Sep  1 16:24:07 2015
@@ -28,6 +28,7 @@
 #include "clang/Basic/TargetInfo.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/Support/MathExtras.h"
+#include "llvm/Support/JamCRC.h"
 
 using namespace clang;
 
@@ -2696,28 +2697,6 @@ void MicrosoftMangleContextImpl::mangleS
   // N.B. The length is in terms of bytes, not characters.
   Mangler.mangleNumber(SL->getByteLength() + SL->getCharByteWidth());
 
-  // We will use the "Rocksoft^tm Model CRC Algorithm" to describe the
-  // properties of our CRC:
-  //   Width  : 32
-  //   Poly   : 04C11DB7
-  //   Init   : 
-  //   RefIn  : True
-  //   RefOut : True
-  //   XorOut : 
-  //   Check  : 340BC6D9
-  uint32_t CRC = 0xU;
-
-  auto UpdateCRC = [](char Byte) {
-for (unsigned i = 0; i < 8; ++i) {
-  bool Bit = CRC & 0x8000U;
-  if (Byte & (1U << i))
-Bit = !Bit;
-  CRC <<= 1;
-  if (Bit)
-CRC ^= 0x04C11DB7U;
-}
-  };
-
   auto GetLittleEndianByte = [, ](unsigned Index) {
 unsigned CharByteWidth = SL->getCharByteWidth();
 uint32_t CodeUnit = SL->getCodeUnit(Index / CharByteWidth);
@@ -2733,22 +2712,19 @@ void MicrosoftMangleContextImpl::mangleS
   };
 
   // CRC all the bytes of the StringLiteral.
+  llvm::JamCRC JC;
   for (unsigned I = 0, E = SL->getByteLength(); I != E; ++I)
-UpdateCRC(GetLittleEndianByte(I));
+JC.update(GetLittleEndianByte(I));
 
   // The NUL terminator byte(s) were not present earlier,
   // we need to manually process those bytes into the CRC.
   for (unsigned NullTerminator = 0; NullTerminator < SL->getCharByteWidth();
++NullTerminator)
-UpdateCRC('\x00');
-
-  // The literature refers to the process of reversing the bits in the final 
CRC
-  // output as "reflection".
-  CRC = llvm::reverseBits(CRC);
+JC.update('\x00');
 
   // : The CRC is encoded utilizing the standard number mangling
   // scheme.
-  Mangler.mangleNumber(CRC);
+  Mangler.mangleNumber(JC.getCRC());
 
   // : The mangled name also contains the first 32 _characters_
   // (including null-terminator bytes) of the StringLiteral.


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246595 - Use hasAttr, not getAttr if we're just checking for presence.

2015-09-01 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Tue Sep  1 17:03:56 2015
New Revision: 246595

URL: http://llvm.org/viewvc/llvm-project?rev=246595=rev
Log:
Use hasAttr, not getAttr if we're just checking for presence.

Modified:
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246595=246594=246595=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep  1 17:03:56 2015
@@ -1497,7 +1497,7 @@ void CodeGenModule::ConstructAttributeLi
 // parse that and add it to the feature set.
 StringRef TargetCPU = getTarget().getTargetOpts().CPU;
 const FunctionDecl *FD = dyn_cast_or_null(TargetDecl);
-if (FD && FD->getAttr()) {
+if (FD && FD->hasAttr()) {
   llvm::StringMap FeatureMap;
   const auto *TD = FD->getAttr();
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12544: Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

2015-09-01 Thread Peter Collingbourne via cfe-commits
pcc added a comment.

It's probably time to add something like the driver test I was talking about in 
http://reviews.llvm.org/D12021. Without that, you will have no test coverage 
for the functional change here.


http://reviews.llvm.org/D12544



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12544: Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

2015-09-01 Thread Ivan Krasin via cfe-commits
krasin updated this revision to Diff 33764.
krasin added a comment.

Add a test for default blacklist.


http://reviews.llvm.org/D12544

Files:
  include/clang/Driver/Options.td
  include/clang/Driver/SanitizerArgs.h
  lib/Driver/SanitizerArgs.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/Inputs/resource_dir/asan_blacklist.txt
  test/Driver/fsanitize-blacklist.c
  test/Frontend/print-header-includes.c

Index: test/Frontend/print-header-includes.c
===
--- test/Frontend/print-header-includes.c
+++ test/Frontend/print-header-includes.c
@@ -14,7 +14,7 @@
 // MS-NOT: Note
 
 // RUN: echo "fun:foo" > %t.blacklist
-// RUN: %clang_cc1 -fsanitize=address -fsanitize-blacklist=%t.blacklist -E --show-includes -o %t.out %s > %t.stdout
+// RUN: %clang_cc1 -fsanitize=address -fdepfile-entry=%t.blacklist -E --show-includes -o %t.out %s > %t.stdout
 // RUN: FileCheck --check-prefix=MS-BLACKLIST < %t.stdout %s
 // MS-BLACKLIST: Note: including file: {{.*\.blacklist}}
 // MS-BLACKLIST: Note: including file: {{.*test.h}}
Index: test/Driver/fsanitize-blacklist.c
===
--- test/Driver/fsanitize-blacklist.c
+++ test/Driver/fsanitize-blacklist.c
@@ -13,13 +13,26 @@
 // RUN: echo "badline" > %t.bad
 
 // RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST
-// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good
-// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.second
+// CHECK-BLACKLIST: -fsanitize-blacklist={{.*}}.good" "-fsanitize-blacklist={{.*}}.second
+
+// Now, check for -fdepfile-entry flags.
+// RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fsanitize-blacklist=%t.second %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-BLACKLIST2
+// CHECK-BLACKLIST2: -fdepfile-entry={{.*}}.good" "-fdepfile-entry={{.*}}.second
+
+// Check that the default blacklist is not added as an extra dependency.
+// RUN: %clang -fsanitize=address -resource-dir=%S/Inputs/resource_dir %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEFAULT-BLACKLIST
+// CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt
+// CHECK-DEFAULT-BLACKLIST-NOT: -fdepfile-entry
 
 // Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
 // RUN: %clang -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE --check-prefix=DELIMITERS
 // CHECK-NO-SANITIZE-NOT: -fsanitize-blacklist
 
+// Ignore -fsanitize-blacklist flag if there is no -fsanitize flag.
+// Now, check for the absense of -fdepfile-entry flags.
+// RUN: %clang -fsanitize-blacklist=%t.good %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-SANITIZE2 --check-prefix=DELIMITERS
+// CHECK-NO-SANITIZE2-NOT: -fdepfile-entry
+
 // Flag -fno-sanitize-blacklist wins if it is specified later.
 // RUN: %clang -fsanitize=address -fsanitize-blacklist=%t.good -fno-sanitize-blacklist %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-BLACKLIST --check-prefix=DELIMITERS
 // CHECK-NO-BLACKLIST-NOT: -fsanitize-blacklist
Index: lib/Frontend/CompilerInvocation.cpp
===
--- lib/Frontend/CompilerInvocation.cpp
+++ lib/Frontend/CompilerInvocation.cpp
@@ -709,7 +709,7 @@
   // Add sanitizer blacklists as extra dependencies.
   // They won't be discovered by the regular preprocessor, so
   // we let make / ninja to know about this implicit dependency.
-  Opts.ExtraDeps = Args.getAllArgValues(OPT_fsanitize_blacklist);
+  Opts.ExtraDeps = Args.getAllArgValues(OPT_fdepfile_entry);
   auto ModuleFiles = Args.getAllArgValues(OPT_fmodule_file);
   Opts.ExtraDeps.insert(Opts.ExtraDeps.end(), ModuleFiles.begin(),
 ModuleFiles.end());
Index: lib/Driver/SanitizerArgs.cpp
===
--- lib/Driver/SanitizerArgs.cpp
+++ lib/Driver/SanitizerArgs.cpp
@@ -176,6 +176,7 @@
   RecoverableSanitizers.clear();
   TrapSanitizers.clear();
   BlacklistFiles.clear();
+  ExtraDeps.clear();
   CoverageFeatures = 0;
   MsanTrackOrigins = 0;
   MsanUseAfterDtor = false;
@@ -383,13 +384,16 @@
 if (Arg->getOption().matches(options::OPT_fsanitize_blacklist)) {
   Arg->claim();
   std::string BLPath = Arg->getValue();
-  if (llvm::sys::fs::exists(BLPath))
+  if (llvm::sys::fs::exists(BLPath)) {
 BlacklistFiles.push_back(BLPath);
-  else
+ExtraDeps.push_back(BLPath);
+  } else
 D.Diag(clang::diag::err_drv_no_such_file) << BLPath;
+
 } else if (Arg->getOption().matches(options::OPT_fno_sanitize_blacklist)) {
   Arg->claim();
   BlacklistFiles.clear();
+  ExtraDeps.clear();
 }
   }
   // Validate blacklists format.
@@ -563,6 +567,11 @@
 BlacklistOpt += BLPath;
 CmdArgs.push_back(Args.MakeArgString(BlacklistOpt));
   }
+  for (const auto  : ExtraDeps) {

Re: [PATCH] D12544: Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

2015-09-01 Thread Ivan Krasin via cfe-commits
krasin added a comment.

In http://reviews.llvm.org/D12544#237819, @pcc wrote:

> It's probably time to add something like the driver test I was talking about 
> in http://reviews.llvm.org/D12021. Without that, you will have no test 
> coverage for the functional change here.


Done, please, take a look.


http://reviews.llvm.org/D12544



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r203885 - [Modules] Emit the module file paths as dependencies of the PCH when we are building one.

2015-09-01 Thread Argyrios Kyrtzidis via cfe-commits
(Apologies for the long delay).

> On Aug 8, 2015, at 6:30 PM, Richard Smith  wrote:
> 
> On Thu, Mar 13, 2014 at 8:07 PM, Argyrios Kyrtzidis  > wrote:
> Author: akirtzidis
> Date: Thu Mar 13 22:07:38 2014
> New Revision: 203885
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=203885=rev 
> 
> Log:
> [Modules] Emit the module file paths as dependencies of the PCH when we are 
> building one.
> 
> This is because the PCH is tied to the module files, if one of the module 
> files changes or gets removed
> the build system should re-build the PCH file.
> 
> Is there any reason this has its own -cc1 flag instead of being tied to 
> -emit-pch?

Offers a bit of flexibility and separation of concerns between dependency file 
generation and output file generation.
But I don’t have a strong preference, if it simplifies things to not have a 
separate option I’m fine with removing it.

>  
> rdar://16321245
> 
> Added:
> cfe/trunk/test/Driver/pch-deps.c
> cfe/trunk/test/Modules/dependency-gen-pch.m
> Modified:
> cfe/trunk/include/clang/Driver/CC1Options.td
> cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
> cfe/trunk/include/clang/Serialization/ASTReader.h
> cfe/trunk/lib/Driver/Tools.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/DependencyFile.cpp
> cfe/trunk/lib/Serialization/ASTReader.cpp
> 
> Modified: cfe/trunk/include/clang/Driver/CC1Options.td
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/CC1Options.td?rev=203885=203884=203885=diff
>  
> 
> ==
> --- cfe/trunk/include/clang/Driver/CC1Options.td (original)
> +++ cfe/trunk/include/clang/Driver/CC1Options.td Thu Mar 13 22:07:38 2014
> @@ -223,6 +223,8 @@ def dependent_lib : Joined<["--"], "depe
> 
>  def sys_header_deps : Flag<["-"], "sys-header-deps">,
>HelpText<"Include system headers in dependency output">;
> +def module_file_deps : Flag<["-"], "module-file-deps">,
> +  HelpText<"Include module files in dependency output">;
>  def header_include_file : Separate<["-"], "header-include-file">,
>HelpText<"Filename (or -) to write header include output to">;
>  def show_includes : Flag<["--"], "show-includes">,
> 
> Modified: cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h?rev=203885=203884=203885=diff
>  
> 
> ==
> --- cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h (original)
> +++ cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h Thu Mar 13 
> 22:07:38 2014
> @@ -26,6 +26,7 @@ public:
>   /// problems.
>unsigned AddMissingHeaderDeps : 1; ///< Add missing headers to dependency 
> list
>unsigned PrintShowIncludes : 1; ///< Print cl.exe style /showIncludes info.
> +  unsigned IncludeModuleFiles : 1; ///< Include module file dependencies.
> 
>/// The file to write dependency output to.
>std::string OutputFile;
> @@ -50,6 +51,7 @@ public:
>  UsePhonyTargets = 0;
>  AddMissingHeaderDeps = 0;
>  PrintShowIncludes = 0;
> +IncludeModuleFiles = 0;
>}
>  };
> 
> 
> Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
> URL: 
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=203885=203884=203885=diff
>  
> 
> ==
> --- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
> +++ cfe/trunk/include/clang/Serialization/ASTReader.h Thu Mar 13 22:07:38 2014
> @@ -171,6 +171,9 @@ public:
>virtual void ReadCounter(const serialization::ModuleFile ,
> unsigned Value) {}
> 
> +  /// This is called for each AST file loaded.
> +  virtual void visitModuleFile(StringRef Filename) {}
> +
>/// \brief Returns true if this \c ASTReaderListener wants to receive the
>/// input files of the AST file via \c visitInputFile, false otherwise.
>virtual bool needsInputFileVisitation() { return false; }
> @@ -217,6 +220,7 @@ public:
>void ReadCounter(const serialization::ModuleFile , unsigned Value) 
> override;
>bool needsInputFileVisitation() override;
>bool needsSystemInputFileVisitation() override;
> +  void visitModuleFile(StringRef Filename) override;
>bool 

Re: [PATCH] D12312: Emiting invariant.group.barrier and adding -fstrict-vptrs

2015-09-01 Thread Piotr Padlewski via cfe-commits
Prazek marked 3 inline comments as done.


Comment at: lib/CodeGen/CGClass.cpp:1279
@@ +1278,3 @@
+  if (CGM.getCodeGenOpts().StrictVPtrs && BaseVPtrsInitialized)
+CXXThisValue = Builder.CreateInvariantGroupBarrier(LoadCXXThis());
+

rjmccall wrote:
> Prazek wrote:
> > rjmccall wrote:
> > > Prazek wrote:
> > > > rjmccall wrote:
> > > > > Should this just be in InitializeVTablePointers?
> > > > I want to add invariant.group.barrier only if it's needed. F.e. I don't 
> > > > want to put before I initialize vptrs for base, or when my class 
> > > > doesn't inherit frome anything. I want emit barrier after I will 
> > > > initialize some other vptrs.
> > > > 
> > > > InitializeVptrs is called in EmitBaseInitializer, and also I woudnt 
> > > > want to put some extra flag if it must produce barrier or not (because 
> > > > it is hard to distinguish it from inside)
> > > Fair enough.
> > > 
> > > Do we need to emit these barriers in unoptimized builds?
> > It depends - if we will not add invariant.group metadata to loads/stores 
> > without optimizations, then we can not add theis invariant barrier stuff. 
> > My question is, if I will run clang
> > 
> > clang++ stuff.cpp -O0 -fstrict-vptrs 
> > 
> > does it mean, that I don't want any optimizations, or it means that I don't 
> > want any optimizations except strict-vptrs?
> > If answer is second one, then I think not checking for optimizations is 
> > fine (If we will change it to be default, then we will have to add 
> > Optmizations turned check)
> Well, we're not actually going to do the optimizations at -O0 in any case, 
> and "please emit the information necessary to do the optimizations without 
> actually doing them" is not an intermediate state that users actually want.
> 
> The basic problem here continues to be that, as designed, this optimization 
> is unsound without cooperation from every module that emitted any IR.  In 
> order for this optimization to qualify as a non-experimental feature, you 
> will need to actually fix that so that it decays gracefully in the presence 
> of a non-cooperating module.  Once you do that, it will also be reasonable to 
> omit these barriers at -O0.
> 
> When we talked about this before, we had a workable, if conservative, plan 
> for how to implement that graceful decay: you need to tag cooperating 
> functions and then untag them when information is merged (e.g. by the 
> inliner) from non-cooperating functions.  Do you still see that as practical?
Ok, I think I won't add invariant.barrier with O0.

I want to concentrate on !invariant.group optimization more now, so for now the 
plan is this:

 if we are in O0, then we don't care at all about invariant.group.barrier, we 
just skip emiting it.
If we are in opt, and fstrict-vtable-pointers is true, then we will add module 
metadata about it
and when LTO will try to link 2 modules
one with strict-vptrs and one without
then for now, we can just raise an error.
In the future we can strip invariant stuff from module without flag.

Because optimizer doesn't care about invariant.group.barrier now, I will add 
module metadata in next patch.


http://reviews.llvm.org/D12312



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12312: Emiting invariant.group.barrier and adding -fstrict-vptrs

2015-09-01 Thread Piotr Padlewski via cfe-commits
Prazek updated the summary for this revision.
Prazek updated this revision to Diff 33775.

http://reviews.llvm.org/D12312

Files:
  include/clang/Driver/Options.td
  include/clang/Frontend/CodeGenOptions.def
  lib/CodeGen/CGClass.cpp
  lib/CodeGen/CGExprCXX.cpp
  lib/Driver/Tools.cpp
  lib/Frontend/CompilerInvocation.cpp
  test/CodeGenCXX/strict-vtable-pointers.cpp

Index: test/CodeGenCXX/strict-vtable-pointers.cpp
===
--- /dev/null
+++ test/CodeGenCXX/strict-vtable-pointers.cpp
@@ -0,0 +1,193 @@
+// RUN: %clang_cc1 %s -I%S -triple=x86_64-apple-darwin10 -fstrict-vtable-pointers -disable-llvm-optzns -O2 -emit-llvm -o %t.ll
+// RUN: FileCheck --check-prefix=CHECK-CTORS %s < %t.ll
+// RUN: FileCheck --check-prefix=CHECK-NEW %s < %t.ll
+// RUN: FileCheck --check-prefix=CHECK-DTORS %s < %t.ll
+
+typedef __typeof__(sizeof(0)) size_t;
+void *operator new(size_t, void*) throw();
+
+struct NotTrivialDtor {
+  ~NotTrivialDtor();
+};
+
+struct DynamicBase1 {
+  NotTrivialDtor obj;
+  virtual void foo();
+};
+
+struct DynamicDerived : DynamicBase1 {
+  void foo();
+};
+
+struct DynamicBase2 {
+  virtual void bar();
+  ~DynamicBase2() {
+bar();
+  }
+};
+
+struct DynamicDerivedMultiple : DynamicBase1, DynamicBase2 {
+  virtual void foo();
+  virtual void bar();
+};
+
+struct StaticBase {
+  NotTrivialDtor obj;
+  void bar();
+};
+
+struct DynamicFromStatic : StaticBase {
+  virtual void bar();
+};
+
+struct DynamicFromVirtualStatic1 : virtual StaticBase {
+};
+
+struct DynamicFromVirtualStatic2 : virtual StaticBase {
+};
+
+struct DynamicFrom2Virtuals :
+DynamicFromVirtualStatic1,
+DynamicFromVirtualStatic2 {
+};
+
+// CHECK-NEW-LABEL: define void @_Z12LocalObjectsv()
+// CHECK-NEW-NOT: @llvm.invariant.group.barrier(
+// CHECK-NEW-LABEL: }
+void LocalObjects() {
+  DynamicBase1 DB;
+  DB.foo();
+  DynamicDerived DD;
+  DD.foo();
+
+  DynamicBase2 DB2;
+  DB2.bar();
+
+  StaticBase SB;
+  SB.bar();
+
+  DynamicDerivedMultiple DDM;
+  DDM.foo();
+  DDM.bar();
+
+  DynamicFromStatic DFS;
+  DFS.bar();
+  DynamicFromVirtualStatic1 DFVS1;
+  DFVS1.bar();
+  DynamicFrom2Virtuals DF2V;
+  DF2V.bar();
+}
+
+struct DynamicFromVirtualStatic1;
+// CHECK-CTORS-LABEL: define linkonce_odr void @_ZN25DynamicFromVirtualStatic1C1Ev
+// CHECK-CTORS-NOT: @llvm.invariant.group.barrier(
+// CHECK-CTORS-LABEL: }
+
+struct DynamicFrom2Virtuals;
+// CHECK-CTORS-LABEL: define linkonce_odr void @_ZN20DynamicFrom2VirtualsC1Ev
+// CHECK-CTORS: call i8* @llvm.invariant.group.barrier(
+// CHECK-CTORS-LABEL: }
+
+
+// CHECK-NEW-LABEL: define void @_Z9Pointers1v()
+// CHECK-NEW-NOT: @llvm.invariant.group.barrier(
+// CHECK-NEW-LABEL: call void @_ZN12DynamicBase1C1Ev(
+
+// CHECK-NEW: %[[THIS3:.*]] = call i8* @llvm.invariant.group.barrier(i8* %[[THIS2:.*]])
+// CHECK-NEW: %[[THIS4:.*]] = bitcast i8* %[[THIS3]] to %[[DynamicDerived:.*]]*
+// CHECK-NEW: call void @_ZN14DynamicDerivedC1Ev(%[[DynamicDerived:.*]]* %[[THIS4]])
+// CHECK-NEW-LABEL: }
+void Pointers1() {
+  DynamicBase1 *DB = new DynamicBase1;
+  DB->foo();
+
+  DynamicDerived *DD = new (DB) DynamicDerived;
+  DD->foo();
+  DD->~DynamicDerived();
+}
+
+// CHECK-NEW-LABEL: define void @_Z14HackingObjectsv()
+// CHECK-NEW:  call void @_ZN12DynamicBase1C1Ev
+// CHECK-NEW:  call i8* @llvm.invariant.group.barrier(
+// CHECK-NEW:  call void @_ZN14DynamicDerivedC1Ev(
+// CHECK-NEW:  call i8* @llvm.invariant.group.barrier(
+// CHECK-NEW: call void @_ZN12DynamicBase1C1Ev(
+// CHECK-NEW-LABEL: }
+void HackingObjects() {
+  DynamicBase1 DB;
+  DB.foo();
+
+  DynamicDerived *DB2 = new () DynamicDerived;
+  // Using DB now is prohibited.
+  DB2->foo();
+  DB2->~DynamicDerived();
+
+  // We have to get back to the previous type to avoid calling wrong destructor
+  new () DynamicBase1;
+  DB.foo();
+}
+
+/*** Testing Constructors ***/
+struct DynamicBase1;
+// CHECK-CTORS-LABEL: define linkonce_odr void @_ZN12DynamicBase1C2Ev(
+// CHECK-CTORS-NOT: call i8* @llvm.invariant.group.barrier(
+// CHECK-CTORS-LABEL: }
+
+
+struct DynamicDerived;
+// CHECK-CTORS-LABEL: define linkonce_odr void @_ZN14DynamicDerivedC2Ev(
+// CHECK-CTORS: call void @_ZN12DynamicBase1C2Ev(
+// CHECK-CTORS: %[[THIS1:.*]] = bitcast %[[DynamicDerived:.*]]* %[[THIS0:.*]] to i8*
+// CHECK-CTORS: %[[THIS2:.*]] = call i8* @llvm.invariant.group.barrier(i8* %[[THIS1:.*]])
+// CHECK-CTORS: %[[THIS3:.*]] = bitcast i8* %[[THIS2:.*]] to %[[DynamicDerived]]*
+// CHECK-CTORS: %[[THIS4:.*]] = bitcast %struct.DynamicDerived* %[[THIS3:.*]] to i32 (...)***
+// CHECK-CTORS: store {{.*}} %[[THIS4:.*]]
+// CHECK-CTORS-LABEL: }
+
+struct DynamicDerivedMultiple;
+// CHECK-CTORS-LABEL: define linkonce_odr void @_ZN22DynamicDerivedMultipleC2Ev
+// CHECK-CTORS: call void @_ZN12DynamicBase1C2Ev(
+// CHECK-CTORS-NOT: @llvm.invariant.group.barrier
+// CHECK-CTORS-LABEL: call void @_ZN12DynamicBase2C2Ev(
+// CHECK-CTORS: %[[THIS1:.*]] = bitcast %[[CLASS:.*]]* %[[THIS0:.*]] 

Re: [PATCH] D12444: [Sema] Avoid crash on tag-type mismatch (Fixes PR24610)

2015-09-01 Thread Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL246618: [Sema] Avoid crash on tag-type mismatch (Fixes 
PR24610) (authored by vedantk).

Changed prior to commit:
  http://reviews.llvm.org/D12444?vs=33623=33777#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D12444

Files:
  cfe/trunk/lib/Sema/SemaDecl.cpp
  cfe/trunk/test/Sema/enum.c

Index: cfe/trunk/test/Sema/enum.c
===
--- cfe/trunk/test/Sema/enum.c
+++ cfe/trunk/test/Sema/enum.c
@@ -119,3 +119,7 @@
 
 typedef enum { NegativeShort = (short)-1 } NegativeShortEnum;
 int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
+
+// PR24610
+enum Color { Red, Green, Blue }; // expected-note{{previous use is here}}
+typedef struct Color NewColor; // expected-error {{use of 'Color' with tag 
type that does not match previous declaration}}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -3560,6 +3560,9 @@
 
 void Sema::setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
 TypedefNameDecl *NewTD) {
+  if (TagFromDeclSpec->isInvalidDecl())
+return;
+
   // Do nothing if the tag already has a name for linkage purposes.
   if (TagFromDeclSpec->hasNameForLinkage())
 return;


Index: cfe/trunk/test/Sema/enum.c
===
--- cfe/trunk/test/Sema/enum.c
+++ cfe/trunk/test/Sema/enum.c
@@ -119,3 +119,7 @@
 
 typedef enum { NegativeShort = (short)-1 } NegativeShortEnum;
 int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
+
+// PR24610
+enum Color { Red, Green, Blue }; // expected-note{{previous use is here}}
+typedef struct Color NewColor; // expected-error {{use of 'Color' with tag type that does not match previous declaration}}
Index: cfe/trunk/lib/Sema/SemaDecl.cpp
===
--- cfe/trunk/lib/Sema/SemaDecl.cpp
+++ cfe/trunk/lib/Sema/SemaDecl.cpp
@@ -3560,6 +3560,9 @@
 
 void Sema::setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
 TypedefNameDecl *NewTD) {
+  if (TagFromDeclSpec->isInvalidDecl())
+return;
+
   // Do nothing if the tag already has a name for linkage purposes.
   if (TagFromDeclSpec->hasNameForLinkage())
 return;
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246618 - [Sema] Avoid crash on tag-type mismatch (Fixes PR24610)

2015-09-01 Thread Vedant Kumar via cfe-commits
Author: vedantk
Date: Tue Sep  1 22:27:15 2015
New Revision: 246618

URL: http://llvm.org/viewvc/llvm-project?rev=246618=rev
Log:
[Sema] Avoid crash on tag-type mismatch (Fixes PR24610)

Differential Revision: http://reviews.llvm.org/D12444

Modified:
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/enum.c

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=246618=246617=246618=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Sep  1 22:27:15 2015
@@ -3560,6 +3560,9 @@ void Sema::handleTagNumbering(const TagD
 
 void Sema::setTagNameForLinkagePurposes(TagDecl *TagFromDeclSpec,
 TypedefNameDecl *NewTD) {
+  if (TagFromDeclSpec->isInvalidDecl())
+return;
+
   // Do nothing if the tag already has a name for linkage purposes.
   if (TagFromDeclSpec->hasNameForLinkage())
 return;

Modified: cfe/trunk/test/Sema/enum.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/enum.c?rev=246618=246617=246618=diff
==
--- cfe/trunk/test/Sema/enum.c (original)
+++ cfe/trunk/test/Sema/enum.c Tue Sep  1 22:27:15 2015
@@ -119,3 +119,7 @@ void crash(enum E* e) // expected-warnin
 
 typedef enum { NegativeShort = (short)-1 } NegativeShortEnum;
 int NegativeShortTest[NegativeShort == -1 ? 1 : -1];
+
+// PR24610
+enum Color { Red, Green, Blue }; // expected-note{{previous use is here}}
+typedef struct Color NewColor; // expected-error {{use of 'Color' with tag 
type that does not match previous declaration}}


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246610 - Migrate the target attribute parsing code into an extension off of

2015-09-01 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Tue Sep  1 19:12:02 2015
New Revision: 246610

URL: http://llvm.org/viewvc/llvm-project?rev=246610=rev
Log:
Migrate the target attribute parsing code into an extension off of
the main attribute and cache the results so we don't have to parse
a single attribute more than once.

This reapplies r246596 with a fix for an uninitialized class member,
and a couple of cleanups and formatting changes.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=246610=246609=246610=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Sep  1 19:12:02 2015
@@ -1315,9 +1315,52 @@ def Pascal : InheritableAttr {
 
 def Target : InheritableAttr {
   let Spellings = [GCC<"target">];
-  let Args = [StringArgument<"features">];
+  let Args = [StringArgument<"featuresStr">];
   let Subjects = SubjectList<[Function], ErrorDiag>;
   let Documentation = [TargetDocs];
+  let AdditionalMembers = [{
+StringRef CPU;
+std::vector Features;
+bool Parsed = false;
+StringRef getCPU() {
+  if (!Parsed)
+parse();
+  return CPU;
+}
+std::vector () {
+  if (!Parsed)
+parse();
+  return Features;
+}
+void parse() {
+  SmallVector AttrFeatures;
+  getFeaturesStr().split(AttrFeatures, ",");
+
+  // Grab the various features and prepend a "+" to turn on the feature to
+  // the backend and add them to our existing set of features.
+  for (auto  : AttrFeatures) {
+// Go ahead and trim whitespace rather than either erroring or
+// accepting it weirdly.
+Feature = Feature.trim();
+
+// We don't support cpu tuning this way currently.
+// TODO: Support the fpmath option. It will require checking
+// overall feature validity for the function with the rest of the
+// attributes on the function.
+if (Feature.startswith("fpmath=") || Feature.startswith("tune="))
+ continue;
+
+// While we're here iterating check for a different target cpu.
+if (Feature.startswith("arch="))
+  CPU = Feature.split("=").second.trim();
+else if (Feature.startswith("no-"))
+  Features.push_back("-" + Feature.split("-").second.str());
+else
+  Features.push_back("+" + Feature.str());
+  }
+  Parsed = true;
+}
+  }];
 }
 
 def TransparentUnion : InheritableAttr {

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246610=246609=246610=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep  1 19:12:02 2015
@@ -1499,40 +1499,19 @@ void CodeGenModule::ConstructAttributeLi
 const FunctionDecl *FD = dyn_cast_or_null(TargetDecl);
 if (FD && FD->hasAttr()) {
   llvm::StringMap FeatureMap;
-  const auto *TD = FD->getAttr();
+  auto *TD = FD->getAttr();
 
   // Make a copy of the features as passed on the command line.
   std::vector FnFeatures =
   getTarget().getTargetOpts().FeaturesAsWritten;
 
-  // Grab the target attribute string.
-  StringRef FeaturesStr = TD->getFeatures();
-  SmallVector AttrFeatures;
-  FeaturesStr.split(AttrFeatures, ",");
+  std::vector  = TD->getFeatures();
+  std::copy(AttrFeatures.begin(), AttrFeatures.end(),
+std::back_inserter(FnFeatures));
 
-  // Grab the various features and prepend a "+" to turn on the feature to
-  // the backend and add them to our existing set of features.
-  for (auto  : AttrFeatures) {
-// Go ahead and trim whitespace rather than either erroring or
-// accepting it weirdly.
-Feature = Feature.trim();
+  if (TD->getCPU() != "")
+   TargetCPU = TD->getCPU();
 
-// While we're here iterating check for a different target cpu.
-if (Feature.startswith("arch="))
-  TargetCPU = Feature.split("=").second.trim();
-else if (Feature.startswith("tune="))
-  // We don't support cpu tuning this way currently.
-  ;
-else if (Feature.startswith("fpmath="))
-  // TODO: Support the fpmath option this way. It will require checking
-  // overall feature validity for the function with the rest of the
-  // attributes on the function.
-  ;
-else if (Feature.startswith("no-"))
-  FnFeatures.push_back("-" + Feature.split("-").second.str());
-else
-  FnFeatures.push_back("+" + Feature.str());
-  }
   // Now populate the feature map, first with the TargetCPU 

Re: [PATCH] D12087: always_inline codegen rewrite

2015-09-01 Thread Evgeniy Stepanov via cfe-commits
eugenis marked 2 inline comments as done.
eugenis added a comment.

Repository:
  rL LLVM

http://reviews.llvm.org/D12087



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12544: Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

2015-09-01 Thread Peter Collingbourne via cfe-commits
pcc accepted this revision.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM with nit.



Comment at: test/Driver/fsanitize-blacklist.c:25
@@ -18,1 +24,3 @@
+// CHECK-DEFAULT-BLACKLIST: -fsanitize-blacklist={{.*}}asan_blacklist.txt
+// CHECK-DEFAULT-BLACKLIST-NOT: -fdepfile-entry
 

Maybe use `FileCheck -implicit-check-not=` to verify that this doesn't also 
appear on the other side of the `-fsanitize-blacklist`?


http://reviews.llvm.org/D12544



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

2015-09-01 Thread Naomi Musgrave via cfe-commits
nmusgrave added inline comments.


Comment at: lib/CodeGen/CGCXX.cpp:42-44
@@ -33,1 +41,5 @@
 bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
+  // If sanitizing memory to check for use-after-dtor, do not emit as
+  // an alias, unless it has no fields or has only fields with non-trivial
+  // destructors.
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor)

vptr poisoning will be implemented in another CL after this is approved


http://reviews.llvm.org/D12022



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r245683 - Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.

2015-09-01 Thread Alexander Kornienko via cfe-commits
Thank you for the update!
On 1 Sep 2015 21:10, "Yaron Keren"  wrote:

> Hi,
>
> In the other thread (search for ... 0ca9a2b from bartek-w) he provided a
> regex with two more changes beyond adding \n.
> Here are all three regexes:
>
> pre-r245683
>  match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
> r245683
>  match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p, line)
> bartek-w
>  match = re.search('^+++\ \"?(.?/){%s}([^ \t\"\n])' % args.p, line)
>
> in bartek-w version, + are not escaped which I do not understand why as +
> is a special character in Python regex (see
> https://docs.python.org/2/library/re.html) and  and the star after [^
> \t\"\n] is missing.
> Not wishing to break any working code I asked for the broken diff example
> to test against before comitting and so far didn't get a reply.
>
> Anyhow, adding the \n is safe and I've commited it now on r246575 but I'm
> still not clear about the other two regex changes.
> I'll update the bug report accordingly.
>
> Yaron
>
>
>
> 2015-09-01 18:52 GMT+03:00 Alexander Kornienko :
> >
> > Looks like this patch broke handling of multiple files:
> https://llvm.org/PR24637
> >
> > Can you take a look at this?
> >
> > On Fri, Aug 21, 2015 at 12:56 PM, Yaron Keren 
> wrote:
> >>
> >> Whenever is any special character in the filename, such as space or
> backslash (Windows), some examples:
> >>
> >> On Windows:
> >> --- ".\\a.cpp"  2015-08-21 00:22:57.885370200 +0300
> >> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
> >>
> >> --- ./a.cpp 2015-08-21 00:22:57.885370200 +0300
> >> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
> >>
> >> --- "a a.cpp"   2015-08-21 00:22:57.885370200 +0300
> >> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
> >>
> >> On Linux:
> >> ~$ diff -U0 ./a.cpp b\ b.cpp
> >> --- ./a.cpp 2015-08-14 00:27:03.569276652 +0300
> >> +++ "b b.cpp"   2015-08-21 13:54:26.787896719 +0300
> >>
> >> filename with space will break current clang-tidy-diff.py on all
> platforms, the regular expression does not match quotes.
> >> There is surely some Python package to process filenames correctly if
> this ever become a problem.
> >>
> >>
> >> 2015-08-21 13:37 GMT+03:00 Alexander Kornienko :
> >>>
> >>> On Fri, Aug 21, 2015 at 11:27 AM, Yaron Keren via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> 
>  Author: yrnkrn
>  Date: Fri Aug 21 04:27:24 2015
>  New Revision: 245683
> 
>  URL: http://llvm.org/viewvc/llvm-project?rev=245683=rev
>  Log:
>  Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput
> >>>
> >>>
> >>> Out of curiosity, when does this happen? (I mean quotes around the
> file name)
> >>>
> 
> 
> 
> 
>  Modified:
>  clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
> 
>  Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>  URL:
> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683=245682=245683=diff
> 
> ==
>  --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
> (original)
>  +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri
> Aug 21 04:27:24 2015
>  @@ -67,7 +67,7 @@ def main():
> filename = None
> lines_by_file = {}
> for line in sys.stdin:
>  -match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
>  +match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p,
> line)
>   if match:
> filename = match.group(2)
>   if filename == None:
> 
> 
>  ___
>  cfe-commits mailing list
>  cfe-commits@lists.llvm.org
>  http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
> >>>
> >>>
> >
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246582 - Re-commit r246497 (and dependent changes r246524 and r246521), reverted in

2015-09-01 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Tue Sep  1 15:35:42 2015
New Revision: 246582

URL: http://llvm.org/viewvc/llvm-project?rev=246582=rev
Log:
Re-commit r246497 (and dependent changes r246524 and r246521), reverted in
r246546, with a workaround for an MSVC 2013 miscompile and an MSVC 2015
rejects-valid.

Original commit message:

[modules] Rework serialized DeclContext lookup table management. Instead of
walking the loaded ModuleFiles looking for lookup tables for the context, store
them all in one place, and merge them together if we find we have too many
(currently, more than 4). If we do merge, include the merged form in our
serialized lookup table, so that downstream readers never need to look at our
imports' tables.

This gives a huge performance improvement to builds with very large numbers of
modules (in some cases, more than a 2x speedup was observed).

Added:
cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h
  - copied, changed from r246545, 
cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h
Modified:
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/include/clang/Serialization/Module.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTReaderInternals.h
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/lib/Serialization/Module.cpp
cfe/trunk/test/Modules/cxx-templates.cpp
cfe/trunk/test/Modules/merge-using-decls.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=246582=246581=246582=diff
==
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Tue Sep  1 15:35:42 2015
@@ -1530,4 +1530,23 @@ namespace clang {
   }
 } // end namespace clang
 
+namespace llvm {
+  template <> struct DenseMapInfo {
+static clang::serialization::DeclarationNameKey getEmptyKey() {
+  return clang::serialization::DeclarationNameKey(-1, 1);
+}
+static clang::serialization::DeclarationNameKey getTombstoneKey() {
+  return clang::serialization::DeclarationNameKey(-1, 2);
+}
+static unsigned
+getHashValue(const clang::serialization::DeclarationNameKey ) {
+  return Key.getHash();
+}
+static bool isEqual(const clang::serialization::DeclarationNameKey ,
+const clang::serialization::DeclarationNameKey ) {
+  return L == R;
+}
+  };
+}
+
 #endif

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=246582=246581=246582=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Tue Sep  1 15:35:42 2015
@@ -282,9 +282,8 @@ class ReadMethodPoolVisitor;
 
 namespace reader {
   class ASTIdentifierLookupTrait;
-  /// \brief The on-disk hash table used for the DeclContext's Name lookup 
table.
-  typedef llvm::OnDiskIterableChainedHashTable
-ASTDeclContextNameLookupTable;
+  /// \brief The on-disk hash table(s) used for DeclContext name lookup.
+  struct DeclContextLookupTable;
 }
 
 } // end namespace serialization
@@ -507,6 +506,10 @@ private:
   /// \brief Map from the TU to its lexical contents from each module file.
   std::vector> TULexicalDecls;
 
+  /// \brief Map from a DeclContext to its lookup tables.
+  llvm::DenseMap Lookups;
+
   // Updates for visible decls can occur for other contexts than just the
   // TU, and when we read those update records, the actual context may not
   // be available yet, so have this pending map using the ID as a key. It
@@ -514,7 +517,6 @@ private:
   struct PendingVisibleUpdate {
 ModuleFile *Mod;
 const unsigned char *Data;
-unsigned BucketOffset;
   };
   typedef SmallVector DeclContextVisibleUpdates;
 
@@ -1089,6 +1091,10 @@ public:
 Visit(GetExistingDecl(ID));
   }
 
+  /// \brief Get the loaded lookup tables for \p Primary, if any.
+  const serialization::reader::DeclContextLookupTable *
+  getLoadedLookupTables(DeclContext *Primary) const;
+
 private:
   struct ImportedModule {
 ModuleFile *Mod;
@@ -1870,6 +1876,13 @@ public:
   /// Note: overrides method in ExternalASTSource
   Module *getModule(unsigned ID) override;
 
+  /// \brief Retrieve the module file with a given local ID within the 
specified
+  /// ModuleFile.
+  ModuleFile *getLocalModuleFile(ModuleFile , unsigned ID);
+
+  /// \brief Get an ID for the given module file.
+  unsigned 

Re: r246497 - [modules] Rework serialized DeclContext lookup table management. Instead of

2015-09-01 Thread Richard Smith via cfe-commits
On Tue, Sep 1, 2015 at 6:26 AM, Aaron Ballman 
wrote:

> On Tue, Sep 1, 2015 at 4:43 AM, İsmail Dönmez
>  wrote:
> > Hi,
> >
> > On Tue, Sep 1, 2015 at 1:17 AM, Richard Smith via cfe-commits
> >  wrote:
> >> Author: rsmith
> >> Date: Mon Aug 31 17:17:11 2015
> >> New Revision: 246497
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=246497=rev
> >> Log:
> >> [modules] Rework serialized DeclContext lookup table management.
> Instead of
> >> walking the loaded ModuleFiles looking for lookup tables for the
> context, store
> >> them all in one place, and merge them together if we find we have too
> many
> >> (currently, more than 4). If we do merge, include the merged form in our
> >> serialized lookup table, so that downstream readers never need to look
> at our
> >> imports' tables.
> >>
> >> This gives a huge performance improvement to builds with very large
> numbers of
> >> modules (in some cases, more than a 2x speedup was observed).
> >>
> >> Added:
> >> cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h
> >
> > This doesn't seem to compile with VS2015:
> >
> > FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe   /nologo /TP
> > /DWIN32 /D_WINDOWS   -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291
> > -wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503
> > -wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610
> > -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389
> > -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4324 -w14062 -we4238 /W4
> > /Zc:inline /Zc:sizedDealloc- /MT /O2 /Ob2
> > -Itools\clang\lib\Serialization -I..\tools\clang\lib\Serialization
> > -I..\tools\clang\include -Itools\clang\include -Iinclude -I..\include
> >   -UNDEBUG  /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
> > -DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
> > -DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE
> > -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
> > -D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0
> > -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
> > -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
> >
> /Fotools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\ASTReader.cpp.obj
> > /Fdtools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\
> > /FS -c ..\tools\clang\lib\Serialization\ASTReader.cpp
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
> > error C2065: 'Files': undeclared identifier
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(111):
> > note: while compiling class template member function 'void
> >
> clang::serialization::MultiOnDiskHashTable::removeOverriddenTables(void)'
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(243):
> > note: see reference to function template instantiation 'void
> >
> clang::serialization::MultiOnDiskHashTable::removeOverriddenTables(void)'
> > being compiled
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\ASTReaderInternals.h(114):
> > note: see reference to class template instantiation
> >
> 'clang::serialization::MultiOnDiskHashTable'
> > being compiled
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
> > error C2228: left of '.count' must have class/struct/union
> >
> c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
> > note: type is 'unknown-type'
> > ninja: build stopped: subcommand failed.
>
> I have reverted r246497 (which required also reverting r246524 and
> r246521 to avoid merge conflicts) to get back to green. Commit was
> r246546.
>
> I'm not certain why MSVC is falling over on this code, but I suspect
> compiler bug. If anyone has a reduced testcase (which I may spend some
> time on if I have a moment), I would be happy to report it to
> Microsoft.


It's two compiler bugs.

In MSVC 2013, providing a move constructor apparently doesn't suppress the
implicit generation of copy operations in some cases. In particular, given:

  struct X { X(); X(X&&); X =(X&&); ~X(); };
  struct Y { X x; };

... Y is copyable (and in my case, copying it led to a use-after-free,
because X had the equivalent of a pointer member).

In MSVC 2015, it appears that implicit lambda capture doesn't work reliably
inside a member function of a class template. The testcase looks something
like:

template struct S {
  typedef T type;
  type f() {
type n;
[&] { ++n; }();
return n;
  }
};
int k = S().f();

... though I don't know if that's enough to reproduce the rejects-valid.

Anyway, these are hopefully both worked around in r246582.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12087: always_inline codegen rewrite

2015-09-01 Thread Evgeniy Stepanov via cfe-commits
eugenis added inline comments.


Comment at: lib/CodeGen/CodeGenModule.cpp:469-470
@@ +468,4 @@
+  llvm::LLVMContext  = getModule().getContext();
+  llvm::Function *StubFn =
+  llvm::Function::Create(FT, Fn->getLinkage(), Name, ());
+  assert(StubFn->getName() == Name && "name was uniqued!");

rnk wrote:
> This is a lot of work to do for every always_inline function that got called. 
> Can we do this like:
> 1. Build SmallVector of all non-direct call uses of Fn
> 2. Return if there are no such uses
> 3. Build the stub function replacement
> 4. `for (Use *U : IndirectUses) U->set(StubFn)`
This is a very good idea. It's not exactly as easy as that, but it works, see 
the new code.


Comment at: test/CodeGen/2008-05-19-AlwaysInline.c:1
@@ -1,2 +1,2 @@
-// RUN: %clang_cc1 %s -emit-llvm -o - | not grep sabrina
+// RUN: %clang_cc1 %s -emit-llvm -o - | not grep 'call.*sabrina('
 

rnk wrote:
> FileCheck?
Actually, this chunk is not needed with your proposed change.
Reverted.


Repository:
  rL LLVM

http://reviews.llvm.org/D12087



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Renato Golin via cfe-commits
On 1 September 2015 at 20:09, Aaron Ballman  wrote:
> Like a parameter/local misalignment?

Yes, I think due to placement new for inherited classes, ignoring the
padding between the base class and the inherited extra.

Anyway, it's not your commit, as I just got a failure on my other box
with 246547, which "passed" on the buildbot.

Ahmed, I think we have another of those issues... :)

I'll let the bot broken, as it'll come back again and "stop" failing
in its own... :/

cheers,
--renato
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: Move createEliminateAvailableExternallyPass earlier

2015-09-01 Thread Teresa Johnson via cfe-commits
Hi Yaron,

Thanks, moving it earlier in general seems ok to me. I originally put
this right before the GlobalDCE calls because it was somewhat related.
I wonder if the createEliminateAvailableExternallyPass call for the
LTO pipeline should similarly be moved up closer to inlining, perhaps
after any IP alias analysis passes? Hopefully someone more familiar
with the passes than I will comment on how early we can do this.

Teresa

On Tue, Sep 1, 2015 at 1:32 PM, Yaron Keren via cfe-commits
 wrote:
> Following the discussion on cfe-dev, this moves
> createEliminateAvailableExternallyPass earlier in the pass pipeline to save
> running many ModulePasses on available external functions that are thrown
> away anyhow.
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
Teresa Johnson | Software Engineer | tejohn...@google.com | 408-460-2413
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-01 Thread Антон Ярцев via cfe-commits
ayartsev updated this revision to Diff 33740.

http://reviews.llvm.org/D9040

Files:
  lib/StaticAnalyzer/Checkers/MallocChecker.cpp
  test/Analysis/malloc.c

Index: test/Analysis/malloc.c
===
--- test/Analysis/malloc.c
+++ test/Analysis/malloc.c
@@ -263,21 +263,21 @@
 
 void CheckUseZeroAllocated7() {
   int *p = realloc(0, 0);
-  *p = 1; //TODO: warn about use of zero-allocated memory
+  *p = 1; // expected-warning {{Use of zero-allocated memory}}
   free(p);
 }
 
 void CheckUseZeroAllocated8() {
   int *p = malloc(8);
   int *q = realloc(p, 0);
-  *q = 1; //TODO: warn about use of zero-allocated memory
+  *q = 1; // expected-warning {{Use of zero-allocated memory}}
   free(q);
 }
 
 void CheckUseZeroAllocated9() {
   int *p = realloc(0, 0);
   int *q = realloc(p, 0);
-  *q = 1; //TODO: warn about use of zero-allocated memory
+  *q = 1; // expected-warning {{Use of zero-allocated memory}}
   free(q);
 }
 
@@ -307,6 +307,34 @@
   free(p);
 }
 
+void CheckUseZeroReallocatedPathNoWarn(_Bool b) {
+  int s = 0;
+  if (b)
+s= 10;
+
+  char *p = malloc(8);
+  char *q = realloc(p, s);
+
+  if (b)
+*q = 1; // no warning
+
+  free(q);
+}
+
+void CheckUseZeroReallocatedPathWarn(_Bool b) {
+  int s = 10;
+  if (b)
+s= 0;
+
+  char *p = malloc(8);
+  char *q = realloc(p, s);
+
+  if (b)
+*q = 1; // expected-warning {{Use of zero-allocated memory}}
+
+  free(q);
+}
+
 // This case tests that storing malloc'ed memory to a static variable which is
 // then returned is not leaked.  In the absence of known contracts for functions
 // or inter-procedural analysis, this is a conservative answer.
Index: lib/StaticAnalyzer/Checkers/MallocChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -508,6 +508,7 @@
 
 REGISTER_MAP_WITH_PROGRAMSTATE(RegionState, SymbolRef, RefState)
 REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
+REGISTER_SET_WITH_PROGRAMSTATE(ReallocSizeZeroSymbols, SymbolRef)
 
 // A map from the freed symbol to the symbol representing the return value of 
 // the free function.
@@ -891,15 +892,19 @@
   return State;
 
 const RefState *RS = State->get(Sym);
-if (!RS)
-  return State; // TODO: change to assert(RS); after realloc() will 
-// guarantee have a RegionState attached.
-
-if (!RS->isAllocated())
-  return State;
-
-return TrueState->set(Sym,
-   RefState::getAllocatedOfSizeZero(RS));
+if (RS) {
+  if (RS->isAllocated())
+return TrueState->set(Sym,
+  RefState::getAllocatedOfSizeZero(RS));
+  else
+return State;
+} else {
+  // Case of zero-size realloc. Historically 'realloc(ptr, 0)' is treated as
+  // 'free(ptr)' and the returned value from 'realloc(ptr, 0)' is not
+  // tracked. Add zero-reallocated Sym to the state to catch references
+  // to zero-allocated memory.
+  return TrueState->add(Sym);
+}
   }
 
   // Assume the value is non-zero going forward.
@@ -1487,6 +1492,9 @@
 Optional
 MallocChecker::getCheckIfTracked(CheckerContext , SymbolRef Sym,
  bool IsALeakCheck) const {
+  if (C.getState()->contains(Sym))
+return CK_MallocChecker;
+
   const RefState *RS = C.getState()->get(Sym);
   assert(RS);
   return getCheckIfTracked(RS->getAllocationFamily(), IsALeakCheck);
@@ -1929,7 +1937,7 @@
   }
 
   if (PrtIsNull && SizeIsZero)
-return nullptr;
+return State;
 
   // Get the from and to pointer symbols as in toPtr = realloc(fromPtr, size).
   assert(!PrtIsNull);
@@ -2291,10 +2299,14 @@
 void MallocChecker::checkUseZeroAllocated(SymbolRef Sym, CheckerContext ,
   const Stmt *S) const {
   assert(Sym);
-  const RefState *RS = C.getState()->get(Sym);
 
-  if (RS && RS->isAllocatedOfSizeZero())
-ReportUseZeroAllocated(C, RS->getStmt()->getSourceRange(), Sym);
+  if (const RefState *RS = C.getState()->get(Sym)) {
+if (RS->isAllocatedOfSizeZero())
+  ReportUseZeroAllocated(C, RS->getStmt()->getSourceRange(), Sym);
+  }
+  else if (C.getState()->contains(Sym)) {
+ReportUseZeroAllocated(C, S->getSourceRange(), Sym);
+  }
 }
 
 bool MallocChecker::checkDoubleDelete(SymbolRef Sym, CheckerContext ) const {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12445: [Static Analyzer] Remove sinks from nullability checks.

2015-09-01 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:166
@@ +165,3 @@
+  /// report anything and turn off the check.
+  ///
+  /// When \p SuppressPath is set to true, no more bugs will be reported on 
this

It is still not clear what the condition is..
More context in the name would be better; for example, how about 
reportBugIfNotOnDefensiveCodePath or reportBugIfPreconditionHolds


Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:374
@@ +373,3 @@
+  ProgramStateRef OriginalState = N->getState();
+  if (OriginalState->get())
+return;

Shouldn't this be part of checkPreconditionViolation?



Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:806
@@ -690,1 +805,3 @@
 
+  ProgramStateRef State = C.getState();
+  if (State->get())

Maybe we should only check these at the time the bug is about to be reported.. 

That way the code would be less error prone..


http://reviews.llvm.org/D12445



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-01 Thread Anna Zaks via cfe-commits
zaks.anna added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:523
@@ -510,2 +522,3 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
+REGISTER_MAP_WITH_PROGRAMSTATE(ReallocSizeZeroFlag, SymbolRef, ReallocSizeZero)
 

I do not think this is related to my question.

You add a map from a symbol to a "flag" here; not really a flag but the empty 
struct ReallocSizeZero. The only ways this is used is to set in the state that 
the symbol is zero realloced or query if the specific symbol is zero realloced. 
It seems that using the set of zero realloced symbols would be the right data 
structure here.

Why do we need the extra complexity of the map and the empty struct?


http://reviews.llvm.org/D9040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12445: [Static Analyzer] Remove sinks from nullability checks.

2015-09-01 Thread Gábor Horváth via cfe-commits
xazax.hun added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp:806
@@ -690,1 +805,3 @@
 
+  ProgramStateRef State = C.getState();
+  if (State->get())

zaks.anna wrote:
> Maybe we should only check these at the time the bug is about to be 
> reported.. 
> 
> That way the code would be less error prone..
This is checked before error reporting as well.
The purpose of this check at the beginning of the callbacks is optimization 
only.


http://reviews.llvm.org/D12445



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12445: [Static Analyzer] Remove sinks from nullability checks.

2015-09-01 Thread Gábor Horváth via cfe-commits
xazax.hun updated this revision to Diff 33728.
xazax.hun marked 2 inline comments as done.
xazax.hun added a comment.

Style fixes according to the review.


http://reviews.llvm.org/D12445

Files:
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  test/Analysis/nullability.mm

Index: test/Analysis/nullability.mm
===
--- test/Analysis/nullability.mm
+++ test/Analysis/nullability.mm
@@ -179,3 +179,65 @@
   takesNullable(p);
   takesNonnull(p);
 }
+
+void onlyReportFirstPreconditionViolationOnPath() {
+  Dummy *p = returnsNullable();
+  takesNonnull(p); // expected-warning {{}}
+  takesNonnull(p); // No warning.
+  // The first warning was not a sink. The analysis expected to continue.
+  int i = 0;
+  i = 5 / i; // expected-warning {{Division by zero}}
+  (void)i;
+}
+
+Dummy *_Nonnull doNotWarnWhenPreconditionIsViolatedInTopFunc(
+Dummy *_Nonnull p) {
+  if (!p) {
+Dummy *ret =
+0; // avoid compiler warning (which is not generated by the analyzer)
+if (getRandom())
+  return ret; // no warning
+else
+  return p; // no warning
+  } else {
+return p;
+  }
+}
+
+Dummy *_Nonnull doNotWarnWhenPreconditionIsViolated(Dummy *_Nonnull p) {
+  if (!p) {
+Dummy *ret =
+0; // avoid compiler warning (which is not generated by the analyzer)
+if (getRandom())
+  return ret; // no warning
+else
+  return p; // no warning
+  } else {
+return p;
+  }
+}
+
+void testPreconditionViolationInInlinedFunction(Dummy *p) {
+  doNotWarnWhenPreconditionIsViolated(p);
+}
+
+void inlinedNullable(Dummy *_Nullable p) {
+  if (p) return;
+}
+void inlinedNonnull(Dummy *_Nonnull p) {
+  if (p) return;
+}
+void inlinedUnspecified(Dummy *p) {
+  if (p) return;
+}
+
+Dummy *_Nonnull testDefensiveInlineChecks(Dummy * p) {
+  switch (getRandom()) {
+  case 1: inlinedNullable(p); break;
+  case 2: inlinedNonnull(p); break;
+  case 3: inlinedUnspecified(p); break;
+  }
+  if (getRandom())
+takesNonnull(p);
+  return p;
+}
Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -161,6 +161,16 @@
 const MemRegion *Region;
   };
 
+  /// When any of the nonnull arguments of the analyzed function is null, do not
+  /// report anything and turn off the check.
+  ///
+  /// When \p SuppressPath is set to true, no more bugs will be reported on this
+  /// path by this checker.
+  void reportBugIfPreconditionHolds(ErrorKind Error, ExplodedNode *N,
+const MemRegion *Region, CheckerContext ,
+const Stmt *ValueExpr = nullptr,
+bool SuppressPath = false) const;
+
   void reportBug(ErrorKind Error, ExplodedNode *N, const MemRegion *Region,
  BugReporter , const Stmt *ValueExpr = nullptr) const {
 if (!BT)
@@ -220,6 +230,13 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(NullabilityMap, const MemRegion *,
NullabilityState)
 
+// If the nullability precondition of a function is violated, we should not
+// report nullability related issues on that path. For this reason once a
+// precondition is not met on a path, this checker will be esentially turned off
+// for the rest of the analysis. We do not want to generate a sink node however,
+// so this checker would not lead to reduced coverage.
+REGISTER_TRAIT_WITH_PROGRAMSTATE(PreconditionViolated, bool)
+
 enum class NullConstraint { IsNull, IsNotNull, Unknown };
 
 static NullConstraint getNullConstraint(DefinedOrUnknownSVal Val,
@@ -302,6 +319,82 @@
   return Nullability::Unspecified;
 }
 
+template 
+static bool
+checkParamsForPreconditionViolation(const ParamVarDeclRange ,
+ProgramStateRef State,
+const LocationContext *LocCtxt) {
+  for (const auto *ParamDecl : Params) {
+if (ParamDecl->isParameterPack())
+  break;
+
+if (getNullabilityAnnotation(ParamDecl->getType()) != Nullability::Nonnull)
+  continue;
+
+auto RegVal = State->getLValue(ParamDecl, LocCtxt)
+  .template getAs();
+if (!RegVal)
+  continue;
+
+auto ParamValue = State->getSVal(RegVal->getRegion())
+  .template getAs();
+if (!ParamValue)
+  continue;
+
+if (getNullConstraint(*ParamValue, State) == NullConstraint::IsNull) {
+  return true;
+}
+  }
+  return false;
+}
+
+static bool checkPreconditionViolation(ProgramStateRef State, ExplodedNode *N,
+   CheckerContext ) {
+  if (State->get())
+return true;
+
+  const LocationContext *LocCtxt = C.getLocationContext();
+  const Decl *D = LocCtxt->getDecl();
+  if (!D)
+return false;
+
+  if (const auto *BlockD = dyn_cast(D)) {

Re: [PATCH] D12453: [CUDA] Allow function overloads based on host/device attributes.

2015-09-01 Thread Artem Belevich via cfe-commits
tra updated the summary for this revision.
tra updated this revision to Diff 33741.
tra marked an inline comment as done.
tra added a comment.

Removed builtin-related changes(http://reviews.llvm.org/D12122). Will commit 
them separately.
Added more test cases.
Addressed eliben@'s comments.


http://reviews.llvm.org/D12453

Files:
  include/clang/Basic/LangOptions.def
  include/clang/Driver/CC1Options.td
  include/clang/Sema/Sema.h
  lib/AST/ItaniumMangle.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Sema/SemaCUDA.cpp
  lib/Sema/SemaDecl.cpp
  lib/Sema/SemaExprCXX.cpp
  lib/Sema/SemaOverload.cpp
  test/CodeGenCUDA/function-overload.cu
  test/SemaCUDA/function-overload.cu

Index: test/SemaCUDA/function-overload.cu
===
--- /dev/null
+++ test/SemaCUDA/function-overload.cu
@@ -0,0 +1,186 @@
+// REQUIRES: x86-registered-target
+// REQUIRES: nvptx-registered-target
+
+// Make sure we handle target overloads correctly.
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu \
+// RUN:-fsyntax-only -fcuda-target-overloads -verify %s
+// RUN: %clang_cc1 -triple nvptx64-nvidia-cuda \
+// RUN:-fsyntax-only -fcuda-target-overloads -fcuda-is-device -verify %s
+
+// Check target overloads handling with disabled call target checks.
+// RUN: %clang_cc1 -DNOCHECKS -triple x86_64-unknown-linux-gnu -fsyntax-only \
+// RUN:-fcuda-disable-target-call-checks -fcuda-target-overloads -verify %s
+// RUN: %clang_cc1 -DNOCHECKS -triple nvptx64-nvidia-cuda -fsyntax-only \
+// RUN:-fcuda-disable-target-call-checks -fcuda-target-overloads \
+// RUN:-fcuda-is-device -verify %s
+
+#include "Inputs/cuda.h"
+
+typedef int (*fp_t)(void);
+typedef void (*gp_t)(void);
+
+__device__ int dhhd(void) { return 2; }
+__host__ int dhhd(void) { return 1; } // expected-note {{previous definition is here}}
+int dhhd(void) { return 1; } // expected-error {{redefinition of 'dhhd'}}
+__host__ __device__ int dhhd(void) { return 3; }
+
+__host__ int hhd(void) { return 4; }
+__host__ __device__ int dhd(void) { return 5; }
+
+__device__ int dhd(void) { return 6; }
+__host__ __device__ int hhd(void) { return 7; }
+
+__device__ int d(void) { return 8; }
+__host__ int h(void) { return 9; }
+__global__ void g(void) {}
+
+extern "C" __device__ int chd(void) {return 10;}
+extern "C" __host__ int chd(void) {return 11;} // expected-note {{previous definition is here}}
+extern "C" int chd(void) {return 11;} // expected-error {{redefinition of 'chd'}}
+extern "C" __host__ __device__ int chd(void) {return 12;} // expected-note {{previous definition is here}}
+extern "C" __host__ __device__ int chd(void) {return 13;} // expected-error {{redefinition of 'chd'}}
+
+__host__ void hostf(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g;
+  fp_t dp = d;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __device__ function 'd' in __host__ function}}
+  // expected-note@33 {{'d' declared here}}
+#endif
+  fp_t hp = h;
+
+  dhhd();
+  hhd();
+  dhd();
+  chd();
+  d();
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{no matching function for call to 'd'}}
+  // expected-note@33 {{candidate function not viable: call to __device__ function from __host__ function}}
+#endif
+  h();
+
+  g(); // expected-error {{call to global function g not configured}}
+  g<<<0,0>>>();
+}
+
+__device__ void devicef(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g; // expected-error {{reference to __global__ function 'g' in __device__ function}}
+   // expected-note@35 {{'g' declared here}}
+  fp_t dp = d;
+  fp_t hp = h;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __host__ function 'h' in __device__ function}}
+  // expected-note@34 {{'h' declared here}}
+#endif
+
+  dhhd();
+  hhd();
+  dhd();
+  chd();
+  d();
+  h();
+  g();
+#if !defined(NOCHECKS)
+  // expected-error@-3 {{no matching function for call to 'h'}}
+  // expected-note@34 {{candidate function not viable: call to __host__ function from __device__ function}}
+#endif
+  // expected-error@-5 {{no matching function for call to 'g'}}
+  // expected-note@35 {{candidate function not viable: call to __global__ function from __device__ function}}
+  g<<<0,0>>>();
+  // expected-error@-1 {{reference to __global__ function 'g' in __device__ function}}
+  // expected-note@35 {{'g' declared here}}
+}
+
+__global__ void globalf(void) {
+  fp_t dhddp = dhhd;
+  fp_t hhdp = hhd;
+  fp_t dhdp = dhd;
+  gp_t gp = g; // expected-error {{reference to __global__ function 'g' in __global__ function}}
+   // expected-note@35 {{'g' declared here}}
+  fp_t dp = d;
+  fp_t hp = h;
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{reference to __host__ function 'h' in __global__ function}}
+  // expected-note@34 {{'h' declared here}}
+#endif
+
+  dhhd();
+  hhd();
+  dhd();
+  chd();
+  d();
+  h();
+#if !defined(NOCHECKS)
+  // expected-error@-2 {{no 

r246600 - Fix assertion failure in TransformOpaqueValueExpr

2015-09-01 Thread Hubert Tong via cfe-commits
Author: hubert.reinterpretcast
Date: Tue Sep  1 17:50:31 2015
New Revision: 246600

URL: http://llvm.org/viewvc/llvm-project?rev=246600=rev
Log:
Fix assertion failure in TransformOpaqueValueExpr

Summary:
`OpaqueValueExpr`s may not have a source expression (as in the case when
they are created due to a default argument error).
This can cause an assertion failure in `TransformOpaqueValueExpr` during
template instantiation.

This patch fixes the assertion failure.

Reviewers: hfinkel, rsmith

Subscribers: fraggamuffin, cfe-commits

Differential Revision: http://reviews.llvm.org/D11582

Patch by Rachel Craik!

Modified:
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaTemplate/default-arguments.cpp

Modified: cfe/trunk/lib/Sema/TreeTransform.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/TreeTransform.h?rev=246600=246599=246600=diff
==
--- cfe/trunk/lib/Sema/TreeTransform.h (original)
+++ cfe/trunk/lib/Sema/TreeTransform.h Tue Sep  1 17:50:31 2015
@@ -7806,7 +7806,7 @@ TreeTransform::TransformOffsetO
 template
 ExprResult
 TreeTransform::TransformOpaqueValueExpr(OpaqueValueExpr *E) {
-  assert(getDerived().AlreadyTransformed(E->getType()) &&
+  assert((!E->getSourceExpr() || 
getDerived().AlreadyTransformed(E->getType())) &&
  "opaque value expression requires transformation");
   return E;
 }

Modified: cfe/trunk/test/SemaTemplate/default-arguments.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaTemplate/default-arguments.cpp?rev=246600=246599=246600=diff
==
--- cfe/trunk/test/SemaTemplate/default-arguments.cpp (original)
+++ cfe/trunk/test/SemaTemplate/default-arguments.cpp Tue Sep  1 17:50:31 2015
@@ -166,3 +166,9 @@ namespace NondefDecls {
   }
   template void f1();  // expected-note{{in instantiation of function 
template specialization 'NondefDecls::f1' requested here}}
 }
+
+template 
+struct C {
+  C(T t = ); // expected-error {{expected expression}}
+};
+C obj;


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-01 Thread Антон Ярцев via cfe-commits
ayartsev added a comment.

Ping


http://reviews.llvm.org/D9040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246596 - Migrate the target attribute parsing code into an extension off of

2015-09-01 Thread Eric Christopher via cfe-commits
Author: echristo
Date: Tue Sep  1 17:03:58 2015
New Revision: 246596

URL: http://llvm.org/viewvc/llvm-project?rev=246596=rev
Log:
Migrate the target attribute parsing code into an extension off of
the main attribute and cache the results so we don't have to parse
a single attribute more than once.

Modified:
cfe/trunk/include/clang/Basic/Attr.td
cfe/trunk/lib/CodeGen/CGCall.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=246596=246595=246596=diff
==
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Tue Sep  1 17:03:58 2015
@@ -1315,9 +1315,54 @@ def Pascal : InheritableAttr {
 
 def Target : InheritableAttr {
   let Spellings = [GCC<"target">];
-  let Args = [StringArgument<"features">];
+  let Args = [StringArgument<"featuresStr">];
   let Subjects = SubjectList<[Function], ErrorDiag>;
   let Documentation = [TargetDocs];
+  let AdditionalMembers = [{
+StringRef CPU;
+std::vector Features;
+bool Parsed;
+StringRef getCPU() {
+   if (!Parsed)
+ parse();
+   return CPU;
+}
+std::vector () {
+   if (!Parsed)
+ parse();
+   return Features;
+}
+void parse() {
+  StringRef FeaturesStr = getFeaturesStr();
+  SmallVector AttrFeatures;
+  FeaturesStr.split(AttrFeatures, ",");
+
+  // Grab the various features and prepend a "+" to turn on the feature to
+  // the backend and add them to our existing set of features.
+  for (auto  : AttrFeatures) {
+// Go ahead and trim whitespace rather than either erroring or
+// accepting it weirdly.
+Feature = Feature.trim();
+
+// While we're here iterating check for a different target cpu.
+if (Feature.startswith("arch="))
+  CPU = Feature.split("=").second.trim();
+else if (Feature.startswith("tune="))
+  // We don't support cpu tuning this way currently.
+  ;
+else if (Feature.startswith("fpmath="))
+  // TODO: Support the fpmath option this way. It will require checking
+  // overall feature validity for the function with the rest of the
+  // attributes on the function.
+  ;
+else if (Feature.startswith("no-"))
+  Features.push_back("-" + Feature.split("-").second.str());
+else
+  Features.push_back("+" + Feature.str());
+  }
+  Parsed = true;
+}
+  }];
 }
 
 def TransparentUnion : InheritableAttr {

Modified: cfe/trunk/lib/CodeGen/CGCall.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGCall.cpp?rev=246596=246595=246596=diff
==
--- cfe/trunk/lib/CodeGen/CGCall.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGCall.cpp Tue Sep  1 17:03:58 2015
@@ -1499,40 +1499,19 @@ void CodeGenModule::ConstructAttributeLi
 const FunctionDecl *FD = dyn_cast_or_null(TargetDecl);
 if (FD && FD->hasAttr()) {
   llvm::StringMap FeatureMap;
-  const auto *TD = FD->getAttr();
+  auto *TD = FD->getAttr();
 
   // Make a copy of the features as passed on the command line.
   std::vector FnFeatures =
   getTarget().getTargetOpts().FeaturesAsWritten;
 
-  // Grab the target attribute string.
-  StringRef FeaturesStr = TD->getFeatures();
-  SmallVector AttrFeatures;
-  FeaturesStr.split(AttrFeatures, ",");
+  std::vector  = TD->getFeatures();
+  std::copy(AttrFeatures.begin(), AttrFeatures.end(),
+std::back_inserter(FnFeatures));
 
-  // Grab the various features and prepend a "+" to turn on the feature to
-  // the backend and add them to our existing set of features.
-  for (auto  : AttrFeatures) {
-// Go ahead and trim whitespace rather than either erroring or
-// accepting it weirdly.
-Feature = Feature.trim();
+  if (TD->getCPU() != "")
+   TargetCPU = TD->getCPU();
 
-// While we're here iterating check for a different target cpu.
-if (Feature.startswith("arch="))
-  TargetCPU = Feature.split("=").second.trim();
-else if (Feature.startswith("tune="))
-  // We don't support cpu tuning this way currently.
-  ;
-else if (Feature.startswith("fpmath="))
-  // TODO: Support the fpmath option this way. It will require checking
-  // overall feature validity for the function with the rest of the
-  // attributes on the function.
-  ;
-else if (Feature.startswith("no-"))
-  FnFeatures.push_back("-" + Feature.split("-").second.str());
-else
-  FnFeatures.push_back("+" + Feature.str());
-  }
   // Now populate the feature map, first with the TargetCPU which is either
   // the default 

r246589 - Make trunk release notes point to 3.7, not 3.6

2015-09-01 Thread Nico Weber via cfe-commits
Author: nico
Date: Tue Sep  1 16:13:14 2015
New Revision: 246589

URL: http://llvm.org/viewvc/llvm-project?rev=246589=rev
Log:
Make trunk release notes point to 3.7, not 3.6

Modified:
cfe/trunk/docs/ReleaseNotes.rst

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=246589=246588=246589=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Tue Sep  1 16:13:14 2015
@@ -11,8 +11,8 @@ Written by the `LLVM Team `_.
+   prefer the `Clang 3.7 Release Notes
+   `_.
 
 Introduction
 


___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D9040: [analyzer] Make realloc(ptr, 0) handling equivalent to malloc(0).

2015-09-01 Thread Антон Ярцев via cfe-commits
ayartsev added inline comments.


Comment at: lib/StaticAnalyzer/Checkers/MallocChecker.cpp:523
@@ -510,2 +522,3 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(ReallocPairs, SymbolRef, ReallocPair)
+REGISTER_MAP_WITH_PROGRAMSTATE(ReallocSizeZeroFlag, SymbolRef, ReallocSizeZero)
 

zaks.anna wrote:
> I do not think this is related to my question.
> 
> You add a map from a symbol to a "flag" here; not really a flag but the empty 
> struct ReallocSizeZero. The only ways this is used is to set in the state 
> that the symbol is zero realloced or query if the specific symbol is zero 
> realloced. It seems that using the set of zero realloced symbols would be the 
> right data structure here.
> 
> Why do we need the extra complexity of the map and the empty struct?
Got it! Updated the patch.


http://reviews.llvm.org/D9040



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12541: [Sparc][Shave]: Empower the toolchain formerly known as SHAVE to do more.

2015-09-01 Thread Douglas Katzman via cfe-commits
dougk created this revision.
dougk added reviewers: jyknight, chandlerc.
dougk added a subscriber: cfe-commits.
Herald added a subscriber: jyknight.

Rename SHAVE toolchain to  Myriad toolchain.
Run the Myriad linker whenever the vendor [sic] is Myriad.
Also recognize RTEMS as the OS, and do something special for that.

(work-in-progress)

http://reviews.llvm.org/D12541

Files:
  lib/Driver/Driver.cpp
  lib/Driver/ToolChains.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  lib/Driver/Tools.h

Index: lib/Driver/Tools.h
===
--- lib/Driver/Tools.h
+++ lib/Driver/Tools.h
@@ -792,6 +792,17 @@
 const llvm::opt::ArgList ,
 const char *LinkingOutput) const override;
 };
+
+class LLVM_LIBRARY_VISIBILITY Linker : public GnuTool {
+public:
+  Linker(const ToolChain ) : GnuTool("shave::Linker", "ld", TC) {}
+  bool hasIntegratedCPP() const override { return false; }
+  bool isLinkJob() const override { return true; }
+  void ConstructJob(Compilation , const JobAction ,
+const InputInfo , const InputInfoList ,
+const llvm::opt::ArgList ,
+const char *LinkingOutput) const override;
+};
 } // end namespace SHAVE
 
 } // end namespace tools
Index: lib/Driver/Tools.cpp
===
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -9651,3 +9651,78 @@
   C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Exec),
   CmdArgs, Inputs));
 }
+
+void tools::SHAVE::Linker::ConstructJob(Compilation , const JobAction ,
+const InputInfo ,
+const InputInfoList ,
+const ArgList ,
+const char *LinkingOutput) const {
+  const auto  =
+  static_cast(getToolChain());
+  const llvm::Triple  = TC.getTriple();
+  ArgStringList CmdArgs;
+
+  SmallString<128> CrtObjDir;
+  TC.getCompilerSupportDir(CrtObjDir);
+
+  CmdArgs.push_back("-EL"); // Endianness = little
+
+  // The remaining logic is mostly like gnutools::Linker::ConstructJob,
+  // but we never pass through a --sysroot option and various other bits.
+  // For example, there are no sanitizers (yet) nor gold linker.
+
+  // Silence warning for "clang -g foo.o -o foo"
+  Args.ClaimAllArgs(options::OPT_g_Group);
+  // and for "clang -w foo.o -o foo". Other warning options are already
+  // handled somewhere else.
+  Args.ClaimAllArgs(options::OPT_w);
+  if (Args.hasArg(options::OPT_s)) // Pass the 'strip' option.
+CmdArgs.push_back("-s");
+
+  CmdArgs.push_back("-o");
+  CmdArgs.push_back(Output.getFilename());
+
+  if (T.getOS() == llvm::Triple::RTEMS) {
+SmallString<128> Path1(CrtObjDir), Path2(CrtObjDir);
+llvm::sys::path::append(Path1, "crti.o");
+llvm::sys::path::append(Path2, "crtbegin.o");
+CmdArgs.push_back(Args.MakeArgString(Path1));
+CmdArgs.push_back(Args.MakeArgString(Path2));
+  }
+
+  Args.AddAllArgs(CmdArgs, {options::OPT_L, options::OPT_T_Group,
+options::OPT_e, options::OPT_s, options::OPT_t,
+options::OPT_Z_Flag, options::OPT_r});
+
+  // The linker doesn't use these builtin paths unless directed to.
+  SmallString<128> LibDir;
+  TC.getBuiltinLibDir(LibDir);
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + LibDir));
+  CmdArgs.push_back(Args.MakeArgString(StringRef("-L") + CrtObjDir));
+
+  AddLinkerInputs(getToolChain(), Inputs, Args, CmdArgs);
+
+  if (T.getOS() == llvm::Triple::RTEMS) {
+CmdArgs.push_back("--start-group");
+CmdArgs.push_back("-lg");
+CmdArgs.push_back("-lrtemscpu");
+CmdArgs.push_back("-lrtemsbsp");
+CmdArgs.push_back("--end-group");
+  }
+  CmdArgs.push_back("-lgcc");
+  if (C.getDriver().CCCIsCXX())
+CmdArgs.push_back("-lstdc++");
+
+  if (T.getOS() == llvm::Triple::RTEMS) {
+SmallString<128> Path1(CrtObjDir), Path2(CrtObjDir);
+llvm::sys::path::append(Path1, "crtend.o");
+llvm::sys::path::append(Path2, "crtn.o");
+CmdArgs.push_back(Args.MakeArgString(Path1));
+CmdArgs.push_back(Args.MakeArgString(Path2));
+  }
+
+  std::string Exec =
+  Args.MakeArgString(TC.GetProgramPath("sparc-myriad-elf-ld"));
+  C.addCommand(llvm::make_unique(JA, *this, Args.MakeArgString(Exec),
+  CmdArgs, Inputs));
+}
Index: lib/Driver/ToolChains.h
===
--- lib/Driver/ToolChains.h
+++ lib/Driver/ToolChains.h
@@ -101,7 +101,8 @@
   public:
 GCCInstallationDetector() : IsValid(false) {}
 void init(const Driver , const llvm::Triple ,
-  const llvm::opt::ArgList );
+  const llvm::opt::ArgList ,
+  const ArrayRef ExtraTripleAliases = {});
 
 /// \brief Check 

Move createEliminateAvailableExternallyPass earlier

2015-09-01 Thread Yaron Keren via cfe-commits
Following the discussion on cfe-dev, this
moves createEliminateAvailableExternallyPass earlier in the pass pipeline
to save running many ModulePasses on available external functions that are
thrown away anyhow.
Index: lib/Transforms/IPO/PassManagerBuilder.cpp
===
--- lib/Transforms/IPO/PassManagerBuilder.cpp   (revision 246535)
+++ lib/Transforms/IPO/PassManagerBuilder.cpp   (working copy)
@@ -331,6 +331,19 @@
   // we must insert a no-op module pass to reset the pass manager.
   MPM.add(createBarrierNoopPass());
 
+  if (!DisableUnitAtATime && OptLevel > 1 && !PrepareForLTO) {
+// Remove avail extern fns and globals definitions if we aren't
+// compiling an object file for later LTO. For LTO we want to preserve
+// these so they are eligible for inlining at link-time. Note if they
+// are unreferenced they will be removed by GlobalDCE later, so
+// this only impacts referenced available externally globals.
+// Eventually they will be suppressed during codegen, but eliminating
+// here enables more opportunity for GlobalDCE as it may make
+// globals referenced by available external functions dead
+// and saves running remaining passes on the eliminated functions.
+MPM.add(createEliminateAvailableExternallyPass());
+  }
+
   if (EnableNonLTOGlobalsModRef)
 // We add a fresh GlobalsModRef run at this point. This is particularly
 // useful as the above will have inlined, DCE'ed, and function-attr
@@ -438,17 +451,6 @@
 // GlobalOpt already deletes dead functions and globals, at -O2 try a
 // late pass of GlobalDCE.  It is capable of deleting dead cycles.
 if (OptLevel > 1) {
-  if (!PrepareForLTO) {
-// Remove avail extern fns and globals definitions if we aren't
-// compiling an object file for later LTO. For LTO we want to preserve
-// these so they are eligible for inlining at link-time. Note if they
-// are unreferenced they will be removed by GlobalDCE below, so
-// this only impacts referenced available externally globals.
-// Eventually they will be suppressed during codegen, but eliminating
-// here enables more opportunity for GlobalDCE as it may make
-// globals referenced by available external functions dead.
-MPM.add(createEliminateAvailableExternallyPass());
-  }
   MPM.add(createGlobalDCEPass()); // Remove dead fns and globals.
   MPM.add(createConstantMergePass()); // Merge dup global constants
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12022: Refactored dtor sanitizing into EHScopeStack

2015-09-01 Thread Richard Smith via cfe-commits
rsmith added inline comments.


Comment at: lib/CodeGen/CGCXX.cpp:42-44
@@ -33,1 +41,5 @@
 bool CodeGenModule::TryEmitBaseDestructorAsAlias(const CXXDestructorDecl *D) {
+  // If sanitizing memory to check for use-after-dtor, do not emit as
+  // an alias, unless it has no fields or has only fields with non-trivial
+  // destructors.
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&

I assume the rationale here is that the field and base class destructors will 
mark their storage as destroyed, so there's nothing else to mark? This may mean 
that vptrs and padding bytes don't get marked as destroyed, is that OK?


Comment at: lib/CodeGen/CGCXX.cpp:45-47
@@ +44,5 @@
+  // destructors.
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&
+  HasFieldWithTrivialDestructor(*this, D->getParent()))
+return true;
+

This check seems to be redundant, since `TryEmitDefinitionAsAlias` checks the 
same thing. Remove this copy?


Comment at: lib/CodeGen/CGCXX.cpp:135
@@ +134,3 @@
+  cast(AliasDecl.getDecl())->getCanonicalDecl();
+  assert(isa(MD));
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&

This function isn't (or wasn't) specific to destructors; I think you should be 
checking for this as part of your `if` below rather than asserting it.


Comment at: lib/CodeGen/CGCXX.cpp:136-138
@@ +135,5 @@
+  assert(isa(MD));
+  if (getCodeGenOpts().SanitizeMemoryUseAfterDtor &&
+  HasFieldWithTrivialDestructor(*this, MD->getParent()))
+return true;
+

Please reorder this after the quicker, higher-level checks below. (Maybe move 
it to just before we create the mangled name?)


Comment at: lib/CodeGen/CGClass.cpp:1334-1335
@@ -1338,1 +1333,4 @@
 {
+  if (Field->getType()->isPointerType())
+return true;
+

This appears redundant; we'd return `true` for pointers on line 1341 anyway. 
(`getBaseElementType` only strips off array types, not pointer types).


Comment at: lib/CodeGen/CGClass.cpp:1549
@@ +1548,3 @@
+
+  // Nothing to poison
+  if (Layout.getFieldCount() == 0)

Add full stop.


Comment at: lib/CodeGen/CGClass.cpp:1554
@@ +1553,3 @@
+  // Iterate over fields declared in this class, and count all fields,
+  // including inherited from base classes.
+  unsigned totalFields = 0;

You're only counting the direct fields here, not the inherited ones.


Comment at: lib/CodeGen/CGClass.cpp:1555-1558
@@ +1554,6 @@
+  // including inherited from base classes.
+  unsigned totalFields = 0;
+  for (auto *Field : Dtor->getParent()->fields()) {
+(void)Field;
+totalFields += 1;
+  }

unsigned totalFields = std::distance(Dtor->getParent()->field_begin(),
 Dtor->getParent()->field_end());


Comment at: lib/CodeGen/CGClass.cpp:1567
@@ +1566,3 @@
+  unsigned inheritedFields = totalFields - Layout.getFieldCount();
+  // todo: don't use iterator for accessing fields
+  RecordDecl::field_iterator Field;

todo -> TODO (or FIXME)


Comment at: lib/CodeGen/CGClass.cpp:1621
@@ +1620,3 @@
+
+  if (layoutEndOffset >= Layout.getFieldCount() - 1) {
+PoisonSize = Layout.getNonVirtualSize().getQuantity() -

I think this is off by one. `layoutEndOffset` is the index of the first field 
that is not poisoned, so this will trigger if we're poisoning up to, but not 
including, the last field, as well as triggering if we're poisoning the last 
field.


Comment at: lib/CodeGen/CGClass.cpp:1644-1645
@@ +1643,4 @@
+  CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
+  // Prevent the current stack frame from disappearing from the stack 
trace.
+  CGF.CurFn->addFnAttr("disable-tail-calls", "true");
+

Maybe do this once in `Emit` (if you poison anything) rather than doing it 
every time you emit a poison call?


Comment at: lib/CodeGen/CGClass.cpp:1722
@@ -1660,1 +1721,3 @@
 
+  if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor &&
+  SanOpts.has(SanitizerKind::Memory))

Please add a comment here. "Mark the lifetime of fields as ending after field 
destructors run and before we destroy base classes." or similar.


http://reviews.llvm.org/D12022



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11963: Create a __config_site file to capture configuration decisions.

2015-09-01 Thread Evgeniy Stepanov via cfe-commits
eugenis added a subscriber: eugenis.
eugenis added a comment.

This would greatly simplify the abi versioning change in 
http://reviews.llvm.org/D11740. Thanks for working on this!



Comment at: include/CMakeLists.txt:24
@@ +23,3 @@
+  -P ${LIBCXX_SOURCE_DIR}/cmake/Modules/CopyLibcxxHeaders.cmake
+  WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR})
+

This is creative :)
I don't know the usual cmake conventions, but CopyLibcxxHeaders is very 
different from other files in cmake/Modules in that it is a standalone script 
and not an included file. Should it be moved to smth like cmake/Scripts, or 
named differently?



http://reviews.llvm.org/D11963



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11361: [OpenMP] Target directive host codegen

2015-09-01 Thread Alexey Bataev via cfe-commits
ABataev added a comment.

Seems good to me, but it would be good if John McCall could look at the patch.


http://reviews.llvm.org/D11361



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r246534 - [modules] When emitting line tables, only emit filenames that are actually referenced by the entries that we emit.

2015-09-01 Thread Yaron Keren via cfe-commits
Hi Richard,

Since yesterday I see several clang test failures which *may* be related to
the series of patches of modules you comitted. These are:
 Clang :: Modules/cxx-templates.cpp
 Clang :: Modules/submodules-merge-defs.cpp
 Clang :: PCH/cxx-key-functions.cpp
 Clang :: PCH/cxx-templates.cpp

(failing as of r246534)

You can see these failing on clang-x64-ninja-win7 bot but you did not get
e-mail since it was masked by other test failing before them:

http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/4522

or on Takumi bot:

http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2923

The bots do not seem to printout details, so here is debug stack dump with
symbols for the three tests failing. The fourth one prints huge AST.

Could you have a look?


  FAIL: Clang :: Modules/cxx-templates.cpp (4128 of 23311)
    TEST 'Clang :: Modules/cxx-templates.cpp' FAILED

   Script:
   --
   rm -rf
C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
   not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
-internal-isystem C:\llvm-clean\msvc\RELWITHDEB
   INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
-fmodules -fimplicit-module-maps -fno-modules-error-recov
   ery
-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
-I C:\
   llvm-clean\tools\clang\test\Modules/Inputs
C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
   -dump-lookups | C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE
C:\llvm-clean\tools\clang\test\Modul
   es\cxx-templates.cpp --check-prefix=CHECK-GLOBAL
   not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
-internal-isystem C:\llvm-clean\msvc\RELWITHDEB
   INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
-fmodules -fimplicit-module-maps -fno-modules-error-recov
   ery
-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
-I C:\
   llvm-clean\tools\clang\test\Modules/Inputs
C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
   -dump-lookups -ast-dump-filter N |
C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\too
   ls\clang\test\Modules\cxx-templates.cpp --check-prefix=CHECK-NAMESPACE-N
   not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
-internal-isystem C:\llvm-clean\msvc\RELWITHDEB
   INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
-fmodules -fimplicit-module-maps -fno-modules-error-recov
   ery
-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
-I C:\
   llvm-clean\tools\clang\test\Modules/Inputs
C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
   -dump -ast-dump-filter SomeTemplate |
C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\
   tools\clang\test\Modules\cxx-templates.cpp --check-prefix=CHECK-DUMP
   C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
C:\llvm-clean\msvc\RELWITHDEBINFO
   \bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
-fmodules -fimplicit-module-maps -fno-modules-error-recovery

 
-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
-I C:\llvm
   -clean\tools\clang\test\Modules/Inputs
C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
   C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
C:\llvm-clean\msvc\RELWITHDEBINFO
   \bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
-fmodules -fimplicit-module-maps -fno-modules-error-recovery

 
-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
-I C:\llvm
   -clean\tools\clang\test\Modules/Inputs
C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
   -DEARLY_IMPORT
   --
   Exit Code: 2

   Command Output (stdout):
   --
   Command 0: "rm" "-rf"
"C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp"
   Command 0 Result: 0
   Command 0 Output:


   Command 0 Stderr:


   Command 1: "not" "C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE"
"-cc1" "-internal-isystem" "C:\llvm-c
   lean\msvc\RELWITHDEBINFO\bin\..\lib\clang\3.8.0\include"
"-nostdsysteminc" "-x" "objective-c++" "-fmodules" "-fimplicit-module
   -maps" "-fno-modules-error-recovery"
"-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-t
   emplates.cpp.tmp" "-I" "C:\llvm-clean\tools\clang\test\Modules/Inputs"
"C:\llvm-clean\tools\clang\test\M
   odules\cxx-templates.cpp" "-std=c++11" "-ast-dump-lookups"
   Command 1 Result: 1
   Command 1 Output:


   Command 1 Stderr:
   0x000140F97571 (0x0358BCC0 0x0358B969
0x0358B920 0x05F6E52F), llvm::OnDiskChainedHashTable

 ::find_hashed()
+ 0x41 bytes(s), c:\llvm-clean\include
   \llvm\support\ondiskhashtable.h, line 330 + 

Re: r246534 - [modules] When emitting line tables, only emit filenames that are actually referenced by the entries that we emit.

2015-09-01 Thread NAKAMURA Takumi via cfe-commits
FYI,

MultiOnDiskHashTable.h:108   delete T;
It is crashing.

Modules/cxx-templates.cpp can fail if target is i686-pc-win32.

On Tue, Sep 1, 2015 at 5:09 PM Yaron Keren via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Hi Richard,
>
> Since yesterday I see several clang test failures which *may* be related
> to the series of patches of modules you comitted. These are:
>  Clang :: Modules/cxx-templates.cpp
>  Clang :: Modules/submodules-merge-defs.cpp
>  Clang :: PCH/cxx-key-functions.cpp
>  Clang :: PCH/cxx-templates.cpp
>
> (failing as of r246534)
>
> You can see these failing on clang-x64-ninja-win7 bot but you did not get
> e-mail since it was masked by other test failing before them:
>
> http://lab.llvm.org:8011/builders/clang-x64-ninja-win7/builds/4522
>
> or on Takumi bot:
>
> http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2923
>
> The bots do not seem to printout details, so here is debug stack dump with
> symbols for the three tests failing. The fourth one prints huge AST.
>
> Could you have a look?
>
>
>   FAIL: Clang :: Modules/cxx-templates.cpp (4128 of 23311)
> TEST 'Clang :: Modules/cxx-templates.cpp' FAILED
> 
>Script:
>--
>rm -rf
> C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>ery
> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
> -I C:\
>llvm-clean\tools\clang\test\Modules/Inputs
> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>-dump-lookups | C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE
> C:\llvm-clean\tools\clang\test\Modul
>es\cxx-templates.cpp --check-prefix=CHECK-GLOBAL
>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>ery
> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
> -I C:\
>llvm-clean\tools\clang\test\Modules/Inputs
> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>-dump-lookups -ast-dump-filter N |
> C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\too
>ls\clang\test\Modules\cxx-templates.cpp --check-prefix=CHECK-NAMESPACE-N
>not C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1
> -internal-isystem C:\llvm-clean\msvc\RELWITHDEB
>INFO\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
> -fmodules -fimplicit-module-maps -fno-modules-error-recov
>ery
> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
> -I C:\
>llvm-clean\tools\clang\test\Modules/Inputs
> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -std=c++11 -ast
>-dump -ast-dump-filter SomeTemplate |
> C:/llvm-clean/msvc/RELWITHDEBINFO/bin\FileCheck.EXE C:\llvm-clean\
>tools\clang\test\Modules\cxx-templates.cpp --check-prefix=CHECK-DUMP
>C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
> C:\llvm-clean\msvc\RELWITHDEBINFO
>\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
> -fmodules -fimplicit-module-maps -fno-modules-error-recovery
>
>  
> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
> -I C:\llvm
>-clean\tools\clang\test\Modules/Inputs
> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
>C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE -cc1 -internal-isystem
> C:\llvm-clean\msvc\RELWITHDEBINFO
>\bin\..\lib\clang\3.8.0\include -nostdsysteminc -x objective-c++
> -fmodules -fimplicit-module-maps -fno-modules-error-recovery
>
>  
> -fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp
> -I C:\llvm
>-clean\tools\clang\test\Modules/Inputs
> C:\llvm-clean\tools\clang\test\Modules\cxx-templates.cpp -verify -std=c++11
>-DEARLY_IMPORT
>--
>Exit Code: 2
>
>Command Output (stdout):
>--
>Command 0: "rm" "-rf"
> "C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-templates.cpp.tmp"
>Command 0 Result: 0
>Command 0 Output:
>
>
>Command 0 Stderr:
>
>
>Command 1: "not" "C:/llvm-clean/msvc/RELWITHDEBINFO/bin/clang.EXE"
> "-cc1" "-internal-isystem" "C:\llvm-c
>lean\msvc\RELWITHDEBINFO\bin\..\lib\clang\3.8.0\include"
> "-nostdsysteminc" "-x" "objective-c++" "-fmodules" "-fimplicit-module
>-maps" "-fno-modules-error-recovery"
> "-fmodules-cache-path=C:\llvm-clean\msvc\tools\clang\test\Modules\Output\cxx-t
>emplates.cpp.tmp" "-I" 

Re: r246497 - [modules] Rework serialized DeclContext lookup table management. Instead of

2015-09-01 Thread İsmail Dönmez via cfe-commits
Hi,

On Tue, Sep 1, 2015 at 1:17 AM, Richard Smith via cfe-commits
 wrote:
> Author: rsmith
> Date: Mon Aug 31 17:17:11 2015
> New Revision: 246497
>
> URL: http://llvm.org/viewvc/llvm-project?rev=246497=rev
> Log:
> [modules] Rework serialized DeclContext lookup table management. Instead of
> walking the loaded ModuleFiles looking for lookup tables for the context, 
> store
> them all in one place, and merge them together if we find we have too many
> (currently, more than 4). If we do merge, include the merged form in our
> serialized lookup table, so that downstream readers never need to look at our
> imports' tables.
>
> This gives a huge performance improvement to builds with very large numbers of
> modules (in some cases, more than a 2x speedup was observed).
>
> Added:
> cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h

This doesn't seem to compile with VS2015:

FAILED: C:\PROGRA~2\MICROS~1.0\VC\bin\amd64\cl.exe   /nologo /TP
/DWIN32 /D_WINDOWS   -wd4146 -wd4180 -wd4244 -wd4258 -wd4267 -wd4291
-wd4345 -wd4351 -wd4355 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503
-wd4624 -wd4722 -wd4800 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610
-wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389
-wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4324 -w14062 -we4238 /W4
/Zc:inline /Zc:sizedDealloc- /MT /O2 /Ob2
-Itools\clang\lib\Serialization -I..\tools\clang\lib\Serialization
-I..\tools\clang\include -Itools\clang\include -Iinclude -I..\include
  -UNDEBUG  /EHs-c- /GR- /showIncludes -DCLANG_ENABLE_ARCMT
-DCLANG_ENABLE_OBJC_REWRITER -DCLANG_ENABLE_STATIC_ANALYZER
-DGTEST_HAS_RTTI=0 -D_CRT_NONSTDC_NO_DEPRECATE
-D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE
-D_CRT_SECURE_NO_WARNINGS -D_GNU_SOURCE -D_HAS_EXCEPTIONS=0
-D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS
/Fotools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\ASTReader.cpp.obj
/Fdtools\clang\lib\Serialization\CMakeFiles\clangSerialization.dir\
/FS -c ..\tools\clang\lib\Serialization\ASTReader.cpp
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
error C2065: 'Files': undeclared identifier
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(111):
note: while compiling class template member function 'void
clang::serialization::MultiOnDiskHashTable::removeOverriddenTables(void)'
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(243):
note: see reference to function template instantiation 'void
clang::serialization::MultiOnDiskHashTable::removeOverriddenTables(void)'
being compiled
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\ASTReaderInternals.h(114):
note: see reference to class template instantiation
'clang::serialization::MultiOnDiskHashTable'
being compiled
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
error C2228: left of '.count' must have class/struct/union
c:\cygwin64\home\ismail\src\llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
note: type is 'unknown-type'
ninja: build stopped: subcommand failed.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12512: [libcxxabi] Manually align pointers in __cxa_allocate_exception - Fixes PR24604

2015-09-01 Thread Joerg Sonnenberger via cfe-commits
joerg added a subscriber: joerg.
joerg requested changes to this revision.
joerg added a reviewer: joerg.
joerg added a comment.
This revision now requires changes to proceed.

Please don't commit this as is. Many platforms have posix_memalign or 
equivalent, which makes this both simpler and potentially without wasting 
memory. Compare e.g. http://reviews.llvm.org/D12001.


http://reviews.llvm.org/D12512



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-09-01 Thread Oliver Stannard via cfe-commits
olista01 added a comment.

Ping?


http://reviews.llvm.org/D12148



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12445: [Static Analyzer] Remove sinks from nullability checks.

2015-09-01 Thread Gábor Horváth via cfe-commits
xazax.hun updated this revision to Diff 33704.
xazax.hun added a comment.

Made sure that inlined defensive checks do not generate false positives.


http://reviews.llvm.org/D12445

Files:
  lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
  test/Analysis/nullability.mm

Index: test/Analysis/nullability.mm
===
--- test/Analysis/nullability.mm
+++ test/Analysis/nullability.mm
@@ -179,3 +179,65 @@
   takesNullable(p);
   takesNonnull(p);
 }
+
+void onlyReportFirstPreconditionViolationOnPath() {
+  Dummy *p = returnsNullable();
+  takesNonnull(p); // expected-warning {{}}
+  takesNonnull(p); // No warning.
+  // The first warning was not a sink. The analysis expected to continue.
+  int i = 0;
+  i = 5 / i; // expected-warning {{Division by zero}}
+  (void)i;
+}
+
+Dummy *_Nonnull doNotWarnWhenPreconditionIsViolatedInTopFunc(
+Dummy *_Nonnull p) {
+  if (!p) {
+Dummy *ret =
+0; // avoid compiler warning (which is not generated by the analyzer)
+if (getRandom())
+  return ret; // no warning
+else
+  return p; // no warning
+  } else {
+return p;
+  }
+}
+
+Dummy *_Nonnull doNotWarnWhenPreconditionIsViolated(Dummy *_Nonnull p) {
+  if (!p) {
+Dummy *ret =
+0; // avoid compiler warning (which is not generated by the analyzer)
+if (getRandom())
+  return ret; // no warning
+else
+  return p; // no warning
+  } else {
+return p;
+  }
+}
+
+void testPreconditionViolationInInlinedFunction(Dummy *p) {
+  doNotWarnWhenPreconditionIsViolated(p);
+}
+
+void inlinedNullable(Dummy *_Nullable p) {
+  if (p) return;
+}
+void inlinedNonnull(Dummy *_Nonnull p) {
+  if (p) return;
+}
+void inlinedUnspecified(Dummy *p) {
+  if (p) return;
+}
+
+Dummy *_Nonnull testDefensiveInlineChecks(Dummy * p) {
+  switch (getRandom()) {
+  case 1: inlinedNullable(p); break;
+  case 2: inlinedNonnull(p); break;
+  case 3: inlinedUnspecified(p); break;
+  }
+  if (getRandom())
+takesNonnull(p);
+  return p;
+}
Index: lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
===
--- lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
+++ lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp
@@ -161,6 +161,16 @@
 const MemRegion *Region;
   };
 
+  /// When any of the nonnull arguments of the analyzed function is null, do not
+  /// report anything and turn off the check.
+  ///
+  /// When \p SuppressPath is set to true, no more bugs will be reported on this
+  /// path by this checker.
+  void reportBugConditionally(ErrorKind Error, ExplodedNode *N,
+  const MemRegion *Region, CheckerContext ,
+  const Stmt *ValueExpr = nullptr,
+  bool SuppressPath = false) const;
+
   void reportBug(ErrorKind Error, ExplodedNode *N, const MemRegion *Region,
  BugReporter , const Stmt *ValueExpr = nullptr) const {
 if (!BT)
@@ -220,6 +230,13 @@
 REGISTER_MAP_WITH_PROGRAMSTATE(NullabilityMap, const MemRegion *,
NullabilityState)
 
+// If the nullability precondition of a function is violated, we should not
+// report nullability related issues on that path. For this reason once a
+// precondition is not met on a path, this checker will be esentially turned off
+// for the rest of the analysis. We do not want to generate a sink node however,
+// so this checker would not lead to reduced coverage.
+REGISTER_TRAIT_WITH_PROGRAMSTATE(PreconditionViolated, bool)
+
 enum class NullConstraint { IsNull, IsNotNull, Unknown };
 
 static NullConstraint getNullConstraint(DefinedOrUnknownSVal Val,
@@ -302,6 +319,76 @@
   return Nullability::Unspecified;
 }
 
+template 
+static ProgramStateRef
+checkParamsForPreconditionViolation(const ParamVarDeclRange ,
+ProgramStateRef State,
+const LocationContext *LocCtxt) {
+  for (const auto *ParamDecl : Params) {
+if (ParamDecl->isParameterPack())
+  break;
+
+if (getNullabilityAnnotation(ParamDecl->getType()) != Nullability::Nonnull)
+  continue;
+
+auto RegVal = State->getLValue(ParamDecl, LocCtxt)
+  .template getAs();
+if (!RegVal)
+  continue;
+
+auto ParamValue = State->getSVal(RegVal->getRegion())
+  .template getAs();
+if (!ParamValue)
+  continue;
+
+if (getNullConstraint(*ParamValue, State) == NullConstraint::IsNull) {
+  return State->set(true);
+}
+  }
+  return State;
+}
+
+static ProgramStateRef
+checkPreconditionViolation(ProgramStateRef State,
+   const LocationContext *LocCtxt) {
+  const Decl *D = LocCtxt->getDecl();
+  if (!D)
+return State;
+
+  if (const auto *BlockD = dyn_cast(D)) {
+return checkParamsForPreconditionViolation(BlockD->parameters(), State,
+   

r246548 - Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.

2015-09-01 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Sep  1 09:49:24 2015
New Revision: 246548

URL: http://llvm.org/viewvc/llvm-project?rev=246548=rev
Log:
Add a new frontend warning for referencing members from the handler of a 
constructor or destructor function-try-block, which is UB in C++.

This corresponds to the CERT secure coding rule ERR53-CPP.

Added:
cfe/trunk/test/SemaCXX/cdtor-fn-try-block.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprCXX.cpp
cfe/trunk/lib/Sema/SemaExprMember.cpp
cfe/trunk/lib/Sema/SemaOverload.cpp
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
cfe/trunk/lib/Sema/TreeTransform.h
cfe/trunk/test/SemaObjCXX/delay-parsing-func-tryblock.mm

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=246548=246547=246548=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep  1 09:49:24 
2015
@@ -5674,6 +5674,9 @@ def err_throw_incomplete_ptr : Error<
   "cannot throw pointer to object of incomplete type %0">;
 def err_return_in_constructor_handler : Error<
   "return in the catch of a function try block of a constructor is illegal">;
+def warn_cdtor_function_try_handler_mem_expr : Warning<
+  "cannot refer to a non-static member from the handler of a "
+  "%select{constructor|destructor}0 function try block">, InGroup;
 
 let CategoryName = "Lambda Issue" in {
   def err_capture_more_than_once : Error<

Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=246548=246547=246548=diff
==
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Tue Sep  1 09:49:24 2015
@@ -3679,19 +3679,23 @@ public:
   ExprResult BuildPossibleImplicitMemberExpr(const CXXScopeSpec ,
  SourceLocation TemplateKWLoc,
  LookupResult ,
-const TemplateArgumentListInfo *TemplateArgs);
+const TemplateArgumentListInfo *TemplateArgs,
+ const Scope *S);
   ExprResult BuildImplicitMemberExpr(const CXXScopeSpec ,
  SourceLocation TemplateKWLoc,
  LookupResult ,
 const TemplateArgumentListInfo *TemplateArgs,
- bool IsDefiniteInstance);
+ bool IsDefiniteInstance,
+ const Scope *S);
   bool UseArgumentDependentLookup(const CXXScopeSpec ,
   const LookupResult ,
   bool HasTrailingLParen);
 
-  ExprResult BuildQualifiedDeclarationNameExpr(
-  CXXScopeSpec , const DeclarationNameInfo ,
-  bool IsAddressOfOperand, TypeSourceInfo **RecoveryTSI = nullptr);
+  ExprResult
+  BuildQualifiedDeclarationNameExpr(CXXScopeSpec ,
+const DeclarationNameInfo ,
+bool IsAddressOfOperand, const Scope *S,
+TypeSourceInfo **RecoveryTSI = nullptr);
 
   ExprResult BuildDependentDeclRefExpr(const CXXScopeSpec ,
SourceLocation TemplateKWLoc,
@@ -3808,6 +3812,7 @@ public:
   CXXScopeSpec , SourceLocation TemplateKWLoc,
   NamedDecl *FirstQualifierInScope, const DeclarationNameInfo ,
   const TemplateArgumentListInfo *TemplateArgs,
+  const Scope *S,
   ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
 
   ExprResult
@@ -3816,6 +3821,7 @@ public:
SourceLocation TemplateKWLoc,
NamedDecl *FirstQualifierInScope, LookupResult ,
const TemplateArgumentListInfo *TemplateArgs,
+   const Scope *S,
bool SuppressQualifierCheck = false,
ActOnMemberAccessExtraArgs *ExtraArgs = nullptr);
 

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=246548=246547=246548=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Sep  1 09:49:24 2015
@@ -1022,7 +1022,7 @@ Corrected:
   
   if (FirstDecl->isCXXClassMember())
 return 

Re: [PATCH] D12530: Fix several corner cases for loop-convert check.

2015-09-01 Thread Angel Garcia via cfe-commits
angelgarcia marked 2 inline comments as done.


Comment at: test/clang-tidy/modernize-loop-convert-basic.cpp:448
@@ +447,3 @@
+ret = it;
+  }
+}

klimek wrote:
> This test seems to be missing the it.insert(0) case that was removed from the 
> "unsupported"  comment, if I'm not missing something.
It was in the test 'modernize-loop-convert-negative.cpp'. I moved these ones 
there as well.


Comment at: test/clang-tidy/modernize-loop-convert-basic.cpp:540-541
@@ -518,4 +539,4 @@
   unsigned size() const;
-  unsigned begin() const;
-  unsigned end() const;
+  unsigned* begin() const;
+  unsigned* end() const;
 };

klimek wrote:
> Isn't it important that it's a pointer to an unsigned const, not that the 
> iterator method is const?
The important thing is that the check now adds a "const" whenever it is safe to 
do it. I changed the return type to a pointer just to be more consistent with 
what an iterator is supposed to be. It isn't important at all in this case.


http://reviews.llvm.org/D12530



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12512: [libcxxabi] Manually align pointers in __cxa_allocate_exception - Fixes PR24604

2015-09-01 Thread Jonathan Roelofs via cfe-commits
jroelofs added a comment.

In http://reviews.llvm.org/D12512#236988, @majnemer wrote:

> In http://reviews.llvm.org/D12512#236987, @EricWF wrote:
>
> > In http://reviews.llvm.org/D12512#236984, @majnemer wrote:
> >
> > > Wouldn't this change be problematic if you threw to code which was 
> > > statically linked with a prior version of libcxxabi?
> >
> >
> > How do you mean? As in you have two different versions of libc++abi linked 
> > into one executable? If so your already in bad shape.
>
>
> Say you have two binaries, foo.exe and bar.so.  Foo.exe statically links 
> against an older libc++abi and bar.so links against a newer libc++abi.  In 
> this instance, our program has two copies of libc++abi statically linked with 
> no ill effects and such a scenario was supported before this patch (at least 
> AFAICT).
>
> However, we might have problems after this patch if foo.exe is linked against 
> a newer static library than bar.so


I don't think that is/was supported. The abi library holds some global state, 
which wouldn't be shared between the two instances of it.


http://reviews.llvm.org/D12512



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[clang-tools-extra] r246550 - Fix several corner cases for loop-convert check.

2015-09-01 Thread Angel Garcia Gomez via cfe-commits
Author: angelgarcia
Date: Tue Sep  1 10:05:15 2015
New Revision: 246550

URL: http://llvm.org/viewvc/llvm-project?rev=246550=rev
Log:
Fix several corner cases for loop-convert check.

Summary: Reduced the amount of wrong conversions of this check.

Reviewers: klimek

Subscribers: alexfh, cfe-commits

Differential Revision: http://reviews.llvm.org/D12530

Modified:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.h
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-basic.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-extra.cpp
clang-tools-extra/trunk/test/clang-tidy/modernize-loop-convert-negative.cpp

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp?rev=246550=246549=246550=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertCheck.cpp Tue Sep  
1 10:05:15 2015
@@ -364,6 +364,23 @@ static bool isDirectMemberExpr(const Exp
   return false;
 }
 
+/// \brief Returns true when it can be guaranteed that the elements of the
+/// container are not being modified.
+static bool usagesAreConst(const UsageResult ) {
+  // FIXME: Make this function more generic.
+  return Usages.empty();
+}
+
+/// \brief Returns true if the elements of the container are never accessed
+/// by reference.
+static bool usagesReturnRValues(const UsageResult ) {
+  for (const auto  : Usages) {
+if (!U.Expression->isRValue())
+  return false;
+  }
+  return true;
+}
+
 LoopConvertCheck::LoopConvertCheck(StringRef Name, ClangTidyContext *Context)
 : ClangTidyCheck(Name, Context), TUInfo(new TUTrackingInfo),
   MinConfidence(StringSwitch(
@@ -452,7 +469,8 @@ void LoopConvertCheck::doConversion(
   StringRef MaybeDereference = ContainerNeedsDereference ? "*" : "";
   std::string TypeString = AutoRefType.getAsString();
   std::string Range = ("(" + TypeString + " " + VarName + " : " +
-   MaybeDereference + ContainerString + ")").str();
+   MaybeDereference + ContainerString + ")")
+  .str();
   Diag << FixItHint::CreateReplacement(
   CharSourceRange::getTokenRange(ParenRange), Range);
   TUInfo->getGeneratedDecls().insert(make_pair(TheLoop, VarName));
@@ -464,7 +482,7 @@ void LoopConvertCheck::doConversion(
 StringRef LoopConvertCheck::checkRejections(ASTContext *Context,
 const Expr *ContainerExpr,
 const ForStmt *TheLoop) {
-  // If we already modified the reange of this for loop, don't do any further
+  // If we already modified the range of this for loop, don't do any further
   // updates on this iteration.
   if (TUInfo->getReplacedVars().count(TheLoop))
 return "";
@@ -525,6 +543,18 @@ void LoopConvertCheck::findAndVerifyUsag
 if (!getReferencedVariable(ContainerExpr) &&
 !isDirectMemberExpr(ContainerExpr))
   ConfidenceLevel.lowerTo(Confidence::CL_Risky);
+  } else if (FixerKind == LFK_PseudoArray) {
+if (!DerefByValue && !DerefByConstRef) {
+  const UsageResult  = Finder.getUsages();
+  if (usagesAreConst(Usages)) {
+// FIXME: check if the type is trivially copiable.
+DerefByConstRef = true;
+  } else if (usagesReturnRValues(Usages)) {
+// If the index usages (dereference, subscript, at) return RValues,
+// then we should not use a non-const reference.
+DerefByValue = true;
+  }
+}
   }
 
   StringRef ContainerString = checkRejections(Context, ContainerExpr, TheLoop);

Modified: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp?rev=246550=246549=246550=diff
==
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp Tue Sep  
1 10:05:15 2015
@@ -425,12 +425,8 @@ ForLoopIndexUseVisitor::ForLoopIndexUseV
   ConfidenceLevel(Confidence::CL_Safe), NextStmtParent(nullptr),
   CurrStmtParent(nullptr), ReplaceWithAliasUse(false),
   AliasFromForInit(false) {
-  if (ContainerExpr) {
+  if (ContainerExpr)
 addComponent(ContainerExpr);
-FoldingSetNodeID ID;
-const Expr *E = ContainerExpr->IgnoreParenImpCasts();
-E->Profile(ID, *Context, true);
-  }
 }
 
 bool ForLoopIndexUseVisitor::findAndVerifyUsages(const Stmt *Body) {
@@ -521,7 +517,13 @@ bool 

Re: [PATCH] D12530: Fix several corner cases for loop-convert check.

2015-09-01 Thread Manuel Klimek via cfe-commits
klimek accepted this revision.
klimek added a comment.
This revision is now accepted and ready to land.

Learned that I need to learn to read, because the deleted comment was just 
duplicated.
Looks good, great first step towards making this significantly more useful :)


http://reviews.llvm.org/D12530



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12301: [PATCH] New checker for UB in handler of a function-try-block

2015-09-01 Thread Aaron Ballman via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Thanks! I've made those changes and commit in r246548, along with an updated 
test case for ObjC++ that I had previously missed.


http://reviews.llvm.org/D12301



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D12530: Fix several corner cases for loop-convert check.

2015-09-01 Thread Manuel Klimek via cfe-commits
klimek added a comment.

Nice!



Comment at: clang-tidy/modernize/LoopConvertCheck.cpp:378
@@ +377,3 @@
+  for (const auto  : Usages) {
+if (!U.E->isRValue())
+  return false;

(not necessarily in this CL) please rename E to Expression or similar; I'm fine 
with one-letter variables for small scopes, but struct scopes are basically 
infinite.


Comment at: test/clang-tidy/modernize-loop-convert-basic.cpp:437
@@ +436,3 @@
+
+  for (S::iterator it = s.begin(), e = s.end(); it != e; ++it) {
+foo(it);

Use LLVM coding conventions for iterators (I, E) as above.


Comment at: test/clang-tidy/modernize-loop-convert-basic.cpp:448
@@ +447,3 @@
+ret = it;
+  }
+}

This test seems to be missing the it.insert(0) case that was removed from the 
"unsupported"  comment, if I'm not missing something.


Comment at: test/clang-tidy/modernize-loop-convert-basic.cpp:540-541
@@ -518,4 +539,4 @@
   unsigned size() const;
-  unsigned begin() const;
-  unsigned end() const;
+  unsigned* begin() const;
+  unsigned* end() const;
 };

Isn't it important that it's a pointer to an unsigned const, not that the 
iterator method is const?


http://reviews.llvm.org/D12530



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r246546 - Reverting r246497 (which requires also reverting r246524 and r246521 to avoid merge conflicts). It broke the build on MSVC 2015. It also broke an MSVC 2013 bot with testing issues.

2015-09-01 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Tue Sep  1 08:24:39 2015
New Revision: 246546

URL: http://llvm.org/viewvc/llvm-project?rev=246546=rev
Log:
Reverting r246497 (which requires also reverting r246524 and r246521 to avoid 
merge conflicts). It broke the build on MSVC 2015. It also broke an MSVC 2013 
bot with testing issues.

llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
error C2065: 'Files': undeclared identifier

http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2917

Removed:
cfe/trunk/lib/Serialization/MultiOnDiskHashTable.h
Modified:
cfe/trunk/include/clang/Serialization/ASTBitCodes.h
cfe/trunk/include/clang/Serialization/ASTReader.h
cfe/trunk/include/clang/Serialization/ASTWriter.h
cfe/trunk/include/clang/Serialization/Module.h
cfe/trunk/lib/Serialization/ASTReader.cpp
cfe/trunk/lib/Serialization/ASTReaderDecl.cpp
cfe/trunk/lib/Serialization/ASTReaderInternals.h
cfe/trunk/lib/Serialization/ASTWriter.cpp
cfe/trunk/lib/Serialization/ASTWriterDecl.cpp
cfe/trunk/lib/Serialization/Module.cpp
cfe/trunk/test/Modules/cxx-templates.cpp
cfe/trunk/test/Modules/merge-using-decls.cpp

Modified: cfe/trunk/include/clang/Serialization/ASTBitCodes.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTBitCodes.h?rev=246546=246545=246546=diff
==
--- cfe/trunk/include/clang/Serialization/ASTBitCodes.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTBitCodes.h Tue Sep  1 08:24:39 2015
@@ -1530,23 +1530,4 @@ namespace clang {
   }
 } // end namespace clang
 
-namespace llvm {
-  template <> struct DenseMapInfo {
-static clang::serialization::DeclarationNameKey getEmptyKey() {
-  return clang::serialization::DeclarationNameKey(-1, 1);
-}
-static clang::serialization::DeclarationNameKey getTombstoneKey() {
-  return clang::serialization::DeclarationNameKey(-1, 2);
-}
-static unsigned
-getHashValue(const clang::serialization::DeclarationNameKey ) {
-  return Key.getHash();
-}
-static bool isEqual(const clang::serialization::DeclarationNameKey ,
-const clang::serialization::DeclarationNameKey ) {
-  return L == R;
-}
-  };
-}
-
 #endif

Modified: cfe/trunk/include/clang/Serialization/ASTReader.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTReader.h?rev=246546=246545=246546=diff
==
--- cfe/trunk/include/clang/Serialization/ASTReader.h (original)
+++ cfe/trunk/include/clang/Serialization/ASTReader.h Tue Sep  1 08:24:39 2015
@@ -282,8 +282,9 @@ class ReadMethodPoolVisitor;
 
 namespace reader {
   class ASTIdentifierLookupTrait;
-  /// \brief The on-disk hash table(s) used for DeclContext name lookup.
-  struct DeclContextLookupTable;
+  /// \brief The on-disk hash table used for the DeclContext's Name lookup 
table.
+  typedef llvm::OnDiskIterableChainedHashTable
+ASTDeclContextNameLookupTable;
 }
 
 } // end namespace serialization
@@ -506,10 +507,6 @@ private:
   /// \brief Map from the TU to its lexical contents from each module file.
   std::vector> TULexicalDecls;
 
-  /// \brief Map from a DeclContext to its lookup tables.
-  llvm::DenseMap Lookups;
-
   // Updates for visible decls can occur for other contexts than just the
   // TU, and when we read those update records, the actual context may not
   // be available yet, so have this pending map using the ID as a key. It
@@ -517,6 +514,7 @@ private:
   struct PendingVisibleUpdate {
 ModuleFile *Mod;
 const unsigned char *Data;
+unsigned BucketOffset;
   };
   typedef SmallVector DeclContextVisibleUpdates;
 
@@ -1091,10 +1089,6 @@ public:
 Visit(GetExistingDecl(ID));
   }
 
-  /// \brief Get the loaded lookup tables for \p Primary, if any.
-  const serialization::reader::DeclContextLookupTable *
-  getLoadedLookupTables(DeclContext *Primary) const;
-
 private:
   struct ImportedModule {
 ModuleFile *Mod;
@@ -1876,13 +1870,6 @@ public:
   /// Note: overrides method in ExternalASTSource
   Module *getModule(unsigned ID) override;
 
-  /// \brief Retrieve the module file with a given local ID within the 
specified
-  /// ModuleFile.
-  ModuleFile *getLocalModuleFile(ModuleFile , unsigned ID);
-
-  /// \brief Get an ID for the given module file.
-  unsigned getModuleFileID(ModuleFile *M);
-
   /// \brief Return a descriptor for the corresponding module.
   llvm::Optional getSourceDescriptor(unsigned ID) 
override;
   /// \brief Return a descriptor for the module.

Modified: cfe/trunk/include/clang/Serialization/ASTWriter.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Serialization/ASTWriter.h?rev=246546=246545=246546=diff

Re: [PATCH] D12148: [ARM] Allow passing/returning of __fp16 arguments

2015-09-01 Thread James Molloy via cfe-commits
jmolloy added a comment.

This looks alright to me, but I'd like to wait for someone more familiar with 
Clang to approve it.


http://reviews.llvm.org/D12148



___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [clang-tools-extra] r245683 - Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput.

2015-09-01 Thread Alexander Kornienko via cfe-commits
Looks like this patch broke handling of multiple files:
https://llvm.org/PR24637

Can you take a look at this?

On Fri, Aug 21, 2015 at 12:56 PM, Yaron Keren  wrote:

> Whenever is any special character in the filename, such as space or
> backslash (Windows), some examples:
>
> On Windows:
> --- ".\\a.cpp"  2015-08-21 00:22:57.885370200 +0300
> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>
> --- ./a.cpp 2015-08-21 00:22:57.885370200 +0300
> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>
> --- "a a.cpp"   2015-08-21 00:22:57.885370200 +0300
> +++ b.cpp   2015-08-21 01:05:28.726269900 +0300
>
> On Linux:
> ~$ diff -U0 ./a.cpp b\ b.cpp
> --- ./a.cpp 2015-08-14 00:27:03.569276652 +0300
> +++ "b b.cpp"   2015-08-21 13:54:26.787896719 +0300
>
> filename with space will break current clang-tidy-diff.py on all
> platforms, the regular expression does not match quotes.
> There is surely some Python package to process filenames correctly if this
> ever become a problem.
>
>
> 2015-08-21 13:37 GMT+03:00 Alexander Kornienko :
>
>> On Fri, Aug 21, 2015 at 11:27 AM, Yaron Keren via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>>
>>> Author: yrnkrn
>>> Date: Fri Aug 21 04:27:24 2015
>>> New Revision: 245683
>>>
>>> URL: http://llvm.org/viewvc/llvm-project?rev=245683=rev
>>> Log:
>>> Tweak clang-tidy-diff.py to recognize "filename" in the diff ourput
>>
>>
>> Out of curiosity, when does this happen? (I mean quotes around the file
>> name)
>>
>>
>>>
>>>
>>
>>> Modified:
>>> clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>>>
>>> Modified: clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py
>>> URL:
>>> http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py?rev=245683=245682=245683=diff
>>>
>>> ==
>>> --- clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py (original)
>>> +++ clang-tools-extra/trunk/clang-tidy/tool/clang-tidy-diff.py Fri Aug
>>> 21 04:27:24 2015
>>> @@ -67,7 +67,7 @@ def main():
>>>filename = None
>>>lines_by_file = {}
>>>for line in sys.stdin:
>>> -match = re.search('^\+\+\+\ (.*?/){%s}(\S*)' % args.p, line)
>>> +match = re.search('^\+\+\+\ \"?(.*?/){%s}([^ \t\"]*)' % args.p,
>>> line)
>>>  if match:
>>>filename = match.group(2)
>>>  if filename == None:
>>>
>>>
>>> ___
>>> cfe-commits mailing list
>>> cfe-commits@lists.llvm.org
>>> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>>>
>>
>>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits