[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-11 Thread Paweł Żukowski via Phabricator via cfe-commits
idlecode added a comment.

Yes, please.
Thanks for you time :)


https://reviews.llvm.org/D29724



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


[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-11 Thread Richard Smith via Phabricator via cfe-commits
rsmith added a comment.

LGTM, do you need someone to commit for you?


https://reviews.llvm.org/D29724



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


LLVM buildmaster will be updated and restarted tonight

2017-02-11 Thread Galina Kistanova via cfe-commits
Hello everyone,

LLVM buildmaster will be updated and restarted after 8 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


Re: r294879 - [Driver] Use stem() and not filename().

2017-02-11 Thread Davide Italiano via cfe-commits
On Sat, Feb 11, 2017 at 4:19 PM, Rui Ueyama  wrote:
> On Sat, Feb 11, 2017 at 3:44 PM, Davide Italiano via cfe-commits
>  wrote:
>>
>> Author: davide
>> Date: Sat Feb 11 17:44:37 2017
>> New Revision: 294879
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=294879=rev
>> Log:
>> [Driver] Use stem() and not filename().
>>
>> On Windows the filename might have an extension, namely
>> `.exe`, so the search will fail. Sorry, I don't have a
>> good way to test this as it seems to fail only in some
>> weird configurations. r284430 has the same modification
>> for Fuchsia.
>>
>> Modified:
>> cfe/trunk/lib/Driver/Tools.cpp
>>
>> Modified: cfe/trunk/lib/Driver/Tools.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294879=294878=294879=diff
>>
>> ==
>> --- cfe/trunk/lib/Driver/Tools.cpp (original)
>> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
>> @@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
>>Args.ClaimAllArgs(options::OPT_w);
>>
>>const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
>> -  if (llvm::sys::path::filename(Exec) == "lld") {
>> +  if (llvm::sys::path::stem(Exec) == "lld") {
>>  CmdArgs.push_back("-flavor");
>>  CmdArgs.push_back("old-gnu");
>

Probably not, I'm just reducing diffs with out local branch. I think
we can remove it altogether.

-- 
Davide

"There are no solved problems; there are only problems that are more
or less solved" -- Henri Poincare
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: r294879 - [Driver] Use stem() and not filename().

2017-02-11 Thread Rui Ueyama via cfe-commits
On Sat, Feb 11, 2017 at 3:44 PM, Davide Italiano via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: davide
> Date: Sat Feb 11 17:44:37 2017
> New Revision: 294879
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294879=rev
> Log:
> [Driver] Use stem() and not filename().
>
> On Windows the filename might have an extension, namely
> `.exe`, so the search will fail. Sorry, I don't have a
> good way to test this as it seems to fail only in some
> weird configurations. r284430 has the same modification
> for Fuchsia.
>
> Modified:
> cfe/trunk/lib/Driver/Tools.cpp
>
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/
> Tools.cpp?rev=294879=294878=294879=diff
> 
> ==
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
> @@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
>Args.ClaimAllArgs(options::OPT_w);
>
>const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
> -  if (llvm::sys::path::filename(Exec) == "lld") {
> +  if (llvm::sys::path::stem(Exec) == "lld") {
>  CmdArgs.push_back("-flavor");
>  CmdArgs.push_back("old-gnu");
>

This line caught my attention. I think we've removed "-flavor old-gnu" a
long time ago. Is that still live somewhere?


>  CmdArgs.push_back("-target");
>
>
> ___
> 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


r294879 - [Driver] Use stem() and not filename().

2017-02-11 Thread Davide Italiano via cfe-commits
Author: davide
Date: Sat Feb 11 17:44:37 2017
New Revision: 294879

URL: http://llvm.org/viewvc/llvm-project?rev=294879=rev
Log:
[Driver] Use stem() and not filename().

On Windows the filename might have an extension, namely
`.exe`, so the search will fail. Sorry, I don't have a
good way to test this as it seems to fail only in some
weird configurations. r284430 has the same modification
for Fuchsia.

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

Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=294879=294878=294879=diff
==
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Sat Feb 11 17:44:37 2017
@@ -10163,7 +10163,7 @@ void gnutools::Linker::ConstructJob(Comp
   Args.ClaimAllArgs(options::OPT_w);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
-  if (llvm::sys::path::filename(Exec) == "lld") {
+  if (llvm::sys::path::stem(Exec) == "lld") {
 CmdArgs.push_back("-flavor");
 CmdArgs.push_back("old-gnu");
 CmdArgs.push_back("-target");


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


[PATCH] D29868: Recover more gracefully when __declspec is not supported as a keyword

2017-02-11 Thread Saleem Abdulrasool via Phabricator via cfe-commits
compnerd added inline comments.



Comment at: lib/Parse/ParseDecl.cpp:2973
+  // recognize that scenario and recover gracefully.
+  if (!getLangOpts().MicrosoftExt && Tok.is(tok::identifier) &&
+  Tok.getIdentifierInfo()->getName().equals("__declspec")) {

Shouldn't this be `getLangOpts().DeclSpecKeyword` since you don't need the 
Microsoft extensions as much as you need the declspec keyword to be processed.  
Having `MicrosoftExt` implicitly enable `DeclSpecKeyword` (just as borland mode 
enables it as well).  I suppose that it would fail anyways as 
`Tok.is(tok::identifier)` would fail.



Comment at: lib/Parse/ParseDecl.cpp:2989
+
+  Diag(Loc, diag::err_ms_attributes_not_enabled);
+  continue;

I think that we want to emit the diagnostic even if there is no parenthesis as 
`__declspec` is a reserved identifier, and we would normally diagnose the bad 
`__declspec` (expected '(' after '__declspec').


https://reviews.llvm.org/D29868



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


r294877 - CodeGen: use # as the comment leader for ARC marker

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 17:03:13 2017
New Revision: 294877

URL: http://llvm.org/viewvc/llvm-project?rev=294877=rev
Log:
CodeGen: use # as the comment leader for ARC marker

Use # as the comment leader for AArch64 auto-release elision marker.
This is to keep it in sync with the value used in swift.  When building
libdispatch for Linux AArch64, the auto-release elision marker was
emitted.  However, ELF uses # as the comment leader while MachO accepts
both ; and #.  Use the common marker for it instead.

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

Modified: cfe/trunk/lib/CodeGen/TargetInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/TargetInfo.cpp?rev=294877=294876=294877=diff
==
--- cfe/trunk/lib/CodeGen/TargetInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/TargetInfo.cpp Sat Feb 11 17:03:13 2017
@@ -4835,7 +4835,7 @@ public:
   : TargetCodeGenInfo(new AArch64ABIInfo(CGT, Kind)) {}
 
   StringRef getARCRetainAutoreleasedReturnValueMarker() const override {
-return "mov\tfp, fp\t\t; marker for objc_retainAutoreleaseReturnValue";
+return "mov\tfp, fp\t\t# marker for objc_retainAutoreleaseReturnValue";
   }
 
   int getDwarfEHStackPointer(CodeGen::CodeGenModule ) const override {


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


r294872 - CodeGen: annotate ObjC ARC functions with ABI constraints

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 15:34:18 2017
New Revision: 294872

URL: http://llvm.org/viewvc/llvm-project?rev=294872=rev
Log:
CodeGen: annotate ObjC ARC functions with ABI constraints

Certain ARC runtime functions have an ABI contract of being forwarding.
Annotate the functions with the appropriate `returned` attribute on the
arguments.  This hoists some of the runtime ABI contract information
into the frontend rather than the backend transformations.

The test adjustments are to mark the returned function parameter as
such.  The minor change to the IR output is due to the fact that the
returned reference of the object causes it to extend the lifetime of the
object by returning an autoreleased return value.  The result is that
the explicit objc_autorelease call is no longer formed, as autorelease
elision is now possible on the return.

Modified:
cfe/trunk/lib/CodeGen/CGObjC.cpp
cfe/trunk/test/CodeGenObjC/arc.m

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=294872=294871=294872=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Sat Feb 11 15:34:18 2017
@@ -1802,6 +1802,22 @@ void CodeGenFunction::EmitARCIntrinsicUs
 }
 
 
+static bool IsForwarding(StringRef Name) {
+  return llvm::StringSwitch(Name)
+  .Cases("objc_autoreleaseReturnValue", // 
ARCInstKind::AutoreleaseRV
+ "objc_autorelease",// 
ARCInstKind::Autorelease
+ "objc_retainAutoreleaseReturnValue",   // 
ARCInstKind::FusedRetainAutoreleaseRV
+ "objc_retainAutoreleasedReturnValue",  // 
ARCInstKind::RetainRV
+ "objc_retainAutorelease",  // 
ARCInstKind::FusedRetainAutorelease
+ "objc_retainedObject", // 
ARCInstKind::NoopCast
+ "objc_retain", // ARCInstKind::Retain
+ "objc_unretainedObject",   // 
ARCInstKind::NoopCast
+ "objc_unretainedPointer",  // 
ARCInstKind::NoopCast
+ "objc_unsafeClaimAutoreleasedReturnValue", // ARCInstKind::ClaimRV
+ true)
+  .Default(false);
+}
+
 static llvm::Constant *createARCRuntimeFunction(CodeGenModule ,
 llvm::FunctionType *FTy,
 StringRef Name) {
@@ -1819,6 +1835,13 @@ static llvm::Constant *createARCRuntimeF
   // performance.
   F->addFnAttr(llvm::Attribute::NonLazyBind);
 }
+
+if (IsForwarding(Name)) {
+  llvm::AttrBuilder B;
+  B.addAttribute(llvm::Attribute::Returned);
+
+  F->arg_begin()->addAttr(llvm::AttributeSet::get(F->getContext(), 1, B));
+}
   }
 
   return RTF;

Modified: cfe/trunk/test/CodeGenObjC/arc.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc.m?rev=294872=294871=294872=diff
==
--- cfe/trunk/test/CodeGenObjC/arc.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc.m Sat Feb 11 15:34:18 2017
@@ -7,30 +7,30 @@
 // RUN: %clang_cc1 -fobjc-runtime=macosx-10.7.0 -triple x86_64-apple-darwin11 
-Wno-objc-root-class -Wno-incompatible-pointer-types 
-Wno-arc-unsafe-retained-assign -emit-llvm -fblocks -fobjc-arc 
-fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=ARC-NATIVE %s
 
 // ARC-ALIEN: declare extern_weak void @objc_storeStrong(i8**, i8*)
-// ARC-ALIEN: declare extern_weak i8* @objc_retain(i8*)
-// ARC-ALIEN: declare extern_weak i8* @objc_autoreleaseReturnValue(i8*)
+// ARC-ALIEN: declare extern_weak i8* @objc_retain(i8* returned)
+// ARC-ALIEN: declare extern_weak i8* @objc_autoreleaseReturnValue(i8* 
returned)
 // ARC-ALIEN: declare i8* @objc_msgSend(i8*, i8*, ...) [[NLB:#[0-9]+]]
 // ARC-ALIEN: declare extern_weak void @objc_release(i8*)
-// ARC-ALIEN: declare extern_weak i8* @objc_retainAutoreleasedReturnValue(i8*)
+// ARC-ALIEN: declare extern_weak i8* @objc_retainAutoreleasedReturnValue(i8* 
returned)
 // ARC-ALIEN: declare extern_weak i8* @objc_initWeak(i8**, i8*)
 // ARC-ALIEN: declare extern_weak i8* @objc_storeWeak(i8**, i8*)
 // ARC-ALIEN: declare extern_weak i8* @objc_loadWeakRetained(i8**)
 // ARC-ALIEN: declare extern_weak void @objc_destroyWeak(i8**)
-// ARC-ALIEN: declare extern_weak i8* @objc_autorelease(i8*)
-// ARC-ALIEN: declare extern_weak i8* @objc_retainAutorelease(i8*)
+// declare extern_weak i8* @objc_autorelease(i8*)
+// ARC-ALIEN: declare extern_weak i8* @objc_retainAutorelease(i8* returned)
 
 // ARC-NATIVE: declare void @objc_storeStrong(i8**, i8*)
-// ARC-NATIVE: declare i8* @objc_retain(i8*) [[NLB:#[0-9]+]]
-// ARC-NATIVE: declare i8* @objc_autoreleaseReturnValue(i8*)
+// ARC-NATIVE: declare i8* @objc_retain(i8* returned) [[NLB:#[0-9]+]]
+// ARC-NATIVE: declare i8* 

r294871 - test: ignore some warnings in test code (NFC)

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 15:34:15 2017
New Revision: 294871

URL: http://llvm.org/viewvc/llvm-project?rev=294871=rev
Log:
test: ignore some warnings in test code (NFC)

Silence some diagnostics which clang now generates.  This makes it
easier to see the failures in lit output.  NFC.

Modified:
cfe/trunk/test/CodeGenObjC/arc.m

Modified: cfe/trunk/test/CodeGenObjC/arc.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/arc.m?rev=294871=294870=294871=diff
==
--- cfe/trunk/test/CodeGenObjC/arc.m (original)
+++ cfe/trunk/test/CodeGenObjC/arc.m Sat Feb 11 15:34:15 2017
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck 
%s
-// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks 
-fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck 
-check-prefix=CHECK-GLOBALS %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-objc-root-class 
-Wno-incompatible-pointer-types -Wno-arc-unsafe-retained-assign -emit-llvm 
-fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | 
FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Wno-objc-root-class 
-Wno-incompatible-pointer-types -Wno-arc-unsafe-retained-assign -emit-llvm 
-fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck 
-check-prefix=CHECK-GLOBALS %s
 
 // rdar://13129783. Check both native/non-native arc platforms. Here we check
 // that they treat nonlazybind differently.
-// RUN: %clang_cc1 -fobjc-runtime=macosx-10.6.0 -triple x86_64-apple-darwin10 
-emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck 
-check-prefix=ARC-ALIEN %s
-// RUN: %clang_cc1 -fobjc-runtime=macosx-10.7.0 -triple x86_64-apple-darwin11 
-emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck 
-check-prefix=ARC-NATIVE %s
+// RUN: %clang_cc1 -fobjc-runtime=macosx-10.6.0 -triple x86_64-apple-darwin10 
-Wno-objc-root-class -Wno-incompatible-pointer-types 
-Wno-arc-unsafe-retained-assign -emit-llvm -fblocks -fobjc-arc 
-fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=ARC-ALIEN %s
+// RUN: %clang_cc1 -fobjc-runtime=macosx-10.7.0 -triple x86_64-apple-darwin11 
-Wno-objc-root-class -Wno-incompatible-pointer-types 
-Wno-arc-unsafe-retained-assign -emit-llvm -fblocks -fobjc-arc 
-fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=ARC-NATIVE %s
 
 // ARC-ALIEN: declare extern_weak void @objc_storeStrong(i8**, i8*)
 // ARC-ALIEN: declare extern_weak i8* @objc_retain(i8*)


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


[PATCH] D29868: Recover more gracefully when __declspec is not supported as a keyword

2017-02-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman created this revision.

In r238238, we removed __declspec as a universally-accepted keyword -- instead, 
it is only enabled as a supported keyword when -fms-extensions or -fdeclspec is 
passed to the driver. However, this had an unfortunate side-effect in that it 
made for bad diagnostics in the presence of a __declspec when neither of those 
flags are passed. For instance:

__declspec(naked) void f(void) {}

clang -fsyntax-only -fno-ms-extensions -Wall -pedantic main.c

main.cpp:1:24: error: parameter named 'f' is missing
__declspec(naked) void f(void) {}

  ^

main.cpp:1:31: error: expected ';' at end of declaration
__declspec(naked) void f(void) {}

  ^
  ;

main.cpp:1:12: warning: parameter 'naked' was not declared, defaulting to type 
'int' [-Wpedantic]
__declspec(naked) void f(void) {}

  ^

main.cpp:1:1: warning: type specifier missing, defaults to 'int' 
[-Wimplicit-int]
__declspec(naked) void f(void) {}

This patch addresses the poor diagnostics by noticing when a __declspec has 
been used but is not enabled. It eats the attribute, diagnoses the use, and 
then attempts to continue parsing.


https://reviews.llvm.org/D29868

Files:
  include/clang/Basic/DiagnosticParseKinds.td
  lib/Parse/ParseDecl.cpp
  test/Parser/declspec-recovery.c
  test/Parser/declspec-supported.c


Index: test/Parser/declspec-supported.c
===
--- test/Parser/declspec-supported.c
+++ test/Parser/declspec-supported.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fms-extensions 
-verify %s
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fdeclspec -verify %s
+// expected-no-diagnostics
+
+__declspec(naked) void f(void) {}
+
+struct S {
+  __declspec(property(get=Getter, put=Setter)) int X;
+  int Y;
+};
Index: test/Parser/declspec-recovery.c
===
--- test/Parser/declspec-recovery.c
+++ test/Parser/declspec-recovery.c
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -verify %s
+
+__declspec(naked) void f(void) {} // expected-error{{'__declspec' attributes 
are not enabled; use '-fdeclspec' or '-fms-extensions' to enable support for 
__declspec attributes}}
+
+struct S {
+  __declspec(property(get=Getter, put=Setter)) int X; // 
expected-error{{'__declspec' attributes are not enabled; use '-fdeclspec' or 
'-fms-extensions' to enable support for __declspec attributes}}
+  int Y;
+};
Index: lib/Parse/ParseDecl.cpp
===
--- lib/Parse/ParseDecl.cpp
+++ lib/Parse/ParseDecl.cpp
@@ -2966,6 +2966,31 @@
   if (DS.hasTypeSpecifier())
 goto DoneWithDeclSpec;
 
+  // If the token is an identifier named "__declspec" and Microsoft
+  // extensions are not enabled, it is likely that there will be cascading
+  // parse errors if this really is a __declspec attribute. Attempt to
+  // recognize that scenario and recover gracefully.
+  if (!getLangOpts().MicrosoftExt && Tok.is(tok::identifier) &&
+  Tok.getIdentifierInfo()->getName().equals("__declspec")) {
+// The next token should be an open paren. If it is, eat the entire
+// attribute declaration and continue.
+if (NextToken().is(tok::l_paren)) {
+  // Consume the __declspec identifier.
+  SourceLocation Loc = ConsumeToken();
+
+  // Eat the parens and everything between them.
+  BalancedDelimiterTracker T(*this, tok::l_paren);
+  if (T.consumeOpen()) {
+assert(false && "Not a left paren?");
+return;
+  }
+  T.skipToEnd();
+
+  Diag(Loc, diag::err_ms_attributes_not_enabled);
+  continue;
+}
+  }
+
   // In C++, check to see if this is a scope specifier like foo::bar::, if
   // so handle it as such.  This is important for ctor parsing.
   if (getLangOpts().CPlusPlus) {
Index: include/clang/Basic/DiagnosticParseKinds.td
===
--- include/clang/Basic/DiagnosticParseKinds.td
+++ include/clang/Basic/DiagnosticParseKinds.td
@@ -176,6 +176,9 @@
 def warn_attribute_no_decl : Warning<
   "attribute %0 ignored, because it is not attached to a declaration">, 
   InGroup;
+def err_ms_attributes_not_enabled : Error<
+  "'__declspec' attributes are not enabled; use '-fdeclspec' or "
+  "'-fms-extensions' to enable support for __declspec attributes">;
 def err_expected_method_body : Error<"expected method body">;
 def err_declspec_after_virtspec : Error<
   "'%0' qualifier may not appear after the virtual specifier '%1'">;


Index: test/Parser/declspec-supported.c
===
--- test/Parser/declspec-supported.c
+++ test/Parser/declspec-supported.c
@@ -0,0 +1,10 @@
+// RUN: %clang_cc1 -triple i386-pc-unknown -fsyntax-only -fms-extensions -verify 

[PATCH] D29843: [CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility

2017-02-11 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg requested changes to this revision.
joerg added inline comments.
This revision now requires changes to proceed.



Comment at: lib/CodeGen/CodeGenModule.cpp:2402
+  return GetOrCreateLLVMGlobal(Name, llvm::PointerType::getUnqual(Ty), nullptr,
+   NotForDefinition, Hidden);
 }

Can't this use the VarDecl argument of GetOrCreateLLVMGlobal to set the 
visibility? I'd prefer to keep reundant arguments to a minimum.


https://reviews.llvm.org/D29843



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


[PATCH] D29817: [AVR] Fix __AVR_xxx macro definitions

2017-02-11 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay added a comment.

Done, thanks for the patch @Lekensteyn!

If you plan on submitting more patches, feel free to ask for commit access 
.


Repository:
  rL LLVM

https://reviews.llvm.org/D29817



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


r294869 - [AVR] Fix __AVR_xxx macro definitions; authored by Peter Wu

2017-02-11 Thread Dylan McKay via cfe-commits
Author: dylanmckay
Date: Sat Feb 11 15:06:07 2017
New Revision: 294869

URL: http://llvm.org/viewvc/llvm-project?rev=294869=rev
Log:
[AVR] Fix __AVR_xxx macro definitions; authored by Peter Wu

Summary:
The -mmcu option for GCC sets macros like __AVR_ATmega328P__ (with the trailing
underscores), be sure to include these underscores for Clangs -mcpu option.

See "AVR Built-in Macros" in https://gcc.gnu.org/onlinedocs/gcc/AVR-Options.html

Reviewers: jroelofs, dylanmckay

Reviewed By: jroelofs, dylanmckay

Subscribers: efriedma, cfe-commits

Differential Revision: https://reviews.llvm.org/D29817

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/test/CodeGen/avr/target-cpu-defines/atmega328p.c
cfe/trunk/test/CodeGen/avr/target-cpu-defines/attiny104.c

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=294869=294868=294869=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Feb 11 15:06:07 2017
@@ -8464,244 +8464,244 @@ struct MCUInfo {
 // This list should be kept up-to-date with AVRDevices.td in LLVM.
 static ArrayRef AVRMcus = {
   { "at90s1200", "__AVR_AT90S1200__" },
-  { "attiny11", "__AVR_ATtiny11" },
-  { "attiny12", "__AVR_ATtiny12" },
-  { "attiny15", "__AVR_ATtiny15" },
-  { "attiny28", "__AVR_ATtiny28" },
-  { "at90s2313", "__AVR_AT90S2313" },
-  { "at90s2323", "__AVR_AT90S2323" },
-  { "at90s2333", "__AVR_AT90S2333" },
-  { "at90s2343", "__AVR_AT90S2343" },
-  { "attiny22", "__AVR_ATtiny22" },
-  { "attiny26", "__AVR_ATtiny26" },
-  { "at86rf401", "__AVR_AT86RF401" },
-  { "at90s4414", "__AVR_AT90S4414" },
-  { "at90s4433", "__AVR_AT90S4433" },
-  { "at90s4434", "__AVR_AT90S4434" },
-  { "at90s8515", "__AVR_AT90S8515" },
-  { "at90c8534", "__AVR_AT90c8534" },
-  { "at90s8535", "__AVR_AT90S8535" },
-  { "ata5272", "__AVR_ATA5272" },
-  { "attiny13", "__AVR_ATtiny13" },
-  { "attiny13a", "__AVR_ATtiny13A" },
-  { "attiny2313", "__AVR_ATtiny2313" },
-  { "attiny2313a", "__AVR_ATtiny2313A" },
-  { "attiny24", "__AVR_ATtiny24" },
-  { "attiny24a", "__AVR_ATtiny24A" },
-  { "attiny4313", "__AVR_ATtiny4313" },
-  { "attiny44", "__AVR_ATtiny44" },
-  { "attiny44a", "__AVR_ATtiny44A" },
-  { "attiny84", "__AVR_ATtiny84" },
-  { "attiny84a", "__AVR_ATtiny84A" },
-  { "attiny25", "__AVR_ATtiny25" },
-  { "attiny45", "__AVR_ATtiny45" },
-  { "attiny85", "__AVR_ATtiny85" },
-  { "attiny261", "__AVR_ATtiny261" },
-  { "attiny261a", "__AVR_ATtiny261A" },
-  { "attiny461", "__AVR_ATtiny461" },
-  { "attiny461a", "__AVR_ATtiny461A" },
-  { "attiny861", "__AVR_ATtiny861" },
-  { "attiny861a", "__AVR_ATtiny861A" },
-  { "attiny87", "__AVR_ATtiny87" },
-  { "attiny43u", "__AVR_ATtiny43U" },
-  { "attiny48", "__AVR_ATtiny48" },
-  { "attiny88", "__AVR_ATtiny88" },
-  { "attiny828", "__AVR_ATtiny828" },
-  { "at43usb355", "__AVR_AT43USB355" },
-  { "at76c711", "__AVR_AT76C711" },
-  { "atmega103", "__AVR_ATmega103" },
-  { "at43usb320", "__AVR_AT43USB320" },
-  { "attiny167", "__AVR_ATtiny167" },
-  { "at90usb82", "__AVR_AT90USB82" },
-  { "at90usb162", "__AVR_AT90USB162" },
-  { "ata5505", "__AVR_ATA5505" },
-  { "atmega8u2", "__AVR_ATmega8U2" },
-  { "atmega16u2", "__AVR_ATmega16U2" },
-  { "atmega32u2", "__AVR_ATmega32U2" },
-  { "attiny1634", "__AVR_ATtiny1634" },
-  { "atmega8", "__AVR_ATmega8" },
-  { "ata6289", "__AVR_ATA6289" },
-  { "atmega8a", "__AVR_ATmega8A" },
-  { "ata6285", "__AVR_ATA6285" },
-  { "ata6286", "__AVR_ATA6286" },
-  { "atmega48", "__AVR_ATmega48" },
-  { "atmega48a", "__AVR_ATmega48A" },
-  { "atmega48pa", "__AVR_ATmega48PA" },
-  { "atmega48p", "__AVR_ATmega48P" },
-  { "atmega88", "__AVR_ATmega88" },
-  { "atmega88a", "__AVR_ATmega88A" },
-  { "atmega88p", "__AVR_ATmega88P" },
-  { "atmega88pa", "__AVR_ATmega88PA" },
-  { "atmega8515", "__AVR_ATmega8515" },
-  { "atmega8535", "__AVR_ATmega8535" },
-  { "atmega8hva", "__AVR_ATmega8HVA" },
-  { "at90pwm1", "__AVR_AT90PWM1" },
-  { "at90pwm2", "__AVR_AT90PWM2" },
-  { "at90pwm2b", "__AVR_AT90PWM2B" },
-  { "at90pwm3", "__AVR_AT90PWM3" },
-  { "at90pwm3b", "__AVR_AT90PWM3B" },
-  { "at90pwm81", "__AVR_AT90PWM81" },
-  { "ata5790", "__AVR_ATA5790" },
-  { "ata5795", "__AVR_ATA5795" },
-  { "atmega16", "__AVR_ATmega16" },
-  { "atmega16a", "__AVR_ATmega16A" },
-  { "atmega161", "__AVR_ATmega161" },
-  { "atmega162", "__AVR_ATmega162" },
-  { "atmega163", "__AVR_ATmega163" },
-  { "atmega164a", "__AVR_ATmega164A" },
-  { "atmega164p", "__AVR_ATmega164P" },
-  { "atmega164pa", "__AVR_ATmega164PA" },
-  { "atmega165", "__AVR_ATmega165" },
-  { "atmega165a", "__AVR_ATmega165A" },
-  { "atmega165p", "__AVR_ATmega165P" },
-  { "atmega165pa", "__AVR_ATmega165PA" },
-  { "atmega168", "__AVR_ATmega168" },
-  { "atmega168a", "__AVR_ATmega168A" },
-  { "atmega168p", "__AVR_ATmega168P" },
-  { "atmega168pa", "__AVR_ATmega168PA" },
-  { "atmega169", 

[PATCH] D29817: [AVR] Fix __AVR_xxx macro definitions

2017-02-11 Thread Dylan McKay via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL294869: [AVR] Fix __AVR_xxx macro definitions; authored by 
Peter Wu (authored by dylanmckay).

Changed prior to commit:
  https://reviews.llvm.org/D29817?vs=88025=88104#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D29817

Files:
  cfe/trunk/lib/Basic/Targets.cpp
  cfe/trunk/test/CodeGen/avr/target-cpu-defines/atmega328p.c
  cfe/trunk/test/CodeGen/avr/target-cpu-defines/attiny104.c

Index: cfe/trunk/test/CodeGen/avr/target-cpu-defines/attiny104.c
===
--- cfe/trunk/test/CodeGen/avr/target-cpu-defines/attiny104.c
+++ cfe/trunk/test/CodeGen/avr/target-cpu-defines/attiny104.c
@@ -3,5 +3,5 @@
 
 // CHECK: #define AVR 1
 // CHECK: #define __AVR 1
-// CHECK: #define __AVR_ATtiny104 1
+// CHECK: #define __AVR_ATtiny104__ 1
 // CHECK: #define __AVR__ 1
Index: cfe/trunk/test/CodeGen/avr/target-cpu-defines/atmega328p.c
===
--- cfe/trunk/test/CodeGen/avr/target-cpu-defines/atmega328p.c
+++ cfe/trunk/test/CodeGen/avr/target-cpu-defines/atmega328p.c
@@ -3,5 +3,5 @@
 
 // CHECK: #define AVR 1
 // CHECK: #define __AVR 1
-// CHECK: #define __AVR_ATmega328P 1
+// CHECK: #define __AVR_ATmega328P__ 1
 // CHECK: #define __AVR__ 1
Index: cfe/trunk/lib/Basic/Targets.cpp
===
--- cfe/trunk/lib/Basic/Targets.cpp
+++ cfe/trunk/lib/Basic/Targets.cpp
@@ -8464,244 +8464,244 @@
 // This list should be kept up-to-date with AVRDevices.td in LLVM.
 static ArrayRef AVRMcus = {
   { "at90s1200", "__AVR_AT90S1200__" },
-  { "attiny11", "__AVR_ATtiny11" },
-  { "attiny12", "__AVR_ATtiny12" },
-  { "attiny15", "__AVR_ATtiny15" },
-  { "attiny28", "__AVR_ATtiny28" },
-  { "at90s2313", "__AVR_AT90S2313" },
-  { "at90s2323", "__AVR_AT90S2323" },
-  { "at90s2333", "__AVR_AT90S2333" },
-  { "at90s2343", "__AVR_AT90S2343" },
-  { "attiny22", "__AVR_ATtiny22" },
-  { "attiny26", "__AVR_ATtiny26" },
-  { "at86rf401", "__AVR_AT86RF401" },
-  { "at90s4414", "__AVR_AT90S4414" },
-  { "at90s4433", "__AVR_AT90S4433" },
-  { "at90s4434", "__AVR_AT90S4434" },
-  { "at90s8515", "__AVR_AT90S8515" },
-  { "at90c8534", "__AVR_AT90c8534" },
-  { "at90s8535", "__AVR_AT90S8535" },
-  { "ata5272", "__AVR_ATA5272" },
-  { "attiny13", "__AVR_ATtiny13" },
-  { "attiny13a", "__AVR_ATtiny13A" },
-  { "attiny2313", "__AVR_ATtiny2313" },
-  { "attiny2313a", "__AVR_ATtiny2313A" },
-  { "attiny24", "__AVR_ATtiny24" },
-  { "attiny24a", "__AVR_ATtiny24A" },
-  { "attiny4313", "__AVR_ATtiny4313" },
-  { "attiny44", "__AVR_ATtiny44" },
-  { "attiny44a", "__AVR_ATtiny44A" },
-  { "attiny84", "__AVR_ATtiny84" },
-  { "attiny84a", "__AVR_ATtiny84A" },
-  { "attiny25", "__AVR_ATtiny25" },
-  { "attiny45", "__AVR_ATtiny45" },
-  { "attiny85", "__AVR_ATtiny85" },
-  { "attiny261", "__AVR_ATtiny261" },
-  { "attiny261a", "__AVR_ATtiny261A" },
-  { "attiny461", "__AVR_ATtiny461" },
-  { "attiny461a", "__AVR_ATtiny461A" },
-  { "attiny861", "__AVR_ATtiny861" },
-  { "attiny861a", "__AVR_ATtiny861A" },
-  { "attiny87", "__AVR_ATtiny87" },
-  { "attiny43u", "__AVR_ATtiny43U" },
-  { "attiny48", "__AVR_ATtiny48" },
-  { "attiny88", "__AVR_ATtiny88" },
-  { "attiny828", "__AVR_ATtiny828" },
-  { "at43usb355", "__AVR_AT43USB355" },
-  { "at76c711", "__AVR_AT76C711" },
-  { "atmega103", "__AVR_ATmega103" },
-  { "at43usb320", "__AVR_AT43USB320" },
-  { "attiny167", "__AVR_ATtiny167" },
-  { "at90usb82", "__AVR_AT90USB82" },
-  { "at90usb162", "__AVR_AT90USB162" },
-  { "ata5505", "__AVR_ATA5505" },
-  { "atmega8u2", "__AVR_ATmega8U2" },
-  { "atmega16u2", "__AVR_ATmega16U2" },
-  { "atmega32u2", "__AVR_ATmega32U2" },
-  { "attiny1634", "__AVR_ATtiny1634" },
-  { "atmega8", "__AVR_ATmega8" },
-  { "ata6289", "__AVR_ATA6289" },
-  { "atmega8a", "__AVR_ATmega8A" },
-  { "ata6285", "__AVR_ATA6285" },
-  { "ata6286", "__AVR_ATA6286" },
-  { "atmega48", "__AVR_ATmega48" },
-  { "atmega48a", "__AVR_ATmega48A" },
-  { "atmega48pa", "__AVR_ATmega48PA" },
-  { "atmega48p", "__AVR_ATmega48P" },
-  { "atmega88", "__AVR_ATmega88" },
-  { "atmega88a", "__AVR_ATmega88A" },
-  { "atmega88p", "__AVR_ATmega88P" },
-  { "atmega88pa", "__AVR_ATmega88PA" },
-  { "atmega8515", "__AVR_ATmega8515" },
-  { "atmega8535", "__AVR_ATmega8535" },
-  { "atmega8hva", "__AVR_ATmega8HVA" },
-  { "at90pwm1", "__AVR_AT90PWM1" },
-  { "at90pwm2", "__AVR_AT90PWM2" },
-  { "at90pwm2b", "__AVR_AT90PWM2B" },
-  { "at90pwm3", "__AVR_AT90PWM3" },
-  { "at90pwm3b", "__AVR_AT90PWM3B" },
-  { "at90pwm81", "__AVR_AT90PWM81" },
-  { "ata5790", "__AVR_ATA5790" },
-  { "ata5795", "__AVR_ATA5795" },
-  { "atmega16", "__AVR_ATmega16" },
-  { "atmega16a", "__AVR_ATmega16A" },
-  { "atmega161", "__AVR_ATmega161" },
-  { "atmega162", "__AVR_ATmega162" },
-  { "atmega163", "__AVR_ATmega163" },
-  { "atmega164a", "__AVR_ATmega164A" },
-  { "atmega164p", 

[PATCH] D29692: [clang-tidy] add check modernize-use-const-instead-of-define

2017-02-11 Thread Alexander Lanin via Phabricator via cfe-commits
AlexanderLanin updated this revision to Diff 88103.
AlexanderLanin marked 2 inline comments as done.
AlexanderLanin added a comment.

Fixes as reported in review


https://reviews.llvm.org/D29692

Files:
  clang-tidy/modernize/CMakeLists.txt
  clang-tidy/modernize/ModernizeTidyModule.cpp
  clang-tidy/modernize/UseConstInsteadOfDefineCheck.cpp
  clang-tidy/modernize/UseConstInsteadOfDefineCheck.h
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst
  test/clang-tidy/modernize-use-const-instead-of-define.cpp

Index: test/clang-tidy/modernize-use-const-instead-of-define.cpp
===
--- /dev/null
+++ test/clang-tidy/modernize-use-const-instead-of-define.cpp
@@ -0,0 +1,40 @@
+// RUN: %check_clang_tidy %s modernize-use-const-instead-of-define %t
+
+// Although there might be cases where the - sign is actually used those
+// should be rare enough. e.g. int a = 5 BAD1;
+#define BAD1  -1
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD2  2
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD3(A)   0
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD4(X)   (7)
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD5(X)   +4
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD6 'x'
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD7 0xff
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+
+#define GOOD1 -
+#define GOOD2 (1+2)
+#define GOOD3(A)  #A
+#define GOOD4(A,B)A+B
+#define GOOD5(T)  ((T*)0)
+#define GOOD6(type)   (type(123))
+#define GOOD7(car, ...)   car
+#define GOOD8 a[5]
+#define GOOD9(x)  ;x;
+#define GOOD10;-2;
+#define GOOD11=2
+#define GOOD12+'a'
+#define GOOD13-'z'
+#define GOOD14!3
+#define GOOD15~-1
+#define GOOD16"str"
+
+#define NOT_DETECTED_YET_1(x)  ((unsigned char)(0xff))
+#define NOT_DETECTED_YET_2 (int)7
+#define NOT_DETECTED_YET_3 int(-5)
+#define NOT_DETECTED_YET_4 (int)(0)
Index: docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst
===
--- /dev/null
+++ docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst
@@ -0,0 +1,41 @@
+.. title:: clang-tidy - modernize-use-const-instead-of-define
+
+modernize-use-const-instead-of-define
+=
+
+C++ const variables should be preferred over ``#define`` directives as
+``#define`` does not obey type checking and scope rules.
+
+Example
+---
+
+.. code-block:: c++
+
+  `// calc.h
+  namespace RealCalculation {
+#define PI 3.14159
+  }
+
+  // quick.h
+  namespace QuickCalculation {
+#define PI 1
+  }
+
+  // calc.cpp
+  #include "calc.h"
+  #include "quick.h"
+
+  double calc(const double r) {
+return 2*PI*r*r;
+  }
+
+Code guidelines
+---
+
+While many C++ code guidelines like to prohibit macros completely with the
+exception of include guards, that's a rather strict limitation.
+Disallowing simple numbers should not require any significant code change and
+may even offer fix-it suggestions in the future.
+
+See also:
+https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es31-dont-use-macros-for-constants-or-functions
Index: docs/clang-tidy/checks/list.rst
===
--- docs/clang-tidy/checks/list.rst
+++ docs/clang-tidy/checks/list.rst
@@ -112,6 +112,7 @@
modernize-shrink-to-fit
modernize-use-auto
modernize-use-bool-literals
+   modernize-use-const-instead-of-define
modernize-use-default-member-init
modernize-use-emplace
modernize-use-equals-default
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -57,6 +57,12 @@
 Improvements to clang-tidy
 --
 
+
+- New `modernize-use-const-instead-of-define
+  `_ check
+
+  Finds uses of ``#define`` where a const value would be more appropriate.
+
 - New `safety-no-assembler
   `_ check
 
Index: clang-tidy/modernize/UseConstInsteadOfDefineCheck.h
===
--- /dev/null
+++ clang-tidy/modernize/UseConstInsteadOfDefineCheck.h
@@ -0,0 +1,40 @@
+//===--- 

[PATCH] D29692: [clang-tidy] add check modernize-use-const-instead-of-define

2017-02-11 Thread Alexander Lanin via Phabricator via cfe-commits
AlexanderLanin marked 9 inline comments as done.
AlexanderLanin added a comment.

Not sure about CppCoreGuidelines as several guidelines have the same rule and I 
only used CppCoreGuidelines as it's convenient to link a specific rule. But I 
can move it if you like?!




Comment at: clang-tidy/modernize/UseConstInsteadOfDefineCheck.cpp:41
+/// others like ~ are not so obvious and depend on usage
+bool isReasonableNumberPrefix(const Token ) {
+  return T.isOneOf(tok::plus, tok::minus);

Eugene.Zelenko wrote:
> In LLVM Functions should be static, not inside anonymous namespace. Same 
> below.
mhh copied from MacroParentheses check



Comment at: docs/clang-tidy/checks/modernize-use-const-instead-of-define.rst:11
+
+voif defineSeven() {
+  #define X 7

malcolm.parsons wrote:
> s/voif/void/
> Why is this in a function anyway?
that's why I wrote strange example ;-)
Hope the new one is better ?!



Comment at: test/clang-tidy/modernize-use-const-instead-of-define.cpp:6
+#define BAD1  -1
+// CHECK-MESSAGES: :[[@LINE-1]]:{{.*}} [modernize-use-const-instead-of-define]
+#define BAD2  2

malcolm.parsons wrote:
> Check the message?
I didn't check the exact message since I changed the wording several times and 
it's currently the same message for everything that's detected anyway. Shall I 
check the exact message anyway?


Repository:
  rL LLVM

https://reviews.llvm.org/D29692



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


[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-11 Thread Paweł Żukowski via Phabricator via cfe-commits
idlecode updated this revision to Diff 88101.
idlecode added a comment.

Addressed Richard's inline comment.


https://reviews.llvm.org/D29724

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Frontend/LangStandard.h
  include/clang/Frontend/LangStandards.def
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/unknown-std.c
  test/Driver/unknown-std.cl
  test/Driver/unknown-std.cpp

Index: test/Driver/unknown-std.cpp
===
--- /dev/null
+++ test/Driver/unknown-std.cpp
@@ -0,0 +1,26 @@
+// This file checks output given when processing C++/ObjC++ files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'c++98' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'c++03' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++98' for 'ISO C++ 1998 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++0x' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++0x' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1y' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++1y' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard
+// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard
+// CHECK-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard
+
+// Make sure that no other output is present.
+// CHECK-NOT: {{^.+$}}
+
Index: test/Driver/unknown-std.cl
===
--- /dev/null
+++ test/Driver/unknown-std.cl
@@ -0,0 +1,16 @@
+// This file checks output given when processing OpenCL files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'cl' for 'OpenCL 1.0' standard
+// CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
+// CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
+// CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
+
+// Make sure that no other output is present.
+// CHECK-NOT: {{^.+$}}
+
Index: test/Driver/unknown-std.c
===
--- /dev/null
+++ test/Driver/unknown-std.c
@@ -0,0 +1,34 @@
+// This file checks output given when processing C/ObjC files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'c89' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'c90' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'iso9899:1990' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'iso9899:199409' for 'ISO C 1990 with amendment 1' standard
+// CHECK-NEXT: note: use 'gnu89' for 'ISO C 1990 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu90' for 'ISO C 1990 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c99' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'c9x' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'iso9899:1999' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'iso9899:199x' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu9x' for 'ISO C 1999 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c11' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'c1x' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'iso9899:2011' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'iso9899:201x' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu1x' for 'ISO C 2011 with GNU extensions' standard
+// CHECK-NEXT: note: use 'cl' for 'OpenCL 1.0' standard
+// CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
+// CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
+// CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
+
+// Make sure that no other output is present.
+// 

Re: r294855 - docs: update docs for objc_storeStrong behaviour

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Hi Hans,

Would you mind grabbing this for the 4.0 release as well?  It's merely
correcting the documentation, so should have no impact on the toolchain
itself.

On Sat, Feb 11, 2017 at 9:24 AM, Saleem Abdulrasool via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: compnerd
> Date: Sat Feb 11 11:24:09 2017
> New Revision: 294855
>
> URL: http://llvm.org/viewvc/llvm-project?rev=294855=rev
> Log:
> docs: update docs for objc_storeStrong behaviour
>
> objc_storeStrong does not return a value.
>
> Modified:
> cfe/trunk/docs/AutomaticReferenceCounting.rst
> cfe/trunk/lib/CodeGen/CodeGenModule.h
>
> Modified: cfe/trunk/docs/AutomaticReferenceCounting.rst
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/
> AutomaticReferenceCounting.rst?rev=294855=294854=294855=diff
> 
> ==
> --- cfe/trunk/docs/AutomaticReferenceCounting.rst (original)
> +++ cfe/trunk/docs/AutomaticReferenceCounting.rst Sat Feb 11 11:24:09 2017
> @@ -2258,16 +2258,13 @@ non-block type [*]_.  Equivalent to the
>
>  .. code-block:: objc
>
> -  id objc_storeStrong(id *object, id value) {
> -value = [value retain];
> +  void objc_storeStrong(id *object, id value) {
>  id oldValue = *object;
> +value = [value retain];
>  *object = value;
>  [oldValue release];
> -return value;
>}
>
> -Always returns ``value``.
> -
>  .. [*] This does not imply that a ``__strong`` object of block type is an
> invalid argument to this function. Rather it implies that an
> ``objc_retain``
> and not an ``objc_retainBlock`` operation will be emitted if the
> argument is
>
> Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/
> CodeGenModule.h?rev=294855=294854=294855=diff
> 
> ==
> --- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
> +++ cfe/trunk/lib/CodeGen/CodeGenModule.h Sat Feb 11 11:24:09 2017
> @@ -166,7 +166,7 @@ struct ObjCEntrypoints {
>/// void objc_release(id);
>llvm::Constant *objc_release;
>
> -  /// id objc_storeStrong(id*, id);
> +  /// void objc_storeStrong(id*, id);
>llvm::Constant *objc_storeStrong;
>
>/// id objc_storeWeak(id*, id);
>
>
> ___
> cfe-commits mailing list
> cfe-commits@lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>



-- 
Saleem Abdulrasool
compnerd (at) compnerd (dot) org
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-11 Thread Richard Smith via Phabricator via cfe-commits
rsmith accepted this revision.
rsmith added inline comments.
This revision is now accepted and ready to land.



Comment at: lib/Frontend/CompilerInvocation.cpp:1753-1754
+  KindValue != LangStandard::lang_unspecified;
+  ++KindValue)
+  {
+const LangStandard  = LangStandard::getLangStandardForKind(

`{` on previous line, please, and indent the previous two lines to match the 
`(`.


https://reviews.llvm.org/D29724



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


Re: r293199 - Turn on -Wblock-capture-autoreleasing by default.

2017-02-11 Thread Nico Weber via cfe-commits
Hi Akira,

this fires in internal chrome/ios code like so:

somefile.m: error: block captures an autoreleasing out-parameter, which may
result in use-after-free bugs [-Werror,-Wblock-capture-autoreleasing]
  if (error) {
  ^
somefile.m: note: declare the parameter __autoreleasing explicitly to
suppress this warning
- (NSDictionary *)fooWithError:(NSError **)error {
  ^
  __autoreleasing
somefile.m: note: declare the parameter __strong or capture a __block
__strong variable to keep values alive across autorelease pools


A colleague points out that
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#indirect-parameters
suggests NSError ** should "be implicitly qualified with __autoreleasing."
Is that a bug in the implementation of the warning,
is AutomaticReferenceCounting.html incorrect, or are we just
misunderstanding that document?

Thanks,
Nico

On Thu, Jan 26, 2017 at 1:51 PM, Akira Hatanaka via cfe-commits <
cfe-commits@lists.llvm.org> wrote:

> Author: ahatanak
> Date: Thu Jan 26 12:51:10 2017
> New Revision: 293199
>
> URL: http://llvm.org/viewvc/llvm-project?rev=293199=rev
> Log:
> Turn on -Wblock-capture-autoreleasing by default.
>
> Turning on the warning by default helps the users as it's a common
> mistake to capture out-parameters in a block without ensuring the object
> assigned doesn't get released.
>
> rdar://problem/30200058
>
> Modified:
> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> cfe/trunk/test/SemaObjC/arc.m
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/
> DiagnosticSemaKinds.td?rev=293199=293198=293199=diff
> 
> ==
> --- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Thu Jan 26
> 12:51:10 2017
> @@ -5185,7 +5185,7 @@ def err_arc_inconsistent_property_owners
>  def warn_block_capture_autoreleasing : Warning<
>"block captures an autoreleasing out-parameter, which may result in "
>"use-after-free bugs">,
> -  InGroup, DefaultIgnore;
> +  InGroup;
>  def note_declare_parameter_autoreleasing : Note<
>"declare the parameter __autoreleasing explicitly to suppress this
> warning">;
>  def note_declare_parameter_strong : Note<
>
> Modified: cfe/trunk/test/SemaObjC/arc.m
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/
> SemaObjC/arc.m?rev=293199=293198=293199=diff
> 
> ==
> --- cfe/trunk/test/SemaObjC/arc.m (original)
> +++ cfe/trunk/test/SemaObjC/arc.m Thu Jan 26 12:51:10 2017
> @@ -1,4 +1,4 @@
> -// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak
> -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class
> -Wblock-capture-autoreleasing %s
> +// RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime-has-weak
> -fsyntax-only -fobjc-arc -fblocks -verify -Wno-objc-root-class %s
>
>  typedef unsigned long NSUInteger;
>  typedef const void * CFTypeRef;
>
>
> ___
> 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


[PATCH] D29724: [Driver] Report available language standards on user error

2017-02-11 Thread Paweł Żukowski via Phabricator via cfe-commits
idlecode updated this revision to Diff 88100.
idlecode added a comment.

Displayed standards will now match processed file kind


https://reviews.llvm.org/D29724

Files:
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Frontend/LangStandard.h
  include/clang/Frontend/LangStandards.def
  lib/Frontend/CompilerInvocation.cpp
  test/Driver/unknown-std.c
  test/Driver/unknown-std.cl
  test/Driver/unknown-std.cpp

Index: test/Driver/unknown-std.cpp
===
--- /dev/null
+++ test/Driver/unknown-std.cpp
@@ -0,0 +1,26 @@
+// This file checks output given when processing C++/ObjC++ files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'c++98' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'c++03' for 'ISO C++ 1998 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++98' for 'ISO C++ 1998 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++0x' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'c++11' for 'ISO C++ 2011 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++0x' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++11' for 'ISO C++ 2011 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1y' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'c++14' for 'ISO C++ 2014 with amendments' standard
+// CHECK-NEXT: note: use 'gnu++1y' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu++14' for 'ISO C++ 2014 with amendments and GNU extensions' standard
+// CHECK-NEXT: note: use 'c++1z' for 'Working draft for ISO C++ 2017' standard
+// CHECK-NEXT: note: use 'gnu++1z' for 'Working draft for ISO C++ 2017 with GNU extensions' standard
+// CHECK-NEXT: note: use 'cuda' for 'NVIDIA CUDA(tm)' standard
+
+// Make sure that no other output is present.
+// CHECK-NOT: {{^.+$}}
+
Index: test/Driver/unknown-std.cl
===
--- /dev/null
+++ test/Driver/unknown-std.cl
@@ -0,0 +1,16 @@
+// This file checks output given when processing OpenCL files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'cl' for 'OpenCL 1.0' standard
+// CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
+// CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
+// CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
+
+// Make sure that no other output is present.
+// CHECK-NOT: {{^.+$}}
+
Index: test/Driver/unknown-std.c
===
--- /dev/null
+++ test/Driver/unknown-std.c
@@ -0,0 +1,34 @@
+// This file checks output given when processing C/ObjC files.
+// When user selects invalid language standard
+// print out supported values with short description.
+
+// RUN: not %clang %s -std=foobar -c 2>&1 | \
+// RUN: FileCheck --match-full-lines %s
+
+// CHECK: error: invalid value 'foobar' in '-std=foobar'
+// CHECK-NEXT: note: use 'c89' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'c90' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'iso9899:1990' for 'ISO C 1990' standard
+// CHECK-NEXT: note: use 'iso9899:199409' for 'ISO C 1990 with amendment 1' standard
+// CHECK-NEXT: note: use 'gnu89' for 'ISO C 1990 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu90' for 'ISO C 1990 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c99' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'c9x' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'iso9899:1999' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'iso9899:199x' for 'ISO C 1999' standard
+// CHECK-NEXT: note: use 'gnu99' for 'ISO C 1999 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu9x' for 'ISO C 1999 with GNU extensions' standard
+// CHECK-NEXT: note: use 'c11' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'c1x' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'iso9899:2011' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'iso9899:201x' for 'ISO C 2011' standard
+// CHECK-NEXT: note: use 'gnu11' for 'ISO C 2011 with GNU extensions' standard
+// CHECK-NEXT: note: use 'gnu1x' for 'ISO C 2011 with GNU extensions' standard
+// CHECK-NEXT: note: use 'cl' for 'OpenCL 1.0' standard
+// CHECK-NEXT: note: use 'cl1.1' for 'OpenCL 1.1' standard
+// CHECK-NEXT: note: use 'cl1.2' for 'OpenCL 1.2' standard
+// CHECK-NEXT: note: use 'cl2.0' for 'OpenCL 2.0' standard
+
+// Make sure that no other output is 

r294862 - Hopefully fixes a compile error introduced by r294861.

2017-02-11 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Feb 11 12:00:32 2017
New Revision: 294862

URL: http://llvm.org/viewvc/llvm-project?rev=294862=rev
Log:
Hopefully fixes a compile error introduced by r294861.

Modified:
cfe/trunk/include/clang/AST/TypeLoc.h

Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=294862=294861=294862=diff
==
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Sat Feb 11 12:00:32 2017
@@ -75,22 +75,7 @@ public:
   /// adjustments from a type that wad written as a T to another type that is
   /// still canonically a T (ignores parens, attributes, elaborated types, 
etc).
   template 
-  T getAsAdjusted() const {
-TypeLoc Cur = *this;
-while (!T::isKind(Cur)) {
-  if (auto PTL = Cur.getAs())
-Cur = PTL.getInnerLoc();
-  else if (auto ATL = Cur.getAs())
-Cur = ATL.getModifiedLoc();
-  else if (auto ETL = Cur.getAs())
-Cur = ETL.getNamedTypeLoc();
-  else if (auto ATL = Cur.getAs())
-Cur = ATL.getOriginalLoc();
-  else
-break;
-}
-return Cur.getAs();
-  }
+  T getAsAdjusted() const;
 
   /// The kinds of TypeLocs.  Equivalent to the Type::TypeClass enum,
   /// except it also defines a Qualified enum that corresponds to the
@@ -2210,6 +2195,24 @@ public:
 
   QualType getInnerType() const { return this->getTypePtr()->getElementType(); 
}
 };
+
+template 
+inline T TypeLoc::getAsAdjusted() const {
+  TypeLoc Cur = *this;
+  while (!T::isKind(Cur)) {
+if (auto PTL = Cur.getAs())
+  Cur = PTL.getInnerLoc();
+else if (auto ATL = Cur.getAs())
+  Cur = ATL.getModifiedLoc();
+else if (auto ETL = Cur.getAs())
+  Cur = ETL.getNamedTypeLoc();
+else if (auto ATL = Cur.getAs())
+  Cur = ATL.getOriginalLoc();
+else
+  break;
+  }
+  return Cur.getAs();
+}
 }
 
 #endif


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


r294861 - Attributes on K C functions should not cause incompatible function type with a redeclaration having the same attribute. Fixing this introduced a secondary problem where we were assuming th

2017-02-11 Thread Aaron Ballman via cfe-commits
Author: aaronballman
Date: Sat Feb 11 11:49:53 2017
New Revision: 294861

URL: http://llvm.org/viewvc/llvm-project?rev=294861=rev
Log:
Attributes on K C functions should not cause incompatible function type with 
a redeclaration having the same attribute. Fixing this introduced a secondary 
problem where we were assuming that K functions could not be attributed types 
when reporting old-style function definitions that are not preceded by a 
prototype.

This patch fixes PR31020.

Modified:
cfe/trunk/include/clang/AST/Type.h
cfe/trunk/include/clang/AST/TypeLoc.h
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/knr-def-call.c
cfe/trunk/test/Sema/warn-strict-prototypes.c

Modified: cfe/trunk/include/clang/AST/Type.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=294861=294860=294861=diff
==
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Sat Feb 11 11:49:53 2017
@@ -1888,6 +1888,13 @@ public:
   /// immediately following this class.
   template  const T *getAs() const;
 
+  /// Member-template getAsAdjusted. Look through specific kinds
+  /// of sugar (parens, attributes, etc) for an instance of \.
+  /// This is used when you need to walk over sugar nodes that represent some
+  /// kind of type adjustment from a type that was written as a \
+  /// to another type that is still canonically a \.
+  template  const T *getAsAdjusted() const;
+
   /// A variant of getAs<> for array types which silently discards
   /// qualifiers from the outermost type.
   const ArrayType *getAsArrayTypeUnsafe() const;
@@ -6008,6 +6015,38 @@ template  const T *Type::get
   return cast(getUnqualifiedDesugaredType());
 }
 
+template  const T *Type::getAsAdjusted() const {
+  static_assert(!TypeIsArrayType::value, "ArrayType cannot be used with 
getAsAdjusted!");
+
+  // If this is directly a T type, return it.
+  if (const T *Ty = dyn_cast(this))
+return Ty;
+
+  // If the canonical form of this type isn't the right kind, reject it.
+  if (!isa(CanonicalType))
+return nullptr;
+
+  // Strip off type adjustments that do not modify the underlying nature of the
+  // type.
+  const Type *Ty = this;
+  while (Ty) {
+if (const auto *A = dyn_cast(Ty))
+  Ty = A->getModifiedType().getTypePtr();
+else if (const auto *E = dyn_cast(Ty))
+  Ty = E->desugar().getTypePtr();
+else if (const auto *P = dyn_cast(Ty))
+  Ty = P->desugar().getTypePtr();
+else if (const auto *A = dyn_cast(Ty))
+  Ty = A->desugar().getTypePtr();
+else
+  break;
+  }
+
+  // Just because the canonical type is correct does not mean we can use 
cast<>,
+  // since we may not have stripped off all the sugar down to the base type.
+  return dyn_cast(Ty);
+}
+
 inline const ArrayType *Type::getAsArrayTypeUnsafe() const {
   // If this is directly an array type, return it.
   if (const ArrayType *arr = dyn_cast(this))

Modified: cfe/trunk/include/clang/AST/TypeLoc.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/TypeLoc.h?rev=294861=294860=294861=diff
==
--- cfe/trunk/include/clang/AST/TypeLoc.h (original)
+++ cfe/trunk/include/clang/AST/TypeLoc.h Sat Feb 11 11:49:53 2017
@@ -70,6 +70,28 @@ public:
 return t;
   }
 
+  /// \brief Convert to the specified TypeLoc type, returning a null TypeLoc if
+  /// this TypeLock is not of the desired type. It will consider type
+  /// adjustments from a type that wad written as a T to another type that is
+  /// still canonically a T (ignores parens, attributes, elaborated types, 
etc).
+  template 
+  T getAsAdjusted() const {
+TypeLoc Cur = *this;
+while (!T::isKind(Cur)) {
+  if (auto PTL = Cur.getAs())
+Cur = PTL.getInnerLoc();
+  else if (auto ATL = Cur.getAs())
+Cur = ATL.getModifiedLoc();
+  else if (auto ETL = Cur.getAs())
+Cur = ETL.getNamedTypeLoc();
+  else if (auto ATL = Cur.getAs())
+Cur = ATL.getOriginalLoc();
+  else
+break;
+}
+return Cur.getAs();
+  }
+
   /// The kinds of TypeLocs.  Equivalent to the Type::TypeClass enum,
   /// except it also defines a Qualified enum that corresponds to the
   /// QualifiedLoc class.

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=294861=294860=294861=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Feb 11 11:49:53 2017
@@ -7564,11 +7564,12 @@ static FunctionDecl* CreateNewFunctionDe
 // Determine whether the function was written with a
 // prototype. This true when:
 //   - there is a prototype in the declarator, or
-//   - the type R of the function is some kind of typedef or other 

[PATCH] D28166: Properly merge K functions that have attributes

2017-02-11 Thread Aaron Ballman via Phabricator via cfe-commits
aaron.ballman closed this revision.
aaron.ballman added a comment.

Committed in r294861.


https://reviews.llvm.org/D28166



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


r294854 - CodeGen: rename variables to adhere to naming convention

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 11:24:07 2017
New Revision: 294854

URL: http://llvm.org/viewvc/llvm-project?rev=294854=rev
Log:
CodeGen: rename variables to adhere to naming convention

Adjust style before making more intrusive changes.  NFC.

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

Modified: cfe/trunk/lib/CodeGen/CGObjC.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjC.cpp?rev=294854=294853=294854=diff
==
--- cfe/trunk/lib/CodeGen/CGObjC.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjC.cpp Sat Feb 11 11:24:07 2017
@@ -1803,25 +1803,25 @@ void CodeGenFunction::EmitARCIntrinsicUs
 
 
 static llvm::Constant *createARCRuntimeFunction(CodeGenModule ,
-llvm::FunctionType *type,
-StringRef fnName) {
-  llvm::Constant *fn = CGM.CreateRuntimeFunction(type, fnName);
+llvm::FunctionType *FTy,
+StringRef Name) {
+  llvm::Constant *RTF = CGM.CreateRuntimeFunction(FTy, Name);
 
-  if (llvm::Function *f = dyn_cast(fn)) {
+  if (auto *F = dyn_cast(RTF)) {
 // If the target runtime doesn't naturally support ARC, emit weak
 // references to the runtime support library.  We don't really
 // permit this to fail, but we need a particular relocation style.
 if (!CGM.getLangOpts().ObjCRuntime.hasNativeARC() &&
 !CGM.getTriple().isOSBinFormatCOFF()) {
-  f->setLinkage(llvm::Function::ExternalWeakLinkage);
-} else if (fnName == "objc_retain" || fnName  == "objc_release") {
+  F->setLinkage(llvm::Function::ExternalWeakLinkage);
+} else if (Name == "objc_retain" || Name  == "objc_release") {
   // If we have Native ARC, set nonlazybind attribute for these APIs for
   // performance.
-  f->addFnAttr(llvm::Attribute::NonLazyBind);
+  F->addFnAttr(llvm::Attribute::NonLazyBind);
 }
   }
 
-  return fn;
+  return RTF;
 }
 
 /// Perform an operation having the signature
@@ -1832,7 +1832,8 @@ static llvm::Value *emitARCValueOperatio
   llvm::Constant *,
   StringRef fnName,
   bool isTailCall = false) {
-  if (isa(value)) return value;
+  if (isa(value))
+return value;
 
   if (!fn) {
 llvm::FunctionType *fnType =


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


r294853 - Sema: simplify conditional execution (NFC)

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 11:24:04 2017
New Revision: 294853

URL: http://llvm.org/viewvc/llvm-project?rev=294853=rev
Log:
Sema: simplify conditional execution (NFC)

The conditional cast is unnecessary since we know that it will always
succeed.  NFC.

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

Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=294853=294852=294853=diff
==
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sat Feb 11 11:24:04 2017
@@ -3018,10 +3018,7 @@ Sema::ActOnCXXMemberDeclarator(Scope *S,
 return nullptr;
 }
 
-// Check for any possible shadowed member variables
-if (const auto *RD = cast(CurContext))
-  CheckShadowInheritedFields(Loc, Name, RD);
-
+CheckShadowInheritedFields(Loc, Name, cast(CurContext));
   } else {
 Member = HandleDeclarator(S, D, TemplateParameterLists);
 if (!Member)


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


r294855 - docs: update docs for objc_storeStrong behaviour

2017-02-11 Thread Saleem Abdulrasool via cfe-commits
Author: compnerd
Date: Sat Feb 11 11:24:09 2017
New Revision: 294855

URL: http://llvm.org/viewvc/llvm-project?rev=294855=rev
Log:
docs: update docs for objc_storeStrong behaviour

objc_storeStrong does not return a value.

Modified:
cfe/trunk/docs/AutomaticReferenceCounting.rst
cfe/trunk/lib/CodeGen/CodeGenModule.h

Modified: cfe/trunk/docs/AutomaticReferenceCounting.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/AutomaticReferenceCounting.rst?rev=294855=294854=294855=diff
==
--- cfe/trunk/docs/AutomaticReferenceCounting.rst (original)
+++ cfe/trunk/docs/AutomaticReferenceCounting.rst Sat Feb 11 11:24:09 2017
@@ -2258,16 +2258,13 @@ non-block type [*]_.  Equivalent to the
 
 .. code-block:: objc
 
-  id objc_storeStrong(id *object, id value) {
-value = [value retain];
+  void objc_storeStrong(id *object, id value) {
 id oldValue = *object;
+value = [value retain];
 *object = value;
 [oldValue release];
-return value;
   }
 
-Always returns ``value``.
-
 .. [*] This does not imply that a ``__strong`` object of block type is an
invalid argument to this function. Rather it implies that an ``objc_retain``
and not an ``objc_retainBlock`` operation will be emitted if the argument is

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.h?rev=294855=294854=294855=diff
==
--- cfe/trunk/lib/CodeGen/CodeGenModule.h (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.h Sat Feb 11 11:24:09 2017
@@ -166,7 +166,7 @@ struct ObjCEntrypoints {
   /// void objc_release(id);
   llvm::Constant *objc_release;
 
-  /// id objc_storeStrong(id*, id);
+  /// void objc_storeStrong(id*, id);
   llvm::Constant *objc_storeStrong;
 
   /// id objc_storeWeak(id*, id);


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


[PATCH] D29817: [AVR] Fix __AVR_xxx macro definitions

2017-02-11 Thread Peter Wu via Phabricator via cfe-commits
Lekensteyn added a comment.

In https://reviews.llvm.org/D29817#674306, @dylanmckay wrote:

> Do you have commit access @Lekensteyn?


No I do not, please push it for me :-)


https://reviews.llvm.org/D29817



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


r294838 - Make helpers static. NFC.

2017-02-11 Thread Benjamin Kramer via cfe-commits
Author: d0k
Date: Sat Feb 11 06:21:17 2017
New Revision: 294838

URL: http://llvm.org/viewvc/llvm-project?rev=294838=rev
Log:
Make helpers static. NFC.

Modified:
cfe/trunk/lib/Analysis/OSLog.cpp
cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp

Modified: cfe/trunk/lib/Analysis/OSLog.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/OSLog.cpp?rev=294838=294837=294838=diff
==
--- cfe/trunk/lib/Analysis/OSLog.cpp (original)
+++ cfe/trunk/lib/Analysis/OSLog.cpp Sat Feb 11 06:21:17 2017
@@ -14,6 +14,7 @@ using namespace clang;
 using clang::analyze_os_log::OSLogBufferItem;
 using clang::analyze_os_log::OSLogBufferLayout;
 
+namespace {
 class OSLogFormatStringHandler
 : public analyze_format_string::FormatStringHandler {
 private:
@@ -165,6 +166,7 @@ public:
 }
   }
 };
+} // end anonymous namespace
 
 bool clang::analyze_os_log::computeOSLogBufferLayout(
 ASTContext , const CallExpr *E, OSLogBufferLayout ) {

Modified: cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp?rev=294838=294837=294838=diff
==
--- cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp (original)
+++ cfe/trunk/lib/Sema/SemaTemplateDeduction.cpp Sat Feb 11 06:21:17 2017
@@ -2336,7 +2336,7 @@ static Sema::TemplateDeductionResult Con
   return Sema::TDK_Success;
 }
 
-DeclContext *getAsDeclContextOrEnclosing(Decl *D) {
+static DeclContext *getAsDeclContextOrEnclosing(Decl *D) {
   if (auto *DC = dyn_cast(D))
 return DC;
   return D->getDeclContext();
@@ -2436,7 +2436,7 @@ FinishTemplateArgumentDeduction(
 /// Complete template argument deduction for a class or variable template,
 /// when partial ordering against a partial specialization.
 // FIXME: Factor out duplication with partial specialization version above.
-Sema::TemplateDeductionResult FinishTemplateArgumentDeduction(
+static Sema::TemplateDeductionResult FinishTemplateArgumentDeduction(
 Sema , TemplateDecl *Template, bool PartialOrdering,
 const TemplateArgumentList ,
 SmallVectorImpl ,


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


[PATCH] D29839: [clang-tidy] New misc-istream-overflow check

2017-02-11 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added a comment.

In https://reviews.llvm.org/D29839#674315, @xazax.hun wrote:

> In https://reviews.llvm.org/D29839#674307, @Prazek wrote:
>
> > In https://reviews.llvm.org/D29839#674301, @xazax.hun wrote:
> >
> > > Shouldn't this be a path sensitive check within the clang static analyzer 
> > > instead? So branches are properly handled and interprocedural analysis is 
> > > done.
> >
> >
> > Do you have some examples? I would argue, that even if you would have code 
> > that firstly uses width(), and then after a while reads input, then this is 
> > bugprone, and probably the line initializing width should be just before 
> > reading.
>
>
> You are right, reasonable code sets the width right before reading the input. 
> But do we only want to catch bugs in reasonable code?


We will catch bugs in resonable and not resonable code. But because clang-tidy 
is a linter, we will also warn about cases that might be valid, but looks 
buggy, making code resonable. 
We won't gonna have any false negatives (missed bugs), we only can have more 
false positives (warnings about correct code), but because it is linter, it 
totally make sense to warn about these cases.


https://reviews.llvm.org/D29839



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


[PATCH] D29839: [clang-tidy] New misc-istream-overflow check

2017-02-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D29839#674307, @Prazek wrote:

> In https://reviews.llvm.org/D29839#674301, @xazax.hun wrote:
>
> > Shouldn't this be a path sensitive check within the clang static analyzer 
> > instead? So branches are properly handled and interprocedural analysis is 
> > done.
>
>
> Do you have some examples? I would argue, that even if you would have code 
> that firstly uses width(), and then after a while reads input, then this is 
> bugprone, and probably the line initializing width should be just before 
> reading.


You are right, reasonable code sets the width right before reading the input. 
But do we only want to catch bugs in reasonable code?


https://reviews.llvm.org/D29839



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


[PATCH] D29863: [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.

2017-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF updated this revision to Diff 88088.
EricWF added a comment.

- Fix the initializer list constructors.
- Add tests for almost every constructor.

The following two examples still do not work:

  std::basic_string s1("hello world", 2); // deduces Allocator = int
  std::basic_string s2("hello world", 0, 2); // deduces Allocator = int

This is because the `Allocator` argument is not normally deduced, and
therefore would not normally accept an integer argument.


https://reviews.llvm.org/D29863

Files:
  include/string
  test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp

Index: test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
===
--- /dev/null
+++ test/std/strings/basic.string/string.cons/implicit_deduction_guides.pass.cpp
@@ -0,0 +1,117 @@
+//===--===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is dual licensed under the MIT and the University of Illinois Open
+// Source Licenses. See LICENSE.TXT for details.
+//
+//===--===//
+
+// UNSUPPORTED: c++98, c++03, c++11, c++14
+
+// Clang does not implement deduction guides yet.
+// XFAIL: clang, apple-clang
+
+// 
+
+// Test that the constructors offered by std::basic_string are formulated
+// so they're compatible with implicit deduction guides.
+
+#include 
+#include 
+#include 
+
+#include "test_macros.h"
+#include "test_allocator.h"
+#include "constexpr_char_traits.hpp"
+
+
+template >
+using BStr = std::basic_string;
+
+
+int main()
+{
+  {
+std::basic_string s = "hello world";
+std::basic_string w(L"hello world");
+
+ASSERT_SAME_TYPE(decltype(s), std::basic_string);
+ASSERT_SAME_TYPE(decltype(w), std::basic_string);
+  }
+  {
+std::basic_string s("hello world", test_allocator{});
+ASSERT_SAME_TYPE(decltype(s), BStr);
+  }
+  {
+std::basic_string s("hello world", 2ull, test_allocator{});
+std::basic_string w(L"hello world", 2ull, test_allocator{});
+ASSERT_SAME_TYPE(decltype(s), BStr);
+ASSERT_SAME_TYPE(decltype(w), BStr);
+
+  }
+  {
+std::basic_string s(6ull, 'a');
+std::basic_string w(2ull, L'b');
+ASSERT_SAME_TYPE(decltype(s), std::string);
+assert(s == "aa");
+ASSERT_SAME_TYPE(decltype(w), std::wstring);
+assert(w == L"bb");
+  }
+  {
+std::basic_string s(6ull, 'a', test_allocator{});
+std::basic_string w(2ull, L'b', test_allocator{});
+ASSERT_SAME_TYPE(decltype(s), BStr);
+assert(s == "aa");
+ASSERT_SAME_TYPE(decltype(w), BStr);
+assert(w == L"bb");
+  }
+  {
+std::string const s1;
+std::basic_string s(s1);
+ASSERT_SAME_TYPE(decltype(s), std::string);
+
+std::basic_string w = std::wstring{};
+ASSERT_SAME_TYPE(decltype(w), std::wstring);
+  }
+  {
+std::basic_string s({'a', 'b', 'c'});
+ASSERT_SAME_TYPE(decltype(s), std::string);
+assert(s == "abc");
+
+std::basic_string w({L'a', L'b', L'c'});
+ASSERT_SAME_TYPE(decltype(w), std::wstring);
+assert(w == L"abc");
+  }
+  {
+std::basic_string s({'a', 'b', 'c'}, test_allocator{});
+ASSERT_SAME_TYPE(decltype(s), BStr);
+assert(s == "abc");
+
+std::basic_string w({L'a', L'b', L'c'}, test_allocator{});
+ASSERT_SAME_TYPE(decltype(w), BStr);
+assert(w == L"abc");
+  }
+  {
+std::string_view sv("abc");
+std::basic_string s(sv);
+ASSERT_SAME_TYPE(decltype(s), std::string);
+assert(s == "abc");
+
+using CT = constexpr_char_traits;
+std::basic_string_view wsv(L"def");
+std::basic_string w(wsv, test_allocator{});
+ASSERT_SAME_TYPE(decltype(w),
+ std::basic_string);
+  }
+  {
+// FIXME: The third argument deduces as the allocator.
+// std::string s1("abcd");
+//std::basic_string s(s1, 1ull, 3ull);
+//ASSERT_SAME_TYPE(decltype(s), std::string);
+
+const BStr w1(L"abcd");
+std::basic_string w(w1, 1u, 3u, test_allocator{});
+ASSERT_SAME_TYPE(decltype(w), BStr);
+  }
+}
Index: include/string
===
--- include/string
+++ include/string
@@ -775,41 +775,41 @@
 _LIBCPP_INLINE_VISIBILITY
 basic_string(basic_string&& __str, const allocator_type& __a);
 #endif  // _LIBCPP_HAS_NO_RVALUE_REFERENCES
-_LIBCPP_INLINE_VISIBILITY basic_string(const value_type* __s);
+_LIBCPP_INLINE_VISIBILITY basic_string(const _CharT* __s);
 _LIBCPP_INLINE_VISIBILITY
-basic_string(const value_type* __s, const allocator_type& __a);
+basic_string(const 

[PATCH] D29863: [libc++] Fix PR 31938 - std::basic_string constructors use non-deductible parameter types.

2017-02-11 Thread Eric Fiselier via Phabricator via cfe-commits
EricWF added inline comments.



Comment at: include/string:782
 _LIBCPP_INLINE_VISIBILITY
 basic_string(const value_type* __s, size_type __n);
 _LIBCPP_INLINE_VISIBILITY

rsmith wrote:
> Did you skip this one intentionally?
Yes. `size_type`  is a typedef for `allocator_traits::size_type`, 
This causes the `basic_string(CharT*, Allocator const&)` to always be chosen 
instead, resulting in a incorrect allocator type.



Comment at: include/string:788
 _LIBCPP_INLINE_VISIBILITY
 basic_string(size_type __n, value_type __c, const allocator_type& __a);
 basic_string(const basic_string& __str, size_type __pos, size_type __n,

rsmith wrote:
> Likewise these two.
I thought they would suffer the same fate as the above overload but that is not 
the case. I'll update after reviewing each constructor.



Comment at: include/string:812
 _LIBCPP_INLINE_VISIBILITY
 basic_string(initializer_list __il, const allocator_type& __a);
 #endif  // _LIBCPP_HAS_NO_GENERALIZED_INITIALIZERS

rsmith wrote:
> And these
Just making sure I was on the right track first.


https://reviews.llvm.org/D29863



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


[PATCH] D29839: [clang-tidy] New misc-istream-overflow check

2017-02-11 Thread Piotr Padlewski via Phabricator via cfe-commits
Prazek added a comment.

In https://reviews.llvm.org/D29839#674301, @xazax.hun wrote:

> Shouldn't this be a path sensitive check within the clang static analyzer 
> instead? So branches are properly handled and interprocedural analysis is 
> done.


Do you have some examples? I would argue, that even if you would have code that 
firstly uses width(), and then after a while reads input, then this is 
bugprone, and probably the line initializing width should be just before 
reading.


https://reviews.llvm.org/D29839



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


[PATCH] D29817: [AVR] Fix __AVR_xxx macro definitions

2017-02-11 Thread Dylan McKay via Phabricator via cfe-commits
dylanmckay added a comment.

Do you have commit access @Lekensteyn?


https://reviews.llvm.org/D29817



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


[PATCH] D29839: [clang-tidy] New misc-istream-overflow check

2017-02-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

Shouldn't this be a path sensitive check within the clang static analyzer 
instead? So branches are properly handled and interprocedural analysis is done.


https://reviews.llvm.org/D29839



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


[PATCH] D15227: [analyzer] Valist checkers.

2017-02-11 Thread Gábor Horváth via Phabricator via cfe-commits
xazax.hun added a comment.

In https://reviews.llvm.org/D15227#674278, @zaks.anna wrote:

> @xazax.hun,
>
> Can we move this out of alpha?
>
> Have this checkers been tested on a large codebase? What are false positive 
> rates?


I have tested it on a few ~200k LOC C codebase and I did not see any major 
problem. There is one problem left though, when I committed this check some of 
the build bots broke, I suspect that slightly different AST is generated on 
some of the platforms. I temporarily fixed the issue by hardcoding the triple 
into the tests and I did not have time yet to investigate the source of the 
problems. But as far as I remember, this produced false negatives in the tests 
not false positives.


Repository:
  rL LLVM

https://reviews.llvm.org/D15227



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


[libcxx] r294833 - Remove a now unneeded __CloudABI__ check.

2017-02-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sat Feb 11 02:33:16 2017
New Revision: 294833

URL: http://llvm.org/viewvc/llvm-project?rev=294833=rev
Log:
Remove a now unneeded __CloudABI__ check.

CloudABI has gained the setlocale() function in the meantime, meaning
there is no longer a need to conditionalize this.


Modified:
libcxx/trunk/src/locale.cpp

Modified: libcxx/trunk/src/locale.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/locale.cpp?rev=294833=294832=294833=diff
==
--- libcxx/trunk/src/locale.cpp (original)
+++ libcxx/trunk/src/locale.cpp Sat Feb 11 02:33:16 2017
@@ -579,10 +579,8 @@ locale::global(const locale& loc)
 locale& g = __global();
 locale r = g;
 g = loc;
-#ifndef __CloudABI__
 if (g.name() != "*")
 setlocale(LC_ALL, g.name().c_str());
-#endif
 return r;
 }
 


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


[libcxx] r294832 - Fix the build of thread.cpp on CloudABI.

2017-02-11 Thread Ed Schouten via cfe-commits
Author: ed
Date: Sat Feb 11 02:30:18 2017
New Revision: 294832

URL: http://llvm.org/viewvc/llvm-project?rev=294832=rev
Log:
Fix the build of thread.cpp on CloudABI.

CloudABI does provide unistd.h, but doesn't define __unix__. We need to
include this header file to make hardware_concurrency work.

Modified:
libcxx/trunk/src/thread.cpp

Modified: libcxx/trunk/src/thread.cpp
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/thread.cpp?rev=294832=294831=294832=diff
==
--- libcxx/trunk/src/thread.cpp (original)
+++ libcxx/trunk/src/thread.cpp Sat Feb 11 02:30:18 2017
@@ -24,9 +24,9 @@
 # endif // defined(BSD)
 #endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
 
-#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || 
defined(__CloudABI__)
 # include 
-#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#endif // defined(__unix__) || (defined(__APPLE__) && defined(__MACH__)) || 
defined(__CloudABI__)
 
 #if defined(__NetBSD__)
 #pragma weak pthread_create // Do not create libpthread dependency


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


[PATCH] D29739: Make Lit tests C++11 compatible - Objective-C++

2017-02-11 Thread John McCall via Phabricator via cfe-commits
rjmccall added a comment.

In https://reviews.llvm.org/D29739#674288, @probinson wrote:

> In https://reviews.llvm.org/D29739#673971, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D29739#673933, @tigerleapgorge wrote:
> >
> > > Hi John,
> > >
> > > Here is the most recent discussion I can find on cfe-dev.
> > >  “I'm guessing that Objective-C/C++ is kind of passe, so nobody is really 
> > > interested in modernizing it”
> > >  http://lists.llvm.org/pipermail/cfe-dev/2016-December/051844.html
> > >
> > > As far as I am aware, there appears to be no strong reason to bump or not 
> > > to bump ObjC++.
> >
> >
> > It certainly simplifies the message to say that we've changed the default 
> > C++ dialect to C++11 across the board.  That should apply to ObjC++ as 
> > well.  I would not describe ObjC++ as passé; it's a very important language 
> > for Apple developers.
>
>
> Nice to know, although nobody piped up on the earlier cited discussion.
>
> Sony is invested in making the lit tests C++11 clean so that we can upstream 
> a change to make it the default C++ dialect for PS4.  That will ensure that 
> any new C++ tests are C++11 clean.  This is one step in the direction of 
> making C++11 (or even something newer) the default dialect for everybody.
>  However we are not an Objective-C++ vendor.  We are neutral about changing 
> the default dialect there; if you want to change the default dialect for 
> Objective-C++, that's fine with us, but I don't think we can invest in 
> learning enough about Objective-C++ to do the right thing with the existing 
> Objective-C++ tests.  In particular I don't know whether forcing 98 on these 
> tests is the "right" solution; all we know is that it made the tests pass, 
> which is not particularly surprising.


I understand.  That's part of why I do code review, because sometimes I can 
answer questions for other people. :)  Forcing 98 on these tests is fine.

> I really think Apple would need to step up here if the default Objective-C++ 
> dialect is going to change.

I don't mind stepping up and doing this work.  I just thought you'd already 
done it.  This patch updates some tests; is that enough, or are there further 
changes required in order to change the default ObjC++ dialect?

John.


https://reviews.llvm.org/D29739



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