Re: r244867 - Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Yaron Keren via cfe-commits
Hi Ivan,

CHECK-EIGHT is failing bots, see


http://lab.llvm.org:8011/builders/clang-x86_64-ubuntu-gdb-75/builds/24306/steps/check-all/logs/FAIL%3A%20Clang%3A%3Adependency-gen.c

I disabled it in r244869.

Yaron


2015-08-13 7:04 GMT+03:00 Ivan Krasin via cfe-commits <
cfe-commits@lists.llvm.org>:

> Author: krasin
> Date: Wed Aug 12 23:04:37 2015
> New Revision: 244867
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244867&view=rev
> Log:
> Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.
>
> Summary:
> Clang sanitizers, such as AddressSanitizer, ThreadSanitizer,
> MemorySanitizer,
> Control Flow Integrity and others, use blacklists to specify which types /
> functions
> should not be instrumented to avoid false positives or suppress known
> failures.
>
> This change adds the blacklist filenames to the list of dependencies of
> the rules,
> generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that
> certain
> C/C++/ObjC files need to be recompiled (if a blacklist is updated).
>
> Reviewers: pcc
>
> Subscribers: rsmith, honggyu.kim, pcc, cfe-commits
>
> Differential Revision: http://reviews.llvm.org/D11968
>
> Modified:
> cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
> cfe/trunk/include/clang/Frontend/Utils.h
> cfe/trunk/lib/Frontend/CompilerInstance.cpp
> cfe/trunk/lib/Frontend/CompilerInvocation.cpp
> cfe/trunk/lib/Frontend/DependencyFile.cpp
> cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
> cfe/trunk/test/Frontend/dependency-gen.c
> cfe/trunk/test/Frontend/print-header-includes.c
>
> Modified: cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h?rev=244867&r1=244866&r2=244867&view=diff
>
> ==
> --- cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h (original)
> +++ cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h Wed Aug 12
> 23:04:37 2015
> @@ -47,6 +47,9 @@ public:
>/// must contain at least one entry.
>std::vector Targets;
>
> +  /// A list of filenames to be used as extra dependencies for every
> target.
> +  std::vector ExtraDeps;
> +
>/// \brief The file to write GraphViz-formatted header dependencies to.
>std::string DOTOutputFile;
>
>
> Modified: cfe/trunk/include/clang/Frontend/Utils.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=244867&r1=244866&r2=244867&view=diff
>
> ==
> --- cfe/trunk/include/clang/Frontend/Utils.h (original)
> +++ cfe/trunk/include/clang/Frontend/Utils.h Wed Aug 12 23:04:37 2015
> @@ -148,6 +148,9 @@ public:
>  /// AttachHeaderIncludeGen - Create a header include list generator, and
> attach
>  /// it to the given preprocessor.
>  ///
> +/// \param ExtraHeaders - If not empty, will write the header filenames,
> just
> +/// like they were included during a regular preprocessing. Useful for
> +/// implicit include dependencies, like sanitizer blacklists.
>  /// \param ShowAllHeaders - If true, show all header information instead
> of just
>  /// headers following the predefines buffer. This is useful for making
> sure
>  /// includes mentioned on the command line are also reported, but differs
> from
> @@ -156,7 +159,9 @@ public:
>  /// information to, instead of writing to stderr.
>  /// \param ShowDepth - Whether to indent to show the nesting of the
> includes.
>  /// \param MSStyle - Whether to print in cl.exe /showIncludes style.
> -void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false,
> +void AttachHeaderIncludeGen(Preprocessor &PP,
> +const std::vector &ExtraHeaders,
> +bool ShowAllHeaders = false,
>  StringRef OutputPath = "",
>  bool ShowDepth = true, bool MSStyle = false);
>
>
> Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=244867&r1=244866&r2=244867&view=diff
>
> ==
> --- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
> +++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Wed Aug 12 23:04:37 2015
> @@ -354,17 +354,19 @@ void CompilerInstance::createPreprocesso
>
>// Handle generating header include information, if requested.
>if (DepOpts.ShowHeaderIncludes)
> -AttachHeaderIncludeGen(*PP);
> +AttachHeaderIncludeGen(*PP, DepOpts.ExtraDeps);
>if (!DepOpts.HeaderIncludeOutputFile.empty()) {
>  StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
>  if (OutputPath == "-")
>OutputPath = "";
> -AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath,
> +AttachHeaderIncludeGen(*PP, DepOpts.ExtraDeps,
> 

r244869 - Disable failing check in bots from r244867.

2015-08-12 Thread Yaron Keren via cfe-commits
Author: yrnkrn
Date: Thu Aug 13 01:12:49 2015
New Revision: 244869

URL: http://llvm.org/viewvc/llvm-project?rev=244869&view=rev
Log:
Disable failing check in bots from r244867.


Modified:
cfe/trunk/test/Frontend/dependency-gen.c

Modified: cfe/trunk/test/Frontend/dependency-gen.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Frontend/dependency-gen.c?rev=244869&r1=244868&r2=244869&view=diff
==
--- cfe/trunk/test/Frontend/dependency-gen.c (original)
+++ cfe/trunk/test/Frontend/dependency-gen.c Thu Aug 13 01:12:49 2015
@@ -25,7 +25,6 @@
 // CHECK-SEVEN: .blacklist
 // CHECK-SEVEN: {{ }}x.h
 // RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . | 
FileCheck -check-prefix=CHECK-EIGHT %s
-// CHECK-EIGHT: asan_blacklist.txt
 // CHECK-EIGHT: {{ }}x.h
 // RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . 
-fno-sanitize-blacklist | FileCheck -check-prefix=CHECK-NINE %s
 // CHECK-NINE-NOT: asan_blacklist.txt


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


Re: [PATCH] D11808: Driver: Fix include and lib dirs when not using gcc under mingw

2015-08-12 Thread Yaron Keren via cfe-commits
yaron.keren added a comment.

Yes, go ahead.


http://reviews.llvm.org/D11808



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


Re: [PATCH] D11297: PR17829: Functions declared extern "C" with a name matching a mangled C++ function are allowed

2015-08-12 Thread John McCall via cfe-commits
rjmccall added a comment.

You only have one attempt to define the function here; I don't see the problem. 
 Recall that I said to add a flag to getOrCreateLLVMFunction that says whether 
the caller intends to define the function.  The rule should be that only 
callers that pass "true" should be allowed to assume that they'll get a normal 
llvm::Function back.  Everybody needs to be prepared to receive a bitcast.  
Whenever you find yourself needing to replace an existing function, just queue 
it up to be replaced at the end of IRGen.

I don't think we need to fall over ourselves ensuring that these "aliased" uses 
properly mark functions as used or instantiate templates or anything.


http://reviews.llvm.org/D11297



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


r244867 - Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Ivan Krasin via cfe-commits
Author: krasin
Date: Wed Aug 12 23:04:37 2015
New Revision: 244867

URL: http://llvm.org/viewvc/llvm-project?rev=244867&view=rev
Log:
Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

Summary:
Clang sanitizers, such as AddressSanitizer, ThreadSanitizer, MemorySanitizer,
Control Flow Integrity and others, use blacklists to specify which types / 
functions
should not be instrumented to avoid false positives or suppress known failures.

This change adds the blacklist filenames to the list of dependencies of the 
rules,
generated with -M/-MM/-MD/-MMD. This lets CMake/Ninja recognize that certain
C/C++/ObjC files need to be recompiled (if a blacklist is updated).

Reviewers: pcc

Subscribers: rsmith, honggyu.kim, pcc, cfe-commits

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

Modified:
cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
cfe/trunk/include/clang/Frontend/Utils.h
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp
cfe/trunk/lib/Frontend/DependencyFile.cpp
cfe/trunk/lib/Frontend/HeaderIncludeGen.cpp
cfe/trunk/test/Frontend/dependency-gen.c
cfe/trunk/test/Frontend/print-header-includes.c

Modified: cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h?rev=244867&r1=244866&r2=244867&view=diff
==
--- cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/DependencyOutputOptions.h Wed Aug 12 
23:04:37 2015
@@ -47,6 +47,9 @@ public:
   /// must contain at least one entry.
   std::vector Targets;
 
+  /// A list of filenames to be used as extra dependencies for every target.
+  std::vector ExtraDeps;
+
   /// \brief The file to write GraphViz-formatted header dependencies to.
   std::string DOTOutputFile;
 

Modified: cfe/trunk/include/clang/Frontend/Utils.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/Utils.h?rev=244867&r1=244866&r2=244867&view=diff
==
--- cfe/trunk/include/clang/Frontend/Utils.h (original)
+++ cfe/trunk/include/clang/Frontend/Utils.h Wed Aug 12 23:04:37 2015
@@ -148,6 +148,9 @@ public:
 /// AttachHeaderIncludeGen - Create a header include list generator, and attach
 /// it to the given preprocessor.
 ///
+/// \param ExtraHeaders - If not empty, will write the header filenames, just
+/// like they were included during a regular preprocessing. Useful for
+/// implicit include dependencies, like sanitizer blacklists.
 /// \param ShowAllHeaders - If true, show all header information instead of 
just
 /// headers following the predefines buffer. This is useful for making sure
 /// includes mentioned on the command line are also reported, but differs from
@@ -156,7 +159,9 @@ public:
 /// information to, instead of writing to stderr.
 /// \param ShowDepth - Whether to indent to show the nesting of the includes.
 /// \param MSStyle - Whether to print in cl.exe /showIncludes style.
-void AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders = false,
+void AttachHeaderIncludeGen(Preprocessor &PP,
+const std::vector &ExtraHeaders,
+bool ShowAllHeaders = false,
 StringRef OutputPath = "",
 bool ShowDepth = true, bool MSStyle = false);
 

Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=244867&r1=244866&r2=244867&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Wed Aug 12 23:04:37 2015
@@ -354,17 +354,19 @@ void CompilerInstance::createPreprocesso
 
   // Handle generating header include information, if requested.
   if (DepOpts.ShowHeaderIncludes)
-AttachHeaderIncludeGen(*PP);
+AttachHeaderIncludeGen(*PP, DepOpts.ExtraDeps);
   if (!DepOpts.HeaderIncludeOutputFile.empty()) {
 StringRef OutputPath = DepOpts.HeaderIncludeOutputFile;
 if (OutputPath == "-")
   OutputPath = "";
-AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/true, OutputPath,
+AttachHeaderIncludeGen(*PP, DepOpts.ExtraDeps,
+   /*ShowAllHeaders=*/true, OutputPath,
/*ShowDepth=*/false);
   }
 
   if (DepOpts.PrintShowIncludes) {
-AttachHeaderIncludeGen(*PP, /*ShowAllHeaders=*/false, /*OutputPath=*/"",
+AttachHeaderIncludeGen(*PP, DepOpts.ExtraDeps,
+   /*ShowAllHeaders=*/false, /*OutputPath=*/"",
/*ShowDepth=*/true, /*MSStyle=*/true);
   }
 }

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
ht

Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-12 Thread Dan Gohman via cfe-commits
sunfish updated this revision to Diff 32025.
sunfish marked 3 inline comments as done.
sunfish added a comment.

Minor changes to address review comments.


Repository:
  rL LLVM

http://reviews.llvm.org/D12002

Files:
  include/clang/Basic/BuiltinsWebAssembly.def
  include/clang/Basic/TargetBuiltins.h
  include/clang/Basic/TargetCXXABI.h
  include/clang/module.modulemap
  lib/AST/ASTContext.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  test/CodeGen/builtins-wasm.c
  test/CodeGen/target-data.c
  test/CodeGen/wasm-arguments.c
  test/CodeGen/wasm-regparm.c
  test/CodeGenCXX/member-alignment.cpp
  test/CodeGenCXX/member-function-pointers.cpp
  test/CodeGenCXX/static-init-wasm.cpp
  test/Driver/wasm32-unknown-unknown.cpp
  test/Driver/wasm64-unknown-unknown.cpp
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -8418,3 +8418,601 @@
 // XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
 // XCORE:#define __LITTLE_ENDIAN__ 1
 // XCORE:#define __XS1B__ 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm32-unknown-unknown < /dev/null | FileCheck -check-prefix=WEBASSEMBLY32 %s
+//
+// WEBASSEMBLY32:#define _ILP32 1
+// WEBASSEMBLY32-NOT:#define _LP64
+// WEBASSEMBLY32:#define __ATOMIC_ACQUIRE 2
+// WEBASSEMBLY32:#define __ATOMIC_ACQ_REL 4
+// WEBASSEMBLY32:#define __ATOMIC_CONSUME 1
+// WEBASSEMBLY32:#define __ATOMIC_RELAXED 0
+// WEBASSEMBLY32:#define __ATOMIC_RELEASE 3
+// WEBASSEMBLY32:#define __ATOMIC_SEQ_CST 5
+// WEBASSEMBLY32:#define __BIGGEST_ALIGNMENT__ 16
+// WEBASSEMBLY32:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+// WEBASSEMBLY32:#define __CHAR16_TYPE__ unsigned short
+// WEBASSEMBLY32:#define __CHAR32_TYPE__ unsigned int
+// WEBASSEMBLY32:#define __CHAR_BIT__ 8
+// WEBASSEMBLY32:#define __CONSTANT_CFSTRINGS__ 1
+// WEBASSEMBLY32:#define __DBL_DECIMAL_DIG__ 17
+// WEBASSEMBLY32:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// WEBASSEMBLY32:#define __DBL_DIG__ 15
+// WEBASSEMBLY32:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// WEBASSEMBLY32:#define __DBL_HAS_DENORM__ 1
+// WEBASSEMBLY32:#define __DBL_HAS_INFINITY__ 1
+// WEBASSEMBLY32:#define __DBL_HAS_QUIET_NAN__ 1
+// WEBASSEMBLY32:#define __DBL_MANT_DIG__ 53
+// WEBASSEMBLY32:#define __DBL_MAX_10_EXP__ 308
+// WEBASSEMBLY32:#define __DBL_MAX_EXP__ 1024
+// WEBASSEMBLY32:#define __DBL_MAX__ 1.7976931348623157e+308
+// WEBASSEMBLY32:#define __DBL_MIN_10_EXP__ (-307)
+// WEBASSEMBLY32:#define __DBL_MIN_EXP__ (-1021)
+// WEBASSEMBLY32:#define __DBL_MIN__ 2.2250738585072014e-308
+// WEBASSEMBLY32:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// WEBASSEMBLY32:#define __FINITE_MATH_ONLY__ 0
+// WEBASSEMBLY32:#define __FLT_DECIMAL_DIG__ 9
+// WEBASSEMBLY32:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// WEBASSEMBLY32:#define __FLT_DIG__ 6
+// WEBASSEMBLY32:#define __FLT_EPSILON__ 1.19209290e-7F
+// WEBASSEMBLY32:#define __FLT_EVAL_METHOD__ 0
+// WEBASSEMBLY32:#define __FLT_HAS_DENORM__ 1
+// WEBASSEMBLY32:#define __FLT_HAS_INFINITY__ 1
+// WEBASSEMBLY32:#define __FLT_HAS_QUIET_NAN__ 1
+// WEBASSEMBLY32:#define __FLT_MANT_DIG__ 24
+// WEBASSEMBLY32:#define __FLT_MAX_10_EXP__ 38
+// WEBASSEMBLY32:#define __FLT_MAX_EXP__ 128
+// WEBASSEMBLY32:#define __FLT_MAX__ 3.40282347e+38F
+// WEBASSEMBLY32:#define __FLT_MIN_10_EXP__ (-37)
+// WEBASSEMBLY32:#define __FLT_MIN_EXP__ (-125)
+// WEBASSEMBLY32:#define __FLT_MIN__ 1.17549435e-38F
+// WEBASSEMBLY32:#define __FLT_RADIX__ 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_INT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
+// WEBASSEMBLY32:#define __GCC_ATOMIC_LONG_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
+// WEBASSEMBLY32:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GNUC_MINOR__
+// WEBASSEMBLY32:#define __GNUC_PATCHLEVEL__
+// WEBASSEMBLY32:#define __GNUC_STDC_INLINE__ 1
+// WEBASSEMBLY32:#define __GNUC__
+// WEBASSEMBLY32:#define __GXX_ABI_VERSION 1002
+// WEBASSEMBLY32:#define __GXX_RTTI 1
+// WEBASSEMBLY32:#define __ILP32__ 1
+// WEBASSEMBLY32:#define __INT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32:#define __INT16_FMTd__ "hd"
+// WEBASSEMBLY32:#define __INT16_FMTi__ "hi"
+// WEBASSEMBLY32:#define __INT16_MAX__ 32767
+// WEBASSEMBLY32:#define __INT16_TYPE__ short
+// WEBASSEMBLY32:#define __INT32_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32:#define __INT32_FMTd__ "d"
+// WEBA

Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-12 Thread Dan Gohman via cfe-commits
sunfish planned changes to this revision.
sunfish marked 3 inline comments as done.


Comment at: lib/Basic/Targets.cpp:6935
@@ +6934,3 @@
+NoAsmVariants = true;
+LongDoubleWidth = LongDoubleAlign = 64;
+SuitableAlign = 128;

jfb wrote:
> That's already the default?
I thought I'd leave it in while we discuss whether this is really what we want.


Comment at: lib/Basic/Targets.cpp:6937
@@ +6936,3 @@
+SuitableAlign = 128;
+RegParmMax = 0; // Disallow regparm
+  }

jfb wrote:
> Already the default?
Right.


Comment at: lib/Basic/Targets.cpp:6938
@@ +6937,3 @@
+RegParmMax = 0; // Disallow regparm
+  }
+

jfb wrote:
> `TLSSupported = false` for now.
Since the MVP doesn't have threads at all, all variables are TLS :-). And after 
the MVP, we'll add threads with TLS. Is there a downside to leaving this on for 
now? It'll make the thread prototyping work easier.


Comment at: lib/Basic/Targets.cpp:6941
@@ +6940,3 @@
+  void
+  getDefaultFeatures(llvm::StringMap &Features) const override final {}
+  bool setCPU(const std::string &Name) override final {

jfb wrote:
> Not needed, since that's the default impl?
We're going to put code in there before long anyway, so there's no harm in 
getting it ready.


Comment at: lib/Basic/Targets.cpp:6956
@@ +6955,3 @@
+
+Builder.defineMacro("__REGISTER_PREFIX__", "");
+  }

jfb wrote:
> I'm not sure we need this. Does it just make porting easier?
I don't know if we specifically need it; I just included it because lots of 
other popular targets have it.


Comment at: lib/Basic/Targets.cpp:6983
@@ +6982,3 @@
+  const char *getClobbers() const override { return ""; }
+  bool isCLZForZeroUndef() const override { return false; }
+};

jfb wrote:
> `final` for these two.
Right.


Comment at: lib/Basic/Targets.cpp:6994
@@ +6993,3 @@
+
+class WebAssembly32TargetInfo : public WebAssemblyTargetInfo {
+public:

jfb wrote:
> `final`
This class is subclassed.


Comment at: lib/Basic/Targets.cpp:7015
@@ +7014,3 @@
+
+class WebAssembly64TargetInfo : public WebAssemblyTargetInfo {
+public:

jfb wrote:
> `final`
This one is too.


Comment at: lib/Driver/Tools.cpp:1559
@@ -1558,1 +1558,3 @@
 
+/// getWebAssemblyTargetCPU - Get the (LLVM) name of the WebAssembly cpu we are
+/// targeting.

jfb wrote:
> New comment style without `name -`.
Right.


Comment at: test/CodeGen/wasm-arguments.c:91
@@ +90,2 @@
+// WEBASSEMBLY64: define void @f10(%struct.bitfield1* byval align 4 %bf1)
+void f10(bitfield1 bf1) {}

jfb wrote:
> TODO for vararg test?
There's a TODO for "implement va_list properly" elsewhere, so we can add tests 
when we actually implement it.


Comment at: test/Driver/wasm32-unknown-unknown.cpp:51
@@ +50,3 @@
+void __wasm__defined() {}
+#endif
+

jfb wrote:
> Also test `__wasm32__` (and 64 in the other file).
test/Preprocessor/init.c covers this.


Comment at: test/Driver/wasm32-unknown-unknown.cpp:64
@@ +63,3 @@
+void _REENTRANTundefined() {}
+#endif
+

jfb wrote:
> Test `__REGISTER_PREFIX__` if we do keep it.
test/Preprocessor/init.c covers this.


Comment at: test/Preprocessor/init.c:8478
@@ +8477,3 @@
+// WEBASSEMBLY32:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1

jfb wrote:
> `ATOMIC_*_LOCK_FREE` should always be `1` for "maybe".
Clang is setting these automatically based on the value of 
MaxAtomicInlineWidth. Are you saying 32 is the wrong value for wasm32? This is 
perhaps a discussion to be had on the spec side.

The value for wasm64 is also an interesting topic for the spec side.


Repository:
  rL LLVM

http://reviews.llvm.org/D12002



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


Re: [PATCH] D7642: Introduce the idea of a minimum libc version

2015-08-12 Thread Saleem Abdulrasool via cfe-commits
compnerd added a comment.

Okay, if thats the general pattern, then we can stick it in the triple.  
Though, that means that the use of the triple for determining the MS 
compatibility needs to be undone.  If the version in the triple is the libc 
version, then it can differ from the MS compatibility version.  The target 
platform may be different from the compiler version (IIRC, thats the 
terminology that Visual Studio uses).


Repository:
  rL LLVM

http://reviews.llvm.org/D7642



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


Re: [PATCH] D11844: [Modules] More descriptive diagnostics for misplaced import directive

2015-08-12 Thread Sean Silva via cfe-commits
On Wed, Aug 12, 2015 at 6:05 PM, Richard Smith 
wrote:

> On Wed, Aug 12, 2015 at 6:00 PM, Sean Silva  wrote:
>
>>
>>
>> On Wed, Aug 12, 2015 at 2:43 PM, Richard Smith 
>> wrote:
>>
>>> On Wed, Aug 12, 2015 at 12:08 AM, Sean Silva 
>>> wrote:
>>>
 silvas added a subscriber: silvas.

 
 Comment at: lib/Parse/Parser.cpp:2003
 @@ +2002,3 @@
 +Diag(Tok, diag::err_unexpected_module_start);
 +// Recover by skipping content of the included submodule.
 +unsigned ModuleNesting = 1;
 
 rsmith wrote:
 > This is liable to produce bad follow-on diagnostics; I don't think
 this is a reasonable way to recover. I can see a few feasible options here:
 >
 > 1) Emit a fatal error when this happens (suppressing further
 diagnostics)
 > 2) Break out to the top level of parsing and resume from there (that
 is, assume that a modular header expects to be included at the top level
 and that the user didn't screw up their module map)
 > 3) Enter the module and carry on parsing from here
 >
 > My preference would be either (1) or (2). But either way, we should
 diagnose the still-open bracketing constructs, because the problem is
 likely to be a missing close brace at the end of an unrelated header file.
 I strongly prefer (1). In all cases I have recorded in my notes when
 modularizing, the `error: expected '}'` diagnostic indicated one of two
 things:
 - that a header needed to be marked textual in the module map.
 - that a #include had to be moved to the top of the file (this case was
 likely behaving unexpectedly in the non-modules case and "happened to
 work").
 For the sake of our users, it is probably best to immediately fatal
 error and suggest an alternative (the suggestions can be a separate patch;
 my recommendations are below).

 I believe a user is most likely to run into this diagnostic when
 developing an initial set of module maps, so our diagnostic should be
 tailored to that audience.
>>>
>>>
>>> I think your observations may be biased by your current experiences
>>> modularizing existing code, and not representative of the complete
>>> development cycle. Modularization is a one-time effort; maintaining the
>>> code after modularization is a continuous process. I think it's *far* more
>>> likely that a header listed in your module map was expected to be modular,
>>> and that a brace mismatch within that file is unintentional and due to a
>>> missing brace somewhere.
>>>
>>
>> I don't think so. That implies that the inclusion is not at the top of
>> the file, which is extremely unlikely in a modular codebase.
>>
>
> This also happens when there's a missing brace at the end of your modular
> header, which is almost certainly the most common way to hit this problem
> in an already-modularized codebase. And it happens in codebases that use a
> mixture of modular and non-modular headers, where there's no reason to
> expect all the modular includes are before the non-modular ones.
>

:lets-do-both.jpg:

Do we have a way to guard just notes behind warning flags? Maybe
"-Winitial-module-map" or something could enable the "assume this module
map might have errors" heuristics (which in my experience are highly
reliable for that use case). We can document to users to turn this on when
initially modularizing.

-- Sean Silva


>
>
>> 125993 #include lines.
>>
>>
>>>
>>> However, we should aim to provide diagnostics that are helpful for
>>> either case.
>>>
>>> These users may have little experience with modules when they encounter
 this diagnostic, so a notes suggesting a likely remedy helps them develop
 confidence by providing authoritative advice (and avoiding a round trip to
 the documentation).

 My fine-grained recommendations from experience are:
 - #include inside extern "C": always meant to be modular, always the
 fix is to move it out of the braced block.
 - #include inside namespace: always meant to be modular, always the fix
 is to move it out of the braced block.
 - #include inside class: always textual (e.g. bringing in methods like
 TableGen .inc files; sometimes similar ".inc" files are manually written
 and not autogenerated. I have observed e.g. "classfoo_methods.h" files;
 another instance of this is stamping out ".def" files)
 - #include inside array initializer: always textual. Typically ".def"
 files
 - #include inside function: always textual. Typically ".def" files
 (e.g. generate a switch)

 ".inl" files are theoretically a problem inside namespaces, but I have
 not observed this issue in practice. In my experience code taking the
 effort to have ".inl" files is quite clean and avoids such textual
 dependencies. The issues I have seen in practice with ".inl" files usually
 end up coming out through a different part of clang.

Re: [PATCH] D12002: Initial WebAssembly support in clang

2015-08-12 Thread JF Bastien via cfe-commits
jfb added a subscriber: rengolin.


Comment at: include/clang/Basic/TargetCXXABI.h:166
@@ +165,3 @@
+case GenericMIPS:
+  // TODO: ARM-style pointers to member functions put the discriminator in
+  //   the this adjustment, so they don't require functions to have any

@rengolin: FYI.


Comment at: lib/Basic/Targets.cpp:6935
@@ +6934,3 @@
+NoAsmVariants = true;
+LongDoubleWidth = LongDoubleAlign = 64;
+SuitableAlign = 128;

That's already the default?


Comment at: lib/Basic/Targets.cpp:6937
@@ +6936,3 @@
+SuitableAlign = 128;
+RegParmMax = 0; // Disallow regparm
+  }

Already the default?


Comment at: lib/Basic/Targets.cpp:6938
@@ +6937,3 @@
+RegParmMax = 0; // Disallow regparm
+  }
+

`TLSSupported = false` for now.


Comment at: lib/Basic/Targets.cpp:6941
@@ +6940,3 @@
+  void
+  getDefaultFeatures(llvm::StringMap &Features) const override final {}
+  bool setCPU(const std::string &Name) override final {

Not needed, since that's the default impl?


Comment at: lib/Basic/Targets.cpp:6956
@@ +6955,3 @@
+
+Builder.defineMacro("__REGISTER_PREFIX__", "");
+  }

I'm not sure we need this. Does it just make porting easier?


Comment at: lib/Basic/Targets.cpp:6983
@@ +6982,3 @@
+  const char *getClobbers() const override { return ""; }
+  bool isCLZForZeroUndef() const override { return false; }
+};

`final` for these two.


Comment at: lib/Basic/Targets.cpp:6994
@@ +6993,3 @@
+
+class WebAssembly32TargetInfo : public WebAssemblyTargetInfo {
+public:

`final`


Comment at: lib/Basic/Targets.cpp:7015
@@ +7014,3 @@
+
+class WebAssembly64TargetInfo : public WebAssemblyTargetInfo {
+public:

`final`


Comment at: lib/Driver/Tools.cpp:1559
@@ -1558,1 +1558,3 @@
 
+/// getWebAssemblyTargetCPU - Get the (LLVM) name of the WebAssembly cpu we are
+/// targeting.

New comment style without `name -`.


Comment at: test/CodeGen/wasm-arguments.c:91
@@ +90,2 @@
+// WEBASSEMBLY64: define void @f10(%struct.bitfield1* byval align 4 %bf1)
+void f10(bitfield1 bf1) {}

TODO for vararg test?


Comment at: test/Driver/wasm32-unknown-unknown.cpp:51
@@ +50,3 @@
+void __wasm__defined() {}
+#endif
+

Also test `__wasm32__` (and 64 in the other file).


Comment at: test/Driver/wasm32-unknown-unknown.cpp:64
@@ +63,3 @@
+void _REENTRANTundefined() {}
+#endif
+

Test `__REGISTER_PREFIX__` if we do keep it.


Comment at: test/Preprocessor/init.c:8478
@@ +8477,3 @@
+// WEBASSEMBLY32:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1

`ATOMIC_*_LOCK_FREE` should always be `1` for "maybe".


Repository:
  rL LLVM

http://reviews.llvm.org/D12002



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


r244855 - Update for llvm api change.

2015-08-12 Thread Rafael Espindola via cfe-commits
Author: rafael
Date: Wed Aug 12 20:07:06 2015
New Revision: 244855

URL: http://llvm.org/viewvc/llvm-project?rev=244855&view=rev
Log:
Update for llvm api change.

Modified:
cfe/trunk/tools/driver/driver.cpp

Modified: cfe/trunk/tools/driver/driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=244855&r1=244854&r2=244855&view=diff
==
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Wed Aug 12 20:07:06 2015
@@ -406,7 +406,7 @@ int main(int argc_, const char **argv_)
   const DriverSuffix *DS = parseDriverSuffix(ProgName);
 
   llvm::BumpPtrAllocator A;
-  llvm::BumpPtrStringSaver Saver(A);
+  llvm::StringSaver Saver(A);
 
   // Parse response files using the GNU syntax, unless we're in CL mode. There
   // are two ways to put clang in CL compatibility mode: argv[0] is either


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


Re: [PATCH] D11844: [Modules] More descriptive diagnostics for misplaced import directive

2015-08-12 Thread Richard Smith via cfe-commits
On Wed, Aug 12, 2015 at 6:00 PM, Sean Silva  wrote:

>
>
> On Wed, Aug 12, 2015 at 2:43 PM, Richard Smith 
> wrote:
>
>> On Wed, Aug 12, 2015 at 12:08 AM, Sean Silva 
>> wrote:
>>
>>> silvas added a subscriber: silvas.
>>>
>>> 
>>> Comment at: lib/Parse/Parser.cpp:2003
>>> @@ +2002,3 @@
>>> +Diag(Tok, diag::err_unexpected_module_start);
>>> +// Recover by skipping content of the included submodule.
>>> +unsigned ModuleNesting = 1;
>>> 
>>> rsmith wrote:
>>> > This is liable to produce bad follow-on diagnostics; I don't think
>>> this is a reasonable way to recover. I can see a few feasible options here:
>>> >
>>> > 1) Emit a fatal error when this happens (suppressing further
>>> diagnostics)
>>> > 2) Break out to the top level of parsing and resume from there (that
>>> is, assume that a modular header expects to be included at the top level
>>> and that the user didn't screw up their module map)
>>> > 3) Enter the module and carry on parsing from here
>>> >
>>> > My preference would be either (1) or (2). But either way, we should
>>> diagnose the still-open bracketing constructs, because the problem is
>>> likely to be a missing close brace at the end of an unrelated header file.
>>> I strongly prefer (1). In all cases I have recorded in my notes when
>>> modularizing, the `error: expected '}'` diagnostic indicated one of two
>>> things:
>>> - that a header needed to be marked textual in the module map.
>>> - that a #include had to be moved to the top of the file (this case was
>>> likely behaving unexpectedly in the non-modules case and "happened to
>>> work").
>>> For the sake of our users, it is probably best to immediately fatal
>>> error and suggest an alternative (the suggestions can be a separate patch;
>>> my recommendations are below).
>>>
>>> I believe a user is most likely to run into this diagnostic when
>>> developing an initial set of module maps, so our diagnostic should be
>>> tailored to that audience.
>>
>>
>> I think your observations may be biased by your current experiences
>> modularizing existing code, and not representative of the complete
>> development cycle. Modularization is a one-time effort; maintaining the
>> code after modularization is a continuous process. I think it's *far* more
>> likely that a header listed in your module map was expected to be modular,
>> and that a brace mismatch within that file is unintentional and due to a
>> missing brace somewhere.
>>
>
> I don't think so. That implies that the inclusion is not at the top of the
> file, which is extremely unlikely in a modular codebase.
>

This also happens when there's a missing brace at the end of your modular
header, which is almost certainly the most common way to hit this problem
in an already-modularized codebase. And it happens in codebases that use a
mixture of modular and non-modular headers, where there's no reason to
expect all the modular includes are before the non-modular ones.


> 125993 #include lines.
>
>
>>
>> However, we should aim to provide diagnostics that are helpful for either
>> case.
>>
>> These users may have little experience with modules when they encounter
>>> this diagnostic, so a notes suggesting a likely remedy helps them develop
>>> confidence by providing authoritative advice (and avoiding a round trip to
>>> the documentation).
>>>
>>> My fine-grained recommendations from experience are:
>>> - #include inside extern "C": always meant to be modular, always the fix
>>> is to move it out of the braced block.
>>> - #include inside namespace: always meant to be modular, always the fix
>>> is to move it out of the braced block.
>>> - #include inside class: always textual (e.g. bringing in methods like
>>> TableGen .inc files; sometimes similar ".inc" files are manually written
>>> and not autogenerated. I have observed e.g. "classfoo_methods.h" files;
>>> another instance of this is stamping out ".def" files)
>>> - #include inside array initializer: always textual. Typically ".def"
>>> files
>>> - #include inside function: always textual. Typically ".def" files (e.g.
>>> generate a switch)
>>>
>>> ".inl" files are theoretically a problem inside namespaces, but I have
>>> not observed this issue in practice. In my experience code taking the
>>> effort to have ".inl" files is quite clean and avoids such textual
>>> dependencies. The issues I have seen in practice with ".inl" files usually
>>> end up coming out through a different part of clang. Improving that is for
>>> a separate patch though.
>>>
>>>
>>> http://reviews.llvm.org/D11844
>>>
>>>
>>>
>>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11844: [Modules] More descriptive diagnostics for misplaced import directive

2015-08-12 Thread Sean Silva via cfe-commits
On Wed, Aug 12, 2015 at 2:43 PM, Richard Smith 
wrote:

> On Wed, Aug 12, 2015 at 12:08 AM, Sean Silva 
> wrote:
>
>> silvas added a subscriber: silvas.
>>
>> 
>> Comment at: lib/Parse/Parser.cpp:2003
>> @@ +2002,3 @@
>> +Diag(Tok, diag::err_unexpected_module_start);
>> +// Recover by skipping content of the included submodule.
>> +unsigned ModuleNesting = 1;
>> 
>> rsmith wrote:
>> > This is liable to produce bad follow-on diagnostics; I don't think this
>> is a reasonable way to recover. I can see a few feasible options here:
>> >
>> > 1) Emit a fatal error when this happens (suppressing further
>> diagnostics)
>> > 2) Break out to the top level of parsing and resume from there (that
>> is, assume that a modular header expects to be included at the top level
>> and that the user didn't screw up their module map)
>> > 3) Enter the module and carry on parsing from here
>> >
>> > My preference would be either (1) or (2). But either way, we should
>> diagnose the still-open bracketing constructs, because the problem is
>> likely to be a missing close brace at the end of an unrelated header file.
>> I strongly prefer (1). In all cases I have recorded in my notes when
>> modularizing, the `error: expected '}'` diagnostic indicated one of two
>> things:
>> - that a header needed to be marked textual in the module map.
>> - that a #include had to be moved to the top of the file (this case was
>> likely behaving unexpectedly in the non-modules case and "happened to
>> work").
>> For the sake of our users, it is probably best to immediately fatal error
>> and suggest an alternative (the suggestions can be a separate patch; my
>> recommendations are below).
>>
>> I believe a user is most likely to run into this diagnostic when
>> developing an initial set of module maps, so our diagnostic should be
>> tailored to that audience.
>
>
> I think your observations may be biased by your current experiences
> modularizing existing code, and not representative of the complete
> development cycle. Modularization is a one-time effort; maintaining the
> code after modularization is a continuous process. I think it's *far* more
> likely that a header listed in your module map was expected to be modular,
> and that a brace mismatch within that file is unintentional and due to a
> missing brace somewhere.
>

I don't think so. That implies that the inclusion is not at the top of the
file, which is extremely unlikely in a modular codebase.

125993 #include lines.


>
> However, we should aim to provide diagnostics that are helpful for either
> case.
>
> These users may have little experience with modules when they encounter
>> this diagnostic, so a notes suggesting a likely remedy helps them develop
>> confidence by providing authoritative advice (and avoiding a round trip to
>> the documentation).
>>
>> My fine-grained recommendations from experience are:
>> - #include inside extern "C": always meant to be modular, always the fix
>> is to move it out of the braced block.
>> - #include inside namespace: always meant to be modular, always the fix
>> is to move it out of the braced block.
>> - #include inside class: always textual (e.g. bringing in methods like
>> TableGen .inc files; sometimes similar ".inc" files are manually written
>> and not autogenerated. I have observed e.g. "classfoo_methods.h" files;
>> another instance of this is stamping out ".def" files)
>> - #include inside array initializer: always textual. Typically ".def"
>> files
>> - #include inside function: always textual. Typically ".def" files (e.g.
>> generate a switch)
>>
>> ".inl" files are theoretically a problem inside namespaces, but I have
>> not observed this issue in practice. In my experience code taking the
>> effort to have ".inl" files is quite clean and avoids such textual
>> dependencies. The issues I have seen in practice with ".inl" files usually
>> end up coming out through a different part of clang. Improving that is for
>> a separate patch though.
>>
>>
>> http://reviews.llvm.org/D11844
>>
>>
>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11844: [Modules] More descriptive diagnostics for misplaced import directive

2015-08-12 Thread Sean Silva via cfe-commits
On Wed, Aug 12, 2015 at 6:00 PM, Sean Silva  wrote:

>
>
> On Wed, Aug 12, 2015 at 2:43 PM, Richard Smith 
> wrote:
>
>> On Wed, Aug 12, 2015 at 12:08 AM, Sean Silva 
>> wrote:
>>
>>> silvas added a subscriber: silvas.
>>>
>>> 
>>> Comment at: lib/Parse/Parser.cpp:2003
>>> @@ +2002,3 @@
>>> +Diag(Tok, diag::err_unexpected_module_start);
>>> +// Recover by skipping content of the included submodule.
>>> +unsigned ModuleNesting = 1;
>>> 
>>> rsmith wrote:
>>> > This is liable to produce bad follow-on diagnostics; I don't think
>>> this is a reasonable way to recover. I can see a few feasible options here:
>>> >
>>> > 1) Emit a fatal error when this happens (suppressing further
>>> diagnostics)
>>> > 2) Break out to the top level of parsing and resume from there (that
>>> is, assume that a modular header expects to be included at the top level
>>> and that the user didn't screw up their module map)
>>> > 3) Enter the module and carry on parsing from here
>>> >
>>> > My preference would be either (1) or (2). But either way, we should
>>> diagnose the still-open bracketing constructs, because the problem is
>>> likely to be a missing close brace at the end of an unrelated header file.
>>> I strongly prefer (1). In all cases I have recorded in my notes when
>>> modularizing, the `error: expected '}'` diagnostic indicated one of two
>>> things:
>>> - that a header needed to be marked textual in the module map.
>>> - that a #include had to be moved to the top of the file (this case was
>>> likely behaving unexpectedly in the non-modules case and "happened to
>>> work").
>>> For the sake of our users, it is probably best to immediately fatal
>>> error and suggest an alternative (the suggestions can be a separate patch;
>>> my recommendations are below).
>>>
>>> I believe a user is most likely to run into this diagnostic when
>>> developing an initial set of module maps, so our diagnostic should be
>>> tailored to that audience.
>>
>>
>> I think your observations may be biased by your current experiences
>> modularizing existing code, and not representative of the complete
>> development cycle. Modularization is a one-time effort; maintaining the
>> code after modularization is a continuous process. I think it's *far* more
>> likely that a header listed in your module map was expected to be modular,
>> and that a brace mismatch within that file is unintentional and due to a
>> missing brace somewhere.
>>
>
> I don't think so. That implies that the inclusion is not at the top of the
> file, which is extremely unlikely in a modular codebase.
>
> 125993 #include lines.
>

Oops, apparently I accidentally hit send...
I'm gathering some real statistics on this.

-- Sean Silva


>
>
>>
>> However, we should aim to provide diagnostics that are helpful for either
>> case.
>>
>> These users may have little experience with modules when they encounter
>>> this diagnostic, so a notes suggesting a likely remedy helps them develop
>>> confidence by providing authoritative advice (and avoiding a round trip to
>>> the documentation).
>>>
>>> My fine-grained recommendations from experience are:
>>> - #include inside extern "C": always meant to be modular, always the fix
>>> is to move it out of the braced block.
>>> - #include inside namespace: always meant to be modular, always the fix
>>> is to move it out of the braced block.
>>> - #include inside class: always textual (e.g. bringing in methods like
>>> TableGen .inc files; sometimes similar ".inc" files are manually written
>>> and not autogenerated. I have observed e.g. "classfoo_methods.h" files;
>>> another instance of this is stamping out ".def" files)
>>> - #include inside array initializer: always textual. Typically ".def"
>>> files
>>> - #include inside function: always textual. Typically ".def" files (e.g.
>>> generate a switch)
>>>
>>> ".inl" files are theoretically a problem inside namespaces, but I have
>>> not observed this issue in practice. In my experience code taking the
>>> effort to have ".inl" files is quite clean and avoids such textual
>>> dependencies. The issues I have seen in practice with ".inl" files usually
>>> end up coming out through a different part of clang. Improving that is for
>>> a separate patch though.
>>>
>>>
>>> http://reviews.llvm.org/D11844
>>>
>>>
>>>
>>>
>>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244852 - Add SourceManager::dump() to dump the current set of SLocEntries.

2015-08-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 12 19:45:11 2015
New Revision: 244852

URL: http://llvm.org/viewvc/llvm-project?rev=244852&view=rev
Log:
Add SourceManager::dump() to dump the current set of SLocEntries.

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

Modified: cfe/trunk/include/clang/Basic/SourceManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/SourceManager.h?rev=244852&r1=244851&r2=244852&view=diff
==
--- cfe/trunk/include/clang/Basic/SourceManager.h (original)
+++ cfe/trunk/include/clang/Basic/SourceManager.h Wed Aug 12 19:45:11 2015
@@ -1463,6 +1463,8 @@ public:
   ///
   void PrintStats() const;
 
+  void dump() const;
+
   /// \brief Get the number of local SLocEntries we have.
   unsigned local_sloc_entry_size() const { return LocalSLocEntryTable.size(); }
 

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=244852&r1=244851&r2=244852&view=diff
==
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Aug 12 19:45:11 2015
@@ -2135,6 +2135,63 @@ void SourceManager::PrintStats() const {
<< NumBinaryProbes << " binary.\n";
 }
 
+LLVM_DUMP_METHOD void SourceManager::dump() const {
+  llvm::raw_ostream &out = llvm::errs();
+
+  auto DumpSLocEntry = [&](int ID, const SrcMgr::SLocEntry &Entry,
+   llvm::Optional NextStart) {
+out << "SLocEntry  " << (Entry.isFile() ? "file" : 
"expansion")
+<< " \n";
+else
+  out << "???\?>\n";
+if (Entry.isFile()) {
+  auto &FI = Entry.getFile();
+  if (FI.NumCreatedFIDs)
+out << "  covers \n";
+  if (FI.getIncludeLoc().isValid())
+out << "  included from " << FI.getIncludeLoc().getOffset() << "\n";
+  if (auto *CC = FI.getContentCache()) {
+out << "  for " << (CC->OrigEntry ? CC->OrigEntry->getName() : 
"")
+<< "\n";
+if (CC->BufferOverridden)
+  out << "  contents overridden\n";
+if (CC->ContentsEntry != CC->OrigEntry) {
+  out << "  contents from "
+  << (CC->ContentsEntry ? CC->ContentsEntry->getName() : "")
+  << "\n";
+}
+  }
+} else {
+  auto &EI = Entry.getExpansion();
+  out << "  spelling from " << EI.getSpellingLoc().getOffset() << "\n";
+  out << "  macro " << (EI.isMacroArgExpansion() ? "arg" : "body")
+  << " range <" << EI.getExpansionLocStart().getOffset() << ":"
+  << EI.getExpansionLocEnd().getOffset() << ">\n";
+}
+  };
+
+  // Dump local SLocEntries.
+  for (unsigned ID = 0, NumIDs = LocalSLocEntryTable.size(); ID != NumIDs; 
++ID) {
+DumpSLocEntry(ID, LocalSLocEntryTable[ID],
+  ID == NumIDs - 1 ? NextLocalOffset
+   : LocalSLocEntryTable[ID + 1].getOffset());
+  }
+  // Dump loaded SLocEntries.
+  llvm::Optional NextStart;
+  for (unsigned Index = 0; Index != LoadedSLocEntryTable.size(); ++Index) {
+int ID = -(int)Index - 2;
+if (SLocEntryLoaded[Index]) {
+  DumpSLocEntry(ID, LoadedSLocEntryTable[Index], NextStart);
+  NextStart = LoadedSLocEntryTable[Index].getOffset();
+} else {
+  NextStart = None;
+}
+  }
+}
+
 ExternalSLocEntrySource::~ExternalSLocEntrySource() { }
 
 /// Return the amount of memory used by memory buffers, breaking down


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


[PATCH] D12002: Initial WebAssembly support in clang

2015-08-12 Thread Dan Gohman via cfe-commits
sunfish created this revision.
sunfish added subscribers: cfe-commits, jfb.
sunfish set the repository for this revision to rL LLVM.

This patch adds initial WebAssembly support in clang. The WebAssembly target is 
currently experimental.

Repository:
  rL LLVM

http://reviews.llvm.org/D12002

Files:
  include/clang/Basic/BuiltinsWebAssembly.def
  include/clang/Basic/TargetBuiltins.h
  include/clang/Basic/TargetCXXABI.h
  include/clang/module.modulemap
  lib/AST/ASTContext.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/ItaniumCXXABI.cpp
  lib/CodeGen/TargetInfo.cpp
  lib/Driver/ToolChains.h
  lib/Driver/Tools.cpp
  test/CodeGen/builtins-wasm.c
  test/CodeGen/target-data.c
  test/CodeGen/wasm-arguments.c
  test/CodeGen/wasm-regparm.c
  test/CodeGenCXX/member-alignment.cpp
  test/CodeGenCXX/member-function-pointers.cpp
  test/CodeGenCXX/static-init-wasm.cpp
  test/Driver/wasm32-unknown-unknown.cpp
  test/Driver/wasm64-unknown-unknown.cpp
  test/Preprocessor/init.c

Index: test/Preprocessor/init.c
===
--- test/Preprocessor/init.c
+++ test/Preprocessor/init.c
@@ -8418,3 +8418,601 @@
 // XCORE:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
 // XCORE:#define __LITTLE_ENDIAN__ 1
 // XCORE:#define __XS1B__ 1
+//
+// RUN: %clang_cc1 -E -dM -ffreestanding -triple=wasm32-unknown-unknown < /dev/null | FileCheck -check-prefix=WEBASSEMBLY32 %s
+//
+// WEBASSEMBLY32:#define _ILP32 1
+// WEBASSEMBLY32-NOT:#define _LP64
+// WEBASSEMBLY32:#define __ATOMIC_ACQUIRE 2
+// WEBASSEMBLY32:#define __ATOMIC_ACQ_REL 4
+// WEBASSEMBLY32:#define __ATOMIC_CONSUME 1
+// WEBASSEMBLY32:#define __ATOMIC_RELAXED 0
+// WEBASSEMBLY32:#define __ATOMIC_RELEASE 3
+// WEBASSEMBLY32:#define __ATOMIC_SEQ_CST 5
+// WEBASSEMBLY32:#define __BIGGEST_ALIGNMENT__ 16
+// WEBASSEMBLY32:#define __BYTE_ORDER__ __ORDER_LITTLE_ENDIAN__
+// WEBASSEMBLY32:#define __CHAR16_TYPE__ unsigned short
+// WEBASSEMBLY32:#define __CHAR32_TYPE__ unsigned int
+// WEBASSEMBLY32:#define __CHAR_BIT__ 8
+// WEBASSEMBLY32:#define __CONSTANT_CFSTRINGS__ 1
+// WEBASSEMBLY32:#define __DBL_DECIMAL_DIG__ 17
+// WEBASSEMBLY32:#define __DBL_DENORM_MIN__ 4.9406564584124654e-324
+// WEBASSEMBLY32:#define __DBL_DIG__ 15
+// WEBASSEMBLY32:#define __DBL_EPSILON__ 2.2204460492503131e-16
+// WEBASSEMBLY32:#define __DBL_HAS_DENORM__ 1
+// WEBASSEMBLY32:#define __DBL_HAS_INFINITY__ 1
+// WEBASSEMBLY32:#define __DBL_HAS_QUIET_NAN__ 1
+// WEBASSEMBLY32:#define __DBL_MANT_DIG__ 53
+// WEBASSEMBLY32:#define __DBL_MAX_10_EXP__ 308
+// WEBASSEMBLY32:#define __DBL_MAX_EXP__ 1024
+// WEBASSEMBLY32:#define __DBL_MAX__ 1.7976931348623157e+308
+// WEBASSEMBLY32:#define __DBL_MIN_10_EXP__ (-307)
+// WEBASSEMBLY32:#define __DBL_MIN_EXP__ (-1021)
+// WEBASSEMBLY32:#define __DBL_MIN__ 2.2250738585072014e-308
+// WEBASSEMBLY32:#define __DECIMAL_DIG__ __LDBL_DECIMAL_DIG__
+// WEBASSEMBLY32:#define __FINITE_MATH_ONLY__ 0
+// WEBASSEMBLY32:#define __FLT_DECIMAL_DIG__ 9
+// WEBASSEMBLY32:#define __FLT_DENORM_MIN__ 1.40129846e-45F
+// WEBASSEMBLY32:#define __FLT_DIG__ 6
+// WEBASSEMBLY32:#define __FLT_EPSILON__ 1.19209290e-7F
+// WEBASSEMBLY32:#define __FLT_EVAL_METHOD__ 0
+// WEBASSEMBLY32:#define __FLT_HAS_DENORM__ 1
+// WEBASSEMBLY32:#define __FLT_HAS_INFINITY__ 1
+// WEBASSEMBLY32:#define __FLT_HAS_QUIET_NAN__ 1
+// WEBASSEMBLY32:#define __FLT_MANT_DIG__ 24
+// WEBASSEMBLY32:#define __FLT_MAX_10_EXP__ 38
+// WEBASSEMBLY32:#define __FLT_MAX_EXP__ 128
+// WEBASSEMBLY32:#define __FLT_MAX__ 3.40282347e+38F
+// WEBASSEMBLY32:#define __FLT_MIN_10_EXP__ (-37)
+// WEBASSEMBLY32:#define __FLT_MIN_EXP__ (-125)
+// WEBASSEMBLY32:#define __FLT_MIN__ 1.17549435e-38F
+// WEBASSEMBLY32:#define __FLT_RADIX__ 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_BOOL_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR16_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR32_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_CHAR_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_INT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_LLONG_LOCK_FREE 1
+// WEBASSEMBLY32:#define __GCC_ATOMIC_LONG_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_POINTER_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_SHORT_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GCC_ATOMIC_TEST_AND_SET_TRUEVAL 1
+// WEBASSEMBLY32:#define __GCC_ATOMIC_WCHAR_T_LOCK_FREE 2
+// WEBASSEMBLY32:#define __GNUC_MINOR__
+// WEBASSEMBLY32:#define __GNUC_PATCHLEVEL__
+// WEBASSEMBLY32:#define __GNUC_STDC_INLINE__ 1
+// WEBASSEMBLY32:#define __GNUC__
+// WEBASSEMBLY32:#define __GXX_ABI_VERSION 1002
+// WEBASSEMBLY32:#define __GXX_RTTI 1
+// WEBASSEMBLY32:#define __ILP32__ 1
+// WEBASSEMBLY32:#define __INT16_C_SUFFIX__ {{$}}
+// WEBASSEMBLY32:#define __INT16_FMTd__ "hd"
+// WEBASSEMBLY32:#define __INT16_FMTi__ "hi"
+// WEBASSEMBLY32:#define __INT16_MAX__ 32767
+// WEBASSEMBLY32:#define __INT16_TYPE__ short
+// WEBASSEMBLY32:#de

Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Ivan Krasin via cfe-commits
krasin added a comment.

Thank you, Peter.

I will commit once I have restored my password (the email to Chris is sent)


http://reviews.llvm.org/D11968



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


Re: [PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in

2015-08-12 Thread Hal Finkel via cfe-commits
- Original Message -
> From: "Dan Albert via cfe-commits" 
> To: "Marshall Clow" 
> Cc: "Joerg Sonnenberger" , "cfe-commits" 
> 
> Sent: Wednesday, August 12, 2015 6:03:30 PM
> Subject: Re: [PATCH] D11948: Add some macros to abstract marking of 
> parameters as "not null", and use them in
> 
> 
> 
> 
> My testing was varied. I could not get GCC or clang to optimize it
> away for Linux, but both did for ARM Android.
> 
> 
> Regardless, the fact that GCC is already doing this doesn't mean it's
> desirable. We end up hunting and fixing bugs from this optimization
> this every release, and our time could be better spent.

I could say the same thing about many optimizations -- I spend a lot of time 
tracking down bugs they expose -- the real thing to investigate here are the 
potential benefits to real code from performing the optimization. I'm generally 
in favor of these kinds of optimizations because they tend to lower abstraction 
penalties, but actual data here would be helpful.

What would also be helpful is properly supporting 
-fno-delete-null-pointer-checks.

 -Hal

> 
> On Wed, Aug 12, 2015 at 3:42 PM, Marshall Clow via cfe-commits <
> cfe-commits@lists.llvm.org > wrote:
> 
> On Tue, Aug 11, 2015 at 2:28 PM, Joerg Sonnenberger via cfe-commits <
> cfe-commits@lists.llvm.org > wrote:
> 
> 
> On Tue, Aug 11, 2015 at 02:06:58PM -0700, Marshall Clow via
> cfe-commits wrote:
> > On Tue, Aug 11, 2015 at 1:34 PM, Dan Albert < danalb...@google.com
> > > wrote:
> > 
> > > Yeah, those sound like exactly what we want. Helping people find
> > > UB is
> > > good, but optimizing assuming we've fixed all of the UB isn't
> > > something we
> > > can do.
> > > 
> > 
> > Dan -- that's the situation you're in today.
> > GCC has done that kind of optimization for *years*.
> 
> Only on platforms that use this markup. Which is exactly the point I
> am
> raising. The gain by this optimisation is questionable at best and it
> has created (or exposed, however you want to call it) non-trivial
> bugs
> in the real world. There is a reason why there is a lot of push back
> outside glibc for this markers.
> 
> 
> 
> 
> I don't think that this is true.
> 
> 
> My tests (from a previous message - run on a Mac, which does not use
> glibc) show that gcc recognizes this and optimizes based on that.
> 
> 
> -- Marshall
> 
> 
> ___
> 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
> 

-- 
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11808: Driver: Fix include and lib dirs when not using gcc under mingw

2015-08-12 Thread Martell Malone via cfe-commits
martell updated this revision to Diff 32007.
martell added a comment.

Updated to address yaron's comments.

Okay for me to merge now ?


http://reviews.llvm.org/D11808

Files:
  lib/Driver/MinGWToolChain.cpp
  test/Driver/Inputs/mingw_clang_tree/mingw32/i686-w64-mingw32/include/.keep
  test/Driver/Inputs/mingw_clang_tree/mingw32/include/.keep
  test/Driver/mingw.cpp

Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -1,3 +1,8 @@
+// RUN: %clang -target i686-windows-gnu -c -### 
--sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_CLANG_TREE %s
+// CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include"
+// CHECK_MINGW_CLANG_TREE: 
"{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -stdlib=libstdc++ -c -### 
--sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck 
-check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: 
"{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -47,7 +47,7 @@
   Archs.emplace_back(getTriple().getArchName());
   Archs[0] += "-w64-mingw32";
   Archs.emplace_back("mingw32");
-  Arch = "unknown";
+  Arch = Archs[0].str();
   // lib: Arch Linux, Ubuntu, Windows
   // lib64: openSUSE Linux
   for (StringRef CandidateLib : {"lib", "lib64"}) {


Index: test/Driver/mingw.cpp
===
--- test/Driver/mingw.cpp
+++ test/Driver/mingw.cpp
@@ -1,3 +1,8 @@
+// RUN: %clang -target i686-windows-gnu -c -### --sysroot=%S/Inputs/mingw_clang_tree/mingw32 %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_CLANG_TREE %s
+// CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}i686-w64-mingw32{{/|}}include"
+// CHECK_MINGW_CLANG_TREE: "{{.*}}/Inputs/mingw_clang_tree/mingw32{{/|}}include"
+
+
 // RUN: %clang -target i686-pc-windows-gnu -stdlib=libstdc++ -c -### --sysroot=%S/Inputs/mingw_mingw_org_tree/mingw %s 2>&1 | FileCheck -check-prefix=CHECK_MINGW_ORG_TREE %s
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++"
 // CHECK_MINGW_ORG_TREE: "{{.*}}/Inputs/mingw_mingw_org_tree/mingw{{/|}}lib{{/|}}gcc{{/|}}mingw32{{/|}}4.8.1{{/|}}include{{/|}}c++{{/|}}mingw32"
Index: lib/Driver/MinGWToolChain.cpp
===
--- lib/Driver/MinGWToolChain.cpp
+++ lib/Driver/MinGWToolChain.cpp
@@ -47,7 +47,7 @@
   Archs.emplace_back(getTriple().getArchName());
   Archs[0] += "-w64-mingw32";
   Archs.emplace_back("mingw32");
-  Arch = "unknown";
+  Arch = Archs[0].str();
   // lib: Arch Linux, Ubuntu, Windows
   // lib64: openSUSE Linux
   for (StringRef CandidateLib : {"lib", "lib64"}) {
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D12000: Bugfix - Clang handles __builtin_object_size in wrong way

2015-08-12 Thread George Burgess IV via cfe-commits
george.burgess.iv created this revision.
george.burgess.iv added a subscriber: cfe-commits.

Attached is a fix for https://llvm.org/bugs/show_bug.cgi?id=15212 .

Summary: Tighten up some of the results for __builtin_object_size(ptr, type) 
when given type == 1 or type == 3 + fixed a bug where we would report incorrect 
results for type == 3.

> 90% of the patch is courtesy of Richard Smith. :)


http://reviews.llvm.org/D12000

Files:
  lib/AST/ExprConstant.cpp
  test/CodeGen/object-size.c
  test/Sema/const-eval.c

Index: test/Sema/const-eval.c
===
--- test/Sema/const-eval.c
+++ test/Sema/const-eval.c
@@ -118,10 +118,6 @@
 const float constfloat = 0;
 EVAL_EXPR(43, varfloat && constfloat) // expected-error {{must have a constant size}}
 
-// 
-// (Make sure we continue to reject this.)
-EVAL_EXPR(44, "x"[0]); // expected-error {{variable length array}}
-
 // 
 EVAL_EXPR(45, ((char*)-1) + 1 == 0 ? 1 : -1)
 EVAL_EXPR(46, ((char*)-1) + 1 < (char*) -1 ? 1 : -1)
Index: test/CodeGen/object-size.c
===
--- test/CodeGen/object-size.c
+++ test/CodeGen/object-size.c
@@ -146,3 +146,36 @@
   // CHECK: call i64 @llvm.objectsize.i64
   return __builtin_object_size(cond ? a : b, 0);
 }
+
+// CHECK: @test19
+void test19() {
+  struct {
+char a[4];
+char b[4];
+  } foo;
+
+  // CHECK: store i32 8
+  gi = __builtin_object_size(&foo.a, 0);
+  // CHECK: store i32 4
+  gi = __builtin_object_size(&foo.a, 1);
+  // CHECK: store i32 8
+  gi = __builtin_object_size(&foo.a, 2);
+  // CHECK: store i32 4
+  gi = __builtin_object_size(&foo.a, 3);
+}
+
+// CHECK: @test20
+void test20() {
+  struct {
+int t[10];
+  } t[10];
+
+  // CHECK: store i32 380
+  gi = __builtin_object_size(&t[0].t[5], 0);
+  // CHECK: store i32 20
+  gi = __builtin_object_size(&t[0].t[5], 1);
+  // CHECK: store i32 380
+  gi = __builtin_object_size(&t[0].t[5], 2);
+  // CHECK: store i32 20
+  gi = __builtin_object_size(&t[0].t[5], 3);
+}
Index: lib/AST/ExprConstant.cpp
===
--- lib/AST/ExprConstant.cpp
+++ lib/AST/ExprConstant.cpp
@@ -967,10 +967,6 @@
 // Check this LValue refers to an object. If not, set the designator to be
 // invalid and emit a diagnostic.
 bool checkSubobject(EvalInfo &Info, const Expr *E, CheckSubobjectKind CSK) {
-  // Outside C++11, do not build a designator referring to a subobject of
-  // any object: we won't use such a designator for anything.
-  if (!Info.getLangOpts().CPlusPlus11)
-Designator.setInvalid();
   return (CSK == CSK_ArrayToPointer || checkNullPointer(Info, E, CSK)) &&
  Designator.checkSubobject(Info, E, CSK);
 }
@@ -2713,8 +2709,7 @@
 
   // Check for special cases where there is no existing APValue to look at.
   const Expr *Base = LVal.Base.dyn_cast();
-  if (!LVal.Designator.Invalid && Base && !LVal.CallIndex &&
-  !Type.isVolatileQualified()) {
+  if (Base && !LVal.CallIndex && !Type.isVolatileQualified()) {
 if (const CompoundLiteralExpr *CLE = dyn_cast(Base)) {
   // In C99, a CompoundLiteralExpr is an lvalue, and we defer evaluating the
   // initializer until now for such expressions. Such an expression can't be
@@ -5998,8 +5993,7 @@
   bool VisitSizeOfPackExpr(const SizeOfPackExpr *E);
 
 private:
-  static QualType GetObjectType(APValue::LValueBase B);
-  bool TryEvaluateBuiltinObjectSize(const CallExpr *E);
+  bool TryEvaluateBuiltinObjectSize(const CallExpr *E, unsigned Type);
   // FIXME: Missing: array subscript of vector, member of vector
 };
 } // end anonymous namespace
@@ -6171,7 +6165,7 @@
 
 /// Retrieves the "underlying object type" of the given expression,
 /// as used by __builtin_object_size.
-QualType IntExprEvaluator::GetObjectType(APValue::LValueBase B) {
+static QualType getObjectType(APValue::LValueBase B) {
   if (const ValueDecl *D = B.dyn_cast()) {
 if (const VarDecl *VD = dyn_cast(D))
   return VD->getType();
@@ -6183,68 +6177,109 @@
   return QualType();
 }
 
-bool IntExprEvaluator::TryEvaluateBuiltinObjectSize(const CallExpr *E) {
+bool IntExprEvaluator::TryEvaluateBuiltinObjectSize(const CallExpr *E,
+unsigned Type) {
+  // Determine the denoted object.
   LValue Base;
-
   {
 // The operand of __builtin_object_size is never evaluated for side-effects.
 // If there are any, but we can determine the pointed-to object anyway, then
 // ignore the side-effects.
 SpeculativeEvaluationRAII SpeculativeEval(Info);
+FoldConstant Fold(Info, true);
 if (!EvaluatePointer(E->getArg(0), Base, Info))
   return false;
   }
 
-  if (!Base.getLValueBase()) {
-// It is not possible to determine which objects ptr points to at compile time,
-// __builtin_object_size should return (size_t) -1 for type 0 or 1
-// and (size_t) 0 for type 2 or 3

Re: r220305 - Driver: Move crash report command mangling into Command::Print

2015-08-12 Thread Justin Bogner via cfe-commits
On Wed, Aug 12, 2015 at 3:09 PM, David Blaikie  wrote:
> On Tue, Oct 21, 2014 at 10:24 AM, Justin Bogner 
> wrote:
>> Author: bogner
>> Date: Tue Oct 21 12:24:44 2014
>> New Revision: 220305
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=220305&view=rev
>> Log:
>> Driver: Move crash report command mangling into Command::Print
>>
>> This pushes the logic for generating a crash reproduction script
>> entirely into Command::Print, instead of Command doing half of the
>> work and then relying on textual substitution for the rest. This makes
>> this logic much easier to read and will simplify fixing a couple of
>> issues in this area.
>
>
>> Modified:
>> cfe/trunk/include/clang/Driver/Job.h
>> cfe/trunk/lib/Driver/Driver.cpp
>> cfe/trunk/lib/Driver/Job.cpp
>>
>> Modified: cfe/trunk/include/clang/Driver/Job.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=220305&r1=220304&r2=220305&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Driver/Job.h (original)
>> +++ cfe/trunk/include/clang/Driver/Job.h Tue Oct 21 12:24:44 2014
>> @@ -29,6 +29,14 @@ class Tool;
>>  // Re-export this as clang::driver::ArgStringList.
>>  using llvm::opt::ArgStringList;
>>
>> +struct CrashReportInfo {
>> +  StringRef Filename;
>> +  StringRef VFSPath;
>> +
>> +  CrashReportInfo(StringRef Filename, StringRef VFSPath)
>> +  : Filename(Filename), VFSPath(VFSPath) {}
>> +};
>> +
>>  class Job {
>>  public:
>>enum JobClass {
>> @@ -52,9 +60,9 @@ public:
>>/// \param OS - The stream to print on.
>>/// \param Terminator - A string to print at the end of the line.
>>/// \param Quote - Should separate arguments be quoted.
>> -  /// \param CrashReport - Whether to print for inclusion in a crash
>> report.
>> -  virtual void Print(llvm::raw_ostream &OS, const char *Terminator,
>> - bool Quote, bool CrashReport = false) const = 0;
>> +  /// \param CrashInfo - Details for inclusion in a crash report.
>> +  virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool
>> Quote,
>> + CrashReportInfo *CrashInfo = nullptr) const = 0;
>>  };
>>
>>  /// Command - An executable path/name and argument vector to
>> @@ -102,7 +110,7 @@ public:
>>const llvm::opt::ArgStringList &_Arguments);
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
>> - bool CrashReport = false) const override;
>> + CrashReportInfo *CrashInfo = nullptr) const override;
>>
>>virtual int Execute(const StringRef **Redirects, std::string *ErrMsg,
>>bool *ExecutionFailed) const;
>> @@ -141,7 +149,7 @@ public:
>>std::unique_ptr Fallback_);
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
>> - bool CrashReport = false) const override;
>> + CrashReportInfo *CrashInfo = nullptr) const override;
>>
>>int Execute(const StringRef **Redirects, std::string *ErrMsg,
>>bool *ExecutionFailed) const override;
>> @@ -170,7 +178,7 @@ public:
>>virtual ~JobList() {}
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator,
>> - bool Quote, bool CrashReport = false) const override;
>> + bool Quote, CrashReportInfo *CrashInfo = nullptr) const
>> override;
>>
>>/// Add a job to the list (taking ownership).
>>void addJob(std::unique_ptr J) { Jobs.push_back(std::move(J)); }
>>
>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=220305&r1=220304&r2=220305&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 21 12:24:44 2014
>> @@ -424,10 +424,7 @@ void Driver::generateCompilationDiagnost
>>CCGenDiagnostics = true;
>>
>>// Save the original job command(s).
>> -  std::string Cmd;
>> -  llvm::raw_string_ostream OS(Cmd);
>> -  FailingCommand.Print(OS, "\n", /*Quote*/ false, /*CrashReport*/ true);
>> -  OS.flush();
>> +  Command Cmd = FailingCommand;
>>
>
> It seems this code was/is undertested, or it would've caught the bug that
> I believe was introduced here.
>
> This line of code ("Command Cmd = FailingCommand") silently slices the
> FailingCommand object into a plain Command object, even in cases where
> FailingCommand is a derived class. This means that later on when
> "Cmd.Print" is called, it only prints as a plain Command, not as an
> appropriately derived Command object.
>
> Could you add more testing here to demonstrate this bug, and perhaps
> revert to the original code or otherwise address this issue?

Surprisingly, it's almost impossible to actually hit this bug, and the
behaviour with the sliced object actually ends being as good or better
than the behaviour 

Re: [PATCH] D10356: scan-build: Add --analyzer-target option

2015-08-12 Thread Honggyu Kim via cfe-commits
honggyu.kim accepted this revision.
honggyu.kim added a reviewer: honggyu.kim.
honggyu.kim added a comment.
This revision is now accepted and ready to land.

In http://reviews.llvm.org/D10356#219772, @krememek wrote:

> Committed r244400


Thanks for accepting it!


http://reviews.llvm.org/D10356



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


r244843 - Wdeprecated: LambdaScopeInfos need to be copied, so make the ScopeInfo hierarchy safely copyable

2015-08-12 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 12 18:59:02 2015
New Revision: 244843

URL: http://llvm.org/viewvc/llvm-project?rev=244843&view=rev
Log:
Wdeprecated: LambdaScopeInfos need to be copied, so make the ScopeInfo 
hierarchy safely copyable

Making the base class's copy ctor protected and the derived classes
final to avoid any slicing-prone APIs.

Modified:
cfe/trunk/include/clang/Sema/ScopeInfo.h

Modified: cfe/trunk/include/clang/Sema/ScopeInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/ScopeInfo.h?rev=244843&r1=244842&r2=244843&view=diff
==
--- cfe/trunk/include/clang/Sema/ScopeInfo.h (original)
+++ cfe/trunk/include/clang/Sema/ScopeInfo.h Wed Aug 12 18:59:02 2015
@@ -291,6 +291,9 @@ private:
   /// Part of the implementation of -Wrepeated-use-of-weak.
   WeakObjectUseMap WeakObjectUses;
 
+protected:
+  FunctionScopeInfo(const FunctionScopeInfo&) = default;
+
 public:
   /// Record that a weak object was accessed.
   ///
@@ -364,6 +367,9 @@ public:
 };
 
 class CapturingScopeInfo : public FunctionScopeInfo {
+protected:
+  CapturingScopeInfo(const CapturingScopeInfo&) = default;
+
 public:
   enum ImplicitCaptureStyle {
 ImpCap_None, ImpCap_LambdaByval, ImpCap_LambdaByref, ImpCap_Block,
@@ -549,7 +555,7 @@ public:
 };
 
 /// \brief Retains information about a block that is currently being parsed.
-class BlockScopeInfo : public CapturingScopeInfo {
+class BlockScopeInfo final : public CapturingScopeInfo {
 public:
   BlockDecl *TheDecl;
   
@@ -576,7 +582,7 @@ public:
 };
 
 /// \brief Retains information about a captured region.
-class CapturedRegionScopeInfo: public CapturingScopeInfo {
+class CapturedRegionScopeInfo final : public CapturingScopeInfo {
 public:
   /// \brief The CapturedDecl for this statement.
   CapturedDecl *TheCapturedDecl;
@@ -617,7 +623,7 @@ public:
   }
 };
 
-class LambdaScopeInfo : public CapturingScopeInfo {
+class LambdaScopeInfo final : public CapturingScopeInfo {
 public:
   /// \brief The class that describes the lambda.
   CXXRecordDecl *Lambda;


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


r244838 - Wdeprecated: ApplyDebugLocation is returned by value yet if it is ever copied (rather than RVO'd) that would be broken, make it movable instead

2015-08-12 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 12 18:49:57 2015
New Revision: 244838

URL: http://llvm.org/viewvc/llvm-project?rev=244838&view=rev
Log:
Wdeprecated: ApplyDebugLocation is returned by value yet if it is ever copied 
(rather than RVO'd) that would be broken, make it movable instead

Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
cfe/trunk/lib/CodeGen/CGDebugInfo.h

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=244838&r1=244837&r2=244838&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 12 18:49:57 2015
@@ -56,54 +56,63 @@ CGDebugInfo::~CGDebugInfo() {
 
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,
SourceLocation TemporaryLocation)
-: CGF(CGF) {
+: CGF(&CGF) {
   init(TemporaryLocation);
 }
 
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF,
bool DefaultToEmpty,
SourceLocation TemporaryLocation)
-: CGF(CGF) {
+: CGF(&CGF) {
   init(TemporaryLocation, DefaultToEmpty);
 }
 
 void ApplyDebugLocation::init(SourceLocation TemporaryLocation,
   bool DefaultToEmpty) {
-  if (auto *DI = CGF.getDebugInfo()) {
-OriginalLocation = CGF.Builder.getCurrentDebugLocation();
-if (TemporaryLocation.isInvalid()) {
-  if (DefaultToEmpty)
-CGF.Builder.SetCurrentDebugLocation(llvm::DebugLoc());
-  else {
-// Construct a location that has a valid scope, but no line info.
-assert(!DI->LexicalBlockStack.empty());
-CGF.Builder.SetCurrentDebugLocation(
-llvm::DebugLoc::get(0, 0, DI->LexicalBlockStack.back()));
-  }
-} else
-  DI->EmitLocation(CGF.Builder, TemporaryLocation);
+  auto *DI = CGF->getDebugInfo();
+  if (!DI) {
+CGF = nullptr;
+return;
   }
+
+  OriginalLocation = CGF->Builder.getCurrentDebugLocation();
+  if (TemporaryLocation.isValid()) {
+DI->EmitLocation(CGF->Builder, TemporaryLocation);
+return;
+  }
+
+  if (DefaultToEmpty) {
+CGF->Builder.SetCurrentDebugLocation(llvm::DebugLoc());
+return;
+  }
+
+  // Construct a location that has a valid scope, but no line info.
+  assert(!DI->LexicalBlockStack.empty());
+  CGF->Builder.SetCurrentDebugLocation(
+  llvm::DebugLoc::get(0, 0, DI->LexicalBlockStack.back()));
 }
 
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E)
-: CGF(CGF) {
+: CGF(&CGF) {
   init(E->getExprLoc());
 }
 
 ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc 
Loc)
-: CGF(CGF) {
-  if (CGF.getDebugInfo()) {
-OriginalLocation = CGF.Builder.getCurrentDebugLocation();
-if (Loc)
-  CGF.Builder.SetCurrentDebugLocation(std::move(Loc));
+: CGF(&CGF) {
+  if (!CGF.getDebugInfo()) {
+this->CGF = nullptr;
+return;
   }
+  OriginalLocation = CGF.Builder.getCurrentDebugLocation();
+  if (Loc)
+CGF.Builder.SetCurrentDebugLocation(std::move(Loc));
 }
 
 ApplyDebugLocation::~ApplyDebugLocation() {
   // Query CGF so the location isn't overwritten when location updates are
   // temporarily disabled (for C++ default function arguments)
-  if (CGF.getDebugInfo())
-CGF.Builder.SetCurrentDebugLocation(std::move(OriginalLocation));
+  if (CGF)
+CGF->Builder.SetCurrentDebugLocation(std::move(OriginalLocation));
 }
 
 void CGDebugInfo::setLocation(SourceLocation Loc) {

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.h?rev=244838&r1=244837&r2=244838&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.h (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.h Wed Aug 12 18:49:57 2015
@@ -502,13 +502,16 @@ private:
  SourceLocation TemporaryLocation);
 
   llvm::DebugLoc OriginalLocation;
-  CodeGenFunction &CGF;
+  CodeGenFunction *CGF;
 
 public:
   /// Set the location to the (valid) TemporaryLocation.
   ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation);
   ApplyDebugLocation(CodeGenFunction &CGF, const Expr *E);
   ApplyDebugLocation(CodeGenFunction &CGF, llvm::DebugLoc Loc);
+  ApplyDebugLocation(ApplyDebugLocation &&Other) : CGF(Other.CGF) {
+Other.CGF = nullptr;
+  }
 
   ~ApplyDebugLocation();
 


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


r244831 - Wdeprecated: CGBuilderInserter is copy constructed in some contexts - remove the unnecessarily disabling copy assignment to enable this

2015-08-12 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 12 18:16:55 2015
New Revision: 244831

URL: http://llvm.org/viewvc/llvm-project?rev=244831&view=rev
Log:
Wdeprecated: CGBuilderInserter is copy constructed in some contexts - remove 
the unnecessarily disabling copy assignment to enable this

The object has very simple state, there seems no reason to disallow all
the usual value semantic operations.

Modified:
cfe/trunk/lib/CodeGen/CGBuilder.h

Modified: cfe/trunk/lib/CodeGen/CGBuilder.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGBuilder.h?rev=244831&r1=244830&r2=244831&view=diff
==
--- cfe/trunk/lib/CodeGen/CGBuilder.h (original)
+++ cfe/trunk/lib/CodeGen/CGBuilder.h Wed Aug 12 18:16:55 2015
@@ -22,9 +22,9 @@ class CodeGenFunction;
 /// instructions.
 template 
 class CGBuilderInserter
-  : protected llvm::IRBuilderDefaultInserter {
+: protected llvm::IRBuilderDefaultInserter {
 public:
-  CGBuilderInserter() : CGF(nullptr) {}
+  CGBuilderInserter() = default;
   explicit CGBuilderInserter(CodeGenFunction *CGF) : CGF(CGF) {}
 
 protected:
@@ -33,9 +33,7 @@ protected:
 llvm::BasicBlock *BB,
 llvm::BasicBlock::iterator InsertPt) const;
 private:
-  void operator=(const CGBuilderInserter &) = delete;
-
-  CodeGenFunction *CGF;
+  CodeGenFunction *CGF = nullptr;
 };
 
 // Don't preserve names on values in an optimized build.


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


r244829 - -Wdeprecated: Job objects are stored in a vector yet are not really copyable, make them movable instead

2015-08-12 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 12 18:09:24 2015
New Revision: 244829

URL: http://llvm.org/viewvc/llvm-project?rev=244829&view=rev
Log:
-Wdeprecated: Job objects are stored in a vector yet are not really copyable, 
make them movable instead

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

Modified: cfe/trunk/lib/AST/ExprConstant.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=244829&r1=244828&r2=244829&view=diff
==
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Aug 12 18:09:24 2015
@@ -6555,7 +6555,13 @@ class DataRecursiveIntBinOpEvaluator {
 EvalResult LHSResult; // meaningful only for binary operator expression.
 enum { AnyExprKind, BinOpKind, BinOpVisitedLHSKind } Kind;
 
-Job() : StoredInfo(nullptr) {}
+Job() = default;
+Job(Job &&J)
+: E(J.E), LHSResult(J.LHSResult), Kind(J.Kind),
+  StoredInfo(J.StoredInfo), OldEvalStatus(J.OldEvalStatus) {
+  J.StoredInfo = nullptr;
+}
+
 void startSpeculativeEval(EvalInfo &Info) {
   OldEvalStatus = Info.EvalStatus;
   Info.EvalStatus.Diag = nullptr;
@@ -6567,7 +6573,7 @@ class DataRecursiveIntBinOpEvaluator {
   }
 }
   private:
-EvalInfo *StoredInfo; // non-null if status changed.
+EvalInfo *StoredInfo = nullptr; // non-null if status changed.
 Expr::EvalStatus OldEvalStatus;
   };
 


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


Re: [PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in

2015-08-12 Thread Dan Albert via cfe-commits
My testing was varied. I could not get GCC or clang to optimize it away for
Linux, but both did for ARM Android.

Regardless, the fact that GCC is already doing this doesn't mean it's
desirable. We end up hunting and fixing bugs from this optimization this
every release, and our time could be better spent.

On Wed, Aug 12, 2015 at 3:42 PM, Marshall Clow via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
>
> On Tue, Aug 11, 2015 at 2:28 PM, Joerg Sonnenberger via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> On Tue, Aug 11, 2015 at 02:06:58PM -0700, Marshall Clow via cfe-commits
>> wrote:
>> > On Tue, Aug 11, 2015 at 1:34 PM, Dan Albert 
>> wrote:
>> >
>> > > Yeah, those sound like exactly what we want. Helping people find UB is
>> > > good, but optimizing assuming we've fixed all of the UB isn't
>> something we
>> > > can do.
>> > >
>> >
>> > Dan -- that's the situation you're in today.
>> > GCC has done that kind of optimization for *years*.
>>
>> Only on platforms that use this markup. Which is exactly the point I am
>> raising. The gain by this optimisation is questionable at best and it
>> has created (or exposed, however you want to call it) non-trivial bugs
>> in the real world. There is a reason why there is a lot of push back
>> outside glibc for this markers.
>>
>>
> I don't think that this is true.
>
> My tests (from a previous message - run on a Mac, which does not use
> glibc) show that gcc recognizes this and optimizes based on that.
>
> -- Marshall
>
>
>
> ___
> 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


r244826 - -Wdeprecated: SavedInstanceContext is returned by value but isn't really copyable, but it can be made movable

2015-08-12 Thread David Blaikie via cfe-commits
Author: dblaikie
Date: Wed Aug 12 17:58:10 2015
New Revision: 244826

URL: http://llvm.org/viewvc/llvm-project?rev=244826&view=rev
Log:
-Wdeprecated: SavedInstanceContext is returned by value but isn't really 
copyable, but it can be made movable

Modified:
cfe/trunk/lib/Sema/SemaAccess.cpp

Modified: cfe/trunk/lib/Sema/SemaAccess.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaAccess.cpp?rev=244826&r1=244825&r2=244826&view=diff
==
--- cfe/trunk/lib/Sema/SemaAccess.cpp (original)
+++ cfe/trunk/lib/Sema/SemaAccess.cpp Wed Aug 12 17:58:10 2015
@@ -182,15 +182,20 @@ struct AccessTarget : public AccessedEnt
 
   class SavedInstanceContext {
   public:
+SavedInstanceContext(SavedInstanceContext &&S)
+: Target(S.Target), Has(S.Has) {
+  S.Target = nullptr;
+}
 ~SavedInstanceContext() {
-  Target.HasInstanceContext = Has;
+  if (Target)
+Target->HasInstanceContext = Has;
 }
 
   private:
 friend struct AccessTarget;
 explicit SavedInstanceContext(AccessTarget &Target)
-  : Target(Target), Has(Target.HasInstanceContext) {}
-AccessTarget &Target;
+: Target(&Target), Has(Target.HasInstanceContext) {}
+AccessTarget *Target;
 bool Has;
   };
 


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


Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Peter Collingbourne via cfe-commits
pcc accepted this revision.
pcc added a reviewer: pcc.
pcc added a comment.
This revision is now accepted and ready to land.

LGTM


http://reviews.llvm.org/D11968



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


Re: [PATCH] D11658: [Sema] main can't be declared as global variable

2015-08-12 Thread Richard Smith via cfe-commits
rsmith added a comment.

Looks good other than the diagnostic wording.



Comment at: include/clang/Basic/DiagnosticSemaKinds.td:513
@@ -512,1 +512,3 @@
 "platform-specific data}0) must be of type %1">;
+def err_main_global_variable : Error<"main can't be declared as global 
variable">;
+def warn_main_redefined : Warning<"external-linkage variable named 'main' has "

It's much more common to use "cannot" rather than the contraction "can't" in 
our diagnostic wording.


Comment at: include/clang/Basic/DiagnosticSemaKinds.td:514
@@ +513,3 @@
+def err_main_global_variable : Error<"main can't be declared as global 
variable">;
+def warn_main_redefined : Warning<"external-linkage variable named 'main' has "
+"undefined behavior">, InGroup;

I would still like this reworded.


http://reviews.llvm.org/D11658



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


Re: [PATCH] D11948: Add some macros to abstract marking of parameters as "not null", and use them in

2015-08-12 Thread Marshall Clow via cfe-commits
On Tue, Aug 11, 2015 at 2:28 PM, Joerg Sonnenberger via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> On Tue, Aug 11, 2015 at 02:06:58PM -0700, Marshall Clow via cfe-commits
> wrote:
> > On Tue, Aug 11, 2015 at 1:34 PM, Dan Albert 
> wrote:
> >
> > > Yeah, those sound like exactly what we want. Helping people find UB is
> > > good, but optimizing assuming we've fixed all of the UB isn't
> something we
> > > can do.
> > >
> >
> > Dan -- that's the situation you're in today.
> > GCC has done that kind of optimization for *years*.
>
> Only on platforms that use this markup. Which is exactly the point I am
> raising. The gain by this optimisation is questionable at best and it
> has created (or exposed, however you want to call it) non-trivial bugs
> in the real world. There is a reason why there is a lot of push back
> outside glibc for this markers.
>
>
I don't think that this is true.

My tests (from a previous message - run on a Mac, which does not use glibc)
show that gcc recognizes this and optimizes based on that.

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


r244822 - [modules] If loading a .pcm file would cause us to run out of source locations, attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed input...)

2015-08-12 Thread Richard Smith via cfe-commits
Author: rsmith
Date: Wed Aug 12 17:25:24 2015
New Revision: 244822

URL: http://llvm.org/viewvc/llvm-project?rev=244822&view=rev
Log:
[modules] If loading a .pcm file would cause us to run out of source locations, 
attempt to fail more gracefully. (No test; this requires >= 4GB of preprocessed 
input...)

Modified:
cfe/trunk/lib/Basic/SourceManager.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Basic/SourceManager.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/SourceManager.cpp?rev=244822&r1=244821&r2=244822&view=diff
==
--- cfe/trunk/lib/Basic/SourceManager.cpp (original)
+++ cfe/trunk/lib/Basic/SourceManager.cpp Wed Aug 12 17:25:24 2015
@@ -484,10 +484,12 @@ std::pair
 SourceManager::AllocateLoadedSLocEntries(unsigned NumSLocEntries,
  unsigned TotalSize) {
   assert(ExternalSLocEntries && "Don't have an external sloc source");
+  // Make sure we're not about to run out of source locations.
+  if (CurrentLoadedOffset - TotalSize < NextLocalOffset)
+return std::make_pair(0, 0);
   LoadedSLocEntryTable.resize(LoadedSLocEntryTable.size() + NumSLocEntries);
   SLocEntryLoaded.resize(LoadedSLocEntryTable.size());
   CurrentLoadedOffset -= TotalSize;
-  assert(CurrentLoadedOffset >= NextLocalOffset && "Out of source locations");
   int ID = LoadedSLocEntryTable.size();
   return std::make_pair(-ID - 1, CurrentLoadedOffset);
 }

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=244822&r1=244821&r2=244822&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Wed Aug 12 17:25:24 2015
@@ -2727,6 +2727,10 @@ ASTReader::ReadASTBlock(ModuleFile &F, u
   std::tie(F.SLocEntryBaseID, F.SLocEntryBaseOffset) =
   SourceMgr.AllocateLoadedSLocEntries(F.LocalNumSLocEntries,
   SLocSpaceSize);
+  if (!F.SLocEntryBaseID) {
+Error("ran out of source locations");
+break;
+  }
   // Make our entry in the range map. BaseID is negative and growing, so
   // we invert it. Because we invert it, though, we need the other end of
   // the range.


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


Re: r244820 - Revert "Implement poisoning of only class members in dtor, as opposed to also poisoning fields inherited from base classes."

2015-08-12 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 3:17 PM, David Majnemer via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

>
>
> On Wed, Aug 12, 2015 at 6:07 PM, Naomi Musgrave via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
>
>> Author: nmusgrave
>> Date: Wed Aug 12 17:07:24 2015
>> New Revision: 244820
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=244820&view=rev
>> Log:
>> Revert "Implement poisoning of only class members in dtor, as opposed to
>> also poisoning fields inherited from base classes."
>>
>> This reverts commit 8dbbf3578a9a5d063232b59e558e5fe46e2cd42c.
>>
>
> In the future, please refer to SVN revisions.
>

There's a helper script to facilitate this in
llvm/utils/git-svn/git-svnrevert


>
> Thanks!
>
>
>> Rolled back due to buildbot failures on 'ninja check-clang'.
>>
>> Removed:
>> cfe/trunk/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
>> Modified:
>> cfe/trunk/lib/CodeGen/CGClass.cpp
>> cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
>> cfe/trunk/test/CodeGenCXX/sanitize-dtor-fn-attribute.cpp
>>
>> Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=244820&r1=244819&r2=244820&view=diff
>>
>> ==
>> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
>> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Aug 12 17:07:24 2015
>> @@ -1376,30 +1376,9 @@ static void EmitDtorSanitizerCallback(Co
>>const ASTRecordLayout &Layout =
>>CGF.getContext().getASTRecordLayout(Dtor->getParent());
>>
>> -  // Nothing to poison
>> -  if(Layout.getFieldCount() == 0)
>> -return;
>> -
>> -  // Construct pointer to region to begin poisoning, and calculate poison
>> -  // size, so that only members declared in this class are poisoned.
>> -  llvm::Value *OffsetPtr;
>> -  CharUnits::QuantityType PoisonSize;
>> -  ASTContext &Context = CGF.getContext();
>> -
>> -  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
>> -  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
>> -  getQuantity());
>> -
>> -  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
>> -  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
>> -
>> -  PoisonSize = Layout.getSize().getQuantity() -
>> -
>> Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
>> -
>>llvm::Value *Args[] = {
>> -CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
>> -llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
>> -
>> +  CGF.Builder.CreateBitCast(CGF.LoadCXXThis(), CGF.VoidPtrTy),
>> +  llvm::ConstantInt::get(CGF.SizeTy,
>> Layout.getSize().getQuantity())};
>>llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
>>
>>llvm::FunctionType *FnType =
>> @@ -1407,8 +1386,6 @@ static void EmitDtorSanitizerCallback(Co
>>llvm::Value *Fn =
>>CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
>>
>> -  // Disables tail call elimination, to prevent the current stack frame
>> from
>> -  // disappearing from the stack trace.
>>CGF.CurFn->addFnAttr("disable-tail-calls", "true");
>>CGF.EmitNounwindRuntimeCall(Fn, Args);
>>  }
>> @@ -1491,13 +1468,6 @@ void CodeGenFunction::EmitDestructorBody
>>  // the caller's body.
>>  if (getLangOpts().AppleKext)
>>CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
>> -
>> -// Insert memory-poisoning instrumentation, before final clean ups,
>> -// to ensure this class's members are protected from invalid access.
>> -if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
>> -&& SanOpts.has(SanitizerKind::Memory))
>> -  EmitDtorSanitizerCallback(*this, Dtor);
>> -
>>  break;
>>}
>>
>> @@ -1507,6 +1477,11 @@ void CodeGenFunction::EmitDestructorBody
>>// Exit the try if applicable.
>>if (isTryBody)
>>  ExitCXXTryStmt(*cast(Body), true);
>> +
>> +  // Insert memory-poisoning instrumentation.
>> +  if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
>> +  && SanOpts.has(SanitizerKind::Memory))
>> +EmitDtorSanitizerCallback(*this, Dtor);
>>  }
>>
>>  void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList
>> &Args) {
>>
>> Modified: cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp?rev=244820&r1=244819&r2=244820&view=diff
>>
>> ==
>> --- cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp (original)
>> +++ cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp Wed Aug 12
>> 17:07:24 2015
>> @@ -7,8 +7,7 @@ struct Simple {
>>  Simple s;
>>  // Simple internal member is poisoned by compiler-generated dtor
>>  // CHECK-LABEL: define {{.*}}SimpleD1Ev
>> -// CHECK-NOT: call void @__sanitizer_dtor_callback
>> -// CHECK: call void {{.*}}SimpleD2Ev
>> +// CHECK: call void @__sanitizer_dtor_callback
>>  // CHECK-NO

Re: r244820 - Revert "Implement poisoning of only class members in dtor, as opposed to also poisoning fields inherited from base classes."

2015-08-12 Thread David Majnemer via cfe-commits
On Wed, Aug 12, 2015 at 6:07 PM, Naomi Musgrave via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: nmusgrave
> Date: Wed Aug 12 17:07:24 2015
> New Revision: 244820
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244820&view=rev
> Log:
> Revert "Implement poisoning of only class members in dtor, as opposed to
> also poisoning fields inherited from base classes."
>
> This reverts commit 8dbbf3578a9a5d063232b59e558e5fe46e2cd42c.
>

In the future, please refer to SVN revisions.

Thanks!


> Rolled back due to buildbot failures on 'ninja check-clang'.
>
> Removed:
> cfe/trunk/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
> Modified:
> cfe/trunk/lib/CodeGen/CGClass.cpp
> cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
> cfe/trunk/test/CodeGenCXX/sanitize-dtor-fn-attribute.cpp
>
> Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=244820&r1=244819&r2=244820&view=diff
>
> ==
> --- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
> +++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Aug 12 17:07:24 2015
> @@ -1376,30 +1376,9 @@ static void EmitDtorSanitizerCallback(Co
>const ASTRecordLayout &Layout =
>CGF.getContext().getASTRecordLayout(Dtor->getParent());
>
> -  // Nothing to poison
> -  if(Layout.getFieldCount() == 0)
> -return;
> -
> -  // Construct pointer to region to begin poisoning, and calculate poison
> -  // size, so that only members declared in this class are poisoned.
> -  llvm::Value *OffsetPtr;
> -  CharUnits::QuantityType PoisonSize;
> -  ASTContext &Context = CGF.getContext();
> -
> -  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
> -  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
> -  getQuantity());
> -
> -  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
> -  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
> -
> -  PoisonSize = Layout.getSize().getQuantity() -
> -  Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
> -
>llvm::Value *Args[] = {
> -CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
> -llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
> -
> +  CGF.Builder.CreateBitCast(CGF.LoadCXXThis(), CGF.VoidPtrTy),
> +  llvm::ConstantInt::get(CGF.SizeTy, Layout.getSize().getQuantity())};
>llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
>
>llvm::FunctionType *FnType =
> @@ -1407,8 +1386,6 @@ static void EmitDtorSanitizerCallback(Co
>llvm::Value *Fn =
>CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
>
> -  // Disables tail call elimination, to prevent the current stack frame
> from
> -  // disappearing from the stack trace.
>CGF.CurFn->addFnAttr("disable-tail-calls", "true");
>CGF.EmitNounwindRuntimeCall(Fn, Args);
>  }
> @@ -1491,13 +1468,6 @@ void CodeGenFunction::EmitDestructorBody
>  // the caller's body.
>  if (getLangOpts().AppleKext)
>CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
> -
> -// Insert memory-poisoning instrumentation, before final clean ups,
> -// to ensure this class's members are protected from invalid access.
> -if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
> -&& SanOpts.has(SanitizerKind::Memory))
> -  EmitDtorSanitizerCallback(*this, Dtor);
> -
>  break;
>}
>
> @@ -1507,6 +1477,11 @@ void CodeGenFunction::EmitDestructorBody
>// Exit the try if applicable.
>if (isTryBody)
>  ExitCXXTryStmt(*cast(Body), true);
> +
> +  // Insert memory-poisoning instrumentation.
> +  if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
> +  && SanOpts.has(SanitizerKind::Memory))
> +EmitDtorSanitizerCallback(*this, Dtor);
>  }
>
>  void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList
> &Args) {
>
> Modified: cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp?rev=244820&r1=244819&r2=244820&view=diff
>
> ==
> --- cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp (original)
> +++ cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp Wed Aug 12
> 17:07:24 2015
> @@ -7,8 +7,7 @@ struct Simple {
>  Simple s;
>  // Simple internal member is poisoned by compiler-generated dtor
>  // CHECK-LABEL: define {{.*}}SimpleD1Ev
> -// CHECK-NOT: call void @__sanitizer_dtor_callback
> -// CHECK: call void {{.*}}SimpleD2Ev
> +// CHECK: call void @__sanitizer_dtor_callback
>  // CHECK-NOT: call void @__sanitizer_dtor_callback
>  // CHECK: ret void
>
> @@ -18,8 +17,7 @@ struct Inlined {
>  Inlined i;
>  // Simple internal member is poisoned by compiler-generated dtor
>  // CHECK-LABEL: define {{.*}}InlinedD1Ev
> -// CHECK-NOT: call void @__sanitizer_dtor_callback
> -// CHECK: call void {{.*}}InlinedD

Re: r220305 - Driver: Move crash report command mangling into Command::Print

2015-08-12 Thread David Blaikie via cfe-commits
(switching over to the new mailing list)

On Wed, Aug 12, 2015 at 3:09 PM, David Blaikie  wrote:

>
>
> On Tue, Oct 21, 2014 at 10:24 AM, Justin Bogner 
> wrote:
>
>> Author: bogner
>> Date: Tue Oct 21 12:24:44 2014
>> New Revision: 220305
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=220305&view=rev
>> Log:
>> Driver: Move crash report command mangling into Command::Print
>>
>> This pushes the logic for generating a crash reproduction script
>> entirely into Command::Print, instead of Command doing half of the
>> work and then relying on textual substitution for the rest. This makes
>> this logic much easier to read and will simplify fixing a couple of
>> issues in this area.
>
>
>> Modified:
>> cfe/trunk/include/clang/Driver/Job.h
>> cfe/trunk/lib/Driver/Driver.cpp
>> cfe/trunk/lib/Driver/Job.cpp
>>
>> Modified: cfe/trunk/include/clang/Driver/Job.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Job.h?rev=220305&r1=220304&r2=220305&view=diff
>>
>> ==
>> --- cfe/trunk/include/clang/Driver/Job.h (original)
>> +++ cfe/trunk/include/clang/Driver/Job.h Tue Oct 21 12:24:44 2014
>> @@ -29,6 +29,14 @@ class Tool;
>>  // Re-export this as clang::driver::ArgStringList.
>>  using llvm::opt::ArgStringList;
>>
>> +struct CrashReportInfo {
>> +  StringRef Filename;
>> +  StringRef VFSPath;
>> +
>> +  CrashReportInfo(StringRef Filename, StringRef VFSPath)
>> +  : Filename(Filename), VFSPath(VFSPath) {}
>> +};
>> +
>>  class Job {
>>  public:
>>enum JobClass {
>> @@ -52,9 +60,9 @@ public:
>>/// \param OS - The stream to print on.
>>/// \param Terminator - A string to print at the end of the line.
>>/// \param Quote - Should separate arguments be quoted.
>> -  /// \param CrashReport - Whether to print for inclusion in a crash
>> report.
>> -  virtual void Print(llvm::raw_ostream &OS, const char *Terminator,
>> - bool Quote, bool CrashReport = false) const = 0;
>> +  /// \param CrashInfo - Details for inclusion in a crash report.
>> +  virtual void Print(llvm::raw_ostream &OS, const char *Terminator, bool
>> Quote,
>> + CrashReportInfo *CrashInfo = nullptr) const = 0;
>>  };
>>
>>  /// Command - An executable path/name and argument vector to
>> @@ -102,7 +110,7 @@ public:
>>const llvm::opt::ArgStringList &_Arguments);
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
>> - bool CrashReport = false) const override;
>> + CrashReportInfo *CrashInfo = nullptr) const override;
>>
>>virtual int Execute(const StringRef **Redirects, std::string *ErrMsg,
>>bool *ExecutionFailed) const;
>> @@ -141,7 +149,7 @@ public:
>>std::unique_ptr Fallback_);
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator, bool Quote,
>> - bool CrashReport = false) const override;
>> + CrashReportInfo *CrashInfo = nullptr) const override;
>>
>>int Execute(const StringRef **Redirects, std::string *ErrMsg,
>>bool *ExecutionFailed) const override;
>> @@ -170,7 +178,7 @@ public:
>>virtual ~JobList() {}
>>
>>void Print(llvm::raw_ostream &OS, const char *Terminator,
>> - bool Quote, bool CrashReport = false) const override;
>> + bool Quote, CrashReportInfo *CrashInfo = nullptr) const
>> override;
>>
>>/// Add a job to the list (taking ownership).
>>void addJob(std::unique_ptr J) { Jobs.push_back(std::move(J)); }
>>
>> Modified: cfe/trunk/lib/Driver/Driver.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=220305&r1=220304&r2=220305&view=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Driver.cpp (original)
>> +++ cfe/trunk/lib/Driver/Driver.cpp Tue Oct 21 12:24:44 2014
>> @@ -424,10 +424,7 @@ void Driver::generateCompilationDiagnost
>>CCGenDiagnostics = true;
>>
>>// Save the original job command(s).
>> -  std::string Cmd;
>> -  llvm::raw_string_ostream OS(Cmd);
>> -  FailingCommand.Print(OS, "\n", /*Quote*/ false, /*CrashReport*/ true);
>> -  OS.flush();
>> +  Command Cmd = FailingCommand;
>>
>
> It seems this code was/is undertested, or it would've caught the bug that
> I believe was introduced here.
>
> This line of code ("Command Cmd = FailingCommand") silently slices the
> FailingCommand object into a plain Command object, even in cases where
> FailingCommand is a derived class. This means that later on when
> "Cmd.Print" is called, it only prints as a plain Command, not as an
> appropriately derived Command object.
>
> Could you add more testing here to demonstrate this bug, and perhaps
> revert to the original code or otherwise address this issue?
>
> (this came up while I was trying to enable -Wdeprecated in LLVM and it
> pointed to the call to the deprecate

r244820 - Revert "Implement poisoning of only class members in dtor, as opposed to also poisoning fields inherited from base classes."

2015-08-12 Thread Naomi Musgrave via cfe-commits
Author: nmusgrave
Date: Wed Aug 12 17:07:24 2015
New Revision: 244820

URL: http://llvm.org/viewvc/llvm-project?rev=244820&view=rev
Log:
Revert "Implement poisoning of only class members in dtor, as opposed to also 
poisoning fields inherited from base classes."

This reverts commit 8dbbf3578a9a5d063232b59e558e5fe46e2cd42c.
Rolled back due to buildbot failures on 'ninja check-clang'.

Removed:
cfe/trunk/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
cfe/trunk/test/CodeGenCXX/sanitize-dtor-fn-attribute.cpp

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=244820&r1=244819&r2=244820&view=diff
==
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Aug 12 17:07:24 2015
@@ -1376,30 +1376,9 @@ static void EmitDtorSanitizerCallback(Co
   const ASTRecordLayout &Layout =
   CGF.getContext().getASTRecordLayout(Dtor->getParent());
 
-  // Nothing to poison
-  if(Layout.getFieldCount() == 0)
-return;
-
-  // Construct pointer to region to begin poisoning, and calculate poison
-  // size, so that only members declared in this class are poisoned.
-  llvm::Value *OffsetPtr;
-  CharUnits::QuantityType PoisonSize;
-  ASTContext &Context = CGF.getContext();
-
-  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
-  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
-  getQuantity());
-
-  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
-  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
-
-  PoisonSize = Layout.getSize().getQuantity() -
-  Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
-
   llvm::Value *Args[] = {
-CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
-llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
-
+  CGF.Builder.CreateBitCast(CGF.LoadCXXThis(), CGF.VoidPtrTy),
+  llvm::ConstantInt::get(CGF.SizeTy, Layout.getSize().getQuantity())};
   llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
 
   llvm::FunctionType *FnType =
@@ -1407,8 +1386,6 @@ static void EmitDtorSanitizerCallback(Co
   llvm::Value *Fn =
   CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
 
-  // Disables tail call elimination, to prevent the current stack frame from
-  // disappearing from the stack trace.
   CGF.CurFn->addFnAttr("disable-tail-calls", "true");
   CGF.EmitNounwindRuntimeCall(Fn, Args);
 }
@@ -1491,13 +1468,6 @@ void CodeGenFunction::EmitDestructorBody
 // the caller's body.
 if (getLangOpts().AppleKext)
   CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
-
-// Insert memory-poisoning instrumentation, before final clean ups,
-// to ensure this class's members are protected from invalid access.
-if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
-&& SanOpts.has(SanitizerKind::Memory))
-  EmitDtorSanitizerCallback(*this, Dtor);
-
 break;
   }
 
@@ -1507,6 +1477,11 @@ void CodeGenFunction::EmitDestructorBody
   // Exit the try if applicable.
   if (isTryBody)
 ExitCXXTryStmt(*cast(Body), true);
+
+  // Insert memory-poisoning instrumentation.
+  if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
+  && SanOpts.has(SanitizerKind::Memory))
+EmitDtorSanitizerCallback(*this, Dtor);
 }
 
 void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList 
&Args) {

Modified: cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp?rev=244820&r1=244819&r2=244820&view=diff
==
--- cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp Wed Aug 12 17:07:24 
2015
@@ -7,8 +7,7 @@ struct Simple {
 Simple s;
 // Simple internal member is poisoned by compiler-generated dtor
 // CHECK-LABEL: define {{.*}}SimpleD1Ev
-// CHECK-NOT: call void @__sanitizer_dtor_callback
-// CHECK: call void {{.*}}SimpleD2Ev
+// CHECK: call void @__sanitizer_dtor_callback
 // CHECK-NOT: call void @__sanitizer_dtor_callback
 // CHECK: ret void
 
@@ -18,8 +17,7 @@ struct Inlined {
 Inlined i;
 // Simple internal member is poisoned by compiler-generated dtor
 // CHECK-LABEL: define {{.*}}InlinedD1Ev
-// CHECK-NOT: call void @__sanitizer_dtor_callback
-// CHECK: call void {{.*}}InlinedD2Ev
+// CHECK: call void @__sanitizer_dtor_callback
 // CHECK-NOT: call void @__sanitizer_dtor_callback
 // CHECK: ret void
 
@@ -46,8 +44,7 @@ Defaulted_Non_Trivial def_non_trivial;
 // By including a Simple member in the struct, the compiler is
 // forced to generate a non-trivial destructor.
 // CHECK-LABEL: define {{.*}}Defaulted_Non_TrivialD1Ev
-// CHECK-NOT: call void @__sa

Re: [PATCH] RE: [cfe-dev] missing return statement for non-void functions in C++

2015-08-12 Thread Richard Smith via cfe-commits
This patch seems a bit confused. You warn that the flag is ignored in C++,
but it only has an effect in C++. You have a testcase with a .c extension
that is built with -x c++.

On Wed, Aug 12, 2015 at 5:23 AM, Sjoerd Meijer 
wrote:

> [ + cfe-commits@lists.llvm.org ]
>
>
>
> Hi,
>
> The functionality is now available under a flag, see attached patch. Note
> that the flag is ignored in C++ mode, so it will help the use case of
> compiling (legacy) C code with a C++ compiler.
>
> Cheers,
>
> Sjoerd.
>
>
>
> *From:* Sjoerd Meijer [mailto:sjoerd.mei...@arm.com
> ]
> *Sent:* 03 August 2015 11:40
> *To:* 'Richard Smith'
> *Cc:* Hal Finkel; Marshall Clow; cfe-...@cs.uiuc.edu Developers; cfe
> commits
> *Subject:* RE: [PATCH] RE: [cfe-dev] missing return statement for
> non-void functions in C++
>
>
>
> Hi Richard,
>
>
>
> I agree with your conclusions and will start preparing a patch for option
> 3) under a flag that is off by default; this enables folks to build/run C
> code in C++. I actually think option 2) would be a good one too, but as it
> is already available under a flag I also don’t see how useful it is
> combining options 2) and 3) with another (or one more) flag that is off by
> default.
>
>
>
> Cheers.
>
>
>
> *From:* meta...@gmail.com [mailto:meta...@gmail.com ] *On
> Behalf Of *Richard Smith
> *Sent:* 31 July 2015 19:46
> *To:* Sjoerd Meijer
> *Cc:* Hal Finkel; Marshall Clow; cfe-...@cs.uiuc.edu Developers; cfe
> commits
> *Subject:* Re: [PATCH] RE: [cfe-dev] missing return statement for
> non-void functions in C++
>
>
>
> On Fri, Jul 31, 2015 at 7:35 AM, Sjoerd Meijer 
> wrote:
>
> Hi, I am not sure if we came to a conclusion. Please find attached a
> patch. It simply removes the two lines that insert an unreachable statement
> (which cause removal of the return statement). Please note that at -O0 the
> trap instruction is still generated. Is this something we could live with?
>
>
>
> I don't think this is an improvement:
>
>
>
> This doesn't satisfy the folks who want an 'unreachable' for better code
> size and optimization, and it doesn't satisfy the folks who want a
> guaranteed trap for security, and it doesn't satisfy the folks who want
> their broken code to limp along (because it'll still trap at -O0), and it
> is at best a minor improvement for the folks who want missing returns to be
> more easily debuggable (with -On, the code goes wrong in the caller, or
> appears to work, rather than falling into an unrelated function, and
> debugging this with -O0 was already easy).
>
>
>
> I think there are three options that are defensible here:
>
> 1) The status quo: this is UB and we treat it as such and optimize on that
> basis, but provide a trap as a convenience at -O0
>
> 2) The secure approach: this is UB but we always trap
>
> 3) Define the behavior to return 'undef' for C types: this allows
> questionable C code that has UB in C++ to keep working when built with a
> C++ compiler
>
>
>
> Note that (3) can be combined with either (1) or (2). (2) is already
> available via the 'return' sanitizer. So this really reduces to: in those
> cases where C says it's OK so long as the caller doesn't look at the
> returned value (and where the return type doesn't have a non-trivial copy
> constructor or destructor, isn't a reference, and so on), should we attempt
> to preserve the C behaviour? I would be OK with putting that behind a `-f`
> flag (perhaps `-fstrict-return` or similar) to support those folks who want
> to build C code in C++, but I would suggest having that flag be off by
> default, since that is not the usual use case for a C++ compiler.
>
>
>
> Cheers,
>
> Sjoerd.
>
>
>
> *From:* cfe-dev-boun...@cs.uiuc.edu [mailto:cfe-dev-boun...@cs.uiuc.edu] *On
> Behalf Of *Richard Smith
> *Sent:* 29 July 2015 18:07
> *To:* Hal Finkel
> *Cc:* Marshall Clow; cfe-...@cs.uiuc.edu Developers
>
>
> *Subject:* Re: [cfe-dev] missing return statement for non-void functions
> in C++
>
>
>
> On Jul 29, 2015 7:43 AM, "Hal Finkel"  wrote:
> >
> > - Original Message -
> > > From: "David Blaikie" 
> > > To: "James Molloy" 
> > > Cc: "Marshall Clow" , "cfe-dev Developers" <
> cfe-...@cs.uiuc.edu>
> > > Sent: Wednesday, July 29, 2015 9:15:09 AM
> > > Subject: Re: [cfe-dev] missing return statement for non-void functions
> in C++
> > >
> > >
> > > On Jul 29, 2015 7:06 AM, "James Molloy" < ja...@jamesmolloy.co.uk >
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > If we're going to emit a trap instruction (and thus create a broken
> > > > binary), why don't we error instead?
> > >
> > > We warn, can't error, because it may be dynamically unreached, in
> > > which case the program is valid and we can't reject it.
> >
> > I think this also explains why this is useful for optimization.
> >
> >  1. It is a code-size optimization
> >  2. By eliminating unreachable control flow, we can remove branches and
> tests that are not actual necessary
> >
> > int foo(int x) {
> >   if (x > 5) return 2*x;
> >   else if (x < 2) 

Re: [PATCH] D11993: [CUDA] Make sure we emit all templated __global__ functions on device side. Again.

2015-08-12 Thread Eli Bendersky via cfe-commits
eliben accepted this revision.
eliben added a comment.

lgtm



Comment at: test/CodeGenCUDA/ptx-kernels.cu:26
@@ -16,1 +25,2 @@
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
+// CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", 
i32 1}

It't not clear what this metadata is part of? I'm guessing llvm.used, so maybe 
make that explicit with an earlier CHECK?


http://reviews.llvm.org/D11993



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


Re: [PATCH] D11844: [Modules] More descriptive diagnostics for misplaced import directive

2015-08-12 Thread Richard Smith via cfe-commits
On Wed, Aug 12, 2015 at 12:08 AM, Sean Silva  wrote:

> silvas added a subscriber: silvas.
>
> 
> Comment at: lib/Parse/Parser.cpp:2003
> @@ +2002,3 @@
> +Diag(Tok, diag::err_unexpected_module_start);
> +// Recover by skipping content of the included submodule.
> +unsigned ModuleNesting = 1;
> 
> rsmith wrote:
> > This is liable to produce bad follow-on diagnostics; I don't think this
> is a reasonable way to recover. I can see a few feasible options here:
> >
> > 1) Emit a fatal error when this happens (suppressing further diagnostics)
> > 2) Break out to the top level of parsing and resume from there (that is,
> assume that a modular header expects to be included at the top level and
> that the user didn't screw up their module map)
> > 3) Enter the module and carry on parsing from here
> >
> > My preference would be either (1) or (2). But either way, we should
> diagnose the still-open bracketing constructs, because the problem is
> likely to be a missing close brace at the end of an unrelated header file.
> I strongly prefer (1). In all cases I have recorded in my notes when
> modularizing, the `error: expected '}'` diagnostic indicated one of two
> things:
> - that a header needed to be marked textual in the module map.
> - that a #include had to be moved to the top of the file (this case was
> likely behaving unexpectedly in the non-modules case and "happened to
> work").
> For the sake of our users, it is probably best to immediately fatal error
> and suggest an alternative (the suggestions can be a separate patch; my
> recommendations are below).
>
> I believe a user is most likely to run into this diagnostic when
> developing an initial set of module maps, so our diagnostic should be
> tailored to that audience.


I think your observations may be biased by your current experiences
modularizing existing code, and not representative of the complete
development cycle. Modularization is a one-time effort; maintaining the
code after modularization is a continuous process. I think it's *far* more
likely that a header listed in your module map was expected to be modular,
and that a brace mismatch within that file is unintentional and due to a
missing brace somewhere.

However, we should aim to provide diagnostics that are helpful for either
case.

These users may have little experience with modules when they encounter
> this diagnostic, so a notes suggesting a likely remedy helps them develop
> confidence by providing authoritative advice (and avoiding a round trip to
> the documentation).
>
> My fine-grained recommendations from experience are:
> - #include inside extern "C": always meant to be modular, always the fix
> is to move it out of the braced block.
> - #include inside namespace: always meant to be modular, always the fix is
> to move it out of the braced block.
> - #include inside class: always textual (e.g. bringing in methods like
> TableGen .inc files; sometimes similar ".inc" files are manually written
> and not autogenerated. I have observed e.g. "classfoo_methods.h" files;
> another instance of this is stamping out ".def" files)
> - #include inside array initializer: always textual. Typically ".def" files
> - #include inside function: always textual. Typically ".def" files (e.g.
> generate a switch)
>
> ".inl" files are theoretically a problem inside namespaces, but I have not
> observed this issue in practice. In my experience code taking the effort to
> have ".inl" files is quite clean and avoids such textual dependencies. The
> issues I have seen in practice with ".inl" files usually end up coming out
> through a different part of clang. Improving that is for a separate patch
> though.
>
>
> http://reviews.llvm.org/D11844
>
>
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244819 - Implement poisoning of only class members in dtor, as opposed to also poisoning fields inherited from base classes.

2015-08-12 Thread Naomi Musgrave via cfe-commits
Author: nmusgrave
Date: Wed Aug 12 16:37:40 2015
New Revision: 244819

URL: http://llvm.org/viewvc/llvm-project?rev=244819&view=rev
Log:
Implement poisoning of only class members in dtor, as opposed to also poisoning 
fields inherited from base classes.
Verify emitted code for derived class with virtual destructor sanitizes its 
members only once.
Changed emission order for dtor callback, so only the last dtor for a class 
emits the sanitizing callback, while ensuring that class members are poisoned 
before base class destructors are invoked.
Skip poisoning of members, if class has no fields.
Removed patch file containing extraneous changes.

Summary: Poisoning applied to only class members, and before dtors for base 
class invoked

Reviewers: eugenis, kcc

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

Added:
cfe/trunk/test/CodeGenCXX/sanitize-dtor-derived-class.cpp
Modified:
cfe/trunk/lib/CodeGen/CGClass.cpp
cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
cfe/trunk/test/CodeGenCXX/sanitize-dtor-fn-attribute.cpp

Modified: cfe/trunk/lib/CodeGen/CGClass.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGClass.cpp?rev=244819&r1=244818&r2=244819&view=diff
==
--- cfe/trunk/lib/CodeGen/CGClass.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGClass.cpp Wed Aug 12 16:37:40 2015
@@ -1376,9 +1376,30 @@ static void EmitDtorSanitizerCallback(Co
   const ASTRecordLayout &Layout =
   CGF.getContext().getASTRecordLayout(Dtor->getParent());
 
+  // Nothing to poison
+  if(Layout.getFieldCount() == 0)
+return;
+
+  // Construct pointer to region to begin poisoning, and calculate poison
+  // size, so that only members declared in this class are poisoned.
+  llvm::Value *OffsetPtr;
+  CharUnits::QuantityType PoisonSize;
+  ASTContext &Context = CGF.getContext();
+
+  llvm::ConstantInt *OffsetSizePtr = llvm::ConstantInt::get(
+  CGF.SizeTy, Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).
+  getQuantity());
+
+  OffsetPtr = CGF.Builder.CreateGEP(CGF.Builder.CreateBitCast(
+  CGF.LoadCXXThis(), CGF.Int8PtrTy), OffsetSizePtr);
+
+  PoisonSize = Layout.getSize().getQuantity() -
+  Context.toCharUnitsFromBits(Layout.getFieldOffset(0)).getQuantity();
+
   llvm::Value *Args[] = {
-  CGF.Builder.CreateBitCast(CGF.LoadCXXThis(), CGF.VoidPtrTy),
-  llvm::ConstantInt::get(CGF.SizeTy, Layout.getSize().getQuantity())};
+CGF.Builder.CreateBitCast(OffsetPtr, CGF.VoidPtrTy),
+llvm::ConstantInt::get(CGF.SizeTy, PoisonSize)};
+
   llvm::Type *ArgTypes[] = {CGF.VoidPtrTy, CGF.SizeTy};
 
   llvm::FunctionType *FnType =
@@ -1386,6 +1407,8 @@ static void EmitDtorSanitizerCallback(Co
   llvm::Value *Fn =
   CGF.CGM.CreateRuntimeFunction(FnType, "__sanitizer_dtor_callback");
 
+  // Disables tail call elimination, to prevent the current stack frame from
+  // disappearing from the stack trace.
   CGF.CurFn->addFnAttr("disable-tail-calls", "true");
   CGF.EmitNounwindRuntimeCall(Fn, Args);
 }
@@ -1468,6 +1491,13 @@ void CodeGenFunction::EmitDestructorBody
 // the caller's body.
 if (getLangOpts().AppleKext)
   CurFn->addFnAttr(llvm::Attribute::AlwaysInline);
+
+// Insert memory-poisoning instrumentation, before final clean ups,
+// to ensure this class's members are protected from invalid access.
+if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
+&& SanOpts.has(SanitizerKind::Memory))
+  EmitDtorSanitizerCallback(*this, Dtor);
+
 break;
   }
 
@@ -1477,11 +1507,6 @@ void CodeGenFunction::EmitDestructorBody
   // Exit the try if applicable.
   if (isTryBody)
 ExitCXXTryStmt(*cast(Body), true);
-
-  // Insert memory-poisoning instrumentation.
-  if (CGM.getCodeGenOpts().SanitizeMemoryUseAfterDtor
-  && SanOpts.has(SanitizerKind::Memory))
-EmitDtorSanitizerCallback(*this, Dtor);
 }
 
 void CodeGenFunction::emitImplicitAssignmentOperatorBody(FunctionArgList 
&Args) {

Modified: cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp?rev=244819&r1=244818&r2=244819&view=diff
==
--- cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp (original)
+++ cfe/trunk/test/CodeGenCXX/sanitize-dtor-callback.cpp Wed Aug 12 16:37:40 
2015
@@ -7,7 +7,8 @@ struct Simple {
 Simple s;
 // Simple internal member is poisoned by compiler-generated dtor
 // CHECK-LABEL: define {{.*}}SimpleD1Ev
-// CHECK: call void @__sanitizer_dtor_callback
+// CHECK-NOT: call void @__sanitizer_dtor_callback
+// CHECK: call void {{.*}}SimpleD2Ev
 // CHECK-NOT: call void @__sanitizer_dtor_callback
 // CHECK: ret void
 
@@ -17,7 +18,8 @@ struct Inlined {
 Inlined i;
 // Simple internal member is poisoned by compiler-generated dtor
 // CHECK-LABEL: define {{.*}}InlinedD1Ev
-// CHECK: call void @__sanitizer_dt

Re: [PATCH] D11993: [CUDA] Make sure we emit all templated __global__ functions on device side. Again.

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

LGTM. Thanks for working on this.

-eric


http://reviews.llvm.org/D11993



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


[PATCH] D11993: [CUDA] Make sure we emit all templated __global__ functions on device side. Again.

2015-08-12 Thread Artem Belevich via cfe-commits
tra created this revision.
tra added reviewers: echristo, rsmith, eliben.
tra added a subscriber: cfe-commits.

This is a somewhat different way to do it than D11666 which got rolled back.

Codegen postpones emitting instantiated kernel function template until it's 
used.
If kernel is used only from the host side (which is normally the case) we'll 
never emit 
it because on device side we don't emit the host code that uses it.

The change allows CUDA kernels to be emitted on device side unconditionally.
It's overly conservative and may emit more functions than we really need, but 
it 
guarantees that the kernels launched from the host side are do exist on 
device-side.
In case it ever causes issues, there are other ways to address the issue, 
though they are more invasive and are currently not worth the trouble.

http://reviews.llvm.org/D11993

Files:
  lib/AST/ASTContext.cpp
  test/CodeGenCUDA/ptx-kernels.cu

Index: test/CodeGenCUDA/ptx-kernels.cu
===
--- test/CodeGenCUDA/ptx-kernels.cu
+++ test/CodeGenCUDA/ptx-kernels.cu
@@ -1,3 +1,7 @@
+// Make sure that __global__ functions are emitted along with correct
+// annotations and are added to @llvm.used to prevent their elimination.
+// REQUIRES: nvptx-registered-target
+//
 // RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device 
-emit-llvm -o - | FileCheck %s
 
 #include "Inputs/cuda.h"
@@ -13,4 +17,10 @@
   device_function();
 }
 
+// Make sure host-instantiated kernels are preserved on device side.
+template  __global__ void templated_kernel(T param) {}
+// CHECK-LABEL: define linkonce_odr void @_Z16templated_kernelIiEvT_
+void host_function() { templated_kernel<<<0,0>>>(0); }
+
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
+// CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", 
i32 1}
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -8336,7 +8336,19 @@
 // Constructors and destructors are required.
 if (FD->hasAttr() || FD->hasAttr())
   return true;
-
+
+// Force all CUDA kernels to be emitted on device side.
+// Otherwise, templated kernels may never be emitted as they are
+// only used from host-side code which we never emit on device
+// side and which therefore would never trigger us to emit
+// device-side kernel it might've instantiated. The trade-off is
+// that emitting all kernels is over-conservative and we may emit
+// more of them than necessary. If excess of generated GPU code
+// becomes a problem we can revisit this.
+if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
+FD->hasAttr())
+  return true;
+
 // The key function for a class is required.  This rule only comes
 // into play when inline functions can be key functions, though.
 if (getTargetInfo().getCXXABI().canKeyFunctionBeInline()) {


Index: test/CodeGenCUDA/ptx-kernels.cu
===
--- test/CodeGenCUDA/ptx-kernels.cu
+++ test/CodeGenCUDA/ptx-kernels.cu
@@ -1,3 +1,7 @@
+// Make sure that __global__ functions are emitted along with correct
+// annotations and are added to @llvm.used to prevent their elimination.
+// REQUIRES: nvptx-registered-target
+//
 // RUN: %clang_cc1 %s -triple nvptx-unknown-unknown -fcuda-is-device -emit-llvm -o - | FileCheck %s
 
 #include "Inputs/cuda.h"
@@ -13,4 +17,10 @@
   device_function();
 }
 
+// Make sure host-instantiated kernels are preserved on device side.
+template  __global__ void templated_kernel(T param) {}
+// CHECK-LABEL: define linkonce_odr void @_Z16templated_kernelIiEvT_
+void host_function() { templated_kernel<<<0,0>>>(0); }
+
 // CHECK: !{{[0-9]+}} = !{void ()* @global_function, !"kernel", i32 1}
+// CHECK: !{{[0-9]+}} = !{void (i32)* @_Z16templated_kernelIiEvT_, !"kernel", i32 1}
Index: lib/AST/ASTContext.cpp
===
--- lib/AST/ASTContext.cpp
+++ lib/AST/ASTContext.cpp
@@ -8336,7 +8336,19 @@
 // Constructors and destructors are required.
 if (FD->hasAttr() || FD->hasAttr())
   return true;
-
+
+// Force all CUDA kernels to be emitted on device side.
+// Otherwise, templated kernels may never be emitted as they are
+// only used from host-side code which we never emit on device
+// side and which therefore would never trigger us to emit
+// device-side kernel it might've instantiated. The trade-off is
+// that emitting all kernels is over-conservative and we may emit
+// more of them than necessary. If excess of generated GPU code
+// becomes a problem we can revisit this.
+if (getLangOpts().CUDA && getLangOpts().CUDAIsDevice &&
+FD->hasAttr())
+  return true;
+
 // The key function for a class is required.  This rule only comes
 // in

Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Richard Smith via cfe-commits
rsmith added a subscriber: rsmith.
rsmith added a comment.

LGTM


http://reviews.llvm.org/D11968



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


Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Ivan Krasin via cfe-commits
krasin updated this revision to Diff 31983.
krasin added a comment.

More tests / fix tests.


http://reviews.llvm.org/D11968

Files:
  include/clang/Frontend/DependencyOutputOptions.h
  include/clang/Frontend/Utils.h
  lib/Frontend/CompilerInstance.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/DependencyFile.cpp
  lib/Frontend/HeaderIncludeGen.cpp
  test/Frontend/dependency-gen.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
@@ -13,4 +13,12 @@
 // MS: Note: including file:  {{.*test2.h}}
 // 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: FileCheck --check-prefix=MS-BLACKLIST < %t.stdout %s
+// MS-BLACKLIST: Note: including file: {{.*\.blacklist}}
+// MS-BLACKLIST: Note: including file: {{.*test.h}}
+// MS-BLACKLIST: Note: including file:  {{.*test2.h}}
+// MS-BLACKLIST-NOT: Note
+
 #include "Inputs/test.h"
Index: test/Frontend/dependency-gen.c
===
--- test/Frontend/dependency-gen.c
+++ test/Frontend/dependency-gen.c
@@ -20,7 +20,16 @@
 // RUN: cd a/b
 // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s
 // CHECK-SIX: {{ }}x.h
-
+// RUN: echo "fun:foo" > %t.blacklist
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=cfi-vcall -flto -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s
+// CHECK-SEVEN: .blacklist
+// CHECK-SEVEN: {{ }}x.h
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . | FileCheck -check-prefix=CHECK-EIGHT %s
+// CHECK-EIGHT: asan_blacklist.txt
+// CHECK-EIGHT: {{ }}x.h
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . -fno-sanitize-blacklist | FileCheck -check-prefix=CHECK-NINE %s
+// CHECK-NINE-NOT: asan_blacklist.txt
+// CHECK-NINE: {{ }}x.h
 #ifndef INCLUDE_FLAG_TEST
 #include 
 #endif
Index: lib/Frontend/HeaderIncludeGen.cpp
===
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -46,7 +46,36 @@
 };
 }
 
-void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
+static void PrintHeaderInfo(raw_ostream *OutputFile, const char* Filename,
+bool ShowDepth, unsigned CurrentIncludeDepth,
+bool MSStyle) {
+// Write to a temporary string to avoid unnecessary flushing on errs().
+SmallString<512> Pathname(Filename);
+if (!MSStyle)
+  Lexer::Stringify(Pathname);
+
+SmallString<256> Msg;
+if (MSStyle)
+  Msg += "Note: including file:";
+
+if (ShowDepth) {
+  // The main source file is at depth 1, so skip one dot.
+  for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
+Msg += MSStyle ? ' ' : '.';
+
+  if (!MSStyle)
+Msg += ' ';
+}
+Msg += Pathname;
+Msg += '\n';
+
+OutputFile->write(Msg.data(), Msg.size());
+OutputFile->flush();
+}
+
+void clang::AttachHeaderIncludeGen(Preprocessor &PP,
+   const std::vector &ExtraHeaders,
+   bool ShowAllHeaders,
StringRef OutputPath, bool ShowDepth,
bool MSStyle) {
   raw_ostream *OutputFile = MSStyle ? &llvm::outs() : &llvm::errs();
@@ -69,6 +98,14 @@
 }
   }
 
+  // Print header info for extra headers, pretending they were discovered
+  // by the regular preprocessor. The primary use case is to support
+  // proper generation of Make / Ninja file dependencies for implicit includes,
+  // such as sanitizer blacklists. It's only important for cl.exe
+  // compatibility, the GNU way to generate rules is -M / -MM / -MD / -MMD.
+  for (auto Header : ExtraHeaders) {
+PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle);
+  }
   PP.addPPCallbacks(llvm::make_unique(&PP,
   ShowAllHeaders,
   OutputFile,
@@ -112,27 +149,7 @@
   // Dump the header include information we are past the predefines buffer or
   // are showing all headers.
   if (ShowHeader && Reason == PPCallbacks::EnterFile) {
-// Write to a temporary string to avoid unnecessary flushing on errs().
-SmallString<512> Filename(UserLoc.getFilename());
-if (!MSStyle)
-  Lexer::Stringify(Filename);
-
-SmallString<256> Msg;
-if (MSStyle)
-  Msg += "Note: including file:";
-
-if (ShowDepth) {
-  // The main source file is at depth 1, so skip one dot.
-  for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
-Msg += MSStyle ? ' ' : '.';
-
-  if (!MSSt

Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Ivan Krasin via cfe-commits
krasin marked an inline comment as done.
krasin added a comment.

Please, take another look. The test for --show-includes is on the way.


http://reviews.llvm.org/D11968



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


Re: [PATCH] D11968: Add sanitizer blacklists to the rules generated with -M/-MM/-MD/-MMD.

2015-08-12 Thread Ivan Krasin via cfe-commits
krasin updated this revision to Diff 31979.
krasin added a comment.

Windows compat


http://reviews.llvm.org/D11968

Files:
  include/clang/Frontend/DependencyOutputOptions.h
  include/clang/Frontend/Utils.h
  lib/Frontend/CompilerInstance.cpp
  lib/Frontend/CompilerInvocation.cpp
  lib/Frontend/DependencyFile.cpp
  lib/Frontend/HeaderIncludeGen.cpp
  test/Frontend/dependency-gen.c

Index: test/Frontend/dependency-gen.c
===
--- test/Frontend/dependency-gen.c
+++ test/Frontend/dependency-gen.c
@@ -20,7 +20,16 @@
 // RUN: cd a/b
 // RUN: %clang -MD -MF - %s -fsyntax-only -I ./ | FileCheck -check-prefix=CHECK-SIX %s
 // CHECK-SIX: {{ }}x.h
-
+// RUN: echo "fun:foo" > %t.blacklist
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=cfi-vcall -flto -fsanitize-blacklist=%t.blacklist -I ./ | FileCheck -check-prefix=CHECK-SEVEN %s
+// CHECK-SEVEN: {{ }}x.h
+// CHECK-SEVEN: .blacklist
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . | FileCheck -check-prefix=CHECK-EIGHT %s
+// CHECK-EIGHT: {{ }}x.h
+// CHECK-EIGHT: asan_blacklist.txt
+// RUN: %clang -MD -MF - %s -fsyntax-only -fsanitize=address -flto -I . -fno-sanitize-blacklist | FileCheck -check-prefix=CHECK-NINE %s
+// CHECK-NINE: {{ }}x.h
+// CHECK-NINE-NOT: asan_blacklist.txt
 #ifndef INCLUDE_FLAG_TEST
 #include 
 #endif
Index: lib/Frontend/HeaderIncludeGen.cpp
===
--- lib/Frontend/HeaderIncludeGen.cpp
+++ lib/Frontend/HeaderIncludeGen.cpp
@@ -46,7 +46,36 @@
 };
 }
 
-void clang::AttachHeaderIncludeGen(Preprocessor &PP, bool ShowAllHeaders,
+static void PrintHeaderInfo(raw_ostream *OutputFile, const char* Filename,
+bool ShowDepth, unsigned CurrentIncludeDepth,
+bool MSStyle) {
+// Write to a temporary string to avoid unnecessary flushing on errs().
+SmallString<512> Pathname(Filename);
+if (!MSStyle)
+  Lexer::Stringify(Pathname);
+
+SmallString<256> Msg;
+if (MSStyle)
+  Msg += "Note: including file:";
+
+if (ShowDepth) {
+  // The main source file is at depth 1, so skip one dot.
+  for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
+Msg += MSStyle ? ' ' : '.';
+
+  if (!MSStyle)
+Msg += ' ';
+}
+Msg += Pathname;
+Msg += '\n';
+
+OutputFile->write(Msg.data(), Msg.size());
+OutputFile->flush();
+}
+
+void clang::AttachHeaderIncludeGen(Preprocessor &PP,
+   const std::vector &ExtraHeaders,
+   bool ShowAllHeaders,
StringRef OutputPath, bool ShowDepth,
bool MSStyle) {
   raw_ostream *OutputFile = MSStyle ? &llvm::outs() : &llvm::errs();
@@ -69,6 +98,14 @@
 }
   }
 
+  // Print header info for extra headers, pretending they were discovered
+  // by the regular preprocessor. The primary use case is to support
+  // proper generation of Make / Ninja file dependencies for implicit includes,
+  // such as sanitizer blacklists. It's only important for cl.exe
+  // compatibility, the GNU way to generate rules is -M / -MM / -MD / -MMD.
+  for (auto Header : ExtraHeaders) {
+PrintHeaderInfo(OutputFile, Header.c_str(), ShowDepth, 2, MSStyle);
+  }
   PP.addPPCallbacks(llvm::make_unique(&PP,
   ShowAllHeaders,
   OutputFile,
@@ -112,27 +149,7 @@
   // Dump the header include information we are past the predefines buffer or
   // are showing all headers.
   if (ShowHeader && Reason == PPCallbacks::EnterFile) {
-// Write to a temporary string to avoid unnecessary flushing on errs().
-SmallString<512> Filename(UserLoc.getFilename());
-if (!MSStyle)
-  Lexer::Stringify(Filename);
-
-SmallString<256> Msg;
-if (MSStyle)
-  Msg += "Note: including file:";
-
-if (ShowDepth) {
-  // The main source file is at depth 1, so skip one dot.
-  for (unsigned i = 1; i != CurrentIncludeDepth; ++i)
-Msg += MSStyle ? ' ' : '.';
-
-  if (!MSStyle)
-Msg += ' ';
-}
-Msg += Filename;
-Msg += '\n';
-
-OutputFile->write(Msg.data(), Msg.size());
-OutputFile->flush();
+PrintHeaderInfo(OutputFile, UserLoc.getFilename(),
+ShowDepth, CurrentIncludeDepth, MSStyle);
   }
 }
Index: lib/Frontend/DependencyFile.cpp
===
--- lib/Frontend/DependencyFile.cpp
+++ lib/Frontend/DependencyFile.cpp
@@ -182,7 +182,11 @@
   AddMissingHeaderDeps(Opts.AddMissingHeaderDeps),
   SeenMissingHeader(false),
   IncludeModuleFiles(Opts.IncludeModuleFiles),
-  OutputFormat(Opts.OutputFormat) {}
+  OutputFormat(Opts.OutputFormat) {
+for (auto ExtraDep : Opts.ExtraDeps) {
+  AddFilename(Extra

[PATCH] D11991: Represent 2 parallel string arrays as one string[][2] array.

2015-08-12 Thread Douglas Katzman via cfe-commits
dougk created this revision.
dougk added a reviewer: chandlerc.
dougk added a subscriber: cfe-commits.

I think this conveys the intent better. Alternatively, since it's effectively 
trying to take llvm::sys::path::parent_path() for a number of times determined 
by the occurrences of '/' in one string, we could just do that without storing 
the string of dot-dot-slashes although syntactic processing of pathnames is not 
quite the same as semantic processing (via the actual filesystem).

http://reviews.llvm.org/D11991

Files:
  lib/Driver/ToolChains.cpp

Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1914,34 +1914,33 @@
   llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
   // There are various different suffixes involving the triple we
   // check for. We also record what is necessary to walk from each back
-  // up to the lib directory.
-  const std::string LibSuffixes[] = {
-  "/gcc/" + CandidateTriple.str(),
+  // up to the lib directory. Specifically, the number of "up" steps
+  // in the second half of each row is 1 + the number of path separators
+  // in the first half.
+  const std::string LibAndInstallSuffixes[][2] = {
+  {"/gcc/" + CandidateTriple.str(), "/../../.."},
+
   // Debian puts cross-compilers in gcc-cross
-  "/gcc-cross/" + CandidateTriple.str(),
-  "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
+  {"/gcc-cross/" + CandidateTriple.str(), "/../../.."},
+
+  {"/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
+   "/../../../.."},
 
   // The Freescale PPC SDK has the gcc libraries in
   // /usr/lib//x.y.z so have a look there as well.
-  "/" + CandidateTriple.str(),
+  {"/" + CandidateTriple.str(), "/../.."},
 
   // Ubuntu has a strange mis-matched pair of triples that this happens to
   // match.
   // FIXME: It may be worthwhile to generalize this and look for a second
   // triple.
-  "/i386-linux-gnu/gcc/" + CandidateTriple.str()};
-  const std::string InstallSuffixes[] = {
-  "/../../..",// gcc/
-  "/../../..",// gcc-cross/
-  "/../../../..", // /gcc/
-  "/../..",   // /
-  "/../../../.."  // i386-linux-gnu/gcc//
-  };
+  {"/i386-linux-gnu/gcc/" + CandidateTriple.str(), "/../../../.."}};
+
   // Only look at the final, weird Ubuntu suffix for i386-linux-gnu.
-  const unsigned NumLibSuffixes =
-  (llvm::array_lengthof(LibSuffixes) - (TargetArch != llvm::Triple::x86));
+  const unsigned NumLibSuffixes = (llvm::array_lengthof(LibAndInstallSuffixes) 
-
+   (TargetArch != llvm::Triple::x86));
   for (unsigned i = 0; i < NumLibSuffixes; ++i) {
-StringRef LibSuffix = LibSuffixes[i];
+StringRef LibSuffix = LibAndInstallSuffixes[i][0];
 std::error_code EC;
 for (llvm::sys::fs::directory_iterator LI(LibDir + LibSuffix, EC), LE;
  !EC && LI != LE; LI = LI.increment(EC)) {
@@ -1975,8 +1974,9 @@
   // FIXME: We hack together the directory name here instead of
   // using LI to ensure stable path separators across Windows and
   // Linux.
-  GCCInstallPath = LibDir + LibSuffixes[i] + "/" + VersionText.str();
-  GCCParentLibPath = GCCInstallPath + InstallSuffixes[i];
+  GCCInstallPath =
+  LibDir + LibAndInstallSuffixes[i][0] + "/" + VersionText.str();
+  GCCParentLibPath = GCCInstallPath + LibAndInstallSuffixes[i][1];
   IsValid = true;
 }
   }


Index: lib/Driver/ToolChains.cpp
===
--- lib/Driver/ToolChains.cpp
+++ lib/Driver/ToolChains.cpp
@@ -1914,34 +1914,33 @@
   llvm::Triple::ArchType TargetArch = TargetTriple.getArch();
   // There are various different suffixes involving the triple we
   // check for. We also record what is necessary to walk from each back
-  // up to the lib directory.
-  const std::string LibSuffixes[] = {
-  "/gcc/" + CandidateTriple.str(),
+  // up to the lib directory. Specifically, the number of "up" steps
+  // in the second half of each row is 1 + the number of path separators
+  // in the first half.
+  const std::string LibAndInstallSuffixes[][2] = {
+  {"/gcc/" + CandidateTriple.str(), "/../../.."},
+
   // Debian puts cross-compilers in gcc-cross
-  "/gcc-cross/" + CandidateTriple.str(),
-  "/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
+  {"/gcc-cross/" + CandidateTriple.str(), "/../../.."},
+
+  {"/" + CandidateTriple.str() + "/gcc/" + CandidateTriple.str(),
+   "/../../../.."},
 
   // The Freescale PPC SDK has the gcc libraries in
   // /usr/lib//x.y.z so have a look there as well.
-  "/" + CandidateTriple.str(),
+  {"/" + CandidateTriple.str(), "/../.."},
 
   // Ubuntu has a strange mis-matched pair of triples that this happens to
   // match.
   // FIXME: I

Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-12 Thread Nico Weber via cfe-commits
On Wed, Aug 12, 2015 at 11:16 AM, David Blaikie  wrote:

>
>
> On Wed, Aug 12, 2015 at 11:12 AM, Nico Weber  wrote:
>
>> On Wed, Aug 12, 2015 at 11:06 AM, David Blaikie 
>> wrote:
>>
>>>
>>>
>>> On Wed, Aug 12, 2015 at 10:11 AM, Nico Weber 
>>> wrote:
>>>
 On Tue, Aug 11, 2015 at 10:15 PM, Daniel Marjamäki <
 daniel.marjam...@evidente.se> wrote:

>
> ideally there should be no -Wunused-parameter compiler warning when
> the parameter is used.
>
> would it feel better to move the "FP" warnings about virtual
> functions, for instance to clang-tidy?
>
> > If you enable this warning, you probably want to know about unused
> parameters, independent of if your function is virtual or not, no?
>
> imho there are some compiler warnings that are too noisy. I don't like
> to get a warning when there is obviously no bug:
>
> sign compare:
>   if the signed value is obviously not negative then there is no bug:
> signed x;  .. if (x>10 && x < s.size())
> unused parameter:
>   could check in the current translation unit if the parameter is used
> in an overloaded method.
>

 It doesn't warn about the presence of the parameter, but about the
 presence of the name. If you say f(int, int) instead of f(int a, int b)
 then the warning won't fire.

>>>
>>>
 (And if you don't like this warning, then don't enable it.)

>>>
>>> This isn't usually the approach we take with Clang's warnings - we try
>>> to remove false positives (where "false positive" is usually defined as
>>> "diagnoses something which is not a bug" (where bug is defined as "the
>>> resulting program behaves in a way that the user doesn't intend/expect"))
>>> where practical.
>>>
>>
>> Sure, for warnings that are supposed to find bugs. The -Wunused warnings
>> warn about stuff that's unused, not bugs.
>>
>
> Seems a reasonable analog here, though, would be that a true positive for
> -Wunused is when the thing really is unused and should be removed.
> Commenting out the variable name is the suppression mechanism to workaround
> false positives.
>

I disagree with this assessment. The warning warns about unused parameter
names. So this is a true positive.


> If there's a targetable subset of cases where the s/n is low enough, it
> could be reasonable to suppress the warning in that subset, I think.
>
> (see improvements to -Wunreachable-code to suppress cases that are
> unreachable in this build (sizeof(int) == 4 conditions, macros, etc), or
> represent valid defensive programming (default in a covered enum switch) to
> make the diagnostic more useful/less noisy)
>
>
>>
>>
>>>
>>> If the subset of cases where this warning fires on parameters to virtual
>>> functions produces more noise (if a significant % of cases just result in
>>> commenting out the parameter name rather than removing the parameter) than
>>> signal, it's certainly within the realm of discussion that we have about
>>> whether that subset of cases is worth keeping in the warning.
>>>
>>> - David
>>>
>>>


> constructor initialization order:
>   should not warn if the order obviously does not matter. for instance
> initialization order of pod variables using constants.
> etc
>
> Best regards,
> Daniel Marjamäki
>
>
> ..
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile: +46 (0)709 12 42 62
> E-mail: daniel.marjam...@evidente.se
>
> www.evidente.se
>
> 
> Från: tha...@google.com [tha...@google.com] för Nico Weber [
> tha...@chromium.org]
> Skickat: den 11 augusti 2015 20:50
> Till: David Blaikie
> Kopia: reviews+d11940+public+578c1335b27aa...@reviews.llvm.org;
> Daniel Marjamäki; cfe-commits@lists.llvm.org
> Ämne: Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual
> method or method that overrides base class method
>
> On Tue, Aug 11, 2015 at 11:32 AM, David Blaikie  > wrote:
>
>
> On Tue, Aug 11, 2015 at 8:46 AM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> Can't you just change your signature to
>
>   virtual void a(int /* x */) {}
>
> in these cases?
>
> You could - does it add much value to do that, though?
>
> If you enable this warning, you probably want to know about unused
> parameters, independent of if your function is virtual or not, no?
>
> (perhaps it does - it means you express the intent that the parameter
> is not used and the compiler helps you check that (so that for the
> parameters you think /should/ be used (you haven't

r244802 - Switching from an explicit loop to DeleteContainerSeconds; NFC.

2015-08-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 12 15:05:18 2015
New Revision: 244802

URL: http://llvm.org/viewvc/llvm-project?rev=244802&view=rev
Log:
Switching from an explicit loop to DeleteContainerSeconds; NFC.

Modified:
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244802&r1=244801&r2=244802&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 15:05:18 2015
@@ -15,6 +15,7 @@
 #include "clang/ASTMatchers/Dynamic/Registry.h"
 #include "Marshallers.h"
 #include "clang/ASTMatchers/ASTMatchers.h"
+#include "llvm/ADT/STLExtras.h"
 #include "llvm/ADT/StringMap.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/Support/ManagedStatic.h"
@@ -358,8 +359,7 @@ RegistryMaps::RegistryMaps() {
 }
 
 RegistryMaps::~RegistryMaps() {
-  for (auto &E : Constructors)
-delete E.getValue();
+  llvm::DeleteContainerSeconds(Constructors);
 }
 
 static llvm::ManagedStatic RegistryData;


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


Re: r244792 - RangRangify some more for loops; NFC.

2015-08-12 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 1:03 PM, Aaron Ballman 
wrote:

> On Wed, Aug 12, 2015 at 3:37 PM, David Blaikie  wrote:
> >
> >
> > On Wed, Aug 12, 2015 at 12:00 PM, Aaron Ballman via cfe-commits
> >  wrote:
> >>
> >> Author: aaronballman
> >> Date: Wed Aug 12 14:00:39 2015
> >> New Revision: 244792
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=244792&view=rev
> >> Log:
> >> RangRangify some more for loops; NFC.
> >>
> >> Modified:
> >> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> >>
> >> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> >> URL:
> >>
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff
> >>
> >>
> ==
> >> --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
> >> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 14:00:39
> >> 2015
> >> @@ -358,11 +358,8 @@ RegistryMaps::RegistryMaps() {
> >>  }
> >>
> >>  RegistryMaps::~RegistryMaps() {
> >> -  for (ConstructorMap::iterator it = Constructors.begin(),
> >> -end = Constructors.end();
> >> -   it != end; ++it) {
> >> -delete it->second;
> >> -  }
> >> +  for (auto &E : Constructors)
> >> +delete E.getValue();
> >
> >
> > This looks like "DeleteContainerSeconds" (but even better if they could
> be
> > switched to unique_ptr)
>
> Ooh, I will switch to that. I tried to unique_ptr'ify the code, but
> it's... complicated.
>

:(


>
> ~Aaron
>
> >
> >>
> >>  }
> >>
> >>  static llvm::ManagedStatic RegistryData;
> >> @@ -433,12 +430,13 @@ Registry::getMatcherCompletions(ArrayRef
> >>std::vector Completions;
> >>
> >>// Search the registry for acceptable matchers.
> >> -  for (ConstructorMap::const_iterator I =
> >> RegistryData->constructors().begin(),
> >> -  E =
> >> RegistryData->constructors().end();
> >> -   I != E; ++I) {
> >> +  for (const auto &M : RegistryData->constructors()) {
> >> +const auto *Matcher = M.getValue();
> >> +StringRef Name = M.getKey();
> >> +
> >>  std::set RetKinds;
> >> -unsigned NumArgs = I->second->isVariadic() ? 1 :
> >> I->second->getNumArgs();
> >> -bool IsPolymorphic = I->second->isPolymorphic();
> >> +unsigned NumArgs = Matcher->isVariadic() ? 1 :
> Matcher->getNumArgs();
> >> +bool IsPolymorphic = Matcher->isPolymorphic();
> >>  std::vector> ArgsKinds(NumArgs);
> >>  unsigned MaxSpecificity = 0;
> >>  for (const ArgKind& Kind : AcceptedTypes) {
> >> @@ -446,13 +444,13 @@ Registry::getMatcherCompletions(ArrayRef
> >>  continue;
> >>unsigned Specificity;
> >>ASTNodeKind LeastDerivedKind;
> >> -  if (I->second->isConvertibleTo(Kind.getMatcherKind(),
> &Specificity,
> >> - &LeastDerivedKind)) {
> >> +  if (Matcher->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
> >> +   &LeastDerivedKind)) {
> >>  if (MaxSpecificity < Specificity)
> >>MaxSpecificity = Specificity;
> >>  RetKinds.insert(LeastDerivedKind);
> >>  for (unsigned Arg = 0; Arg != NumArgs; ++Arg)
> >> -  I->second->getArgKinds(Kind.getMatcherKind(), Arg,
> >> ArgsKinds[Arg]);
> >> +  Matcher->getArgKinds(Kind.getMatcherKind(), Arg,
> >> ArgsKinds[Arg]);
> >>  if (IsPolymorphic)
> >>break;
> >>}
> >> @@ -463,9 +461,9 @@ Registry::getMatcherCompletions(ArrayRef
> >>llvm::raw_string_ostream OS(Decl);
> >>
> >>if (IsPolymorphic) {
> >> -OS << "Matcher " << I->first() << "(Matcher";
> >> +OS << "Matcher " << Name << "(Matcher";
> >>} else {
> >> -OS << "Matcher<" << RetKinds << "> " << I->first() << "(";
> >> +OS << "Matcher<" << RetKinds << "> " << Name << "(";
> >>  for (const std::vector &Arg : ArgsKinds) {
> >>if (&Arg != &ArgsKinds[0])
> >>  OS << ", ";
> >> @@ -488,11 +486,11 @@ Registry::getMatcherCompletions(ArrayRef
> >>}
> >>  }
> >>}
> >> -  if (I->second->isVariadic())
> >> +  if (Matcher->isVariadic())
> >>  OS << "...";
> >>OS << ")";
> >>
> >> -  std::string TypedText = I->first();
> >> +  std::string TypedText = Name;
> >>TypedText += "(";
> >>if (ArgsKinds.empty())
> >>  TypedText += ")";
> >>
> >>
> >> ___
> >> 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: r244792 - RangRangify some more for loops; NFC.

2015-08-12 Thread Aaron Ballman via cfe-commits
On Wed, Aug 12, 2015 at 3:37 PM, David Blaikie  wrote:
>
>
> On Wed, Aug 12, 2015 at 12:00 PM, Aaron Ballman via cfe-commits
>  wrote:
>>
>> Author: aaronballman
>> Date: Wed Aug 12 14:00:39 2015
>> New Revision: 244792
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=244792&view=rev
>> Log:
>> RangRangify some more for loops; NFC.
>>
>> Modified:
>> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>>
>> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff
>>
>> ==
>> --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
>> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 14:00:39
>> 2015
>> @@ -358,11 +358,8 @@ RegistryMaps::RegistryMaps() {
>>  }
>>
>>  RegistryMaps::~RegistryMaps() {
>> -  for (ConstructorMap::iterator it = Constructors.begin(),
>> -end = Constructors.end();
>> -   it != end; ++it) {
>> -delete it->second;
>> -  }
>> +  for (auto &E : Constructors)
>> +delete E.getValue();
>
>
> This looks like "DeleteContainerSeconds" (but even better if they could be
> switched to unique_ptr)

Ooh, I will switch to that. I tried to unique_ptr'ify the code, but
it's... complicated.

~Aaron

>
>>
>>  }
>>
>>  static llvm::ManagedStatic RegistryData;
>> @@ -433,12 +430,13 @@ Registry::getMatcherCompletions(ArrayRef
>>std::vector Completions;
>>
>>// Search the registry for acceptable matchers.
>> -  for (ConstructorMap::const_iterator I =
>> RegistryData->constructors().begin(),
>> -  E =
>> RegistryData->constructors().end();
>> -   I != E; ++I) {
>> +  for (const auto &M : RegistryData->constructors()) {
>> +const auto *Matcher = M.getValue();
>> +StringRef Name = M.getKey();
>> +
>>  std::set RetKinds;
>> -unsigned NumArgs = I->second->isVariadic() ? 1 :
>> I->second->getNumArgs();
>> -bool IsPolymorphic = I->second->isPolymorphic();
>> +unsigned NumArgs = Matcher->isVariadic() ? 1 : Matcher->getNumArgs();
>> +bool IsPolymorphic = Matcher->isPolymorphic();
>>  std::vector> ArgsKinds(NumArgs);
>>  unsigned MaxSpecificity = 0;
>>  for (const ArgKind& Kind : AcceptedTypes) {
>> @@ -446,13 +444,13 @@ Registry::getMatcherCompletions(ArrayRef
>>  continue;
>>unsigned Specificity;
>>ASTNodeKind LeastDerivedKind;
>> -  if (I->second->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
>> - &LeastDerivedKind)) {
>> +  if (Matcher->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
>> +   &LeastDerivedKind)) {
>>  if (MaxSpecificity < Specificity)
>>MaxSpecificity = Specificity;
>>  RetKinds.insert(LeastDerivedKind);
>>  for (unsigned Arg = 0; Arg != NumArgs; ++Arg)
>> -  I->second->getArgKinds(Kind.getMatcherKind(), Arg,
>> ArgsKinds[Arg]);
>> +  Matcher->getArgKinds(Kind.getMatcherKind(), Arg,
>> ArgsKinds[Arg]);
>>  if (IsPolymorphic)
>>break;
>>}
>> @@ -463,9 +461,9 @@ Registry::getMatcherCompletions(ArrayRef
>>llvm::raw_string_ostream OS(Decl);
>>
>>if (IsPolymorphic) {
>> -OS << "Matcher " << I->first() << "(Matcher";
>> +OS << "Matcher " << Name << "(Matcher";
>>} else {
>> -OS << "Matcher<" << RetKinds << "> " << I->first() << "(";
>> +OS << "Matcher<" << RetKinds << "> " << Name << "(";
>>  for (const std::vector &Arg : ArgsKinds) {
>>if (&Arg != &ArgsKinds[0])
>>  OS << ", ";
>> @@ -488,11 +486,11 @@ Registry::getMatcherCompletions(ArrayRef
>>}
>>  }
>>}
>> -  if (I->second->isVariadic())
>> +  if (Matcher->isVariadic())
>>  OS << "...";
>>OS << ")";
>>
>> -  std::string TypedText = I->first();
>> +  std::string TypedText = Name;
>>TypedText += "(";
>>if (ArgsKinds.empty())
>>  TypedText += ")";
>>
>>
>> ___
>> 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


r244797 - Docs: keep copyright years up-to-date

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 14:45:01 2015
New Revision: 244797

URL: http://llvm.org/viewvc/llvm-project?rev=244797&view=rev
Log:
Docs: keep copyright years up-to-date

Modified:
cfe/trunk/docs/conf.py

Modified: cfe/trunk/docs/conf.py
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/conf.py?rev=244797&r1=244796&r2=244797&view=diff
==
--- cfe/trunk/docs/conf.py (original)
+++ cfe/trunk/docs/conf.py Wed Aug 12 14:45:01 2015
@@ -12,6 +12,7 @@
 # serve to show the default.
 
 import sys, os
+from datetime import date
 
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
@@ -41,7 +42,7 @@ master_doc = 'index'
 
 # General information about the project.
 project = u'Clang'
-copyright = u'2007-2015, The Clang Team'
+copyright = u'2007-%d, The Clang Team' % date.today().year
 
 # The version info for the project you're documenting, acts as replacement for
 # |version| and |release|, also used in various other places throughout the


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


Re: r244792 - RangRangify some more for loops; NFC.

2015-08-12 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 12:00 PM, Aaron Ballman via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: aaronballman
> Date: Wed Aug 12 14:00:39 2015
> New Revision: 244792
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244792&view=rev
> Log:
> RangRangify some more for loops; NFC.
>
> Modified:
> cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
>
> Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff
>
> ==
> --- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
> +++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 14:00:39 2015
> @@ -358,11 +358,8 @@ RegistryMaps::RegistryMaps() {
>  }
>
>  RegistryMaps::~RegistryMaps() {
> -  for (ConstructorMap::iterator it = Constructors.begin(),
> -end = Constructors.end();
> -   it != end; ++it) {
> -delete it->second;
> -  }
> +  for (auto &E : Constructors)
> +delete E.getValue();
>

This looks like "DeleteContainerSeconds" (but even better if they could be
switched to unique_ptr)


>  }
>
>  static llvm::ManagedStatic RegistryData;
> @@ -433,12 +430,13 @@ Registry::getMatcherCompletions(ArrayRef
>std::vector Completions;
>
>// Search the registry for acceptable matchers.
> -  for (ConstructorMap::const_iterator I =
> RegistryData->constructors().begin(),
> -  E =
> RegistryData->constructors().end();
> -   I != E; ++I) {
> +  for (const auto &M : RegistryData->constructors()) {
> +const auto *Matcher = M.getValue();
> +StringRef Name = M.getKey();
> +
>  std::set RetKinds;
> -unsigned NumArgs = I->second->isVariadic() ? 1 :
> I->second->getNumArgs();
> -bool IsPolymorphic = I->second->isPolymorphic();
> +unsigned NumArgs = Matcher->isVariadic() ? 1 : Matcher->getNumArgs();
> +bool IsPolymorphic = Matcher->isPolymorphic();
>  std::vector> ArgsKinds(NumArgs);
>  unsigned MaxSpecificity = 0;
>  for (const ArgKind& Kind : AcceptedTypes) {
> @@ -446,13 +444,13 @@ Registry::getMatcherCompletions(ArrayRef
>  continue;
>unsigned Specificity;
>ASTNodeKind LeastDerivedKind;
> -  if (I->second->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
> - &LeastDerivedKind)) {
> +  if (Matcher->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
> +   &LeastDerivedKind)) {
>  if (MaxSpecificity < Specificity)
>MaxSpecificity = Specificity;
>  RetKinds.insert(LeastDerivedKind);
>  for (unsigned Arg = 0; Arg != NumArgs; ++Arg)
> -  I->second->getArgKinds(Kind.getMatcherKind(), Arg,
> ArgsKinds[Arg]);
> +  Matcher->getArgKinds(Kind.getMatcherKind(), Arg,
> ArgsKinds[Arg]);
>  if (IsPolymorphic)
>break;
>}
> @@ -463,9 +461,9 @@ Registry::getMatcherCompletions(ArrayRef
>llvm::raw_string_ostream OS(Decl);
>
>if (IsPolymorphic) {
> -OS << "Matcher " << I->first() << "(Matcher";
> +OS << "Matcher " << Name << "(Matcher";
>} else {
> -OS << "Matcher<" << RetKinds << "> " << I->first() << "(";
> +OS << "Matcher<" << RetKinds << "> " << Name << "(";
>  for (const std::vector &Arg : ArgsKinds) {
>if (&Arg != &ArgsKinds[0])
>  OS << ", ";
> @@ -488,11 +486,11 @@ Registry::getMatcherCompletions(ArrayRef
>}
>  }
>}
> -  if (I->second->isVariadic())
> +  if (Matcher->isVariadic())
>  OS << "...";
>OS << ")";
>
> -  std::string TypedText = I->first();
> +  std::string TypedText = Name;
>TypedText += "(";
>if (ArgsKinds.empty())
>  TypedText += ")";
>
>
> ___
> 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


r244795 - Options.td: Drop trailing space in -fsanitize= help text

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 14:35:05 2015
New Revision: 244795

URL: http://llvm.org/viewvc/llvm-project?rev=244795&view=rev
Log:
Options.td: Drop trailing space in -fsanitize= help text

Modified:
cfe/trunk/include/clang/Driver/Options.td

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=244795&r1=244794&r2=244795&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Wed Aug 12 14:35:05 2015
@@ -554,7 +554,7 @@ def fno_signaling_math : Flag<["-"], "fn
 def fsanitize_EQ : CommaJoined<["-"], "fsanitize=">, Group,
Flags<[CC1Option, CoreOption]>, MetaVarName<"">,
HelpText<"Turn on runtime checks for various forms of 
undefined "
-"or suspicious behavior. See user manual for 
available checks ">;
+"or suspicious behavior. See user manual for 
available checks">;
 def fno_sanitize_EQ : CommaJoined<["-"], "fno-sanitize=">, 
Group,
   Flags<[CoreOption]>;
 def fsanitize_blacklist : Joined<["-"], "fsanitize-blacklist=">,


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


r244794 - Docs: update clang-cl command-line documentation

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 14:35:01 2015
New Revision: 244794

URL: http://llvm.org/viewvc/llvm-project?rev=244794&view=rev
Log:
Docs: update clang-cl command-line documentation

Modified:
cfe/trunk/docs/UsersManual.rst

Modified: cfe/trunk/docs/UsersManual.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/UsersManual.rst?rev=244794&r1=244793&r2=244794&view=diff
==
--- cfe/trunk/docs/UsersManual.rst (original)
+++ cfe/trunk/docs/UsersManual.rst Wed Aug 12 14:35:01 2015
@@ -2005,7 +2005,7 @@ with a warning. For example:
 
   ::
 
-clang-cl.exe: warning: argument unused during compilation: '/Zi'
+clang-cl.exe: warning: argument unused during compilation: '/AI'
 
 To suppress warnings about unused arguments, use the ``-Qunused-arguments`` 
option.
 
@@ -2034,14 +2034,21 @@ Execute ``clang-cl /?`` to see a list of
   /E Preprocess to stdout
   /fallback  Fall back to cl.exe if clang-cl fails to compile
   /FAOutput assembly code file during compilation
-  /Fa Output assembly code to this file during 
compilation
+  /Fa Output assembly code to this file during 
compilation (with /FA)
   /Fe Set output executable file or directory (ends in 
/ or \)
   /FI Include file before parsing
-  /Fi  Set preprocess output file name
-  /Fo Set output object file, or directory (ends in / 
or \)
+  /Fi  Set preprocess output file name (with /P)
+  /Fo Set output object file, or directory (ends in / 
or \) (with /c)
+  /fp:except-
+  /fp:except
+  /fp:fast
+  /fp:precise
+  /fp:strict
+  /GAAssume thread-local variables are defined in the 
executable
   /GF-   Disable string pooling
   /GR-   Disable emission of RTTI data
   /GREnable emission of RTTI data
+  /Gs Set stack probe size
   /Gw-   Don't put each data item in its own section
   /GwPut each data item in its own section
   /Gy-   Don't put each function in its own section
@@ -2062,11 +2069,13 @@ Execute ``clang-cl /?`` to see a list of
   /OiEnable use of builtin functions
   /OsOptimize for size
   /OtOptimize for speed
-  /OxMaximum optimization
   /Oy-   Disable frame pointer omission
   /OyEnable frame pointer omission
-  /O  Optimization level
+  /O  Optimization level
+  /o  Set output file or directory (ends in / or \)
   /P Preprocess to file
+  /Qvec- Disable the loop vectorization passes
+  /Qvec  Enable the loop vectorization passes
   /showIncludes  Print info about included files to stderr
   /TCTreat all source files as C
   /Tc  Specify a C source file
@@ -2079,6 +2088,8 @@ Execute ``clang-cl /?`` to see a list of
   /vmm   Set the default most-general representation to 
multiple inheritance
   /vms   Set the default most-general representation to 
single inheritance
   /vmv   Set the default most-general representation to 
virtual inheritance
+  /volatile:iso  Volatile loads and stores have standard semantics
+  /volatile:ms   Volatile loads and stores have acquire and 
release semantics
   /W0Disable all warnings
   /W1Enable -Wall
   /W2Enable -Wall
@@ -2088,29 +2099,55 @@ Execute ``clang-cl /?`` to see a list of
   /WX-   Do not treat warnings as errors
   /WXTreat warnings as errors
   /w Disable all warnings
-  /ZiEnable debug information
+  /Z7Enable CodeView debug information in object files
+  /Zc:sizedDealloc-  Disable C++14 sized global deallocation functions
+  /Zc:sizedDealloc   Enable C++14 sized global deallocation functions
+  /Zc:strictStrings  Treat string literals as const
+  /Zc:threadSafeInit-Disable thread-safe initialization of static 
variables
+  /Zc:threadSafeInit Enable thread-safe initialization of static 
variables
+  /Zc:trigraphs- Disable trigraphs (default)
+  /Zc:trigraphs  Enable trigraphs
+  /ZiAlias for /Z7. Does not produce PDBs.
+  /ZlDon't mention any default libraries in the object 
file
   /ZpSet the default maximum struct packing alignment 
to 1
   /Zp Specify the default maximum struct packing

Re: [PATCH] Fix types of size_t, intptr_t, and ptrdiff_t on OpenBSD/sparc.

2015-08-12 Thread Brad Smith via cfe-commits

On 08/12/15 11:24, James Y Knight wrote:

Sorry for the miscommunication, I thought you were going to commit it
already. LGTM.


Oh, I was waiting for someone to say something. Thanks.


--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

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


[clang-tools-extra] r244793 - [clang-tidy] Make FileOptionsProvider fields protected to make extending it easier

2015-08-12 Thread Alexander Kornienko via cfe-commits
Author: alexfh
Date: Wed Aug 12 14:29:57 2015
New Revision: 244793

URL: http://llvm.org/viewvc/llvm-project?rev=244793&view=rev
Log:
[clang-tidy] Make FileOptionsProvider fields protected to make extending it 
easier

Modified:
clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h

Modified: clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h?rev=244793&r1=244792&r2=244793&view=diff
==
--- clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h (original)
+++ clang-tools-extra/trunk/clang-tidy/ClangTidyOptions.h Wed Aug 12 14:29:57 
2015
@@ -189,7 +189,7 @@ public:
 
   ClangTidyOptions getOptions(llvm::StringRef FileName) override;
 
-private:
+protected:
   /// \brief Try to read configuration files from \p Directory using registered
   /// \c ConfigHandlers.
   llvm::Optional TryReadConfigFile(llvm::StringRef 
Directory);


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


r244792 - RangRangify some more for loops; NFC.

2015-08-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 12 14:00:39 2015
New Revision: 244792

URL: http://llvm.org/viewvc/llvm-project?rev=244792&view=rev
Log:
RangRangify some more for loops; NFC.

Modified:
cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp

Modified: cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp?rev=244792&r1=244791&r2=244792&view=diff
==
--- cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp (original)
+++ cfe/trunk/lib/ASTMatchers/Dynamic/Registry.cpp Wed Aug 12 14:00:39 2015
@@ -358,11 +358,8 @@ RegistryMaps::RegistryMaps() {
 }
 
 RegistryMaps::~RegistryMaps() {
-  for (ConstructorMap::iterator it = Constructors.begin(),
-end = Constructors.end();
-   it != end; ++it) {
-delete it->second;
-  }
+  for (auto &E : Constructors)
+delete E.getValue();
 }
 
 static llvm::ManagedStatic RegistryData;
@@ -433,12 +430,13 @@ Registry::getMatcherCompletions(ArrayRef
   std::vector Completions;
 
   // Search the registry for acceptable matchers.
-  for (ConstructorMap::const_iterator I = RegistryData->constructors().begin(),
-  E = RegistryData->constructors().end();
-   I != E; ++I) {
+  for (const auto &M : RegistryData->constructors()) {
+const auto *Matcher = M.getValue();
+StringRef Name = M.getKey();
+
 std::set RetKinds;
-unsigned NumArgs = I->second->isVariadic() ? 1 : I->second->getNumArgs();
-bool IsPolymorphic = I->second->isPolymorphic();
+unsigned NumArgs = Matcher->isVariadic() ? 1 : Matcher->getNumArgs();
+bool IsPolymorphic = Matcher->isPolymorphic();
 std::vector> ArgsKinds(NumArgs);
 unsigned MaxSpecificity = 0;
 for (const ArgKind& Kind : AcceptedTypes) {
@@ -446,13 +444,13 @@ Registry::getMatcherCompletions(ArrayRef
 continue;
   unsigned Specificity;
   ASTNodeKind LeastDerivedKind;
-  if (I->second->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
- &LeastDerivedKind)) {
+  if (Matcher->isConvertibleTo(Kind.getMatcherKind(), &Specificity,
+   &LeastDerivedKind)) {
 if (MaxSpecificity < Specificity)
   MaxSpecificity = Specificity;
 RetKinds.insert(LeastDerivedKind);
 for (unsigned Arg = 0; Arg != NumArgs; ++Arg)
-  I->second->getArgKinds(Kind.getMatcherKind(), Arg, ArgsKinds[Arg]);
+  Matcher->getArgKinds(Kind.getMatcherKind(), Arg, ArgsKinds[Arg]);
 if (IsPolymorphic)
   break;
   }
@@ -463,9 +461,9 @@ Registry::getMatcherCompletions(ArrayRef
   llvm::raw_string_ostream OS(Decl);
 
   if (IsPolymorphic) {
-OS << "Matcher " << I->first() << "(Matcher";
+OS << "Matcher " << Name << "(Matcher";
   } else {
-OS << "Matcher<" << RetKinds << "> " << I->first() << "(";
+OS << "Matcher<" << RetKinds << "> " << Name << "(";
 for (const std::vector &Arg : ArgsKinds) {
   if (&Arg != &ArgsKinds[0])
 OS << ", ";
@@ -488,11 +486,11 @@ Registry::getMatcherCompletions(ArrayRef
   }
 }
   }
-  if (I->second->isVariadic())
+  if (Matcher->isVariadic())
 OS << "...";
   OS << ")";
 
-  std::string TypedText = I->first();
+  std::string TypedText = Name;
   TypedText += "(";
   if (ArgsKinds.empty())
 TypedText += ")";


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


Re: [PATCH] D11946: Create clang-tidy module modernize. Add pass-by-value check.

2015-08-12 Thread Alexander Kornienko via cfe-commits
alexfh added inline comments.


Comment at: clang-tidy/modernize/PassByValueCheck.cpp:158
@@ +157,3 @@
+ Compiler.getLangOpts(),
+ IncludeSorter::IS_LLVM));
+  Compiler.getPreprocessor().addPPCallbacks(Inserter->CreatePPCallbacks());

Include sorting style should be configurable. See `BracesAroundStatementsCheck` 
for an example.


Comment at: clang-tidy/modernize/PassByValueCheck.cpp:180
@@ +179,3 @@
+  // Iterate over all declarations of the constructor.
+  for (const ParmVarDecl *ParmDecl : AllParamDecls) {
+auto ParamTL = ParmDecl->getTypeSourceInfo()->getTypeLoc();

nit: I'd remove the variable and iterate over `collectParamDecls(...)` instead.


Comment at: test/clang-tidy/modernize-pass-by-value.cpp:4
@@ +3,3 @@
+
+// CHiECK-FIXES: #include 
+

Typo: `CHiECK-FIXES:`


Comment at: test/clang-tidy/modernize-pass-by-value.cpp:27
@@ +26,3 @@
+
+// Test that we aren't modifying other things than a parameter
+Movable GlobalObj;

nit: Trailing period (+ a few places below).


http://reviews.llvm.org/D11946



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


Re: [PATCH] D11944: Nativize filename in FileManager::getFile().

2015-08-12 Thread Richard Smith via cfe-commits
rsmith added a comment.

In principle, normalizing slashes on Windows makes sense here. But we shouldn't 
use `llvm::sys::path::native`, because it's just too broken.



Comment at: lib/Basic/FileManager.cpp:221-222
@@ -220,1 +220,4 @@
 
+  SmallString<1024> NativeFilename;
+  llvm::sys::path::native(Filename, NativeFilename);
+

I have two concerns with this:

1) It's needlessly inefficient on non-Win32 platforms (we'll make an 
unnecessary string copy)
2) It does something bizarre and wrong on non-Win32 platforms (it converts `\` 
to `/` unless the `\` is followed by another `\`, making most files containing 
`\` inaccessible)


http://reviews.llvm.org/D11944



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


Re: [PATCH] D11983: Make getToolChain actually cache its result, as documented in Driver.h

2015-08-12 Thread Chandler Carruth via cfe-commits
chandlerc added a comment.

This isn't necessary. The TC that we assign to is a reference to the pointer in 
the map. It should already be caching.


http://reviews.llvm.org/D11983



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


r244791 - Don't compare getArchName() to "tce" as a string. NFC.

2015-08-12 Thread Douglas Katzman via cfe-commits
Author: dougk
Date: Wed Aug 12 13:36:12 2015
New Revision: 244791

URL: http://llvm.org/viewvc/llvm-project?rev=244791&view=rev
Log:
Don't compare getArchName() to "tce" as a string. NFC.

Modified:
cfe/trunk/lib/Driver/Driver.cpp

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=244791&r1=244790&r2=244791&view=diff
==
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Wed Aug 12 13:36:12 2015
@@ -325,7 +325,8 @@ static llvm::Triple computeTargetTriple(
   }
 
   // Skip further flag support on OSes which don't support '-m32' or '-m64'.
-  if (Target.getArchName() == "tce" || Target.getOS() == llvm::Triple::Minix)
+  if (Target.getArch() == llvm::Triple::tce ||
+  Target.getOS() == llvm::Triple::Minix)
 return Target;
 
   // Handle pseudo-target flags '-m64', '-mx32', '-m32' and '-m16'.
@@ -2232,21 +2233,27 @@ const ToolChain &Driver::getToolChain(co
 default:
   // Of these targets, Hexagon is the only one that might have
   // an OS of Linux, in which case it got handled above already.
-  if (Target.getArchName() == "tce")
+  switch (Target.getArch()) {
+  case llvm::Triple::tce:
 TC = new toolchains::TCEToolChain(*this, Target, Args);
-  else if (Target.getArch() == llvm::Triple::hexagon)
+break;
+  case llvm::Triple::hexagon:
 TC = new toolchains::HexagonToolChain(*this, Target, Args);
-  else if (Target.getArch() == llvm::Triple::xcore)
+break;
+  case llvm::Triple::xcore:
 TC = new toolchains::XCoreToolChain(*this, Target, Args);
-  else if (Target.getArch() == llvm::Triple::shave)
+break;
+  case llvm::Triple::shave:
 TC = new toolchains::SHAVEToolChain(*this, Target, Args);
-  else if (Target.isOSBinFormatELF())
-TC = new toolchains::Generic_ELF(*this, Target, Args);
-  else if (Target.isOSBinFormatMachO())
-TC = new toolchains::MachO(*this, Target, Args);
-  else
-TC = new toolchains::Generic_GCC(*this, Target, Args);
-  break;
+break;
+  default:
+if (Target.isOSBinFormatELF())
+  TC = new toolchains::Generic_ELF(*this, Target, Args);
+else if (Target.isOSBinFormatMachO())
+  TC = new toolchains::MachO(*this, Target, Args);
+else
+  TC = new toolchains::Generic_GCC(*this, Target, Args);
+  }
 }
   }
   return *TC;


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


Re: [PATCH] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-12 Thread Richard Smith via cfe-commits
rsmith accepted this revision.
rsmith added a comment.
This revision is now accepted and ready to land.

Looks fine, go ahead once you're satisfied that the performance is OK for the 
`requires excluded` / umbrella dir hack.



Comment at: include/clang/Basic/Module.h:363
@@ +362,3 @@
+  /// This is more efficient than getFullModuleName().
+  bool fullModuleNameEqual(ArrayRef nameParts) const;
+

`fullModuleNameEquals` (extra 's' at the end) or `fullModuleNameIs` maybe?


Comment at: lib/Basic/Module.cpp:142-147
@@ +141,8 @@
+bool Module::fullModuleNameEqual(ArrayRef nameParts) const {
+  for (const Module *M = this; M; M = M->Parent) {
+if (nameParts.empty() || M->Name != nameParts.back())
+  return false;
+nameParts = nameParts.drop_back();
+  }
+  return nameParts.empty();
+}

Seems weird to do this by modifying `nameParts` rather than tracking an index, 
but OK...


Comment at: lib/Lex/ModuleMap.cpp:1025-1026
@@ +1024,4 @@
+/// non-modular headers.  For backwards compatibility, we continue to
+/// support
+/// this idiom for just these modules, and map the headers to 'textual' to
+/// match the original intent.

Unnecessary newline?


Comment at: lib/Lex/ModuleMap.cpp:1607-1608
@@ +1606,4 @@
+M->fullModuleNameEqual(TclPrivate))) {
+  IsRequiresExcludedHack = true;
+  return false;
+  } else if (Feature == "cplusplus" && M->fullModuleNameEqual(IOKitAVC)) {

Overindented.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403



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


Re: [PATCH] D11916: [CONCEPTS] Add diagnostic; invalid tag when concept specified

2015-08-12 Thread Aaron Ballman via cfe-commits
LGTM!

~Aaron

On Wed, Aug 12, 2015 at 1:40 PM, Nathan Wilson  wrote:
> nwilson updated this revision to Diff 31957.
> nwilson added a comment.
>
> Addressing comments which were discussed on the mailing list - Apply the same 
> text when diagnosing a free standing declaration as suggested by Aaron. 
> Replace diagnostic identifier err_concept_decl_non_template with 
> err_concept_wrong_decl_kind as suggested by Hubert and Richard.  Fix tests 
> corresponding to the changes.
>
>
> http://reviews.llvm.org/D11916
>
> Files:
>   include/clang/Basic/DiagnosticSemaKinds.td
>   lib/Sema/SemaDecl.cpp
>   test/SemaCXX/cxx-concept-declaration.cpp
>
> Index: test/SemaCXX/cxx-concept-declaration.cpp
> ===
> --- test/SemaCXX/cxx-concept-declaration.cpp
> +++ test/SemaCXX/cxx-concept-declaration.cpp
> @@ -23,3 +23,13 @@
>  template
>  concept bool D6; // expected-error {{variable concept declaration must be 
> initialized}}
>
> +// Tag
> +concept class CC1 {}; // expected-error {{'concept' can only appear on the 
> definition of a function template or variable template}}
> +concept struct CS1 {}; // expected-error {{'concept' can only appear on the 
> definition of a function template or variable template}}
> +concept union CU1 {}; // expected-error {{'concept' can only appear on the 
> definition of a function template or variable template}}
> +concept enum CE1 {}; // expected-error {{'concept' can only appear on the 
> definition of a function template or variable template}}
> +template  concept class TCC1 {}; // expected-error {{'concept' 
> can only appear on the definition of a function template or variable 
> template}}
> +template  concept struct TCS1 {}; // expected-error {{'concept' 
> can only appear on the definition of a function template or variable 
> template}}
> +template  concept union TCU1 {}; // expected-error {{'concept' 
> can only appear on the definition of a function template or variable 
> template}}
> +
> +concept bool; // expected-error {{'concept' can only appear on the 
> definition of a function template or variable template}}
> Index: lib/Sema/SemaDecl.cpp
> ===
> --- lib/Sema/SemaDecl.cpp
> +++ lib/Sema/SemaDecl.cpp
> @@ -3662,6 +3662,14 @@
>  return TagD;
>}
>
> +  if (DS.isConceptSpecified()) {
> +// C++ Concepts TS [dcl.spec.concept]p1: A concept definition refers to
> +// either a function concept and its definition or a variable concept and
> +// its initializer.
> +Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
> +return TagD;
> +  }
> +
>DiagnoseFunctionSpecifiers(DS);
>
>if (DS.isFriendSpecified()) {
> @@ -4865,7 +4873,7 @@
>  // template, declared in namespace scope
>  if (!TemplateParamLists.size()) {
>Diag(D.getDeclSpec().getConceptSpecLoc(),
> -   diag::err_concept_decl_non_template);
> +   diag:: err_concept_wrong_decl_kind);
>return nullptr;
>  }
>
> Index: include/clang/Basic/DiagnosticSemaKinds.td
> ===
> --- include/clang/Basic/DiagnosticSemaKinds.td
> +++ include/clang/Basic/DiagnosticSemaKinds.td
> @@ -1965,7 +1965,7 @@
>"use __attribute__((visibility(\"hidden\"))) attribute instead">;
>
>  // C++ Concepts TS
> -def err_concept_decl_non_template : Error<
> +def err_concept_wrong_decl_kind : Error<
>"'concept' can only appear on the definition of a function template or 
> variable template">;
>  def err_concept_decls_may_only_appear_in_namespace_scope : Error<
>"concept declarations may only appear in namespace scope">;
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11778: Improvements on Diagnostic in Macro Expansions

2015-08-12 Thread Richard Trieu via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244788: Stop printing macro backtraces that don't help 
diagnostics. (authored by rtrieu).

Changed prior to commit:
  http://reviews.llvm.org/D11778?vs=31425&id=31965#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11778

Files:
  cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
  cfe/trunk/test/Misc/diag-presumed.c
  cfe/trunk/test/Misc/reduced-diags-macros-backtrace.cpp
  cfe/trunk/test/Misc/reduced-diags-macros.cpp
  cfe/trunk/test/Preprocessor/macro_arg_slocentry_merge.c

Index: cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
===
--- cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
+++ cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
@@ -423,6 +423,38 @@
  SpellingRanges, None, &SM);
 }
 
+static bool checkRangeForMacroArgExpansion(CharSourceRange Range,
+   const SourceManager &SM) {
+  SourceLocation BegLoc = Range.getBegin(), EndLoc = Range.getEnd();
+  while (BegLoc != EndLoc) {
+if (!SM.isMacroArgExpansion(BegLoc))
+  return false;
+BegLoc.getLocWithOffset(1);
+  }
+
+  return SM.isMacroArgExpansion(BegLoc);
+}
+
+/// A helper function to check if the current ranges are all inside
+/// the macro expansions.
+static bool checkRangesForMacroArgExpansion(SourceLocation Loc,
+ArrayRef Ranges,
+const SourceManager &SM) {
+  assert(Loc.isMacroID() && "Must be a macro expansion!");
+
+  SmallVector SpellingRanges;
+  mapDiagnosticRanges(Loc, Ranges, SpellingRanges, &SM);
+
+  if (!SM.isMacroArgExpansion(Loc))
+return false;
+
+  for (auto I = SpellingRanges.begin(), E = SpellingRanges.end(); I != E; ++I)
+if (!checkRangeForMacroArgExpansion(*I, SM))
+  return false;
+
+  return true;
+}
+
 /// \brief Recursively emit notes for each macro expansion and caret
 /// diagnostics where appropriate.
 ///
@@ -443,12 +475,19 @@
 
   // Produce a stack of macro backtraces.
   SmallVector LocationStack;
+  unsigned IgnoredEnd = 0;
   while (Loc.isMacroID()) {
 LocationStack.push_back(Loc);
+if (checkRangesForMacroArgExpansion(Loc, Ranges, SM))
+  IgnoredEnd = LocationStack.size();
+
 Loc = SM.getImmediateMacroCallerLoc(Loc);
 assert(!Loc.isInvalid() && "must have a valid source location here");
   }
 
+  LocationStack.erase(LocationStack.begin(),
+  LocationStack.begin() + IgnoredEnd);
+
   unsigned MacroDepth = LocationStack.size();
   unsigned MacroLimit = DiagOpts->MacroBacktraceLimit;
   if (MacroDepth <= MacroLimit || MacroLimit == 0) {
Index: cfe/trunk/test/Preprocessor/macro_arg_slocentry_merge.c
===
--- cfe/trunk/test/Preprocessor/macro_arg_slocentry_merge.c
+++ cfe/trunk/test/Preprocessor/macro_arg_slocentry_merge.c
@@ -3,5 +3,3 @@
 #include "macro_arg_slocentry_merge.h"
 
 // CHECK: macro_arg_slocentry_merge.h:7:19: error: unknown type name 'win'
-// CHECK: macro_arg_slocentry_merge.h:5:16: note: expanded from macro 'WINDOW'
-// CHECK: macro_arg_slocentry_merge.h:6:18: note: expanded from macro 'P_'
Index: cfe/trunk/test/Misc/reduced-diags-macros-backtrace.cpp
===
--- cfe/trunk/test/Misc/reduced-diags-macros-backtrace.cpp
+++ cfe/trunk/test/Misc/reduced-diags-macros-backtrace.cpp
@@ -0,0 +1,47 @@
+// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 0 %s 2>&1 | FileCheck %s --check-prefix=ALL
+// RUN: not %clang_cc1 -fsyntax-only -fmacro-backtrace-limit 2 %s 2>&1 | FileCheck %s --check-prefix=SKIP
+
+#define F(x) x + 1
+#define G(x) F(x) + 2
+#define ADD(x,y) G(x) + y
+#define LEVEL4(x) ADD(p,x)
+#define LEVEL3(x) LEVEL4(x)
+#define LEVEL2(x) LEVEL3(x)
+#define LEVEL1(x) LEVEL2(x)
+
+int a = LEVEL1(b);
+
+// ALL: {{.*}}:12:9: error: use of undeclared identifier 'p'
+// ALL-NEXT: int a = LEVEL1(b);
+// ALL-NEXT: ^
+// ALL-NEXT: {{.*}}:10:19: note: expanded from macro 'LEVEL1'
+// ALL-NEXT: #define LEVEL1(x) LEVEL2(x)
+// ALL-NEXT:   ^
+// ALL-NEXT: {{.*}}:9:19: note: expanded from macro 'LEVEL2'
+// ALL-NEXT: #define LEVEL2(x) LEVEL3(x)
+// ALL-NEXT:   ^
+// ALL-NEXT: {{.*}}:8:19: note: expanded from macro 'LEVEL3'
+// ALL-NEXT: #define LEVEL3(x) LEVEL4(x)
+// ALL-NEXT:   ^
+// ALL-NEXT: {{.*}}:7:23: note: expanded from macro 'LEVEL4'
+// ALL-NEXT: #define LEVEL4(x) ADD(p,x)
+// ALL-NEXT:   ^
+// ALL-NEXT: {{.*}}:12:16: error: use of undeclared identifier 'b'
+// ALL-NEXT: int a = LEVEL1(b);
+// ALL-NEXT:^
+// ALL-NEXT: 2 errors generated.
+
+// SKIP: {{.*}}:12:9: error: use of undeclared identifier 'p'
+// SKIP-NEXT: int a = LEVEL1(b);
+// SKIP-NEXT: ^
+// SKIP-NEXT: {{.*}}:10:19: note: expanded from macro 'LEVEL1'
+// S

r244788 - Stop printing macro backtraces that don't help diagnostics.

2015-08-12 Thread Richard Trieu via cfe-commits
Author: rtrieu
Date: Wed Aug 12 13:24:59 2015
New Revision: 244788

URL: http://llvm.org/viewvc/llvm-project?rev=244788&view=rev
Log:
Stop printing macro backtraces that don't help diagnostics.

When displaying the macro backtrace, ignore some of the backtraces that do not
provide extra information to the diagnostic.  Typically, if the problem is
entirely contained within a macro argument, the macro expansion is often not
needed.  Also take into account SourceRange's attached to the diagnostic when
selecting which backtraces to ignore.  Two previous test cases have also been
updated.

Patch by Zhengkai Wu, with minor formatting fixes.

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


Added:
cfe/trunk/test/Misc/reduced-diags-macros-backtrace.cpp
cfe/trunk/test/Misc/reduced-diags-macros.cpp
Modified:
cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
cfe/trunk/test/Misc/diag-presumed.c
cfe/trunk/test/Preprocessor/macro_arg_slocentry_merge.c

Modified: cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp?rev=244788&r1=244787&r2=244788&view=diff
==
--- cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp (original)
+++ cfe/trunk/lib/Frontend/DiagnosticRenderer.cpp Wed Aug 12 13:24:59 2015
@@ -423,6 +423,38 @@ void DiagnosticRenderer::emitSingleMacro
  SpellingRanges, None, &SM);
 }
 
+static bool checkRangeForMacroArgExpansion(CharSourceRange Range,
+   const SourceManager &SM) {
+  SourceLocation BegLoc = Range.getBegin(), EndLoc = Range.getEnd();
+  while (BegLoc != EndLoc) {
+if (!SM.isMacroArgExpansion(BegLoc))
+  return false;
+BegLoc.getLocWithOffset(1);
+  }
+
+  return SM.isMacroArgExpansion(BegLoc);
+}
+
+/// A helper function to check if the current ranges are all inside
+/// the macro expansions.
+static bool checkRangesForMacroArgExpansion(SourceLocation Loc,
+ArrayRef Ranges,
+const SourceManager &SM) {
+  assert(Loc.isMacroID() && "Must be a macro expansion!");
+
+  SmallVector SpellingRanges;
+  mapDiagnosticRanges(Loc, Ranges, SpellingRanges, &SM);
+
+  if (!SM.isMacroArgExpansion(Loc))
+return false;
+
+  for (auto I = SpellingRanges.begin(), E = SpellingRanges.end(); I != E; ++I)
+if (!checkRangeForMacroArgExpansion(*I, SM))
+  return false;
+
+  return true;
+}
+
 /// \brief Recursively emit notes for each macro expansion and caret
 /// diagnostics where appropriate.
 ///
@@ -443,12 +475,19 @@ void DiagnosticRenderer::emitMacroExpans
 
   // Produce a stack of macro backtraces.
   SmallVector LocationStack;
+  unsigned IgnoredEnd = 0;
   while (Loc.isMacroID()) {
 LocationStack.push_back(Loc);
+if (checkRangesForMacroArgExpansion(Loc, Ranges, SM))
+  IgnoredEnd = LocationStack.size();
+
 Loc = SM.getImmediateMacroCallerLoc(Loc);
 assert(!Loc.isInvalid() && "must have a valid source location here");
   }
 
+  LocationStack.erase(LocationStack.begin(),
+  LocationStack.begin() + IgnoredEnd);
+
   unsigned MacroDepth = LocationStack.size();
   unsigned MacroLimit = DiagOpts->MacroBacktraceLimit;
   if (MacroDepth <= MacroLimit || MacroLimit == 0) {

Modified: cfe/trunk/test/Misc/diag-presumed.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/diag-presumed.c?rev=244788&r1=244787&r2=244788&view=diff
==
--- cfe/trunk/test/Misc/diag-presumed.c (original)
+++ cfe/trunk/test/Misc/diag-presumed.c Wed Aug 12 13:24:59 2015
@@ -6,13 +6,11 @@
 X(int n = error);
 
 // PRESUMED: diag-presumed.c:101:11: error: use of undeclared identifier 
'error'
-// PRESUMED: diag-presumed.c:100:14: note: expanded from
 // SPELLING: diag-presumed.c:6:11: error: use of undeclared identifier 'error'
-// SPELLING: diag-presumed.c:5:14: note: expanded from
 
 ;
-// PRESUMED: diag-presumed.c:108:1: error: extra ';' outside of a functio
-// SPELLING: diag-presumed.c:13:1: error: extra ';' outside of a functio
+// PRESUMED: diag-presumed.c:106:1: error: extra ';' outside of a functio
+// SPELLING: diag-presumed.c:11:1: error: extra ';' outside of a functio
 
 # 1 "thing1.cc" 1
 # 1 "thing1.h" 1
@@ -24,13 +22,13 @@ X(int n = error);
 // SPELLING-NOT: extra ';'
 
 another error;
-// PRESUMED: included from {{.*}}diag-presumed.c:112:
+// PRESUMED: included from {{.*}}diag-presumed.c:110:
 // PRESUMED: from thing1.cc:1:
 // PRESUMED: from thing1.h:1:
 // PRESUMED: systemheader.h:7:1: error: unknown type name 'another'
 
 // SPELLING-NOT: included from
-// SPELLING: diag-presumed.c:26:1: error: unknown type name 'another'
+// SPELLING: diag-presumed.c:24:1: error: unknown type name 'another'
 
 # 1 "thing1.h" 2
 # 1 "thing1.cc" 2

Added: cfe/trunk/test/Misc/reduced-diags-ma

Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-12 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 11:12 AM, Nico Weber  wrote:

> On Wed, Aug 12, 2015 at 11:06 AM, David Blaikie 
> wrote:
>
>>
>>
>> On Wed, Aug 12, 2015 at 10:11 AM, Nico Weber  wrote:
>>
>>> On Tue, Aug 11, 2015 at 10:15 PM, Daniel Marjamäki <
>>> daniel.marjam...@evidente.se> wrote:
>>>

 ideally there should be no -Wunused-parameter compiler warning when the
 parameter is used.

 would it feel better to move the "FP" warnings about virtual functions,
 for instance to clang-tidy?

 > If you enable this warning, you probably want to know about unused
 parameters, independent of if your function is virtual or not, no?

 imho there are some compiler warnings that are too noisy. I don't like
 to get a warning when there is obviously no bug:

 sign compare:
   if the signed value is obviously not negative then there is no bug:
 signed x;  .. if (x>10 && x < s.size())
 unused parameter:
   could check in the current translation unit if the parameter is used
 in an overloaded method.

>>>
>>> It doesn't warn about the presence of the parameter, but about the
>>> presence of the name. If you say f(int, int) instead of f(int a, int b)
>>> then the warning won't fire.
>>>
>>
>>
>>> (And if you don't like this warning, then don't enable it.)
>>>
>>
>> This isn't usually the approach we take with Clang's warnings - we try to
>> remove false positives (where "false positive" is usually defined as
>> "diagnoses something which is not a bug" (where bug is defined as "the
>> resulting program behaves in a way that the user doesn't intend/expect"))
>> where practical.
>>
>
> Sure, for warnings that are supposed to find bugs. The -Wunused warnings
> warn about stuff that's unused, not bugs.
>

Seems a reasonable analog here, though, would be that a true positive for
-Wunused is when the thing really is unused and should be removed.
Commenting out the variable name is the suppression mechanism to workaround
false positives. If there's a targetable subset of cases where the s/n is
low enough, it could be reasonable to suppress the warning in that subset,
I think.

(see improvements to -Wunreachable-code to suppress cases that are
unreachable in this build (sizeof(int) == 4 conditions, macros, etc), or
represent valid defensive programming (default in a covered enum switch) to
make the diagnostic more useful/less noisy)


>
>
>>
>> If the subset of cases where this warning fires on parameters to virtual
>> functions produces more noise (if a significant % of cases just result in
>> commenting out the parameter name rather than removing the parameter) than
>> signal, it's certainly within the realm of discussion that we have about
>> whether that subset of cases is worth keeping in the warning.
>>
>> - David
>>
>>
>>>
>>>
 constructor initialization order:
   should not warn if the order obviously does not matter. for instance
 initialization order of pod variables using constants.
 etc

 Best regards,
 Daniel Marjamäki


 ..
 Daniel Marjamäki Senior Engineer
 Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden

 Mobile: +46 (0)709 12 42 62
 E-mail: daniel.marjam...@evidente.se

 www.evidente.se

 
 Från: tha...@google.com [tha...@google.com] för Nico Weber [
 tha...@chromium.org]
 Skickat: den 11 augusti 2015 20:50
 Till: David Blaikie
 Kopia: reviews+d11940+public+578c1335b27aa...@reviews.llvm.org; Daniel
 Marjamäki; cfe-commits@lists.llvm.org
 Ämne: Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual
 method or method that overrides base class method

 On Tue, Aug 11, 2015 at 11:32 AM, David Blaikie >>> > wrote:


 On Tue, Aug 11, 2015 at 8:46 AM, Nico Weber via cfe-commits <
 cfe-commits@lists.llvm.org> wrote:
 Can't you just change your signature to

   virtual void a(int /* x */) {}

 in these cases?

 You could - does it add much value to do that, though?

 If you enable this warning, you probably want to know about unused
 parameters, independent of if your function is virtual or not, no?

 (perhaps it does - it means you express the intent that the parameter
 is not used and the compiler helps you check that (so that for the
 parameters you think /should/ be used (you haven't commented out their name
 but accidentally shadow or otherwise fail to reference, you still get a
 warning))

 - David


 On Tue, Aug 11, 2015 at 6:43 AM, Daniel Marjamäki <
 cfe-commits@lists.llvm.org> wrote:
 danielmarjamaki created this revisi

Re: [PATCH] D11778: Improvements on Diagnostic in Macro Expansions

2015-08-12 Thread Richard Trieu via cfe-commits
rtrieu accepted this revision.
rtrieu added a comment.
This revision is now accepted and ready to land.

This is a first step towards making macro diagnostics better.


http://reviews.llvm.org/D11778



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


Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-12 Thread Nico Weber via cfe-commits
On Wed, Aug 12, 2015 at 11:06 AM, David Blaikie  wrote:

>
>
> On Wed, Aug 12, 2015 at 10:11 AM, Nico Weber  wrote:
>
>> On Tue, Aug 11, 2015 at 10:15 PM, Daniel Marjamäki <
>> daniel.marjam...@evidente.se> wrote:
>>
>>>
>>> ideally there should be no -Wunused-parameter compiler warning when the
>>> parameter is used.
>>>
>>> would it feel better to move the "FP" warnings about virtual functions,
>>> for instance to clang-tidy?
>>>
>>> > If you enable this warning, you probably want to know about unused
>>> parameters, independent of if your function is virtual or not, no?
>>>
>>> imho there are some compiler warnings that are too noisy. I don't like
>>> to get a warning when there is obviously no bug:
>>>
>>> sign compare:
>>>   if the signed value is obviously not negative then there is no bug:
>>> signed x;  .. if (x>10 && x < s.size())
>>> unused parameter:
>>>   could check in the current translation unit if the parameter is used
>>> in an overloaded method.
>>>
>>
>> It doesn't warn about the presence of the parameter, but about the
>> presence of the name. If you say f(int, int) instead of f(int a, int b)
>> then the warning won't fire.
>>
>
>
>> (And if you don't like this warning, then don't enable it.)
>>
>
> This isn't usually the approach we take with Clang's warnings - we try to
> remove false positives (where "false positive" is usually defined as
> "diagnoses something which is not a bug" (where bug is defined as "the
> resulting program behaves in a way that the user doesn't intend/expect"))
> where practical.
>

Sure, for warnings that are supposed to find bugs. The -Wunused warnings
warn about stuff that's unused, not bugs.


>
> If the subset of cases where this warning fires on parameters to virtual
> functions produces more noise (if a significant % of cases just result in
> commenting out the parameter name rather than removing the parameter) than
> signal, it's certainly within the realm of discussion that we have about
> whether that subset of cases is worth keeping in the warning.
>
> - David
>
>
>>
>>
>>> constructor initialization order:
>>>   should not warn if the order obviously does not matter. for instance
>>> initialization order of pod variables using constants.
>>> etc
>>>
>>> Best regards,
>>> Daniel Marjamäki
>>>
>>>
>>> ..
>>> Daniel Marjamäki Senior Engineer
>>> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>>>
>>> Mobile: +46 (0)709 12 42 62
>>> E-mail: daniel.marjam...@evidente.se
>>>
>>> www.evidente.se
>>>
>>> 
>>> Från: tha...@google.com [tha...@google.com] för Nico Weber [
>>> tha...@chromium.org]
>>> Skickat: den 11 augusti 2015 20:50
>>> Till: David Blaikie
>>> Kopia: reviews+d11940+public+578c1335b27aa...@reviews.llvm.org; Daniel
>>> Marjamäki; cfe-commits@lists.llvm.org
>>> Ämne: Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual
>>> method or method that overrides base class method
>>>
>>> On Tue, Aug 11, 2015 at 11:32 AM, David Blaikie >> > wrote:
>>>
>>>
>>> On Tue, Aug 11, 2015 at 8:46 AM, Nico Weber via cfe-commits <
>>> cfe-commits@lists.llvm.org> wrote:
>>> Can't you just change your signature to
>>>
>>>   virtual void a(int /* x */) {}
>>>
>>> in these cases?
>>>
>>> You could - does it add much value to do that, though?
>>>
>>> If you enable this warning, you probably want to know about unused
>>> parameters, independent of if your function is virtual or not, no?
>>>
>>> (perhaps it does - it means you express the intent that the parameter is
>>> not used and the compiler helps you check that (so that for the parameters
>>> you think /should/ be used (you haven't commented out their name but
>>> accidentally shadow or otherwise fail to reference, you still get a
>>> warning))
>>>
>>> - David
>>>
>>>
>>> On Tue, Aug 11, 2015 at 6:43 AM, Daniel Marjamäki <
>>> cfe-commits@lists.llvm.org> wrote:
>>> danielmarjamaki created this revision.
>>> danielmarjamaki added a reviewer: krememek.
>>> danielmarjamaki added a subscriber: cfe-commits.
>>>
>>> Don't diagnose -Wunused-parameter in methods that override other methods
>>> because the overridden methods might use the parameter
>>>
>>> Don't diagnose -Wunused-parameter in virtual methods because these might
>>> be overriden by other methods that use the parameter.
>>>
>>> Such diagnostics could be more accurately written if they are based on
>>> whole-program-analysis that establish if such parameter is unused in all
>>> methods.
>>>
>>>
>>>
>>> http://reviews.llvm.org/D11940
>>>
>>> Files:
>>>   lib/Sema/SemaDecl.cpp
>>>   test/SemaCXX/warn-unused-parameters.cpp
>>>
>>> Index: test/SemaCXX/warn-unused-parameters.cpp
>>> ===
>>>

Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-12 Thread David Blaikie via cfe-commits
On Wed, Aug 12, 2015 at 10:11 AM, Nico Weber  wrote:

> On Tue, Aug 11, 2015 at 10:15 PM, Daniel Marjamäki <
> daniel.marjam...@evidente.se> wrote:
>
>>
>> ideally there should be no -Wunused-parameter compiler warning when the
>> parameter is used.
>>
>> would it feel better to move the "FP" warnings about virtual functions,
>> for instance to clang-tidy?
>>
>> > If you enable this warning, you probably want to know about unused
>> parameters, independent of if your function is virtual or not, no?
>>
>> imho there are some compiler warnings that are too noisy. I don't like to
>> get a warning when there is obviously no bug:
>>
>> sign compare:
>>   if the signed value is obviously not negative then there is no bug:
>> signed x;  .. if (x>10 && x < s.size())
>> unused parameter:
>>   could check in the current translation unit if the parameter is used in
>> an overloaded method.
>>
>
> It doesn't warn about the presence of the parameter, but about the
> presence of the name. If you say f(int, int) instead of f(int a, int b)
> then the warning won't fire.
>


> (And if you don't like this warning, then don't enable it.)
>

This isn't usually the approach we take with Clang's warnings - we try to
remove false positives (where "false positive" is usually defined as
"diagnoses something which is not a bug" (where bug is defined as "the
resulting program behaves in a way that the user doesn't intend/expect"))
where practical.

If the subset of cases where this warning fires on parameters to virtual
functions produces more noise (if a significant % of cases just result in
commenting out the parameter name rather than removing the parameter) than
signal, it's certainly within the realm of discussion that we have about
whether that subset of cases is worth keeping in the warning.

- David


>
>
>> constructor initialization order:
>>   should not warn if the order obviously does not matter. for instance
>> initialization order of pod variables using constants.
>> etc
>>
>> Best regards,
>> Daniel Marjamäki
>>
>>
>> ..
>> Daniel Marjamäki Senior Engineer
>> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>>
>> Mobile: +46 (0)709 12 42 62
>> E-mail: daniel.marjam...@evidente.se
>>
>> www.evidente.se
>>
>> 
>> Från: tha...@google.com [tha...@google.com] för Nico Weber [
>> tha...@chromium.org]
>> Skickat: den 11 augusti 2015 20:50
>> Till: David Blaikie
>> Kopia: reviews+d11940+public+578c1335b27aa...@reviews.llvm.org; Daniel
>> Marjamäki; cfe-commits@lists.llvm.org
>> Ämne: Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual
>> method or method that overrides base class method
>>
>> On Tue, Aug 11, 2015 at 11:32 AM, David Blaikie > > wrote:
>>
>>
>> On Tue, Aug 11, 2015 at 8:46 AM, Nico Weber via cfe-commits <
>> cfe-commits@lists.llvm.org> wrote:
>> Can't you just change your signature to
>>
>>   virtual void a(int /* x */) {}
>>
>> in these cases?
>>
>> You could - does it add much value to do that, though?
>>
>> If you enable this warning, you probably want to know about unused
>> parameters, independent of if your function is virtual or not, no?
>>
>> (perhaps it does - it means you express the intent that the parameter is
>> not used and the compiler helps you check that (so that for the parameters
>> you think /should/ be used (you haven't commented out their name but
>> accidentally shadow or otherwise fail to reference, you still get a
>> warning))
>>
>> - David
>>
>>
>> On Tue, Aug 11, 2015 at 6:43 AM, Daniel Marjamäki <
>> cfe-commits@lists.llvm.org> wrote:
>> danielmarjamaki created this revision.
>> danielmarjamaki added a reviewer: krememek.
>> danielmarjamaki added a subscriber: cfe-commits.
>>
>> Don't diagnose -Wunused-parameter in methods that override other methods
>> because the overridden methods might use the parameter
>>
>> Don't diagnose -Wunused-parameter in virtual methods because these might
>> be overriden by other methods that use the parameter.
>>
>> Such diagnostics could be more accurately written if they are based on
>> whole-program-analysis that establish if such parameter is unused in all
>> methods.
>>
>>
>>
>> http://reviews.llvm.org/D11940
>>
>> Files:
>>   lib/Sema/SemaDecl.cpp
>>   test/SemaCXX/warn-unused-parameters.cpp
>>
>> Index: test/SemaCXX/warn-unused-parameters.cpp
>> ===
>> --- test/SemaCXX/warn-unused-parameters.cpp
>> +++ test/SemaCXX/warn-unused-parameters.cpp
>> @@ -32,3 +32,20 @@
>>auto l = [&t...]() { return sizeof...(s); };
>>return l();
>>  }
>> +
>> +// Don't diagnose virtual methods or methods that override base class
>> +// methods.
>> +class Base {
>> +public:
>> +  virtual

[PATCH] D11983: Make getToolChain actually cache its result, as documented in Driver.h

2015-08-12 Thread Douglas Katzman via cfe-commits
dougk created this revision.
dougk added a reviewer: chandlerc.
dougk added a subscriber: cfe-commits.

http://reviews.llvm.org/D11983

Files:
  lib/Driver/Driver.cpp

Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2248,6 +2248,7 @@
 TC = new toolchains::Generic_GCC(*this, Target, Args);
   break;
 }
+ToolChains[Target.str()] = TC;
   }
   return *TC;
 }


Index: lib/Driver/Driver.cpp
===
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -2248,6 +2248,7 @@
 TC = new toolchains::Generic_GCC(*this, Target, Args);
   break;
 }
+ToolChains[Target.str()] = TC;
   }
   return *TC;
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D11916: [CONCEPTS] Add diagnostic; invalid tag when concept specified

2015-08-12 Thread Nathan Wilson via cfe-commits
nwilson updated this revision to Diff 31957.
nwilson added a comment.

Addressing comments which were discussed on the mailing list - Apply the same 
text when diagnosing a free standing declaration as suggested by Aaron. Replace 
diagnostic identifier err_concept_decl_non_template with 
err_concept_wrong_decl_kind as suggested by Hubert and Richard.  Fix tests 
corresponding to the changes.


http://reviews.llvm.org/D11916

Files:
  include/clang/Basic/DiagnosticSemaKinds.td
  lib/Sema/SemaDecl.cpp
  test/SemaCXX/cxx-concept-declaration.cpp

Index: test/SemaCXX/cxx-concept-declaration.cpp
===
--- test/SemaCXX/cxx-concept-declaration.cpp
+++ test/SemaCXX/cxx-concept-declaration.cpp
@@ -23,3 +23,13 @@
 template
 concept bool D6; // expected-error {{variable concept declaration must be 
initialized}}
 
+// Tag
+concept class CC1 {}; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+concept struct CS1 {}; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+concept union CU1 {}; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+concept enum CE1 {}; // expected-error {{'concept' can only appear on the 
definition of a function template or variable template}}
+template  concept class TCC1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
+template  concept struct TCS1 {}; // expected-error {{'concept' 
can only appear on the definition of a function template or variable template}}
+template  concept union TCU1 {}; // expected-error {{'concept' can 
only appear on the definition of a function template or variable template}}
+
+concept bool; // expected-error {{'concept' can only appear on the definition 
of a function template or variable template}}
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -3662,6 +3662,14 @@
 return TagD;
   }
 
+  if (DS.isConceptSpecified()) {
+// C++ Concepts TS [dcl.spec.concept]p1: A concept definition refers to
+// either a function concept and its definition or a variable concept and
+// its initializer.
+Diag(DS.getConceptSpecLoc(), diag::err_concept_wrong_decl_kind);
+return TagD;
+  }
+
   DiagnoseFunctionSpecifiers(DS);
 
   if (DS.isFriendSpecified()) {
@@ -4865,7 +4873,7 @@
 // template, declared in namespace scope
 if (!TemplateParamLists.size()) {
   Diag(D.getDeclSpec().getConceptSpecLoc(),
-   diag::err_concept_decl_non_template);
+   diag:: err_concept_wrong_decl_kind);
   return nullptr;
 }
 
Index: include/clang/Basic/DiagnosticSemaKinds.td
===
--- include/clang/Basic/DiagnosticSemaKinds.td
+++ include/clang/Basic/DiagnosticSemaKinds.td
@@ -1965,7 +1965,7 @@
   "use __attribute__((visibility(\"hidden\"))) attribute instead">;
 
 // C++ Concepts TS
-def err_concept_decl_non_template : Error<
+def err_concept_wrong_decl_kind : Error<
   "'concept' can only appear on the definition of a function template or 
variable template">;
 def err_concept_decls_may_only_appear_in_namespace_scope : Error<
   "concept declarations may only appear in namespace scope">;


Index: test/SemaCXX/cxx-concept-declaration.cpp
===
--- test/SemaCXX/cxx-concept-declaration.cpp
+++ test/SemaCXX/cxx-concept-declaration.cpp
@@ -23,3 +23,13 @@
 template
 concept bool D6; // expected-error {{variable concept declaration must be initialized}}
 
+// Tag
+concept class CC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+concept struct CS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+concept union CU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+concept enum CE1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+template  concept class TCC1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+template  concept struct TCS1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+template  concept union TCU1 {}; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
+
+concept bool; // expected-error {{'concept' can only appear on the definition of a function template or variable template}}
Index: lib/Sema/SemaDecl.cpp
=

LLVM buildmaster will be restarted tonight

2015-08-12 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be restarted after 6 PM Pacific time today.

Thanks

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


[libunwind] r244774 - Merging r244005:

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 12:16:39 2015
New Revision: 244774

URL: http://llvm.org/viewvc/llvm-project?rev=244774&view=rev
Log:
Merging r244005:

r244005 | tbrethou | 2015-08-04 21:01:47 -0700 (Tue, 04 Aug 2015) | 2 lines

Update to new lists.llvm.org



Modified:
libunwind/branches/release_37/   (props changed)
libunwind/branches/release_37/CMakeLists.txt

Propchange: libunwind/branches/release_37/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 12 12:16:39 2015
@@ -1 +1 @@
-/libunwind/trunk:242642,243073,244237
+/libunwind/trunk:242642,243073,244005,244237

Modified: libunwind/branches/release_37/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libunwind/branches/release_37/CMakeLists.txt?rev=244774&r1=244773&r2=244774&view=diff
==
--- libunwind/branches/release_37/CMakeLists.txt (original)
+++ libunwind/branches/release_37/CMakeLists.txt Wed Aug 12 12:16:39 2015
@@ -60,7 +60,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   set(PACKAGE_NAME libunwind)
   set(PACKAGE_VERSION 3.7.0)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-  set(PACKAGE_BUGREPORT "llvmb...@cs.uiuc.edu")
+  set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 
   if (EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
 set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)


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


[libcxxabi] r244773 - Merging r244004:

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 12:16:15 2015
New Revision: 244773

URL: http://llvm.org/viewvc/llvm-project?rev=244773&view=rev
Log:
Merging r244004:

r244004 | tbrethou | 2015-08-04 21:01:26 -0700 (Tue, 04 Aug 2015) | 2 lines

Update to new lists.llvm.org



Modified:
libcxxabi/branches/release_37/   (props changed)
libcxxabi/branches/release_37/CMakeLists.txt
libcxxabi/branches/release_37/www/index.html

Propchange: libcxxabi/branches/release_37/
--
svn:mergeinfo = /libcxxabi/trunk:244004

Modified: libcxxabi/branches/release_37/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_37/CMakeLists.txt?rev=244773&r1=244772&r2=244773&view=diff
==
--- libcxxabi/branches/release_37/CMakeLists.txt (original)
+++ libcxxabi/branches/release_37/CMakeLists.txt Wed Aug 12 12:16:15 2015
@@ -66,7 +66,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURR
   set(PACKAGE_NAME libcxxabi)
   set(PACKAGE_VERSION 3.7.0svn)
   set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-  set(PACKAGE_BUGREPORT "llvmb...@cs.uiuc.edu")
+  set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 
   if(EXISTS ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)
 set(LLVM_LIT ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py)

Modified: libcxxabi/branches/release_37/www/index.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxxabi/branches/release_37/www/index.html?rev=244773&r1=244772&r2=244773&view=diff
==
--- libcxxabi/branches/release_37/www/index.html (original)
+++ libcxxabi/branches/release_37/www/index.html Wed Aug 12 12:16:15 2015
@@ -22,8 +22,8 @@
 
   
 Quick Links
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev";>cfe-dev
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits";>cfe-commits
+http://lists.llvm.org/mailman/listinfo/cfe-dev";>cfe-dev
+http://lists.llvm.org/mailman/listinfo/cfe-commits";>cfe-commits
 http://llvm.org/bugs/";>Bug Reports
 http://llvm.org/svn/llvm-project/libcxxabi/trunk/";>Browse SVN
 http://llvm.org/viewvc/llvm-project/libcxxabi/trunk/";>Browse 
ViewVC
@@ -119,7 +119,7 @@
   a different ABI library), this may interfere with test results.
 
   Send discussions to the
-  (http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev";>clang mailing 
list).
+  (http://lists.llvm.org/mailman/listinfo/cfe-dev";>clang mailing 
list).
 
   
   Frequently asked questions


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


[libcxx] r244772 - Merging r244003:

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 12:15:27 2015
New Revision: 244772

URL: http://llvm.org/viewvc/llvm-project?rev=244772&view=rev
Log:
Merging r244003:

r244003 | tbrethou | 2015-08-04 20:59:14 -0700 (Tue, 04 Aug 2015) | 2 lines

Update references to lists.llvm.org



Modified:
libcxx/branches/release_37/   (props changed)
libcxx/branches/release_37/CMakeLists.txt
libcxx/branches/release_37/www/atomic_design.html
libcxx/branches/release_37/www/atomic_design_a.html
libcxx/branches/release_37/www/atomic_design_b.html
libcxx/branches/release_37/www/atomic_design_c.html
libcxx/branches/release_37/www/cxx1y_status.html
libcxx/branches/release_37/www/cxx1z_status.html
libcxx/branches/release_37/www/index.html
libcxx/branches/release_37/www/lit_usage.html
libcxx/branches/release_37/www/ts1z_status.html
libcxx/branches/release_37/www/type_traits_design.html

Propchange: libcxx/branches/release_37/
--
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Aug 12 12:15:27 2015
@@ -1,2 +1,2 @@
 /libcxx/branches/apple:136569-137939
-/libcxx/trunk:242377,242421,243530,243641,244462
+/libcxx/trunk:242377,242421,243530,243641,244003,244462

Modified: libcxx/branches/release_37/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/CMakeLists.txt?rev=244772&r1=244771&r2=244772&view=diff
==
--- libcxx/branches/release_37/CMakeLists.txt (original)
+++ libcxx/branches/release_37/CMakeLists.txt Wed Aug 12 12:15:27 2015
@@ -14,7 +14,7 @@ endif()
 set(PACKAGE_NAME libcxx)
 set(PACKAGE_VERSION trunk-svn)
 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
-set(PACKAGE_BUGREPORT "llvmb...@cs.uiuc.edu")
+set(PACKAGE_BUGREPORT "llvm-b...@lists.llvm.org")
 
 # Add path for custom modules
 set(CMAKE_MODULE_PATH

Modified: libcxx/branches/release_37/www/atomic_design.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/www/atomic_design.html?rev=244772&r1=244771&r2=244772&view=diff
==
--- libcxx/branches/release_37/www/atomic_design.html (original)
+++ libcxx/branches/release_37/www/atomic_design.html Wed Aug 12 12:15:27 2015
@@ -22,8 +22,8 @@
 
   
 Quick Links
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev";>cfe-dev
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits";>cfe-commits
+http://lists.llvm.org/mailman/listinfo/cfe-dev";>cfe-dev
+http://lists.llvm.org/mailman/listinfo/cfe-commits";>cfe-commits
 http://llvm.org/bugs/";>Bug Reports
 http://llvm.org/svn/llvm-project/libcxx/trunk/";>Browse SVN
 http://llvm.org/viewvc/llvm-project/libcxx/trunk/";>Browse 
ViewVC

Modified: libcxx/branches/release_37/www/atomic_design_a.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/www/atomic_design_a.html?rev=244772&r1=244771&r2=244772&view=diff
==
--- libcxx/branches/release_37/www/atomic_design_a.html (original)
+++ libcxx/branches/release_37/www/atomic_design_a.html Wed Aug 12 12:15:27 2015
@@ -22,8 +22,8 @@
 
   
 Quick Links
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev";>cfe-dev
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits";>cfe-commits
+http://lists.llvm.org/mailman/listinfo/cfe-dev";>cfe-dev
+http://lists.llvm.org/mailman/listinfo/cfe-commits";>cfe-commits
 http://llvm.org/bugs/";>Bug Reports
 http://llvm.org/svn/llvm-project/libcxx/trunk/";>Browse SVN
 http://llvm.org/viewvc/llvm-project/libcxx/trunk/";>Browse 
ViewVC

Modified: libcxx/branches/release_37/www/atomic_design_b.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/www/atomic_design_b.html?rev=244772&r1=244771&r2=244772&view=diff
==
--- libcxx/branches/release_37/www/atomic_design_b.html (original)
+++ libcxx/branches/release_37/www/atomic_design_b.html Wed Aug 12 12:15:27 2015
@@ -22,8 +22,8 @@
 
   
 Quick Links
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev";>cfe-dev
-http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits";>cfe-commits
+http://lists.llvm.org/mailman/listinfo/cfe-dev";>cfe-dev
+http://lists.llvm.org/mailman/listinfo/cfe-commits";>cfe-commits
 http://llvm.org/bugs/";>Bug Reports
 http://llvm.org/svn/llvm-project/libcxx/trunk/";>Browse SVN
 http://llvm.org/viewvc/llvm-project/libcxx/trunk/";>Browse 
ViewVC

Modified: libcxx/branches/release_37/www/atomic_design_c.html
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/branches/release_37/www/atomic_design_c.html?rev=244772&r1=244771&r2

Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual method or method that overrides base class method

2015-08-12 Thread Nico Weber via cfe-commits
On Tue, Aug 11, 2015 at 10:15 PM, Daniel Marjamäki <
daniel.marjam...@evidente.se> wrote:

>
> ideally there should be no -Wunused-parameter compiler warning when the
> parameter is used.
>
> would it feel better to move the "FP" warnings about virtual functions,
> for instance to clang-tidy?
>
> > If you enable this warning, you probably want to know about unused
> parameters, independent of if your function is virtual or not, no?
>
> imho there are some compiler warnings that are too noisy. I don't like to
> get a warning when there is obviously no bug:
>
> sign compare:
>   if the signed value is obviously not negative then there is no bug:
> signed x;  .. if (x>10 && x < s.size())
> unused parameter:
>   could check in the current translation unit if the parameter is used in
> an overloaded method.
>

It doesn't warn about the presence of the parameter, but about the presence
of the name. If you say f(int, int) instead of f(int a, int b) then the
warning won't fire. (And if you don't like this warning, then don't enable
it.)


> constructor initialization order:
>   should not warn if the order obviously does not matter. for instance
> initialization order of pod variables using constants.
> etc
>
> Best regards,
> Daniel Marjamäki
>
>
> ..
> Daniel Marjamäki Senior Engineer
> Evidente ES East AB  Warfvinges väg 34  SE-112 51 Stockholm  Sweden
>
> Mobile: +46 (0)709 12 42 62
> E-mail: daniel.marjam...@evidente.se
>
> www.evidente.se
>
> 
> Från: tha...@google.com [tha...@google.com] för Nico Weber [
> tha...@chromium.org]
> Skickat: den 11 augusti 2015 20:50
> Till: David Blaikie
> Kopia: reviews+d11940+public+578c1335b27aa...@reviews.llvm.org; Daniel
> Marjamäki; cfe-commits@lists.llvm.org
> Ämne: Re: [PATCH] D11940: don't diagnose -Wunused-parameter in virtual
> method or method that overrides base class method
>
> On Tue, Aug 11, 2015 at 11:32 AM, David Blaikie  > wrote:
>
>
> On Tue, Aug 11, 2015 at 8:46 AM, Nico Weber via cfe-commits <
> cfe-commits@lists.llvm.org> wrote:
> Can't you just change your signature to
>
>   virtual void a(int /* x */) {}
>
> in these cases?
>
> You could - does it add much value to do that, though?
>
> If you enable this warning, you probably want to know about unused
> parameters, independent of if your function is virtual or not, no?
>
> (perhaps it does - it means you express the intent that the parameter is
> not used and the compiler helps you check that (so that for the parameters
> you think /should/ be used (you haven't commented out their name but
> accidentally shadow or otherwise fail to reference, you still get a
> warning))
>
> - David
>
>
> On Tue, Aug 11, 2015 at 6:43 AM, Daniel Marjamäki <
> cfe-commits@lists.llvm.org> wrote:
> danielmarjamaki created this revision.
> danielmarjamaki added a reviewer: krememek.
> danielmarjamaki added a subscriber: cfe-commits.
>
> Don't diagnose -Wunused-parameter in methods that override other methods
> because the overridden methods might use the parameter
>
> Don't diagnose -Wunused-parameter in virtual methods because these might
> be overriden by other methods that use the parameter.
>
> Such diagnostics could be more accurately written if they are based on
> whole-program-analysis that establish if such parameter is unused in all
> methods.
>
>
>
> http://reviews.llvm.org/D11940
>
> Files:
>   lib/Sema/SemaDecl.cpp
>   test/SemaCXX/warn-unused-parameters.cpp
>
> Index: test/SemaCXX/warn-unused-parameters.cpp
> ===
> --- test/SemaCXX/warn-unused-parameters.cpp
> +++ test/SemaCXX/warn-unused-parameters.cpp
> @@ -32,3 +32,20 @@
>auto l = [&t...]() { return sizeof...(s); };
>return l();
>  }
> +
> +// Don't diagnose virtual methods or methods that override base class
> +// methods.
> +class Base {
> +public:
> +  virtual void f(int x);
> +};
> +
> +class Derived : public Base {
> +public:
> +  // Don't warn in overridden methods.
> +  virtual void f(int x) {}
> +
> +  // Don't warn in virtual methods.
> +  virtual void a(int x) {}
> +};
> +
> Index: lib/Sema/SemaDecl.cpp
> ===
> --- lib/Sema/SemaDecl.cpp
> +++ lib/Sema/SemaDecl.cpp
> @@ -10797,8 +10797,13 @@
>
>  if (!FD->isInvalidDecl()) {
>// Don't diagnose unused parameters of defaulted or deleted
> functions.
> -  if (!FD->isDeleted() && !FD->isDefaulted())
> -DiagnoseUnusedParameters(FD->param_begin(), FD->param_end());
> +  if (!FD->isDeleted() && !FD->isDefaulted()) {
> +// Don't diagnose unused parameters in virtual methods or
> +// in methods that override base class methods.
> +const auto MD =

Re: r244719 - [OPENMP] Fix for http://llvm.org/PR24430: clang hangs on invalid input with openmp directive

2015-08-12 Thread Hans Wennborg via cfe-commits
On Wed, Aug 12, 2015 at 12:10 AM, Alexey Bataev via cfe-commits
 wrote:
> Author: abataev
> Date: Wed Aug 12 02:10:54 2015
> New Revision: 244719
>
> URL: http://llvm.org/viewvc/llvm-project?rev=244719&view=rev
> Log:
> [OPENMP] Fix for http://llvm.org/PR24430: clang hangs on invalid input with 
> openmp directive
>
> Add parsing of openmp directives inside structs/unions in C mode.

Merged to 3.7 in r244766. As requested by Alexey on
https://llvm.org/bugs/show_bug.cgi?id=24430#c1
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D10365: Add cmd to compilation database file format

2015-08-12 Thread Daniel Dilts via cfe-commits
diltsman updated this revision to Diff 31952.
diltsman marked an inline comment as done.

http://reviews.llvm.org/D10365

Files:
  ../llvm/tools/clang/include/clang/Tooling/JSONCompilationDatabase.h
  ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp
  ../llvm/tools/clang/unittests/Tooling/CompilationDatabaseTest.cpp

Index: ../llvm/tools/clang/unittests/Tooling/CompilationDatabaseTest.cpp
===
--- ../llvm/tools/clang/unittests/Tooling/CompilationDatabaseTest.cpp
+++ ../llvm/tools/clang/unittests/Tooling/CompilationDatabaseTest.cpp
@@ -36,8 +36,13 @@
   expectFailure("[{[]:\"\"}]", "Incorrectly typed entry");
   expectFailure("[{}]", "Empty entry");
   expectFailure("[{\"directory\":\"\",\"command\":\"\"}]", "Missing file");
-  expectFailure("[{\"directory\":\"\",\"file\":\"\"}]", "Missing command");
+  expectFailure("[{\"directory\":\"\",\"file\":\"\"}]", "Missing command or arguments");
   expectFailure("[{\"command\":\"\",\"file\":\"\"}]", "Missing directory");
+  expectFailure("[{\"directory\":\"\",\"arguments\":[]}]", "Missing file");
+  expectFailure("[{\"arguments\":\"\",\"file\":\"\"}]", "Missing directory");
+  expectFailure("[{\"command\":\"\",\"arguments\":[],\"file\":\"\"}]", "Command and arguments");
+  expectFailure("[{\"directory\":\"\",\"arguments\":\"\",\"file\":\"\"}]", "Arguments not array");
+  expectFailure("[{\"directory\":\"\",\"command\":[],\"file\":\"\"}]", "Command not string");
 }
 
 static std::vector getAllFiles(StringRef JSONDatabase,
Index: ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp
===
--- ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp
+++ ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp
@@ -221,9 +221,8 @@
 SmallString<8> DirectoryStorage;
 SmallString<1024> CommandStorage;
 Commands.emplace_back(
-// FIXME: Escape correctly:
-CommandsRef[I].first->getValue(DirectoryStorage),
-unescapeCommandLine(CommandsRef[I].second->getValue(CommandStorage)));
+  CommandsRef[I].first->getValue(DirectoryStorage),
+  CommandsRef[I].second);
   }
 }
 
@@ -243,44 +242,66 @@
 ErrorMessage = "Expected array.";
 return false;
   }
-  for (llvm::yaml::SequenceNode::iterator AI = Array->begin(),
-  AE = Array->end();
-   AI != AE; ++AI) {
-llvm::yaml::MappingNode *Object = dyn_cast(&*AI);
+  for (auto& NextObject : *Array) {
+llvm::yaml::MappingNode *Object = dyn_cast(&NextObject);
 if (!Object) {
   ErrorMessage = "Expected object.";
   return false;
 }
 llvm::yaml::ScalarNode *Directory = nullptr;
-llvm::yaml::ScalarNode *Command = nullptr;
+std::vector Args;
+bool CommandFound = false;
 llvm::yaml::ScalarNode *File = nullptr;
-for (llvm::yaml::MappingNode::iterator KVI = Object->begin(),
-   KVE = Object->end();
- KVI != KVE; ++KVI) {
-  llvm::yaml::Node *Value = (*KVI).getValue();
+for (auto& NextKeyValue : *Object) {
+  llvm::yaml::ScalarNode *KeyString =
+  dyn_cast(NextKeyValue.getKey());
+  if (!KeyString) {
+ErrorMessage = "Expected strings as key.";
+return false;
+  }
+  SmallString<8> KeyStorage;
+  StringRef KeyValue = KeyString->getValue(KeyStorage);
+  llvm::yaml::Node *Value = NextKeyValue.getValue();
   if (!Value) {
 ErrorMessage = "Expected value.";
 return false;
   }
   llvm::yaml::ScalarNode *ValueString =
   dyn_cast(Value);
-  if (!ValueString) {
-ErrorMessage = "Expected string as value.";
+  llvm::yaml::SequenceNode *SequenceString =
+  dyn_cast(Value);
+  if (KeyValue == "arguments" && !SequenceString) {
+ErrorMessage = "Expected sequence as value.";
 return false;
-  }
-  llvm::yaml::ScalarNode *KeyString =
-  dyn_cast((*KVI).getKey());
-  if (!KeyString) {
-ErrorMessage = "Expected strings as key.";
+  } else if (KeyValue != "arguments" && !ValueString) {
+ErrorMessage = "Expected string as value.";
 return false;
   }
-  SmallString<8> KeyStorage;
-  if (KeyString->getValue(KeyStorage) == "directory") {
+  if (KeyValue == "directory") {
 Directory = ValueString;
-  } else if (KeyString->getValue(KeyStorage) == "command") {
-Command = ValueString;
-  } else if (KeyString->getValue(KeyStorage) == "file") {
+  } else if (KeyValue == "command") {
+if (CommandFound) {
+  ErrorMessage = "Multiple command and arguments found";
+  return false;
+}
+SmallString<1024> CommandStorage;
+// FIXME: Escape correctly:
+Args = unescapeCommandLine(ValueString->getValue(CommandStorage));
+CommandFound = true;
+  } else if (KeyValue 

Re: [PATCH] D10365: Add cmd to compilation database file format

2015-08-12 Thread Daniel Dilts via cfe-commits
diltsman added inline comments.


Comment at: ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp:299
@@ +298,3 @@
+if (CommandFound) {
+  ErrorMessage = "Multiple command and arguments found";
+  return false;

klimek wrote:
> Any reason we don't want to allow both, but prefer the arguments?
I don't see how the arguments are preferred.

I was thinking that the user would either want to use the command line or list 
arguments.  Is there a case where someone would want to do both?

Also, if we permit both, do we need to do any kind of uniquing?


Comment at: ../llvm/tools/clang/lib/Tooling/JSONCompilationDatabase.cpp:302-304
@@ +301,5 @@
+}
+for (llvm::yaml::SequenceNode::iterator CI = SequenceString->begin(),
+  CE = SequenceString->end();
+  CI != CE; ++CI) {
+  SmallString<128> CommandStorage;

klimek wrote:
> Can we use for-range loops with auto?
I changed two other locations to range-based for loops, too.


http://reviews.llvm.org/D10365



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


r244761 - ReleaseNotes: Small version nbr fix

2015-08-12 Thread Hans Wennborg via cfe-commits
Author: hans
Date: Wed Aug 12 11:40:42 2015
New Revision: 244761

URL: http://llvm.org/viewvc/llvm-project?rev=244761&view=rev
Log:
ReleaseNotes: Small version nbr fix

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=244761&r1=244760&r2=244761&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Wed Aug 12 11:40:42 2015
@@ -54,7 +54,7 @@ Improvements to Clang's diagnostics
 
 Clang's diagnostics are constantly being improved to catch more issues,
 explain them more clearly, and provide more accurate source information
-about them. The improvements since the 3.5 release include:
+about them. The improvements since the 3.7 release include:
 
 -  ...
 


___
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-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs updated this revision to Diff 31949.
jroelofs added a comment.

Add license text to the new file, and move the two has-no-threads tests to 
test/libcxx.


http://reviews.llvm.org/D11963

Files:
  CMakeLists.txt
  include/CMakeLists.txt
  include/__config
  include/__config_site.in
  test/libcxx/atomics/libcpp-has-no-threads.pass.cpp
  test/libcxx/test/config.py
  test/std/atomics/libcpp-has-no-threads.fail.cpp
  test/std/atomics/libcpp-has-no-threads.pass.cpp
  test/std/utilities/date.time/tested_elsewhere.pass.cpp

Index: test/std/utilities/date.time/tested_elsewhere.pass.cpp
===
--- test/std/utilities/date.time/tested_elsewhere.pass.cpp
+++ test/std/utilities/date.time/tested_elsewhere.pass.cpp
@@ -30,9 +30,11 @@
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#ifndef _LIBCPP_HAS_NO_THREAD_UNSAFE_C_FUNCTIONS
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
 static_assert((std::is_same::value), "");
+#endif
 static_assert((std::is_same::value), "");
 }
Index: test/std/atomics/libcpp-has-no-threads.pass.cpp
===
--- test/std/atomics/libcpp-has-no-threads.pass.cpp
+++ test/std/atomics/libcpp-has-no-threads.pass.cpp
@@ -1,18 +0,0 @@
-//===--===//
-//
-// 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.
-//
-//===--===//
-// XFAIL: libcpp-has-no-threads
-
-#ifdef _LIBCPP_HAS_NO_THREADS
-#error This should be XFAIL'd for the purpose of detecting that the LIT feature\
- 'libcpp-has-no-threads' is available iff _LIBCPP_HAS_NO_THREADS is defined
-#endif
-
-int main()
-{
-}
Index: test/std/atomics/libcpp-has-no-threads.fail.cpp
===
--- test/std/atomics/libcpp-has-no-threads.fail.cpp
+++ test/std/atomics/libcpp-has-no-threads.fail.cpp
@@ -1,23 +0,0 @@
-//===--===//
-//
-// 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.
-//
-//===--===//
-
-// 
-
-// Test that including  fails to compile when _LIBCPP_HAS_NO_THREADS
-// is defined.
-
-#ifndef _LIBCPP_HAS_NO_THREADS
-#define _LIBCPP_HAS_NO_THREADS
-#endif
-
-#include 
-
-int main()
-{
-}
Index: test/libcxx/test/config.py
===
--- test/libcxx/test/config.py
+++ test/libcxx/test/config.py
@@ -392,7 +392,7 @@
 self.cxx.compile_flags += ['-I' + support_path]
 self.cxx.compile_flags += ['-include', os.path.join(support_path, 'nasty_macros.hpp')]
 libcxx_headers = self.get_lit_conf(
-'libcxx_headers', os.path.join(self.libcxx_src_root, 'include'))
+'libcxx_headers', os.path.join(self.cxx_library_root, '..', 'include', 'c++', 'v1'))
 if not os.path.isdir(libcxx_headers):
 self.lit_config.fatal("libcxx_headers='%s' is not a directory."
   % libcxx_headers)
@@ -416,36 +416,28 @@
 if not enable_global_filesystem_namespace:
 self.config.available_features.add(
 'libcpp-has-no-global-filesystem-namespace')
-self.cxx.compile_flags += [
-'-D_LIBCPP_HAS_NO_GLOBAL_FILESYSTEM_NAMESPACE']
 
 def configure_compile_flags_no_stdin(self):
 enable_stdin = self.get_lit_bool('enable_stdin', True)
 if not enable_stdin:
 self.config.available_features.add('libcpp-has-no-stdin')
-self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDIN']
 
 def configure_compile_flags_no_stdout(self):
 enable_stdout = self.get_lit_bool('enable_stdout', True)
 if not enable_stdout:
 self.config.available_features.add('libcpp-has-no-stdout')
-self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_STDOUT']
 
 def configure_compile_flags_no_threads(self):
-self.cxx.compile_flags += ['-D_LIBCPP_HAS_NO_THREADS']
 self.config.available_features.add('libcpp-has-no-threads')
 
 def configure_compile_flags_no_thread_unsafe_c_functions(self):
 enable_thread_unsafe_c_functions = self.get_lit_bool(
 'enable_thread_unsafe_c_functions', True)
 if not enable_thread_unsafe_c_functions:
-self.cxx.compile_flags += [
-'-D_LIBCPP_HAS

Re: [PATCH] D11946: Create clang-tidy module modernize. Add pass-by-value check.

2015-08-12 Thread Angel Garcia via cfe-commits
angelgarcia updated this revision to Diff 31948.
angelgarcia marked 20 inline comments as done.
angelgarcia added a comment.

Fix tests and minor issues (auto, punctuation, etc).


http://reviews.llvm.org/D11946

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/Makefile
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/Makefile
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/PassByValueCheck.cpp
  clang-tidy/modernize/PassByValueCheck.h
  clang-tidy/tool/CMakeLists.txt
  clang-tidy/tool/ClangTidyMain.cpp
  clang-tidy/tool/Makefile
  test/clang-tidy/modernize-pass-by-value.cpp

Index: test/clang-tidy/modernize-pass-by-value.cpp
===
--- test/clang-tidy/modernize-pass-by-value.cpp
+++ test/clang-tidy/modernize-pass-by-value.cpp
@@ -0,0 +1,197 @@
+// RUN: $(dirname %s)/check_clang_tidy.sh %s modernize-pass-by-value %t
+// REQUIRES: shell
+
+// CHiECK-FIXES: #include 
+
+namespace {
+// POD types are trivially move constructible.
+struct Movable {
+  int a, b, c;
+};
+
+struct NotMovable {
+  NotMovable() = default;
+  NotMovable(const NotMovable &) = default;
+  NotMovable(NotMovable &&) = delete;
+  int a, b, c;
+};
+}
+
+struct A {
+  A(const Movable &M) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move [modernize-pass-by-value]
+  // CHECK-FIXES: A(Movable M) : M(std::move(M)) {}
+  Movable M;
+};
+
+// Test that we aren't modifying other things than a parameter
+Movable GlobalObj;
+struct B {
+  B(const Movable &M) : M(GlobalObj) {}
+  // CHECK-FIXES: B(const Movable &M) : M(GlobalObj) {}
+  Movable M;
+};
+
+// Test that a parameter with more than one reference to it won't be changed.
+struct C {
+  // Tests extra-reference in body
+  C(const Movable &M) : M(M) { this->i = M.a; }
+  // CHECK-FIXES: C(const Movable &M) : M(M) { this->i = M.a; }
+
+  // Tests extra-reference in init-list
+  C(const Movable &M, int) : M(M), i(M.a) {}
+  // CHECK-FIXES: C(const Movable &M, int) : M(M), i(M.a) {}
+  Movable M;
+  int i;
+};
+
+// Test that both declaration and definition are updated
+struct D {
+  D(const Movable &M);
+  // CHECK-FIXES: D(Movable M);
+  Movable M;
+};
+D::D(const Movable &M) : M(M) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: pass by value and use std::move
+// CHECK-FIXES: D::D(Movable M) : M(std::move(M)) {}
+
+// Test with default parameter
+struct E {
+  E(const Movable &M = Movable()) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move
+  // CHECK-FIXES: E(Movable M = Movable()) : M(std::move(M)) {}
+  Movable M;
+};
+
+// Test with object that can't be moved
+struct F {
+  F(const NotMovable &NM) : NM(NM) {}
+  // CHECK-FIXES: F(const NotMovable &NM) : NM(NM) {}
+  NotMovable NM;
+};
+
+// Test unnamed parameter in declaration
+struct G {
+  G(const Movable &);
+  // CHECK-FIXES: G(Movable );
+  Movable M;
+};
+G::G(const Movable &M) : M(M) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: pass by value and use std::move
+// CHECK-FIXES: G::G(Movable M) : M(std::move(M)) {}
+
+// Test parameter with and without qualifier
+namespace ns_H {
+typedef ::Movable HMovable;
+}
+struct H {
+  H(const ns_H::HMovable &M);
+  // CHECK-FIXES: H(ns_H::HMovable M);
+  ns_H::HMovable M;
+};
+using namespace ns_H;
+H::H(const HMovable &M) : M(M) {}
+// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: pass by value and use std::move
+// CHECK-FIXES: H(HMovable M) : M(std::move(M)) {}
+
+// Try messing up with macros
+#define MOVABLE_PARAM(Name) const Movable & Name
+// CHECK-FIXES: #define MOVABLE_PARAM(Name) const Movable & Name
+struct I {
+  I(MOVABLE_PARAM(M)) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move
+  // CHECK-FIXES: I(MOVABLE_PARAM(M)) : M(M) {}
+  Movable M;
+};
+#undef MOVABLE_PARAM
+
+// Test that templates aren't modified
+template  struct J {
+  J(const T &M) : M(M) {}
+  // CHECK-FIXES: J(const T &M) : M(M) {}
+  T M;
+};
+J j1(Movable());
+J j2(NotMovable());
+
+struct K_Movable {
+  K_Movable() = default;
+  K_Movable(const K_Movable &) = default;
+  K_Movable(K_Movable &&o) { dummy = o.dummy; }
+  int dummy;
+};
+
+// Test with movable type with an user defined move constructor.
+struct K {
+  K(const K_Movable &M) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move
+  // CHECK-FIXES: K(K_Movable M) : M(std::move(M)) {}
+  K_Movable M;
+};
+
+template  struct L {
+  L(const Movable &M) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move
+  // CHECK-FIXES: L(Movable M) : M(std::move(M)) {}
+  Movable M;
+};
+L l(Movable());
+
+// Test with a non-instantiated template class
+template  struct N {
+  N(const Movable &M) : M(M) {}
+  // CHECK-MESSAGES: :[[@LINE-1]]:5: warning: pass by value and use std::move
+  // CHECK-FIXES: N(Movable M) : M(std::move(M)) {}
+
+  Movable M;
+  T A;
+};
+
+// Test with value pa

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

2015-08-12 Thread Eric Fiselier via cfe-commits
EricWF added a reviewer: EricWF.
EricWF added a comment.

@jroelofs Thanks for this patch. I've needed this for a while.



Comment at: include/__config:19
@@ -18,1 +18,3 @@
+#include <__config_site>
+
 #ifdef __GNUC__

jroelofs wrote:
> jroelofs wrote:
> > mclow.lists wrote:
> > > espositofulvio wrote:
> > > > mclow.lists wrote:
> > > > > I'm reluctant to do this; because every include file slows down 
> > > > > compilation - for every program that we compile.
> > > > > 
> > > > > However, this may be the right thing to do.
> > > > I'm with Jonathan here, having config params dealt with this way it's 
> > > > easier and make things more manageable while the price of a slowdown, I 
> > > > think, shouldn't be substantial.
> > > I just realized that this will complicate life for libc++ developers. 
> > > Today, I can make a change in the checked-out directory, and test it by 
> > > using `clang -I `.  Now, I'll have to actually build and 
> > > install the headers some where to test.  [ Especially when testing 
> > > against an installed compiler whose libc++ does not have a __config_site 
> > > file ]
> > Another option would be to rename `__config` to `__config.in`, and put the 
> > `#cmakedefine` lines in here. Then the include tree isn't changed.
> > Now, I'll have to actually build and install the headers some where to test.
> 
> Just building is sufficient. The headers get copied to the build directory, 
> along with this new file.
> 
> 
> > [ Especially when testing against an installed compiler whose libc++ does 
> > not have a __config_site file ]
> 
> Why does your workflow rely on testing libcxx binaries against installed 
> headers from a _different_ build of the library? That seems very dicey.
> Just building is sufficient. The headers get copied to the build directory, 
> along with this new file.

Except in "exceptional" configurations the  `__config_site` file should 
essentially remain empty. We could put an empty `__config_site` file in the 
source directory and telling CMake to ignore it. This would prevent the need to 
rebuild libc++ as frequently for the majority of developers. 

 


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] D11403: [Modules] Add Darwin-specific compatibility module map parsing hacks

2015-08-12 Thread Ben Langmuir via cfe-commits
benlangmuir updated this revision to Diff 31947.
benlangmuir added a comment.

Changes per review.  I still need to check performance of code-completing 
import statements to make sure the extra directory iteration isn't a big 
regression.


Repository:
  rL LLVM

http://reviews.llvm.org/D11403

Files:
  include/clang/Basic/Module.h
  lib/Basic/Module.cpp
  lib/Lex/ModuleMap.cpp
  test/Modules/Inputs/System/usr/include/assert.h
  test/Modules/Inputs/System/usr/include/module.map
  test/Modules/Inputs/System/usr/include/tcl-private/header.h
  test/Modules/darwin_specific_modulemap_hacks.m

Index: test/Modules/darwin_specific_modulemap_hacks.m
===
--- /dev/null
+++ test/Modules/darwin_specific_modulemap_hacks.m
@@ -0,0 +1,22 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -isystem %S/Inputs/System/usr/include -triple x86_64-apple-darwin10 %s -verify -fsyntax-only
+// expected-no-diagnostics
+
+@import Darwin.C.excluded; // no error, header is implicitly 'textual'
+@import Tcl.Private;   // no error, header is implicitly 'textual'
+@import IOKit.avc; // no error, cplusplus requirement removed
+
+#if defined(DARWIN_C_EXCLUDED)
+#error assert.h should be textual
+#elif defined(TCL_PRIVATE)
+#error tcl-private/header.h should be textual
+#endif
+
+#import 
+#import 
+
+#if !defined(DARWIN_C_EXCLUDED)
+#error assert.h missing
+#elif !defined(TCL_PRIVATE)
+#error tcl-private/header.h missing
+#endif
Index: test/Modules/Inputs/System/usr/include/tcl-private/header.h
===
--- /dev/null
+++ test/Modules/Inputs/System/usr/include/tcl-private/header.h
@@ -0,0 +1,2 @@
+// tcl-private/header.h
+#define TCL_PRIVATE 1
Index: test/Modules/Inputs/System/usr/include/module.map
===
--- test/Modules/Inputs/System/usr/include/module.map
+++ test/Modules/Inputs/System/usr/include/module.map
@@ -30,3 +30,25 @@
   header "uses_other_constants.h"
   export *
 }
+
+module Darwin {
+  module C {
+module excluded {
+  requires excluded
+  header "assert.h"
+}
+  }
+}
+
+module Tcl {
+  module Private {
+requires excluded
+umbrella ""
+  }
+}
+
+module IOKit {
+  module avc {
+requires cplusplus
+  }
+}
Index: test/Modules/Inputs/System/usr/include/assert.h
===
--- /dev/null
+++ test/Modules/Inputs/System/usr/include/assert.h
@@ -0,0 +1,2 @@
+// assert.h
+#define DARWIN_C_EXCLUDED 1
Index: lib/Lex/ModuleMap.cpp
===
--- lib/Lex/ModuleMap.cpp
+++ lib/Lex/ModuleMap.cpp
@@ -1015,7 +1015,18 @@
 
 /// \brief The active module.
 Module *ActiveModule;
-
+
+/// \brief Whether a module uses the 'requires excluded' hack to mark its
+/// contents as 'textual'.
+///
+/// On older Darwin SDK versions, 'requires excluded' is used to mark the
+/// contents of the Darwin.C.excluded (assert.h) and Tcl.Private modules as
+/// non-modular headers.  For backwards compatibility, we continue to
+/// support
+/// this idiom for just these modules, and map the headers to 'textual' to
+/// match the original intent.
+llvm::SmallPtrSet UsesRequiresExcludedHack;
+
 /// \brief Consume the current token and return its location.
 SourceLocation consumeToken();
 
@@ -1570,6 +1581,38 @@
 : File->getDir(), ExternLoc);
 }
 
+/// Whether to add the requirement \p Feature to the module \p M.
+///
+/// This preserves backwards compatibility for two hacks in the Darwin system
+/// module map files:
+///
+/// 1. The use of 'requires excluded' to make headers non-modular, which
+///should really be mapped to 'textual' now that we have this feature.  We
+///drop the 'excluded' requirement, and set \p IsRequiresExcludedHack to
+///true.  Later, this bit will be used to map all the headers inside this
+///module to 'textual'.
+///
+///This affects Darwin.C.excluded (for assert.h) and Tcl.Private.
+///
+/// 2. Removes a bogus cplusplus requirement from IOKit.avc.  This requirement
+///was never correct and causes issues now that we check it, so drop it.
+static bool shouldAddRequirement(Module *M, StringRef Feature,
+ bool &IsRequiresExcludedHack) {
+  static const StringRef DarwinCExcluded[] = {"Darwin", "C", "excluded"};
+  static const StringRef TclPrivate[] = {"Tcl", "Private"};
+  static const StringRef IOKitAVC[] = {"IOKit", "avc"};
+
+  if (Feature == "excluded" && (M->fullModuleNameEqual(DarwinCExcluded) ||
+M->fullModuleNameEqual(TclPrivate))) {
+  IsRequiresExcludedHack = true;
+  return false;
+  } else if (Feature == "cplusplus" && M->fullModuleNameEqual(IOKitAVC)) {
+return false;
+  }
+
+

r244760 - The alias.c test now requires arm-registered-target

2015-08-12 Thread John Brawn via cfe-commits
Author: john.brawn
Date: Wed Aug 12 10:55:55 2015
New Revision: 244760

URL: http://llvm.org/viewvc/llvm-project?rev=244760&view=rev
Log:
The alias.c test now requires arm-registered-target

This should fix a buildbot failure

Modified:
cfe/trunk/test/CodeGen/alias.c

Modified: cfe/trunk/test/CodeGen/alias.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=244760&r1=244759&r2=244760&view=diff
==
--- cfe/trunk/test/CodeGen/alias.c (original)
+++ cfe/trunk/test/CodeGen/alias.c Wed Aug 12 10:55:55 2015
@@ -1,3 +1,4 @@
+// REQUIRES: arm-registered-target
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck 
-check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | 
FileCheck -check-prefix=CHECKCC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck 
-check-prefix=CHECKASM %s


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


Re: [PATCH] Fix types of size_t, intptr_t, and ptrdiff_t on OpenBSD/sparc.

2015-08-12 Thread James Y Knight via cfe-commits
Sorry for the miscommunication, I thought you were going to commit it
already. LGTM.

On Wed, Aug 12, 2015 at 6:37 AM, Brad Smith  wrote:

> On 06/05/2015 08:30 PM, Brad Smith wrote:
>
>> On 06/05/15 01:33, James Y Knight wrote:
>>
>>> Thanks. Openbsd doesn't seem to have a gcc spec file with it overridden
>>> to long upstream; is it just sharing netbsd's, or is it non-upstreamed
>>> patches?
>>>
>>
>> We've never been very good at pushing our GCC / binutils bits upstream
>> due to the hassles of copyright assignment and all the process involved.
>> The OpenBSD/sparc bits do not exist upstream.
>>
>> http://marc.info/?l=openbsd-cvs&m=129217993805285&w=2
>>
>> http://openbsd.comstyle.com/cgi/cvsweb/src/gnu/gcc/gcc/config/sparc/openbsd.h.diff?r1=1.1&r2=1.2
>>
> ping.
>
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
>
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r244756 - Add test for PR24379

2015-08-12 Thread John Brawn via cfe-commits
Author: john.brawn
Date: Wed Aug 12 10:15:27 2015
New Revision: 244756

URL: http://llvm.org/viewvc/llvm-project?rev=244756&view=rev
Log:
Add test for PR24379

The fix for this is in LLVM but it depends on how clang handles the alias
attribute, so add a test to the clang tests to make sure everything works
together as expected.

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

Modified:
cfe/trunk/test/CodeGen/alias.c

Modified: cfe/trunk/test/CodeGen/alias.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/alias.c?rev=244756&r1=244755&r2=244756&view=diff
==
--- cfe/trunk/test/CodeGen/alias.c (original)
+++ cfe/trunk/test/CodeGen/alias.c Wed Aug 12 10:15:27 2015
@@ -1,19 +1,42 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck 
-check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | 
FileCheck -check-prefix=CHECKCC %s
+// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck 
-check-prefix=CHECKASM %s
 
 int g0;
-// CHECKBASIC: @g0 = common global i32 0
+// CHECKBASIC-DAG: @g0 = common global i32 0
+// CHECKASM-DAG: .comm g0,4,4
 __thread int TL_WITH_ALIAS;
 // CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
+// CHECKASM-DAG: .globl TL_WITH_ALIAS
+// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
 static int bar1 = 42;
-// CHECKBASIC: @bar1 = internal global i32 42
+// CHECKBASIC-DAG: @bar1 = internal global i32 42
+// CHECKASM-DAG: bar1:
+// CHECKASM-DAG: .size bar1, 4
+
+// PR24379: alias variable expected to have same size as aliasee even when 
types differ
+const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
+// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, 
i32 3, i32 5, i32 8, i32 13, i32 0], align 4
+// CHECKASM-DAG: .globl wacom_usb_ids
+// CHECKASM-DAG: .size wacom_usb_ids, 32
+extern const int __mod_usb_device_table __attribute__ 
((alias("wacom_usb_ids")));
+// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 
x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
+// CHECKASM-DAG: .globl __mod_usb_device_table
+// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
+// CHECKASM-DAG-NOT: .size __mod_usb_device_table
 
 extern int g1;
 extern int g1 __attribute((alias("g0")));
 // CHECKBASIC-DAG: @g1 = alias i32* @g0
+// CHECKASM-DAG: .globl g1
+// CHECKASM-DAG: g1 = g0
+// CHECKASM-DAG-NOT: .size g1
 
 extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
 // CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
+// CHECKASM-DAG: .globl __libc_errno
+// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
+// CHECKASM-DAG-NOT: .size __libc_errno
 
 void f0(void) { }
 extern void f1(void);


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


Re: [PATCH] D11980: Add test for PR24379

2015-08-12 Thread John Brawn via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL244756: Add test for PR24379 (authored by john.brawn).

Changed prior to commit:
  http://reviews.llvm.org/D11980?vs=31939&id=31942#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D11980

Files:
  cfe/trunk/test/CodeGen/alias.c

Index: cfe/trunk/test/CodeGen/alias.c
===
--- cfe/trunk/test/CodeGen/alias.c
+++ cfe/trunk/test/CodeGen/alias.c
@@ -1,19 +1,42 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck 
-check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | 
FileCheck -check-prefix=CHECKCC %s
+// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck 
-check-prefix=CHECKASM %s
 
 int g0;
-// CHECKBASIC: @g0 = common global i32 0
+// CHECKBASIC-DAG: @g0 = common global i32 0
+// CHECKASM-DAG: .comm g0,4,4
 __thread int TL_WITH_ALIAS;
 // CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
+// CHECKASM-DAG: .globl TL_WITH_ALIAS
+// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
 static int bar1 = 42;
-// CHECKBASIC: @bar1 = internal global i32 42
+// CHECKBASIC-DAG: @bar1 = internal global i32 42
+// CHECKASM-DAG: bar1:
+// CHECKASM-DAG: .size bar1, 4
+
+// PR24379: alias variable expected to have same size as aliasee even when 
types differ
+const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
+// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, 
i32 3, i32 5, i32 8, i32 13, i32 0], align 4
+// CHECKASM-DAG: .globl wacom_usb_ids
+// CHECKASM-DAG: .size wacom_usb_ids, 32
+extern const int __mod_usb_device_table __attribute__ 
((alias("wacom_usb_ids")));
+// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 
x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
+// CHECKASM-DAG: .globl __mod_usb_device_table
+// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
+// CHECKASM-DAG-NOT: .size __mod_usb_device_table
 
 extern int g1;
 extern int g1 __attribute((alias("g0")));
 // CHECKBASIC-DAG: @g1 = alias i32* @g0
+// CHECKASM-DAG: .globl g1
+// CHECKASM-DAG: g1 = g0
+// CHECKASM-DAG-NOT: .size g1
 
 extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
 // CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
+// CHECKASM-DAG: .globl __libc_errno
+// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
+// CHECKASM-DAG-NOT: .size __libc_errno
 
 void f0(void) { }
 extern void f1(void);


Index: cfe/trunk/test/CodeGen/alias.c
===
--- cfe/trunk/test/CodeGen/alias.c
+++ cfe/trunk/test/CodeGen/alias.c
@@ -1,19 +1,42 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s
+// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck -check-prefix=CHECKASM %s
 
 int g0;
-// CHECKBASIC: @g0 = common global i32 0
+// CHECKBASIC-DAG: @g0 = common global i32 0
+// CHECKASM-DAG: .comm g0,4,4
 __thread int TL_WITH_ALIAS;
 // CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
+// CHECKASM-DAG: .globl TL_WITH_ALIAS
+// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
 static int bar1 = 42;
-// CHECKBASIC: @bar1 = internal global i32 42
+// CHECKBASIC-DAG: @bar1 = internal global i32 42
+// CHECKASM-DAG: bar1:
+// CHECKASM-DAG: .size bar1, 4
+
+// PR24379: alias variable expected to have same size as aliasee even when types differ
+const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
+// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, i32 3, i32 5, i32 8, i32 13, i32 0], align 4
+// CHECKASM-DAG: .globl wacom_usb_ids
+// CHECKASM-DAG: .size wacom_usb_ids, 32
+extern const int __mod_usb_device_table __attribute__ ((alias("wacom_usb_ids")));
+// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
+// CHECKASM-DAG: .globl __mod_usb_device_table
+// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
+// CHECKASM-DAG-NOT: .size __mod_usb_device_table
 
 extern int g1;
 extern int g1 __attribute((alias("g0")));
 // CHECKBASIC-DAG: @g1 = alias i32* @g0
+// CHECKASM-DAG: .globl g1
+// CHECKASM-DAG: g1 = g0
+// CHECKASM-DAG-NOT: .size g1
 
 extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
 // CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
+// CHECKASM-DAG: .globl __libc_errno
+// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
+// CHECKASM-DAG-NOT: .size __libc_errno
 
 void f0(void) { }
 extern void f1(void);
___
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-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: include/__config:19
@@ -18,1 +18,3 @@
+#include <__config_site>
+
 #ifdef __GNUC__

jroelofs wrote:
> mclow.lists wrote:
> > espositofulvio wrote:
> > > mclow.lists wrote:
> > > > I'm reluctant to do this; because every include file slows down 
> > > > compilation - for every program that we compile.
> > > > 
> > > > However, this may be the right thing to do.
> > > I'm with Jonathan here, having config params dealt with this way it's 
> > > easier and make things more manageable while the price of a slowdown, I 
> > > think, shouldn't be substantial.
> > I just realized that this will complicate life for libc++ developers. 
> > Today, I can make a change in the checked-out directory, and test it by 
> > using `clang -I `.  Now, I'll have to actually build and 
> > install the headers some where to test.  [ Especially when testing against 
> > an installed compiler whose libc++ does not have a __config_site file ]
> Another option would be to rename `__config` to `__config.in`, and put the 
> `#cmakedefine` lines in here. Then the include tree isn't changed.
> Now, I'll have to actually build and install the headers some where to test.

Just building is sufficient. The headers get copied to the build directory, 
along with this new file.


> [ Especially when testing against an installed compiler whose libc++ does not 
> have a __config_site file ]

Why does your workflow rely on testing libcxx binaries against installed 
headers from a _different_ build of the library? That seems very dicey.


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] D11832: [Patch] [Analyzer] false positive: Potential leak connected with memcpy (PR 22954)

2015-08-12 Thread pierre gousseau via cfe-commits
pgousseau updated this revision to Diff 31940.
pgousseau added a comment.

Removed 'return' statements and added tests for empty arrays following Anna 
review.
Refactored parameter passing of 'TK_DoNotInvalidateSuperRegion' following Anton 
review, by adding a new member function 'hasTrait' to 'ClusterAnalysis'.

Please let me know if this is acceptable and if yes eventually commit it for me 
?
Regards,
Pierre


http://reviews.llvm.org/D11832

Files:
  include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h
  lib/StaticAnalyzer/Checkers/CStringChecker.cpp
  lib/StaticAnalyzer/Core/RegionStore.cpp
  test/Analysis/pr22954.c

Index: test/Analysis/pr22954.c
===
--- /dev/null
+++ test/Analysis/pr22954.c
@@ -0,0 +1,305 @@
+// Given code 'struct aa { char s1[4]; char * s2;} a; memcpy(a.s1, ...);',
+// this test checks that the CStringChecker only invalidates the destination buffer array a.s1 (instead of a.s1 and a.s2).
+// At the moment the whole of the destination array content is invalidated.
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -analyze -analyzer-checker=core,unix.Malloc,debug.ExprInspection -analyzer-store=region -verify %s
+
+typedef __typeof(sizeof(int)) size_t;
+
+char *strdup(const char *s);
+void free(void *);
+void *memcpy(void *dst, const void *src, size_t n);
+
+void clang_analyzer_eval(int);
+
+struct aa {
+char s1[4];
+char *s2;
+};
+
+// Test different types of structure initialisation.
+int f0() {
+  struct aa a0 = {{1, 2, 3, 4}, 0};
+  a0.s2 = strdup("hello");
+  char input[] = {'a', 'b', 'c', 'd'};
+  memcpy(a0.s1, input, 4);
+  clang_analyzer_eval(a0.s1[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a0.s1[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a0.s1[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a0.s1[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a0.s2 == 0); // expected-warning{{UNKNOWN}}
+  free(a0.s2); // no warning
+  return 0;
+}
+
+int f1() {
+  struct aa a1;
+  a1.s2 = strdup("hello");
+  char input[] = {'a', 'b', 'c', 'd'};
+  memcpy(a1.s1, input, 4);
+  clang_analyzer_eval(a1.s1[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a1.s1[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a1.s1[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a1.s1[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a1.s2 == 0); // expected-warning{{UNKNOWN}}
+  free(a1.s2); // no warning
+  return 0;
+}
+
+int f2() {
+  struct aa a2 = {{1, 2}};
+  a2.s2 = strdup("hello");
+  char input[] = {'a', 'b', 'c', 'd'};
+  memcpy(a2.s1, input, 4);
+  clang_analyzer_eval(a2.s1[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a2.s1[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a2.s1[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a2.s1[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a2.s2 == 0); // expected-warning{{UNKNOWN}}
+  free(a2.s2); // no warning
+  return 0;
+}
+
+int f3() {
+  struct aa a3 = {{1, 2, 3, 4}, 0};
+  a3.s2 = strdup("hello");
+  char input[] = {'a', 'b', 'c', 'd'};
+  int * dest = (int*)a3.s1;
+  memcpy(dest, input, 4);
+  clang_analyzer_eval(a3.s1[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a3.s1[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a3.s1[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a3.s1[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(a3.s2 == 0); // expected-warning{{UNKNOWN}}
+  free(a3.s2); // no warning
+  return 0;
+}
+
+struct bb {
+  struct aa a;
+  char * s2;
+};
+
+int f4() {
+  struct bb b0 = {{1, 2, 3, 4}, 0};
+  b0.s2 = strdup("hello");
+  b0.a.s2 = strdup("hola");
+  char input[] = {'a', 'b', 'c', 'd'};
+  char * dest = (char*)(b0.a.s1);
+  memcpy(dest, input, 4);
+  clang_analyzer_eval(b0.a.s1[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[0] == 'a'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(b0.a.s1[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[1] == 'b'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(b0.a.s1[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[2] == 'c'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(b0.a.s1[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(dest[3] == 'd'); // expected-warning{{UNKNOWN}}
+  clang_analyzer_eval(b0.s2 == 0); // expected-warning{{UNKNOWN}}
+  free(b0.a.s2); // no warning
+  free(b0.s2); // no warning
+  return 0;
+}
+
+int f5() {
+  struct aa a0 = {{1, 

r244751 - The version of libxml2 required by c-index-test must be at least 2.5.3. Considering that this version was released in 2003, you might think the check a bit ridiculous. Unfortunately, GnuWin3

2015-08-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 12 10:01:15 2015
New Revision: 244751

URL: http://llvm.org/viewvc/llvm-project?rev=244751&view=rev
Log:
The version of libxml2 required by c-index-test must be at least 2.5.3. 
Considering that this version was released in 2003, you might think the check a 
bit ridiculous. Unfortunately, GnuWin32 ships with libxml2 2.4.12, which was 
released in 2001.

This allows us to have GnuWin32 on the PATH on Windows without causing 
compilation errors.

Modified:
cfe/trunk/CMakeLists.txt

Modified: cfe/trunk/CMakeLists.txt
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/CMakeLists.txt?rev=244751&r1=244750&r2=244751&view=diff
==
--- cfe/trunk/CMakeLists.txt (original)
+++ cfe/trunk/CMakeLists.txt Wed Aug 12 10:01:15 2015
@@ -168,7 +168,7 @@ else()
   set(BACKEND_PACKAGE_STRING "${PACKAGE_STRING}")
 endif()
 
-find_package(LibXml2)
+find_package(LibXml2 2.5.3 QUIET)
 if (LIBXML2_FOUND)
   set(CLANG_HAVE_LIBXML 1)
 endif()


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


Re: [PATCH] D11980: Add test for PR24379

2015-08-12 Thread Rafael Ávila de Espíndola via cfe-commits
rafael accepted this revision.
rafael added a comment.
This revision is now accepted and ready to land.

LGTM


Repository:
  rL LLVM

http://reviews.llvm.org/D11980



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


Re: [PATCH] D9407: [Profile] Clang support for setting profile output from command line

2015-08-12 Thread Teresa Johnson via cfe-commits
tejohnson closed this revision.
tejohnson added a comment.

Committed awhile back as r236289, closing manually.


http://reviews.llvm.org/D9407



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


Re: [PATCH] D9717: [Patch] Temporarily revert test to prepare for LLVM -fprofile-instr-generate= fix

2015-08-12 Thread Teresa Johnson via cfe-commits
tejohnson abandoned this revision.
tejohnson added a comment.

Obsolete, didn't need to do this.


http://reviews.llvm.org/D9717



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


Re: [PATCH] D11582: Fix assertion failure in TransformOpaqueValueExpr

2015-08-12 Thread Rachel Craik via cfe-commits
rcraik added a comment.

ping 2!


http://reviews.llvm.org/D11582



___
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-08-12 Thread Marshall Clow via cfe-commits
mclow.lists added inline comments.


Comment at: include/__config:19
@@ -18,1 +18,3 @@
+#include <__config_site>
+
 #ifdef __GNUC__

espositofulvio wrote:
> mclow.lists wrote:
> > I'm reluctant to do this; because every include file slows down compilation 
> > - for every program that we compile.
> > 
> > However, this may be the right thing to do.
> I'm with Jonathan here, having config params dealt with this way it's easier 
> and make things more manageable while the price of a slowdown, I think, 
> shouldn't be substantial.
I just realized that this will complicate life for libc++ developers. Today, I 
can make a change in the checked-out directory, and test it by using `clang -I 
`.  Now, I'll have to actually build and install the headers 
some where to test.  [ Especially when testing against an installed compiler 
whose libc++ does not have a __config_site file ]


Comment at: test/std/atomics/libcpp-has-no-threads.pass.cpp:11
@@ -10,1 +10,3 @@
 
+#include <__config_site>
+

jroelofs wrote:
> mclow.lists wrote:
> > This is not the right include file. 
> > 
> > How about "#include ", which defined in the standard (to do 
> > nothing), but includes "<__config>"
> > 
> > Really, this test doesn't belong in test/std/, but in test/libcxx, but this 
> > change didn't put it there.
> > 
> I think it'd be better for me to just move the test. What is  
> supposed to be for?
The standard says that including it does nothing. :-)

It's a great file to include to get all the config information.



http://reviews.llvm.org/D11963



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


[PATCH] D11980: Add test for PR24379

2015-08-12 Thread John Brawn via cfe-commits
john.brawn created this revision.
john.brawn added reviewers: rafael, ab.
john.brawn added a subscriber: cfe-commits.
john.brawn set the repository for this revision to rL LLVM.

The fix for this is in LLVM but it depends on how clang handles the alias 
attribute, so add a test to the clang tests to make sure everything works 
together as expected.


Repository:
  rL LLVM

http://reviews.llvm.org/D11980

Files:
  test/CodeGen/alias.c

Index: test/CodeGen/alias.c
===
--- test/CodeGen/alias.c
+++ test/CodeGen/alias.c
@@ -1,19 +1,42 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck 
-check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | 
FileCheck -check-prefix=CHECKCC %s
+// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck 
-check-prefix=CHECKASM %s
 
 int g0;
-// CHECKBASIC: @g0 = common global i32 0
+// CHECKBASIC-DAG: @g0 = common global i32 0
+// CHECKASM-DAG: .comm g0,4,4
 __thread int TL_WITH_ALIAS;
 // CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
+// CHECKASM-DAG: .globl TL_WITH_ALIAS
+// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
 static int bar1 = 42;
-// CHECKBASIC: @bar1 = internal global i32 42
+// CHECKBASIC-DAG: @bar1 = internal global i32 42
+// CHECKASM-DAG: bar1:
+// CHECKASM-DAG: .size bar1, 4
+
+// PR24379: alias variable expected to have same size as aliasee even when 
types differ
+const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
+// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, 
i32 3, i32 5, i32 8, i32 13, i32 0], align 4
+// CHECKASM-DAG: .globl wacom_usb_ids
+// CHECKASM-DAG: .size wacom_usb_ids, 32
+extern const int __mod_usb_device_table __attribute__ 
((alias("wacom_usb_ids")));
+// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 
x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
+// CHECKASM-DAG: .globl __mod_usb_device_table
+// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
+// CHECKASM-DAG-NOT: .size __mod_usb_device_table
 
 extern int g1;
 extern int g1 __attribute((alias("g0")));
 // CHECKBASIC-DAG: @g1 = alias i32* @g0
+// CHECKASM-DAG: .globl g1
+// CHECKASM-DAG: g1 = g0
+// CHECKASM-DAG-NOT: .size g1
 
 extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
 // CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
+// CHECKASM-DAG: .globl __libc_errno
+// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
+// CHECKASM-DAG-NOT: .size __libc_errno
 
 void f0(void) { }
 extern void f1(void);


Index: test/CodeGen/alias.c
===
--- test/CodeGen/alias.c
+++ test/CodeGen/alias.c
@@ -1,19 +1,42 @@
 // RUN: %clang_cc1 -triple i386-pc-linux-gnu -emit-llvm -o - %s | FileCheck -check-prefix=CHECKBASIC %s
 // RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -emit-llvm -o - %s | FileCheck -check-prefix=CHECKCC %s
+// RUN: %clang_cc1 -triple armv7a-eabi -mfloat-abi hard -S -o - %s | FileCheck -check-prefix=CHECKASM %s
 
 int g0;
-// CHECKBASIC: @g0 = common global i32 0
+// CHECKBASIC-DAG: @g0 = common global i32 0
+// CHECKASM-DAG: .comm g0,4,4
 __thread int TL_WITH_ALIAS;
 // CHECKBASIC-DAG: @TL_WITH_ALIAS = thread_local global i32 0, align 4
+// CHECKASM-DAG: .globl TL_WITH_ALIAS
+// CHECKASM-DAG: .size TL_WITH_ALIAS, 4
 static int bar1 = 42;
-// CHECKBASIC: @bar1 = internal global i32 42
+// CHECKBASIC-DAG: @bar1 = internal global i32 42
+// CHECKASM-DAG: bar1:
+// CHECKASM-DAG: .size bar1, 4
+
+// PR24379: alias variable expected to have same size as aliasee even when types differ
+const int wacom_usb_ids[] = {1, 1, 2, 3, 5, 8, 13, 0};
+// CHECKBASIC-DAG: @wacom_usb_ids = constant [8 x i32] [i32 1, i32 1, i32 2, i32 3, i32 5, i32 8, i32 13, i32 0], align 4
+// CHECKASM-DAG: .globl wacom_usb_ids
+// CHECKASM-DAG: .size wacom_usb_ids, 32
+extern const int __mod_usb_device_table __attribute__ ((alias("wacom_usb_ids")));
+// CHECKBASIC-DAG: @__mod_usb_device_table = alias getelementptr inbounds ([8 x i32], [8 x i32]* @wacom_usb_ids, i32 0, i32 0)
+// CHECKASM-DAG: .globl __mod_usb_device_table
+// CHECKASM-DAG: __mod_usb_device_table = wacom_usb_ids
+// CHECKASM-DAG-NOT: .size __mod_usb_device_table
 
 extern int g1;
 extern int g1 __attribute((alias("g0")));
 // CHECKBASIC-DAG: @g1 = alias i32* @g0
+// CHECKASM-DAG: .globl g1
+// CHECKASM-DAG: g1 = g0
+// CHECKASM-DAG-NOT: .size g1
 
 extern __thread int __libc_errno __attribute__ ((alias ("TL_WITH_ALIAS")));
 // CHECKBASIC-DAG: @__libc_errno = thread_local alias i32* @TL_WITH_ALIAS
+// CHECKASM-DAG: .globl __libc_errno
+// CHECKASM-DAG: __libc_errno = TL_WITH_ALIAS
+// CHECKASM-DAG-NOT: .size __libc_errno
 
 void f0(void) { }
 extern void f1(void);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/lis

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

2015-08-12 Thread Jonathan Roelofs via cfe-commits
jroelofs added inline comments.


Comment at: include/__config:19
@@ -18,1 +18,3 @@
+#include <__config_site>
+
 #ifdef __GNUC__

espositofulvio wrote:
> mclow.lists wrote:
> > I'm reluctant to do this; because every include file slows down compilation 
> > - for every program that we compile.
> > 
> > However, this may be the right thing to do.
> I'm with Jonathan here, having config params dealt with this way it's easier 
> and make things more manageable while the price of a slowdown, I think, 
> shouldn't be substantial.
Another option would be to rename `__config` to `__config.in`, and put the 
`#cmakedefine` lines in here. Then the include tree isn't changed.


Comment at: test/std/atomics/libcpp-has-no-threads.pass.cpp:11
@@ -10,1 +10,3 @@
 
+#include <__config_site>
+

mclow.lists wrote:
> This is not the right include file. 
> 
> How about "#include ", which defined in the standard (to do 
> nothing), but includes "<__config>"
> 
> Really, this test doesn't belong in test/std/, but in test/libcxx, but this 
> change didn't put it there.
> 
I think it'd be better for me to just move the test. What is  supposed 
to be for?


http://reviews.llvm.org/D11963



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


r244749 - Rangify some for loops; NFC.

2015-08-12 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Wed Aug 12 08:38:59 2015
New Revision: 244749

URL: http://llvm.org/viewvc/llvm-project?rev=244749&view=rev
Log:
Rangify some for loops; NFC.

Modified:
cfe/trunk/lib/Basic/Targets.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=244749&r1=244748&r2=244749&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Wed Aug 12 08:38:59 2015
@@ -7540,9 +7540,8 @@ TargetInfo::CreateTargetInfo(Diagnostics
   Target->getDefaultFeatures(Features);
 
   // Apply the user specified deltas.
-  for (unsigned I = 0, N = Opts->FeaturesAsWritten.size();
-   I < N; ++I) {
-const char *Name = Opts->FeaturesAsWritten[I].c_str();
+  for (const auto &F : Opts->FeaturesAsWritten) {
+const char *Name = F.c_str();
 // Apply the feature via the target.
 bool Enabled = Name[0] == '+';
 Target->setFeatureEnabled(Features, Name + 1, Enabled);
@@ -7553,9 +7552,9 @@ TargetInfo::CreateTargetInfo(Diagnostics
   // FIXME: If we are completely confident that we have the right set, we only
   // need to pass the minuses.
   Opts->Features.clear();
-  for (llvm::StringMap::const_iterator it = Features.begin(),
- ie = Features.end(); it != ie; ++it)
-Opts->Features.push_back((it->second ? "+" : "-") + it->first().str());
+  for (const auto &F : Features)
+Opts->Features.push_back((F.getValue() ? "+" : "-") + F.getKey().str());
+
   if (!Target->handleTargetFeatures(Opts->Features, Diags))
 return nullptr;
 


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


  1   2   >