r368804 - [NewPM][PassInstrumentation] IR printing support from clang driver

2019-08-14 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Wed Aug 14 00:11:09 2019
New Revision: 368804

URL: http://llvm.org/viewvc/llvm-project?rev=368804=rev
Log:
[NewPM][PassInstrumentation] IR printing support from clang driver

Summary: https://reviews.llvm.org/D50923 enabled the IR printing support for 
the new pass manager, but only for the case when `opt` tool is used as a 
driver. This patch is to enable the IR printing when `clang` is used as a 
driver.

Reviewers: fedor.sergeev, philip.pfaffe

Subscribers: cfe-commits, yamauchi, llvm-commits

Tags: #clang

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

Added:
cfe/trunk/test/Misc/printer.c
Modified:
cfe/trunk/lib/CodeGen/BackendUtil.cpp

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=368804=368803=368804=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Wed Aug 14 00:11:09 2019
@@ -37,6 +37,7 @@
 #include "llvm/MC/SubtargetFeature.h"
 #include "llvm/Passes/PassBuilder.h"
 #include "llvm/Passes/PassPlugin.h"
+#include "llvm/Passes/StandardInstrumentations.h"
 #include "llvm/Support/BuryPointer.h"
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/MemoryBuffer.h"
@@ -1063,7 +1064,10 @@ void EmitAssemblyHelper::EmitAssemblyWit
   PTO.LoopVectorization = CodeGenOpts.VectorizeLoop;
   PTO.SLPVectorization = CodeGenOpts.VectorizeSLP;
 
-  PassBuilder PB(TM.get(), PTO, PGOOpt);
+  PassInstrumentationCallbacks PIC;
+  StandardInstrumentations SI;
+  SI.registerCallbacks(PIC);
+  PassBuilder PB(TM.get(), PTO, PGOOpt, );
 
   // Attempt to load pass plugins and register their callbacks with PB.
   for (auto  : CodeGenOpts.PassPlugins) {

Added: cfe/trunk/test/Misc/printer.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Misc/printer.c?rev=368804=auto
==
--- cfe/trunk/test/Misc/printer.c (added)
+++ cfe/trunk/test/Misc/printer.c Wed Aug 14 00:11:09 2019
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-llvm -fexperimental-new-pass-manager -mllvm 
-print-before-all %s -o %t 2>&1 | FileCheck %s --check-prefix=CHECK-BEFORE
+// RUN: %clang_cc1 -emit-llvm -fexperimental-new-pass-manager -mllvm 
-print-after-all %s -o %t 2>&1 | FileCheck %s --check-prefix=CHECK-AFTER
+// CHECK-BEFORE: *** IR Dump Before AlwaysInlinerPass ***
+// CHECK-AFTER: *** IR Dump After AlwaysInlinerPass ***
+void foo() {}


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


r319904 - Stringizing raw string literals containing newline

2017-12-06 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Wed Dec  6 09:00:53 2017
New Revision: 319904

URL: http://llvm.org/viewvc/llvm-project?rev=319904=rev
Log:
Stringizing raw string literals containing newline

Summary: This patch implements 4.3 of 
http://open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4220.pdf. If a raw string 
contains a newline character, replace each newline character with the \n escape 
code. Without this patch, included test case (macro_raw_string.cpp) results 
compilation failure.

Reviewers: rsmith, doug.gregor, jkorous-apple

Reviewed By: jkorous-apple

Subscribers: jkorous-apple, vsapsai, cfe-commits

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

Added:
cfe/trunk/test/Preprocessor/macro_raw_string.cpp
Modified:
cfe/trunk/include/clang/Lex/Lexer.h
cfe/trunk/lib/Lex/Lexer.cpp
cfe/trunk/unittests/Lex/LexerTest.cpp

Modified: cfe/trunk/include/clang/Lex/Lexer.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/Lexer.h?rev=319904=319903=319904=diff
==
--- cfe/trunk/include/clang/Lex/Lexer.h (original)
+++ cfe/trunk/include/clang/Lex/Lexer.h Wed Dec  6 09:00:53 2017
@@ -70,7 +70,7 @@ class Lexer : public PreprocessorLexer {
   SourceLocation FileLoc;// Location for start of file.
   LangOptions LangOpts;  // LangOpts enabled by this language (cache).
   bool Is_PragmaLexer;   // True if lexer for _Pragma handling.
-  
+
   
//======//
   // Context-specific lexing flags set by the preprocessor.
   //
@@ -241,17 +241,16 @@ public:
 
   /// \brief Return the current location in the buffer.
   const char *getBufferLocation() const { return BufferPtr; }
-  
-  /// Stringify - Convert the specified string into a C string by escaping '\'
-  /// and " characters.  This does not add surrounding ""'s to the string.
+
+  /// Stringify - Convert the specified string into a C string by i) escaping
+  /// '\\' and " characters and ii) replacing newline character(s) with "\\n".
   /// If Charify is true, this escapes the ' character instead of ".
   static std::string Stringify(StringRef Str, bool Charify = false);
 
-  /// Stringify - Convert the specified string into a C string by escaping '\'
-  /// and " characters.  This does not add surrounding ""'s to the string.
+  /// Stringify - Convert the specified string into a C string by i) escaping
+  /// '\\' and " characters and ii) replacing newline character(s) with "\\n".
   static void Stringify(SmallVectorImpl );
 
-  
   /// getSpelling - This method is used to get the spelling of a token into a
   /// preallocated buffer, instead of as an std::string.  The caller is 
required
   /// to allocate enough space for the token, which is guaranteed to be at 
least
@@ -262,11 +261,11 @@ public:
   /// to point to a constant buffer with the data already in it (avoiding a
   /// copy).  The caller is not allowed to modify the returned buffer pointer
   /// if an internal buffer is returned.
-  static unsigned getSpelling(const Token , const char *, 
+  static unsigned getSpelling(const Token , const char *,
   const SourceManager ,
   const LangOptions ,
   bool *Invalid = nullptr);
-  
+
   /// getSpelling() - Return the 'spelling' of the Tok token.  The spelling of 
a
   /// token is the characters used to represent the token in the source file
   /// after trigraph expansion and escaped-newline folding.  In particular, 
this
@@ -274,7 +273,7 @@ public:
   /// UCNs, etc.
   static std::string getSpelling(const Token ,
  const SourceManager ,
- const LangOptions , 
+ const LangOptions ,
  bool *Invalid = nullptr);
 
   /// getSpelling - This method is used to get the spelling of the
@@ -290,7 +289,7 @@ public:
const SourceManager ,
const LangOptions ,
bool *invalid = nullptr);
-  
+
   /// MeasureTokenLength - Relex the token at the specified location and return
   /// its length in bytes in the input file.  If the token needs cleaning (e.g.
   /// includes a trigraph or an escaped newline) then this count includes bytes
@@ -312,7 +311,7 @@ public:
   static SourceLocation GetBeginningOfToken(SourceLocation Loc,
 const SourceManager ,
 const LangOptions );
-  
+
   /// AdvanceToTokenCharacter - If the current SourceLocation specifies a
   /// location at the start of a token, return a new location that specifies a
   /// character within the token.  This handles trigraphs and escaped newlines.
@@ -320,7 +319,7 @@ public:
 unsigned 

r311037 - Use the file name from linemarker for debug info if an input is preprocessed source.

2017-08-16 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Wed Aug 16 12:36:24 2017
New Revision: 311037

URL: http://llvm.org/viewvc/llvm-project?rev=311037=rev
Log:
Use the file name from linemarker for debug info if an input is preprocessed 
source.

Summary:
Even in the case of the input file is a preprocessed source, clang uses the 
file name of the preprocesses source for debug info (DW_AT_name attribute for 
DW_TAG_compile_unit). However, gcc uses the file name specified in the first 
linemarker instead. This makes more sense because the one specified in the 
linemarker represents the "actual" source file name.

Clang already uses the file name specified in the first linemarker for Module 
name 
(https://github.com/llvm-mirror/clang/blob/master/lib/Frontend/FrontendAction.cpp#L779)
 if the input is preprocessed. This patch makes clang to use the same value for 
debug info as well.

Reviewers: compnerd, rnk, dblaikie, rsmith

Reviewed By: rnk

Subscribers: aprantl, cfe-commits

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

Added:
cfe/trunk/test/CodeGen/debug-info-preprocessed-file.i
Modified:
cfe/trunk/lib/CodeGen/CGDebugInfo.cpp

Modified: cfe/trunk/lib/CodeGen/CGDebugInfo.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDebugInfo.cpp?rev=311037=311036=311037=diff
==
--- cfe/trunk/lib/CodeGen/CGDebugInfo.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDebugInfo.cpp Wed Aug 16 12:36:24 2017
@@ -29,6 +29,7 @@
 #include "clang/Basic/SourceManager.h"
 #include "clang/Basic/Version.h"
 #include "clang/Frontend/CodeGenOptions.h"
+#include "clang/Frontend/FrontendOptions.h"
 #include "clang/Lex/HeaderSearchOptions.h"
 #include "clang/Lex/ModuleMap.h"
 #include "clang/Lex/PreprocessorOptions.h"
@@ -495,6 +496,16 @@ void CGDebugInfo::CreateCompileUnit() {
   llvm::sys::path::append(MainFileDirSS, MainFileName);
   MainFileName = MainFileDirSS.str();
 }
+// If the main file name provided is identical to the input file name, and
+// if the input file is a preprocessed source, use the module name for
+// debug info. The module name comes from the name specified in the first
+// linemarker if the input is a preprocessed source.
+if (MainFile->getName() == MainFileName &&
+FrontendOptions::getInputKindForExtension(
+MainFile->getName().rsplit('.').second)
+.isPreprocessed())
+  MainFileName = CGM.getModule().getName().str();
+
 CSKind = computeChecksum(SM.getMainFileID(), Checksum);
   }
 

Added: cfe/trunk/test/CodeGen/debug-info-preprocessed-file.i
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/debug-info-preprocessed-file.i?rev=311037=auto
==
--- cfe/trunk/test/CodeGen/debug-info-preprocessed-file.i (added)
+++ cfe/trunk/test/CodeGen/debug-info-preprocessed-file.i Wed Aug 16 12:36:24 
2017
@@ -0,0 +1,11 @@
+# 1 "/foo/bar/preprocessed-input.c"
+# 1 "" 1
+# 1 "" 3
+# 318 "" 3
+# 1 "" 1
+# 1 "" 2
+# 1 "preprocessed-input.c" 2
+
+// RUN: %clang -g -c -S -emit-llvm -o - %s | FileCheck %s
+// CHECK: !DICompileUnit(language: DW_LANG_C99, file: ![[FILE:[0-9]+]] 
+// CHECK: ![[FILE]] = !DIFile(filename: "/foo/bar/preprocessed-input.c"


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


r297194 - Use filename in linemarker when compiling preprocessed source (Revised)

2017-03-07 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Tue Mar  7 14:20:23 2017
New Revision: 297194

URL: http://llvm.org/viewvc/llvm-project?rev=297194=rev
Log:
Use filename in linemarker when compiling preprocessed source (Revised)

Summary:
This is a revised version of D28796. Included test is changed to
resolve the target compatibility issue reported (rL293032).

Reviewers: inglorion, dblaikie, echristo, aprantl, probinson

Reviewed By: inglorion

Subscribers: mehdi_amini, cfe-commits

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

Added:
cfe/trunk/test/Frontend/preprocessed-input.i
Modified:
cfe/trunk/include/clang/Frontend/FrontendOptions.h
cfe/trunk/lib/Frontend/FrontendAction.cpp

Modified: cfe/trunk/include/clang/Frontend/FrontendOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendOptions.h?rev=297194=297193=297194=diff
==
--- cfe/trunk/include/clang/Frontend/FrontendOptions.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendOptions.h Tue Mar  7 14:20:23 2017
@@ -81,7 +81,7 @@ enum InputKind {
   IK_LLVM_IR
 };
 
-  
+
 /// \brief An input file for the front end.
 class FrontendInputFile {
   /// \brief The file name, or "-" to read from standard input.
@@ -109,6 +109,13 @@ public:
   bool isEmpty() const { return File.empty() && Buffer == nullptr; }
   bool isFile() const { return !isBuffer(); }
   bool isBuffer() const { return Buffer != nullptr; }
+  bool isPreprocessed() const {
+return Kind == IK_PreprocessedC ||
+   Kind == IK_PreprocessedCXX ||
+   Kind == IK_PreprocessedObjC ||
+   Kind == IK_PreprocessedObjCXX ||
+   Kind == IK_PreprocessedCuda;
+  }
 
   StringRef getFile() const {
 assert(isFile());

Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=297194=297193=297194=diff
==
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Tue Mar  7 14:20:23 2017
@@ -19,6 +19,7 @@
 #include "clang/Frontend/MultiplexConsumer.h"
 #include "clang/Frontend/Utils.h"
 #include "clang/Lex/HeaderSearch.h"
+#include "clang/Lex/LiteralSupport.h"
 #include "clang/Lex/Preprocessor.h"
 #include "clang/Lex/PreprocessorOptions.h"
 #include "clang/Parse/ParseAST.h"
@@ -187,6 +188,42 @@ FrontendAction::CreateWrappedASTConsumer
   return llvm::make_unique(std::move(Consumers));
 }
 
+// For preprocessed files, if the first line is the linemarker and specifies
+// the original source file name, use that name as the input file name.
+static bool ReadOriginalFileName(CompilerInstance , std::string )
+{
+  bool Invalid = false;
+  auto  = CI.getSourceManager();
+  auto MainFileID = SourceMgr.getMainFileID();
+  const auto *MainFileBuf = SourceMgr.getBuffer(MainFileID, );
+  if (Invalid)
+return false;
+
+  std::unique_ptr RawLexer(
+  new Lexer(MainFileID, MainFileBuf, SourceMgr, CI.getLangOpts()));
+
+  // If the first line has the syntax of
+  //
+  // # NUM "FILENAME"
+  //
+  // we use FILENAME as the input file name.
+  Token T;
+  if (RawLexer->LexFromRawLexer(T) || T.getKind() != tok::hash)
+return false;
+  if (RawLexer->LexFromRawLexer(T) || T.isAtStartOfLine() ||
+  T.getKind() != tok::numeric_constant)
+return false;
+  RawLexer->LexFromRawLexer(T);
+  if (T.isAtStartOfLine() || T.getKind() != tok::string_literal)
+return false;
+
+  StringLiteralParser Literal(T, CI.getPreprocessor());
+  if (Literal.hadError)
+return false;
+  InputFile = Literal.GetString().str();
+  return true;
+}
+
 bool FrontendAction::BeginSourceFile(CompilerInstance ,
  const FrontendInputFile ) {
   assert(!Instance && "Already processing a source file!");
@@ -338,6 +375,13 @@ bool FrontendAction::BeginSourceFile(Com
 if (!isModelParsingAction())
   CI.createASTContext();
 
+// For preprocessed files, check if the first line specifies the original
+// source file name with a linemarker.
+std::string OrigFile;
+if (Input.isPreprocessed())
+  if (ReadOriginalFileName(CI, OrigFile))
+InputFile = OrigFile;
+
 std::unique_ptr Consumer =
 CreateWrappedASTConsumer(CI, InputFile);
 if (!Consumer)
@@ -430,9 +474,9 @@ bool FrontendAction::BeginSourceFile(Com
 
   // If there is a layout overrides file, attach an external AST source that
   // provides the layouts from that file.
-  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() && 
+  if (!CI.getFrontendOpts().OverrideRecordLayoutsFile.empty() &&
   CI.hasASTContext() && !CI.getASTContext().getExternalSource()) {
-IntrusiveRefCntPtr 
+IntrusiveRefCntPtr
   Override(new LayoutOverrideSource(
  CI.getFrontendOpts().OverrideRecordLayoutsFile));
 

r295779 - Fix for pr31836 - pp_nonportable_path on absolute paths: broken delimiters

2017-02-21 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Tue Feb 21 16:30:55 2017
New Revision: 295779

URL: http://llvm.org/viewvc/llvm-project?rev=295779=rev
Log:
Fix for pr31836 - pp_nonportable_path on absolute paths: broken delimiters

Summary: This is a patch for PR31836. As the bug replaces the path separators 
in the included file name with the characters following them, the test script 
makes sure that there's no "Ccase-insensitive-include-pr31836.h" in the warning 
message.

Reviewers: rsmith, eric_niebler

Reviewed By: eric_niebler

Subscribers: karies, cfe-commits

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

Added:
cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=295779=295778=295779=diff
==
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Tue Feb 21 16:30:55 2017
@@ -1976,8 +1976,12 @@ void Preprocessor::HandleIncludeDirectiv
   SmallString<128> Path;
   Path.reserve(Name.size()+2);
   Path.push_back(isAngled ? '<' : '"');
+  bool isLeadingSeparator = llvm::sys::path::is_absolute(Name);
   for (auto Component : Components) {
-Path.append(Component);
+if (isLeadingSeparator)
+  isLeadingSeparator = false;
+else
+  Path.append(Component);
 // Append the separator the user used, or the close quote
 Path.push_back(
   Path.size() <= Filename.size() ? Filename[Path.size()-1] :

Added: cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh?rev=295779=auto
==
--- cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh (added)
+++ cfe/trunk/test/Lexer/case-insensitive-include-pr31836.sh Tue Feb 21 
16:30:55 2017
@@ -0,0 +1,9 @@
+// REQUIRES: case-insensitive-filesystem
+// UNSUPPORTED: system-windows
+
+// RUN: mkdir -p %T
+// RUN: touch %T/case-insensitive-include-pr31836.h
+// RUN: echo "#include \"%T/Case-Insensitive-Include-Pr31836.h\"" | %clang_cc1 
-E - 2>&1 | FileCheck %s
+
+// CHECK: warning: non-portable path to file
+// CHECK-SAME: /case-insensitive-include-pr31836.h


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


[PATCH] D23765: Fix for clang PR 29087

2016-11-03 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 76817.
twoh added a comment.

Addressing comments from @rsmith. Thanks!


https://reviews.llvm.org/D23765

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/cxx11-crashes.cpp


Index: test/SemaCXX/cxx11-crashes.cpp
===
--- test/SemaCXX/cxx11-crashes.cpp
+++ test/SemaCXX/cxx11-crashes.cpp
@@ -91,3 +91,15 @@
   Foo(lambda);
 }
 }
+
+namespace pr29091 {
+  struct X{ X(const X ); };
+  struct Y: X { using X::X; };
+  bool foo() { return __has_nothrow_constructor(Y); }
+  bool bar() { return __has_nothrow_copy(Y); }
+
+  struct A { template  A(); };
+  struct B : A { using A::A; };
+  bool baz() { return __has_nothrow_constructor(B); }
+  bool qux() { return __has_nothrow_copy(B); }
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4398,9 +4398,12 @@
 // A template constructor is never a copy constructor.
 // FIXME: However, it may actually be selected at the actual overload
 // resolution point.
-if (isa(ND))
+if (isa(ND->getUnderlyingDecl()))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+auto *Constructor = cast(ND->getUnderlyingDecl());
 if (Constructor->isCopyConstructor(FoundTQs)) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
@@ -4434,9 +4437,12 @@
   bool FoundConstructor = false;
   for (const auto *ND : Self.LookupConstructors(RD)) {
 // FIXME: In C++0x, a constructor template can be a default 
constructor.
-if (isa(ND))
+if (isa(ND->getUnderlyingDecl()))
+  continue;
+// UsingDecl itself is not a constructor
+if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+auto *Constructor = cast(ND->getUnderlyingDecl());
 if (Constructor->isDefaultConstructor()) {
   FoundConstructor = true;
   const FunctionProtoType *CPT


Index: test/SemaCXX/cxx11-crashes.cpp
===
--- test/SemaCXX/cxx11-crashes.cpp
+++ test/SemaCXX/cxx11-crashes.cpp
@@ -91,3 +91,15 @@
   Foo(lambda);
 }
 }
+
+namespace pr29091 {
+  struct X{ X(const X ); };
+  struct Y: X { using X::X; };
+  bool foo() { return __has_nothrow_constructor(Y); }
+  bool bar() { return __has_nothrow_copy(Y); }
+
+  struct A { template  A(); };
+  struct B : A { using A::A; };
+  bool baz() { return __has_nothrow_constructor(B); }
+  bool qux() { return __has_nothrow_copy(B); }
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4398,9 +4398,12 @@
 // A template constructor is never a copy constructor.
 // FIXME: However, it may actually be selected at the actual overload
 // resolution point.
-if (isa(ND))
+if (isa(ND->getUnderlyingDecl()))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+auto *Constructor = cast(ND->getUnderlyingDecl());
 if (Constructor->isCopyConstructor(FoundTQs)) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
@@ -4434,9 +4437,12 @@
   bool FoundConstructor = false;
   for (const auto *ND : Self.LookupConstructors(RD)) {
 // FIXME: In C++0x, a constructor template can be a default constructor.
-if (isa(ND))
+if (isa(ND->getUnderlyingDecl()))
+  continue;
+// UsingDecl itself is not a constructor
+if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+auto *Constructor = cast(ND->getUnderlyingDecl());
 if (Constructor->isDefaultConstructor()) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-31 Thread Taewook Oh via cfe-commits
twoh added a comment.

In https://reviews.llvm.org/D25225#584012, @hfinkel wrote:

> In https://reviews.llvm.org/D25225#584010, @twoh wrote:
>
> > Is there a particular reason why "opt_record_file" is defined in 
> > CC1Options.td, not Options.td? If -opt-record-file= is provided 
> > by the command line, line 829-831 in CompilerInvocation.cpp won't handle it 
> > because opt_record_file is not a CodeGenArg.
>
>
> It is not intended to be used directly. The user should use 
> -fsave-optimization-record (along with -foptimization-record-file= if they 
> don't like the default name selected). We definitely need to write end-user 
> docs for this; it is on my TODO list.


Got it. Thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D25225



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


[PATCH] D25225: Add an option to save the backend-produced YAML optimization record to a file

2016-10-31 Thread Taewook Oh via cfe-commits
twoh added a comment.

Is there a particular reason why "opt_record_file" is defined in CC1Options.td, 
not Options.td? If -opt-record-file= is provided by the command line, 
line 829-831 in CompilerInvocation.cpp won't handle it because opt_record_file 
is not a CodeGenArg.


Repository:
  rL LLVM

https://reviews.llvm.org/D25225



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


[PATCH] D23765: Fix for clang PR 29087

2016-10-28 Thread Taewook Oh via cfe-commits
twoh marked an inline comment as not done.
twoh added a comment.

Ping


https://reviews.llvm.org/D23765



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


[PATCH] D23765: Fix for clang PR 29087

2016-10-21 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 75441.
twoh marked an inline comment as done.
twoh added a comment.

Addressing comments from @sepavloff. Thanks!


https://reviews.llvm.org/D23765

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/cxx11-crashes.cpp


Index: test/SemaCXX/cxx11-crashes.cpp
===
--- test/SemaCXX/cxx11-crashes.cpp
+++ test/SemaCXX/cxx11-crashes.cpp
@@ -91,3 +91,10 @@
   Foo(lambda);
 }
 }
+
+namespace pr29091 {
+  struct X{ X(const X ); };
+  struct Y: X { using X::X; };
+  bool foo() { return __has_nothrow_constructor(Y); }
+  bool bar() { return __has_nothrow_copy(Y); }
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4389,7 +4389,18 @@
 // resolution point.
 if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+const CXXConstructorDecl *Constructor = nullptr;
+if (auto *CSD = dyn_cast(ND)) {
+  Constructor = cast(CSD->getTargetDecl());
+  // Default constructor and copy/move constructor are not inherited.
+  if (Constructor->isDefaultConstructor() ||
+  Constructor->isCopyOrMoveConstructor())
+continue;
+} else
+  Constructor = cast(ND);
 if (Constructor->isCopyConstructor(FoundTQs)) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
@@ -4425,7 +4436,18 @@
 // FIXME: In C++0x, a constructor template can be a default 
constructor.
 if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+const CXXConstructorDecl *Constructor = nullptr;
+if (auto *CSD = dyn_cast(ND)) {
+  Constructor = cast(CSD->getTargetDecl());
+  // Default constructor and copy/move constructor are not inherited.
+  if (Constructor->isDefaultConstructor() ||
+  Constructor->isCopyOrMoveConstructor())
+continue;
+} else
+  Constructor = cast(ND);
 if (Constructor->isDefaultConstructor()) {
   FoundConstructor = true;
   const FunctionProtoType *CPT


Index: test/SemaCXX/cxx11-crashes.cpp
===
--- test/SemaCXX/cxx11-crashes.cpp
+++ test/SemaCXX/cxx11-crashes.cpp
@@ -91,3 +91,10 @@
   Foo(lambda);
 }
 }
+
+namespace pr29091 {
+  struct X{ X(const X ); };
+  struct Y: X { using X::X; };
+  bool foo() { return __has_nothrow_constructor(Y); }
+  bool bar() { return __has_nothrow_copy(Y); }
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -4389,7 +4389,18 @@
 // resolution point.
 if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+const CXXConstructorDecl *Constructor = nullptr;
+if (auto *CSD = dyn_cast(ND)) {
+  Constructor = cast(CSD->getTargetDecl());
+  // Default constructor and copy/move constructor are not inherited.
+  if (Constructor->isDefaultConstructor() ||
+  Constructor->isCopyOrMoveConstructor())
+continue;
+} else
+  Constructor = cast(ND);
 if (Constructor->isCopyConstructor(FoundTQs)) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
@@ -4425,7 +4436,18 @@
 // FIXME: In C++0x, a constructor template can be a default constructor.
 if (isa(ND))
   continue;
-const CXXConstructorDecl *Constructor = cast(ND);
+// UsingDecl itself is not a constructor
+if (isa(ND))
+  continue;
+const CXXConstructorDecl *Constructor = nullptr;
+if (auto *CSD = dyn_cast(ND)) {
+  Constructor = cast(CSD->getTargetDecl());
+  // Default constructor and copy/move constructor are not inherited.
+  if (Constructor->isDefaultConstructor() ||
+  Constructor->isCopyOrMoveConstructor())
+continue;
+} else
+  Constructor = cast(ND);
 if (Constructor->isDefaultConstructor()) {
   FoundConstructor = true;
   const FunctionProtoType *CPT
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D23765: Fix for clang PR 29087

2016-10-20 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


[PATCH] D23765: Fix for clang PR 29087

2016-10-10 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


[PATCH] D23765: Fix for clang PR 29087

2016-10-03 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


Re: [PATCH] D23765: Fix for clang PR 29087

2016-09-23 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


Re: [PATCH] D23765: Fix for clang PR 29087

2016-09-16 Thread Taewook Oh via cfe-commits
twoh added a comment.

@rsmith Thank you for your review! I added tests to cxx11-crashes.cpp, as the 
goal of this patch is not handling __has_* traits right but preventing ICE. 
Also, I tried to use ConstructorUsingShadowDecl::getConstructor instead of 
ConstructorUsingShadowDecl::getTargetDecl followed by casting, but clang build 
was failed with undefined references. I wonder if the definition of 
ConstructorUsingShadowDecl::getConstructor is missed in 
https://reviews.llvm.org/rL274049.


https://reviews.llvm.org/D23765



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


Re: [PATCH] D23765: Fix for clang PR 29087

2016-09-16 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 71711.
twoh added a comment.

Updated diff. For ConstructorUsingShadowDecl, test with its target 
CXXConstructorDecl, but only when it is not a default/copy/move constructor.


https://reviews.llvm.org/D23765

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/cxx11-crashes.cpp

Index: test/SemaCXX/cxx11-crashes.cpp
===
--- test/SemaCXX/cxx11-crashes.cpp
+++ test/SemaCXX/cxx11-crashes.cpp
@@ -91,3 +91,10 @@
   Foo(lambda);
 }
 }
+
+namespace pr29091 {
+  struct X{ X(const X ); };
+  struct Y: X { using X::X; };
+  bool foo() { return __has_nothrow_constructor(Y); }
+  bool bar() { return __has_nothrow_copy(Y); }
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -292,7 +292,7 @@
   if (isDependent) {
 // We didn't find our type, but that's okay: it's dependent
 // anyway.
-
+
 // FIXME: What if we have no nested-name-specifier?
 QualType T = CheckTypenameType(ETK_None, SourceLocation(),
SS.getWithLocInContext(Context),
@@ -326,14 +326,14 @@
 ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
 if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
   return nullptr;
-assert(DS.getTypeSpecType() == DeclSpec::TST_decltype 
+assert(DS.getTypeSpecType() == DeclSpec::TST_decltype
&& "only get destructor types from declspecs");
 QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
 QualType SearchType = GetTypeFromParser(ObjectType);
 if (SearchType->isDependentType() || Context.hasSameUnqualifiedType(SearchType, T)) {
   return ParsedType::make(T);
 }
-  
+
 Diag(DS.getTypeSpecTypeLoc(), diag::err_destructor_expr_type_mismatch)
   << T << SearchType;
 return nullptr;
@@ -662,7 +662,7 @@
   IsThrownVarInScope = true;
   break;
 }
-
+
 if (S->getFlags() &
 (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
  Scope::FunctionPrototypeScope | Scope::ObjCMethodScope |
@@ -672,11 +672,11 @@
 }
   }
   }
-  
+
   return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
 }
 
-ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, 
+ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex,
bool IsThrownVarInScope) {
   // Don't report an error if 'throw' is used in system headers.
   if (!getLangOpts().CXXExceptions &&
@@ -903,10 +903,10 @@
I-- && isa(FunctionScopes[I]);
CurDC = getLambdaAwareParentOfDeclContext(CurDC)) {
 CurLSI = cast(FunctionScopes[I]);
-
-if (!CurLSI->isCXXThisCaptured()) 
+
+if (!CurLSI->isCXXThisCaptured())
 continue;
-  
+
 auto C = CurLSI->getCXXThisCapture();
 
 if (C.isCopyCapture()) {
@@ -922,7 +922,7 @@
 assert(CurLSI);
 assert(isGenericLambdaCallOperatorSpecialization(CurLSI->CallOperator));
 assert(CurDC == getLambdaAwareParentOfDeclContext(CurLSI->CallOperator));
-
+
 auto IsThisCaptured =
 [](CXXRecordDecl *Closure, bool , bool ) {
   IsConst = false;
@@ -992,10 +992,10 @@
   return ThisTy;
 }
 
-Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema , 
+Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema ,
  Decl *ContextDecl,
  unsigned CXXThisTypeQuals,
- bool Enabled) 
+ bool Enabled)
   : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(false)
 {
   if (!Enabled || !ContextDecl)
@@ -1006,13 +1006,13 @@
 Record = Template->getTemplatedDecl();
   else
 Record = cast(ContextDecl);
-
+
   // We care only for CVR qualifiers here, so cut everything else.
   CXXThisTypeQuals &= Qualifiers::FastMask;
   S.CXXThisTypeOverride
 = S.Context.getPointerType(
 S.Context.getRecordType(Record).withCVRQualifiers(CXXThisTypeQuals));
-  
+
   this->Enabled = true;
 }
 
@@ -1026,7 +1026,7 @@
 static Expr *captureThis(Sema , ASTContext , RecordDecl *RD,
  QualType ThisTy, SourceLocation Loc,
  const bool ByCopy) {
- 
+
   QualType AdjustedThisTy = ThisTy;
   // The type of the corresponding data member (not a 'this' pointer if 'by
   // copy').
@@ -1039,7 +1039,7 @@
 CaptureThisFieldTy.removeLocalCVRQualifiers(Qualifiers::CVRMask);
 AdjustedThisTy = Context.getPointerType(CaptureThisFieldTy);
   }
-  
+
   FieldDecl *Field = FieldDecl::Create(
   Context, RD, Loc, Loc, nullptr, CaptureThisFieldTy,
   Context.getTrivialTypeSourceInfo(CaptureThisFieldTy, Loc), nullptr, false,
@@ -1065,41 +1065,41 @@
   return This;
 }
 
-bool 

Re: [PATCH] D23765: Fix for clang PR 29087

2016-09-15 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 71560.
twoh added a comment.

Tests added


https://reviews.llvm.org/D23765

Files:
  lib/Sema/SemaExprCXX.cpp
  test/SemaCXX/crash-has-nothrow-constructor.cpp
  test/SemaCXX/crash-has-nothrow-copy.cpp

Index: test/SemaCXX/crash-has-nothrow-copy.cpp
===
--- test/SemaCXX/crash-has-nothrow-copy.cpp
+++ test/SemaCXX/crash-has-nothrow-copy.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s
+
+#define assert(x) if (x) {}
+
+struct X {
+  X(const X ) {}
+};
+
+struct Y : public X {
+public:
+  using X::X;
+};
+
+int main() {
+  assert(__has_nothrow_copy(Y));
+}
Index: test/SemaCXX/crash-has-nothrow-constructor.cpp
===
--- test/SemaCXX/crash-has-nothrow-constructor.cpp
+++ test/SemaCXX/crash-has-nothrow-constructor.cpp
@@ -0,0 +1,16 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s
+
+#define assert(x) if (x) {}
+
+struct X {
+  X() {}
+};
+
+struct Y : public X {
+public:
+  using X::X;
+};
+
+int main() {
+  assert(__has_nothrow_constructor(Y));
+}
Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -292,7 +292,7 @@
   if (isDependent) {
 // We didn't find our type, but that's okay: it's dependent
 // anyway.
-
+
 // FIXME: What if we have no nested-name-specifier?
 QualType T = CheckTypenameType(ETK_None, SourceLocation(),
SS.getWithLocInContext(Context),
@@ -326,14 +326,14 @@
 ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
 if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
   return nullptr;
-assert(DS.getTypeSpecType() == DeclSpec::TST_decltype 
+assert(DS.getTypeSpecType() == DeclSpec::TST_decltype
&& "only get destructor types from declspecs");
 QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
 QualType SearchType = GetTypeFromParser(ObjectType);
 if (SearchType->isDependentType() || Context.hasSameUnqualifiedType(SearchType, T)) {
   return ParsedType::make(T);
 }
-  
+
 Diag(DS.getTypeSpecTypeLoc(), diag::err_destructor_expr_type_mismatch)
   << T << SearchType;
 return nullptr;
@@ -662,7 +662,7 @@
   IsThrownVarInScope = true;
   break;
 }
-
+
 if (S->getFlags() &
 (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
  Scope::FunctionPrototypeScope | Scope::ObjCMethodScope |
@@ -672,11 +672,11 @@
 }
   }
   }
-  
+
   return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
 }
 
-ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, 
+ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex,
bool IsThrownVarInScope) {
   // Don't report an error if 'throw' is used in system headers.
   if (!getLangOpts().CXXExceptions &&
@@ -903,10 +903,10 @@
I-- && isa(FunctionScopes[I]);
CurDC = getLambdaAwareParentOfDeclContext(CurDC)) {
 CurLSI = cast(FunctionScopes[I]);
-
-if (!CurLSI->isCXXThisCaptured()) 
+
+if (!CurLSI->isCXXThisCaptured())
 continue;
-  
+
 auto C = CurLSI->getCXXThisCapture();
 
 if (C.isCopyCapture()) {
@@ -922,7 +922,7 @@
 assert(CurLSI);
 assert(isGenericLambdaCallOperatorSpecialization(CurLSI->CallOperator));
 assert(CurDC == getLambdaAwareParentOfDeclContext(CurLSI->CallOperator));
-
+
 auto IsThisCaptured =
 [](CXXRecordDecl *Closure, bool , bool ) {
   IsConst = false;
@@ -992,10 +992,10 @@
   return ThisTy;
 }
 
-Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema , 
+Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema ,
  Decl *ContextDecl,
  unsigned CXXThisTypeQuals,
- bool Enabled) 
+ bool Enabled)
   : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(false)
 {
   if (!Enabled || !ContextDecl)
@@ -1006,13 +1006,13 @@
 Record = Template->getTemplatedDecl();
   else
 Record = cast(ContextDecl);
-
+
   // We care only for CVR qualifiers here, so cut everything else.
   CXXThisTypeQuals &= Qualifiers::FastMask;
   S.CXXThisTypeOverride
 = S.Context.getPointerType(
 S.Context.getRecordType(Record).withCVRQualifiers(CXXThisTypeQuals));
-  
+
   this->Enabled = true;
 }
 
@@ -1026,7 +1026,7 @@
 static Expr *captureThis(Sema , ASTContext , RecordDecl *RD,
  QualType ThisTy, SourceLocation Loc,
  const bool ByCopy) {
- 
+
   QualType AdjustedThisTy = ThisTy;
   // The type of the corresponding data member (not a 'this' pointer if 'by
   // copy').
@@ 

Re: [PATCH] D23765: Fix for clang PR 29087

2016-09-14 Thread Taewook Oh via cfe-commits
twoh added a comment.

Ping.


https://reviews.llvm.org/D23765



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


Re: [PATCH] D23765: Fix for clang PR 29087

2016-08-29 Thread Taewook Oh via cfe-commits
twoh added a comment.

ping


https://reviews.llvm.org/D23765



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


[PATCH] D23765: Fix for clang PR 29087

2016-08-22 Thread Taewook Oh via cfe-commits
twoh created this revision.
twoh added a reviewer: rsmith.
twoh added a subscriber: cfe-commits.

Since rL274049, for an inheriting constructor declaration, the name of the 
using declaration (and using shadow declaration comes from the using 
declaration) is the name of a derived class, not the base class (line 8225-8232 
of lib/Sema/SemaDeclCXX.cpp in https://reviews.llvm.org/rL274049). Because of 
this, name-based lookup performed inside Sema::LookupConstructors returns not 
only CXXConstructorDecls but also Using(Shadow)Decls, which results assertion 
failure reported in PR 29087. 

https://reviews.llvm.org/D23765

Files:
  include/clang/AST/DeclCXX.h
  lib/Sema/SemaExprCXX.cpp

Index: lib/Sema/SemaExprCXX.cpp
===
--- lib/Sema/SemaExprCXX.cpp
+++ lib/Sema/SemaExprCXX.cpp
@@ -292,7 +292,7 @@
   if (isDependent) {
 // We didn't find our type, but that's okay: it's dependent
 // anyway.
-
+
 // FIXME: What if we have no nested-name-specifier?
 QualType T = CheckTypenameType(ETK_None, SourceLocation(),
SS.getWithLocInContext(Context),
@@ -326,14 +326,14 @@
 ParsedType Sema::getDestructorType(const DeclSpec& DS, ParsedType ObjectType) {
 if (DS.getTypeSpecType() == DeclSpec::TST_error || !ObjectType)
   return nullptr;
-assert(DS.getTypeSpecType() == DeclSpec::TST_decltype 
+assert(DS.getTypeSpecType() == DeclSpec::TST_decltype
&& "only get destructor types from declspecs");
 QualType T = BuildDecltypeType(DS.getRepAsExpr(), DS.getTypeSpecTypeLoc());
 QualType SearchType = GetTypeFromParser(ObjectType);
 if (SearchType->isDependentType() || Context.hasSameUnqualifiedType(SearchType, T)) {
   return ParsedType::make(T);
 }
-  
+
 Diag(DS.getTypeSpecTypeLoc(), diag::err_destructor_expr_type_mismatch)
   << T << SearchType;
 return nullptr;
@@ -662,7 +662,7 @@
   IsThrownVarInScope = true;
   break;
 }
-
+
 if (S->getFlags() &
 (Scope::FnScope | Scope::ClassScope | Scope::BlockScope |
  Scope::FunctionPrototypeScope | Scope::ObjCMethodScope |
@@ -672,11 +672,11 @@
 }
   }
   }
-  
+
   return BuildCXXThrow(OpLoc, Ex, IsThrownVarInScope);
 }
 
-ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex, 
+ExprResult Sema::BuildCXXThrow(SourceLocation OpLoc, Expr *Ex,
bool IsThrownVarInScope) {
   // Don't report an error if 'throw' is used in system headers.
   if (!getLangOpts().CXXExceptions &&
@@ -903,10 +903,10 @@
I-- && isa(FunctionScopes[I]);
CurDC = getLambdaAwareParentOfDeclContext(CurDC)) {
 CurLSI = cast(FunctionScopes[I]);
-
-if (!CurLSI->isCXXThisCaptured()) 
+
+if (!CurLSI->isCXXThisCaptured())
 continue;
-  
+
 auto C = CurLSI->getCXXThisCapture();
 
 if (C.isCopyCapture()) {
@@ -922,7 +922,7 @@
 assert(CurLSI);
 assert(isGenericLambdaCallOperatorSpecialization(CurLSI->CallOperator));
 assert(CurDC == getLambdaAwareParentOfDeclContext(CurLSI->CallOperator));
-
+
 auto IsThisCaptured =
 [](CXXRecordDecl *Closure, bool , bool ) {
   IsConst = false;
@@ -992,10 +992,10 @@
   return ThisTy;
 }
 
-Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema , 
+Sema::CXXThisScopeRAII::CXXThisScopeRAII(Sema ,
  Decl *ContextDecl,
  unsigned CXXThisTypeQuals,
- bool Enabled) 
+ bool Enabled)
   : S(S), OldCXXThisTypeOverride(S.CXXThisTypeOverride), Enabled(false)
 {
   if (!Enabled || !ContextDecl)
@@ -1006,13 +1006,13 @@
 Record = Template->getTemplatedDecl();
   else
 Record = cast(ContextDecl);
-
+
   // We care only for CVR qualifiers here, so cut everything else.
   CXXThisTypeQuals &= Qualifiers::FastMask;
   S.CXXThisTypeOverride
 = S.Context.getPointerType(
 S.Context.getRecordType(Record).withCVRQualifiers(CXXThisTypeQuals));
-  
+
   this->Enabled = true;
 }
 
@@ -1026,7 +1026,7 @@
 static Expr *captureThis(Sema , ASTContext , RecordDecl *RD,
  QualType ThisTy, SourceLocation Loc,
  const bool ByCopy) {
- 
+
   QualType AdjustedThisTy = ThisTy;
   // The type of the corresponding data member (not a 'this' pointer if 'by
   // copy').
@@ -1039,7 +1039,7 @@
 CaptureThisFieldTy.removeLocalCVRQualifiers(Qualifiers::CVRMask);
 AdjustedThisTy = Context.getPointerType(CaptureThisFieldTy);
   }
-  
+
   FieldDecl *Field = FieldDecl::Create(
   Context, RD, Loc, Loc, nullptr, CaptureThisFieldTy,
   Context.getTrivialTypeSourceInfo(CaptureThisFieldTy, Loc), nullptr, false,
@@ -1065,41 +1065,41 @@
   return This;
 }
 
-bool Sema::CheckCXXThisCapture(SourceLocation Loc, const 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
twoh added a comment.

Patch committed in http://reviews.llvm.org/rL272592.


http://reviews.llvm.org/D19843



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


r272592 - Patch for r272584 (http://reviews.llvm.org/rL272584) to address clang-x64-ninja-win7 buildbot failure.

2016-06-13 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Mon Jun 13 16:55:33 2016
New Revision: 272592

URL: http://llvm.org/viewvc/llvm-project?rev=272592=rev
Log:
Patch for r272584 (http://reviews.llvm.org/rL272584) to address 
clang-x64-ninja-win7 buildbot failure.

Patch by Eric Niebler


Modified:
cfe/trunk/lib/Lex/PPDirectives.cpp

Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=272592=272591=272592=diff
==
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Mon Jun 13 16:55:33 2016
@@ -154,7 +154,7 @@ static bool warnByDefaultOnWrongCase(Str
 
   // "condition_variable" is the longest standard header name at 18 characters.
   // If the include file name is longer than that, it can't be a standard 
header.
-  static constexpr size_t MaxStdHeaderNameLen = 18u;
+  static const size_t MaxStdHeaderNameLen = 18u;
   if (Include.size() > MaxStdHeaderNameLen)
 return false;
 
@@ -391,7 +391,7 @@ void Preprocessor::SkipExcludedCondition
   setCodeCompletionReached();
   continue;
 }
-
+
 // If this is the end of the buffer, we have an error.
 if (Tok.is(tok::eof)) {
   // Emit errors for each unterminated conditional on the stack, including
@@ -746,7 +746,7 @@ const FileEntry *Preprocessor::LookupFil
 SmallVectorImpl *RelativePath,
 ModuleMap::KnownHeader *SuggestedModule,
 bool SkipCache) {
-  Module *RequestingModule = getModuleForLocation(FilenameLoc); 
+  Module *RequestingModule = getModuleForLocation(FilenameLoc);
   bool RequestingModuleIsModuleInterface = 
!SourceMgr.isInMainFile(FilenameLoc);
 
   // If the header lookup mechanism may be relative to the current inclusion
@@ -992,7 +992,7 @@ void Preprocessor::HandleDirective(Token
   return HandleIncludeDirective(SavedHash.getLocation(), Result);
 case tok::pp___include_macros:
   // Handle -imacros.
-  return HandleIncludeMacrosDirective(SavedHash.getLocation(), Result); 
+  return HandleIncludeMacrosDirective(SavedHash.getLocation(), Result);
 
 // C99 6.10.3 - Macro Replacement.
 case tok::pp_define:
@@ -1031,12 +1031,12 @@ void Preprocessor::HandleDirective(Token
 case tok::pp_unassert:
   //isExtension = true;  // FIXME: implement #unassert
   break;
-
+
 case tok::pp___public_macro:
   if (getLangOpts().Modules)
 return HandleMacroPublicDirective(Result);
   break;
-
+
 case tok::pp___private_macro:
   if (getLangOpts().Modules)
 return HandleMacroPrivateDirective(Result);
@@ -1054,12 +1054,12 @@ void Preprocessor::HandleDirective(Token
 // Return the # and the token after it.
 Toks[0] = SavedHash;
 Toks[1] = Result;
-
+
 // If the second token is a hashhash token, then we need to translate it to
 // unknown so the token lexer doesn't try to perform token pasting.
 if (Result.is(tok::hashhash))
   Toks[1].setKind(tok::unknown);
-
+
 // Enter this token stream so that we re-lex the tokens.  Make sure to
 // enable macro expansion, in case the token after the # is an identifier
 // that is expanded.
@@ -1096,7 +1096,7 @@ static bool GetLineValue(Token 
   unsigned ActualLength = PP.getSpelling(DigitTok, DigitTokBegin, );
   if (Invalid)
 return true;
-  
+
   // Verify that we have a simple digit-sequence, and compute the value.  This
   // is always a simple digit string computed in decimal, so we do this 
manually
   // here.
@@ -1147,7 +1147,7 @@ void Preprocessor::HandleLineDirective(T
   unsigned LineNo;
   if (GetLineValue(DigitTok, LineNo, diag::err_pp_line_requires_integer,*this))
 return;
-  
+
   if (LineNo == 0)
 Diag(DigitTok, diag::ext_pp_line_zero);
 
@@ -1230,7 +1230,7 @@ static bool ReadLineMarkerFlags(bool 
 PresumedLoc PLoc = SM.getPresumedLoc(FlagTok.getLocation());
 if (PLoc.isInvalid())
   return true;
-
+
 // If there is no include loc (main file) or if the include loc is in a
 // different physical file, then we aren't in a "1" line marker flag 
region.
 SourceLocation IncLoc = PLoc.getIncludeLoc();
@@ -1418,7 +1418,7 @@ void Preprocessor::HandleIdentSCCSDirect
 void Preprocessor::HandleMacroPublicDirective(Token ) {
   Token MacroNameTok;
   ReadMacroName(MacroNameTok, MU_Undef);
-  
+
   // Error reading macro name?  If so, diagnostic already issued.
   if (MacroNameTok.is(tok::eod))
 return;
@@ -1429,13 +1429,13 @@ void Preprocessor::HandleMacroPublicDire
   IdentifierInfo *II = MacroNameTok.getIdentifierInfo();
   // Okay, we finally have a valid identifier to undef.
   MacroDirective *MD = getLocalMacroDirective(II);
-  
+
   // If the macro is not defined, this is an error.
   if (!MD) {
 Diag(MacroNameTok, diag::err_pp_visibility_non_macro) << II;
 return;
   }
-  
+
   // Note that this macro has now been exported.
   

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
twoh closed this revision.
twoh added a comment.

Committed by commit http://reviews.llvm.org/rL272584


http://reviews.llvm.org/D19843



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


r272584 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Mon Jun 13 15:40:21 2016
New Revision: 272584

URL: http://llvm.org/viewvc/llvm-project?rev=272584=rev
Log:
Use the name of the file on disk to issue a new diagnostic about non-portable 
#include and #import paths.

Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Re-commit of r272562 after addressing clang-x86-win2008-selfhost failure.


Added:
cfe/trunk/test/Lexer/Inputs/case-insensitive-include.h
cfe/trunk/test/Lexer/case-insensitive-include-ms.c
cfe/trunk/test/Lexer/case-insensitive-include.c
cfe/trunk/test/Lexer/case-insensitive-system-include.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/PCH/case-insensitive-include.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=272584=272583=272584=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Mon Jun 13 15:40:21 2016
@@ -275,6 +275,14 @@ def ext_missing_whitespace_after_macro_n
 def warn_missing_whitespace_after_macro_name : Warning<
   "whitespace recommended after macro name">;
 
+class NonportablePath  : Warning<
+  "non-portable path to file '%0'; specified path differs in case from file"
+  " name on disk">;
+def pp_nonportable_path : NonportablePath,
+  InGroup>;
+def pp_nonportable_system_path : NonportablePath, DefaultIgnore,
+  InGroup>;
+  
 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
   InGroup>;
 def pp_pragma_sysheader_in_main_file : Warning<

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=272584=272583=272584=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Mon Jun 13 15:40:21 2016
@@ -52,6 +52,7 @@ public:
 /// descriptor for the file.
 class FileEntry {
   const char *Name;   // Name of the file.
+  std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
   const DirectoryEntry *Dir;  // Directory file lives in.
@@ -82,6 +83,7 @@ public:
   }
 
   const char *getName() const { return Name; }
+  StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=272584=272583=272584=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Mon Jun 13 15:40:21 2016
@@ -91,6 +91,13 @@ public:
   virtual ~File();
   /// \brief Get the status of the file.
   virtual llvm::ErrorOr status() = 0;
+  /// \brief Get the name of the file
+  virtual llvm::ErrorOr getName() {
+if (auto Status = status())
+  return Status->getName().str();
+else
+  return Status.getError();
+  }
   /// \brief Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr
   getBuffer(const Twine , int64_t FileSize = -1,

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=272584=272583=272584=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Mon Jun 13 15:40:21 2016
@@ -151,6 +151,9 @@ public:
   ///
   /// \param HS The header search instance to search with.
   ///
+  /// \param IncludeLoc the source location of the #include or #import
+  /// directive.
+  ///
   /// \param SearchPath If not NULL, will be set to the search path relative
   /// to which the file was found.
   ///
@@ -172,6 +175,7 @@ public:
   /// a framework include ("Foo.h" -> "Foo/Foo.h"), set the new name to this
   /// vector 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
twoh added a comment.

I already reverted the path in http://reviews.llvm.org/rL272572, so re-commit 
should be the way to go.


http://reviews.llvm.org/D19843



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


r272572 - Revert r272562 for build bot failure (clang-x86-win2008-selfhost)

2016-06-13 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Mon Jun 13 13:32:30 2016
New Revision: 272572

URL: http://llvm.org/viewvc/llvm-project?rev=272572=rev
Log:
Revert r272562 for build bot failure (clang-x86-win2008-selfhost)


Removed:
cfe/trunk/test/Lexer/Inputs/case-insensitive-include.h
cfe/trunk/test/Lexer/case-insensitive-include-ms.c
cfe/trunk/test/Lexer/case-insensitive-include.c
cfe/trunk/test/Lexer/case-insensitive-system-include.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/PCH/case-insensitive-include.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=272572=272571=272572=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Mon Jun 13 13:32:30 2016
@@ -275,13 +275,6 @@ def ext_missing_whitespace_after_macro_n
 def warn_missing_whitespace_after_macro_name : Warning<
   "whitespace recommended after macro name">;
 
-class NonportablePath  : Warning<
-  "non-portable path to file '%0'; specified path differs in case from file"
-  " name on disk">;
-def pp_nonportable_path : NonportablePath, 
InGroup>;
-def pp_nonportable_system_path : NonportablePath, DefaultIgnore,
-  InGroup>;
-
 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
   InGroup>;
 def pp_pragma_sysheader_in_main_file : Warning<

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=272572=272571=272572=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Mon Jun 13 13:32:30 2016
@@ -52,7 +52,6 @@ public:
 /// descriptor for the file.
 class FileEntry {
   const char *Name;   // Name of the file.
-  std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
   const DirectoryEntry *Dir;  // Directory file lives in.
@@ -83,7 +82,6 @@ public:
   }
 
   const char *getName() const { return Name; }
-  StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=272572=272571=272572=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Mon Jun 13 13:32:30 2016
@@ -91,13 +91,6 @@ public:
   virtual ~File();
   /// \brief Get the status of the file.
   virtual llvm::ErrorOr status() = 0;
-  /// \brief Get the name of the file
-  virtual llvm::ErrorOr getName() {
-if (auto Status = status())
-  return Status->getName().str();
-else
-  return Status.getError();
-  }
   /// \brief Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr
   getBuffer(const Twine , int64_t FileSize = -1,

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=272572=272571=272572=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Mon Jun 13 13:32:30 2016
@@ -151,9 +151,6 @@ public:
   ///
   /// \param HS The header search instance to search with.
   ///
-  /// \param IncludeLoc the source location of the #include or #import
-  /// directive.
-  ///
   /// \param SearchPath If not NULL, will be set to the search path relative
   /// to which the file was found.
   ///
@@ -175,7 +172,6 @@ public:
   /// a framework include ("Foo.h" -> "Foo/Foo.h"), set the new name to this
   /// vector and point Filename to it.
   const FileEntry *LookupFile(StringRef , HeaderSearch ,
-  SourceLocation IncludeLoc,
   SmallVectorImpl *SearchPath,
   

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
twoh closed this revision.
twoh added a comment.

Re-commited in http://reviews.llvm.org/rL272562


http://reviews.llvm.org/D19843



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


r272562 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-13 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Mon Jun 13 12:03:18 2016
New Revision: 272562

URL: http://llvm.org/viewvc/llvm-project?rev=272562=rev
Log:
Use the name of the file on disk to issue a new diagnostic about non-portable 
#include and #import paths.

Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Re-commit after addressing issues with of generating too many warnings for 
Windows and asan test failures.

Patch by Eric Niebler


Added:
cfe/trunk/test/Lexer/Inputs/case-insensitive-include.h
cfe/trunk/test/Lexer/case-insensitive-include-ms.c
cfe/trunk/test/Lexer/case-insensitive-include.c
cfe/trunk/test/Lexer/case-insensitive-system-include.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/PCH/case-insensitive-include.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=272562=272561=272562=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Mon Jun 13 12:03:18 2016
@@ -274,7 +274,14 @@ def ext_missing_whitespace_after_macro_n
   "whitespace required after macro name">;
 def warn_missing_whitespace_after_macro_name : Warning<
   "whitespace recommended after macro name">;
-  
+
+class NonportablePath  : Warning<
+  "non-portable path to file '%0'; specified path differs in case from file"
+  " name on disk">;
+def pp_nonportable_path : NonportablePath, 
InGroup>;
+def pp_nonportable_system_path : NonportablePath, DefaultIgnore,
+  InGroup>;
+
 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
   InGroup>;
 def pp_pragma_sysheader_in_main_file : Warning<

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=272562=272561=272562=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Mon Jun 13 12:03:18 2016
@@ -52,6 +52,7 @@ public:
 /// descriptor for the file.
 class FileEntry {
   const char *Name;   // Name of the file.
+  std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
   const DirectoryEntry *Dir;  // Directory file lives in.
@@ -82,6 +83,7 @@ public:
   }
 
   const char *getName() const { return Name; }
+  StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=272562=272561=272562=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Mon Jun 13 12:03:18 2016
@@ -91,6 +91,13 @@ public:
   virtual ~File();
   /// \brief Get the status of the file.
   virtual llvm::ErrorOr status() = 0;
+  /// \brief Get the name of the file
+  virtual llvm::ErrorOr getName() {
+if (auto Status = status())
+  return Status->getName().str();
+else
+  return Status.getError();
+  }
   /// \brief Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr
   getBuffer(const Twine , int64_t FileSize = -1,

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=272562=272561=272562=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Mon Jun 13 12:03:18 2016
@@ -151,6 +151,9 @@ public:
   ///
   /// \param HS The header search instance to search with.
   ///
+  /// \param IncludeLoc the source location of the #include or #import
+  /// directive.
+  ///
   /// \param SearchPath If not NULL, will be set to the search path relative
   /// to which the file was found.
   ///
@@ -172,6 +175,7 @@ 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-03 Thread Taewook Oh via cfe-commits
twoh added a comment.

Reverted in r271761.


http://reviews.llvm.org/D19843



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


Re: r271708 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-03 Thread Taewook Oh via cfe-commits
I reverted the patch with r271761 and r271764.

Thanks,
Taewook

On 6/3/16, 6:40 PM, "Bruno Cardoso Lopes"  wrote:

>> The information about whether the file is in a system path is already being
>> computed, so it would incur no extra overhead. I'm not sure that's the right
>> fix. You are more than welcome to revert the (clang) commit while we think
>> of the right fix.
>
>I'm not sure what the right fix is either, but given the windows issue
>and the ASAN bot failing, it doesn't make sense to leave the commit
>here without a proper fix :-)
>Taewook, can you please revert it until you guys sort out what needs
>to be done to appease the buildbots / have the solution for windows?
>
>Thanks,
>
>-- 
>Bruno Cardoso Lopes
>https://urldefense.proofpoint.com/v2/url?u=http-3A__www.brunocardoso.cc=CwIBaQ=5VD0RTtNlTh3ycd41b3MUw=kOsLCgQzH7N8ptZ7diJD9g=c5XZbyZ2UApk2hO-CxcLwd7rLibhZiOTy7SKZNpNwvc=n3ZPgVAw1y5bVd933hdXCrEkcLpjkFODPjPDfxmg9Dc=
> 

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


r271761 - Revert commit r271708

2016-06-03 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Fri Jun  3 22:14:43 2016
New Revision: 271761

URL: http://llvm.org/viewvc/llvm-project?rev=271761=rev
Log:
Revert commit r271708


Removed:
cfe/trunk/test/Lexer/Inputs/case-insensitive-include.h
cfe/trunk/test/Lexer/case-insensitive-include-ms.c
cfe/trunk/test/Lexer/case-insensitive-include.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/PCH/case-insensitive-include.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=271761=271760=271761=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jun  3 22:14:43 2016
@@ -390,7 +390,6 @@ def : DiagGroup<"sequence-point", [Unseq
 def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
 def KeywordAsMacro : DiagGroup<"keyword-macro">;
 def ReservedIdAsMacro : DiagGroup<"reserved-id-macro">;
-def NonportableIncludePath : DiagGroup<"nonportable-include-path">;
 
 // Just silence warnings about -Wstrict-aliasing for now.
 def : DiagGroup<"strict-aliasing=0">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=271761=271760=271761=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Jun  3 22:14:43 2016
@@ -274,10 +274,6 @@ def ext_missing_whitespace_after_macro_n
   "whitespace required after macro name">;
 def warn_missing_whitespace_after_macro_name : Warning<
   "whitespace recommended after macro name">;
-def pp_nonportable_path : Warning<
-  "non-portable path to file '%0'; specified path differs in case from file"
-  " name on disk">,
-  InGroup;
   
 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
   InGroup>;

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=271761=271760=271761=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Fri Jun  3 22:14:43 2016
@@ -52,7 +52,6 @@ public:
 /// descriptor for the file.
 class FileEntry {
   const char *Name;   // Name of the file.
-  std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
   const DirectoryEntry *Dir;  // Directory file lives in.
@@ -83,7 +82,6 @@ public:
   }
 
   const char *getName() const { return Name; }
-  StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=271761=271760=271761=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Fri Jun  3 22:14:43 2016
@@ -91,13 +91,6 @@ public:
   virtual ~File();
   /// \brief Get the status of the file.
   virtual llvm::ErrorOr status() = 0;
-  /// \brief Get the name of the file
-  virtual llvm::ErrorOr getName() {
-if (auto Status = status())
-  return Status->getName();
-else
-  return Status.getError();
-  }
   /// \brief Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr
   getBuffer(const Twine , int64_t FileSize = -1,

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=271761=271760=271761=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h (original)
+++ cfe/trunk/include/clang/Lex/DirectoryLookup.h Fri Jun  3 22:14:43 2016
@@ -151,9 +151,6 @@ public:
   ///
   /// \param HS The header search instance to search with.
   ///
-  /// \param IncludeLoc the source 

Re: [PATCH] D19843: Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-03 Thread Taewook Oh via cfe-commits
twoh added a subscriber: twoh.
twoh closed this revision.
twoh added a comment.

I have commit in r271708: http://reviews.llvm.org/rL271708


http://reviews.llvm.org/D19843



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


r271708 - Use the name of the file on disk to issue a new diagnostic about non-portable #include and #import paths.

2016-06-03 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Fri Jun  3 13:52:51 2016
New Revision: 271708

URL: http://llvm.org/viewvc/llvm-project?rev=271708=rev
Log:
Use the name of the file on disk to issue a new diagnostic about non-portable 
#include and #import paths.

Differential Revision: http://reviews.llvm.org/D19843
Corresponding LLVM change: http://reviews.llvm.org/D19842

Patch by Eric Niebler


Added:
cfe/trunk/test/Lexer/Inputs/case-insensitive-include.h
cfe/trunk/test/Lexer/case-insensitive-include-ms.c
cfe/trunk/test/Lexer/case-insensitive-include.c
Modified:
cfe/trunk/include/clang/Basic/DiagnosticGroups.td
cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
cfe/trunk/include/clang/Basic/FileManager.h
cfe/trunk/include/clang/Basic/VirtualFileSystem.h
cfe/trunk/include/clang/Lex/DirectoryLookup.h
cfe/trunk/include/clang/Lex/HeaderSearch.h
cfe/trunk/lib/Basic/FileManager.cpp
cfe/trunk/lib/Basic/VirtualFileSystem.cpp
cfe/trunk/lib/Lex/HeaderSearch.cpp
cfe/trunk/lib/Lex/PPDirectives.cpp
cfe/trunk/test/PCH/case-insensitive-include.c

Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=271708=271707=271708=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Fri Jun  3 13:52:51 2016
@@ -390,6 +390,7 @@ def : DiagGroup<"sequence-point", [Unseq
 def AmbiguousMacro : DiagGroup<"ambiguous-macro">;
 def KeywordAsMacro : DiagGroup<"keyword-macro">;
 def ReservedIdAsMacro : DiagGroup<"reserved-id-macro">;
+def NonportableIncludePath : DiagGroup<"nonportable-include-path">;
 
 // Just silence warnings about -Wstrict-aliasing for now.
 def : DiagGroup<"strict-aliasing=0">;

Modified: cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td?rev=271708=271707=271708=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticLexKinds.td Fri Jun  3 13:52:51 2016
@@ -274,6 +274,10 @@ def ext_missing_whitespace_after_macro_n
   "whitespace required after macro name">;
 def warn_missing_whitespace_after_macro_name : Warning<
   "whitespace recommended after macro name">;
+def pp_nonportable_path : Warning<
+  "non-portable path to file '%0'; specified path differs in case from file"
+  " name on disk">,
+  InGroup;
   
 def pp_pragma_once_in_main_file : Warning<"#pragma once in main file">,
   InGroup>;

Modified: cfe/trunk/include/clang/Basic/FileManager.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/FileManager.h?rev=271708=271707=271708=diff
==
--- cfe/trunk/include/clang/Basic/FileManager.h (original)
+++ cfe/trunk/include/clang/Basic/FileManager.h Fri Jun  3 13:52:51 2016
@@ -52,6 +52,7 @@ public:
 /// descriptor for the file.
 class FileEntry {
   const char *Name;   // Name of the file.
+  std::string RealPathName;   // Real path to the file; could be empty.
   off_t Size; // File size in bytes.
   time_t ModTime; // Modification time of file.
   const DirectoryEntry *Dir;  // Directory file lives in.
@@ -82,6 +83,7 @@ public:
   }
 
   const char *getName() const { return Name; }
+  StringRef tryGetRealPathName() const { return RealPathName; }
   bool isValid() const { return IsValid; }
   off_t getSize() const { return Size; }
   unsigned getUID() const { return UID; }

Modified: cfe/trunk/include/clang/Basic/VirtualFileSystem.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/VirtualFileSystem.h?rev=271708=271707=271708=diff
==
--- cfe/trunk/include/clang/Basic/VirtualFileSystem.h (original)
+++ cfe/trunk/include/clang/Basic/VirtualFileSystem.h Fri Jun  3 13:52:51 2016
@@ -91,6 +91,13 @@ public:
   virtual ~File();
   /// \brief Get the status of the file.
   virtual llvm::ErrorOr status() = 0;
+  /// \brief Get the name of the file
+  virtual llvm::ErrorOr getName() {
+if (auto Status = status())
+  return Status->getName();
+else
+  return Status.getError();
+  }
   /// \brief Get the contents of the file as a \p MemoryBuffer.
   virtual llvm::ErrorOr
   getBuffer(const Twine , int64_t FileSize = -1,

Modified: cfe/trunk/include/clang/Lex/DirectoryLookup.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/DirectoryLookup.h?rev=271708=271707=271708=diff
==
--- cfe/trunk/include/clang/Lex/DirectoryLookup.h 

r271702 - [Title] Revert test commit

2016-06-03 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Fri Jun  3 13:30:12 2016
New Revision: 271702

URL: http://llvm.org/viewvc/llvm-project?rev=271702=rev
Log:
[Title] Revert test commit

Summary: Revert test commit

Trac Bug: #

Blame Rev:

Reviewed By:

Test Plan:

Revert Plan:

Database Impact:

Memcache Impact:

Other Notes:

EImportant:

- begin *PUBLIC* platform impact section -
Bugzilla: #
- end platform impact -


Modified:
cfe/trunk/include/clang/Basic/Builtins.def

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=271702=271701=271702=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Fri Jun  3 13:30:12 2016
@@ -790,7 +790,6 @@ LIBBUILTIN(isxdigit, "ii", "fnU", "ctype
 LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
 LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
 
-
 // C99
 // In some systems setjmp is a macro that expands to _setjmp. We undefine
 // it here to avoid having two identical LIBBUILTIN entries.


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


r271701 - Test commit

2016-06-03 Thread Taewook Oh via cfe-commits
Author: twoh
Date: Fri Jun  3 13:27:39 2016
New Revision: 271701

URL: http://llvm.org/viewvc/llvm-project?rev=271701=rev
Log:
Test commit 


Modified:
cfe/trunk/include/clang/Basic/Builtins.def

Modified: cfe/trunk/include/clang/Basic/Builtins.def
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Builtins.def?rev=271701=271700=271701=diff
==
--- cfe/trunk/include/clang/Basic/Builtins.def (original)
+++ cfe/trunk/include/clang/Basic/Builtins.def Fri Jun  3 13:27:39 2016
@@ -790,6 +790,7 @@ LIBBUILTIN(isxdigit, "ii", "fnU", "ctype
 LIBBUILTIN(tolower, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
 LIBBUILTIN(toupper, "ii", "fnU", "ctype.h", ALL_LANGUAGES)
 
+
 // C99
 // In some systems setjmp is a macro that expands to _setjmp. We undefine
 // it here to avoid having two identical LIBBUILTIN entries.


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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-21 Thread Taewook Oh via cfe-commits
twoh added a comment.

Hmm, yes it seems not so simple to move the call to another place. If I come up 
with a better idea I'll submit it as a separate patch, as I don't want to block 
this one. Thank you for your work, @faisalv!


http://reviews.llvm.org/D19783



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-20 Thread Taewook Oh via cfe-commits
twoh added a comment.

@faisalv, thank you for the update. I wonder if getCurrentThisType() is the 
best place to call adjustCVQualifiersForCXXThisWithinLambda(). It seems that 
getCurrentThisType() does more than its name suggests. Is there any other place 
that the adjustment function can be called?


http://reviews.llvm.org/D19783



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


Re: [PATCH] D19783: Fix cv-qualification of '*this' captures (and nasty bug PR27507 introduced by commit 263921 "Implement Lambda Capture of *this by Value as [=, *this]")

2016-05-18 Thread Taewook Oh via cfe-commits
twoh added a comment.

My patch passes check-clang and the test cases in this patch as well.

BTW, newly added test cases in the patch seem to be passed even without the 
patch. Isn't the bug appears when template instantiation generates nested 
lambdas (because template instantiation updates the 'context')?


http://reviews.llvm.org/D19783



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


Re: [PATCH] D20349: Fix a clang bug in lambda capture of 'this'

2016-05-18 Thread Taewook Oh via cfe-commits
twoh added a comment.

Thank you for your comments. @faisalv, it is great that you already submitted a 
patch. Let me see if your patch resolves the issue I have. Thanks!


http://reviews.llvm.org/D20349



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


[PATCH] D20349: Fix a clang bug in lambda capture of 'this'

2016-05-17 Thread Taewook Oh via cfe-commits
twoh created this revision.
twoh added reviewers: faisalv, rsmith.
twoh added a subscriber: cfe-commits.

(This is a fix for Bug 27797 https://llvm.org/bugs/show_bug.cgi?id=27797).

Currently when RebuildLambdaScopeInfo() function in lib/Sema/SemaDecl.cpp 
observes lambda capturing 'this', it calls Sema::getCurrentThisType() to get 
the type of 'this'. However, clang (revision 269789) crashes with an assertion 
failure inside Sema::getCurrentThisType() if template instantiation creates 
nested lambdas. Inside, Sema::getCurrentThisType(), there is an assertion 
saying that getCurLambda() never returns nullptr, but nest lambdas created by 
template instantiation makes getCurLambda() returns nullptr. 

Actually, even without the assertion failure, calling 
Sema::getCurrentThisType() from RebuildLambdaScopeInfo() seems wrong. When 
there are nested lambdas, what is required from Sema::getCurrentThisType() is a 
type of 'this' for nesting lambda, while what is supposed to be returned from 
Sema::getCurrentThisType() is a type of 'this' for nested lambda.

This patch addresses this issue and makes RebuildLambdaScopeInfo() compute the 
correct 'this' type. 

http://reviews.llvm.org/D20349

Files:
  lib/Sema/SemaDecl.cpp

Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11109,8 +11109,16 @@
   CaptureType, /*Expr*/ nullptr);
 
 } else if (C.capturesThis()) {
+  QualType ThisTy = CallOperator->getThisType(S.Context);
+  QualType BaseTy = ThisTy->getPointeeType();
+  if (C.getCaptureKind() == LCK_StarThis &&
+  CallOperator->isConst() &&
+  !BaseTy.isConstQualified()) {
+BaseTy.addConst();
+ThisTy = S.Context.getPointerType(BaseTy);
+  }
   LSI->addThisCapture(/*Nested*/ false, C.getLocation(),
-  S.getCurrentThisType(), /*Expr*/ nullptr,
+  ThisTy, /*Expr*/ nullptr,
   C.getCaptureKind() == LCK_StarThis);
 } else {
   LSI->addVLATypeCapture(C.getLocation(), I->getType());


Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -11109,8 +11109,16 @@
   CaptureType, /*Expr*/ nullptr);
 
 } else if (C.capturesThis()) {
+  QualType ThisTy = CallOperator->getThisType(S.Context);
+  QualType BaseTy = ThisTy->getPointeeType();
+  if (C.getCaptureKind() == LCK_StarThis &&
+  CallOperator->isConst() &&
+  !BaseTy.isConstQualified()) {
+BaseTy.addConst();
+ThisTy = S.Context.getPointerType(BaseTy);
+  }
   LSI->addThisCapture(/*Nested*/ false, C.getLocation(),
-  S.getCurrentThisType(), /*Expr*/ nullptr,
+  ThisTy, /*Expr*/ nullptr,
   C.getCaptureKind() == LCK_StarThis);
 } else {
   LSI->addVLATypeCapture(C.getLocation(), I->getType());
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-05-04 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 56198.
twoh added a comment.

Rebased on ToT. Thanks @aaron.ballman!


http://reviews.llvm.org/D19062

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype-powerpc64.c
  test/Sema/libbuiltins-ctype-x86_64.c

Index: test/Sema/libbuiltins-ctype-x86_64.c
===
--- test/Sema/libbuiltins-ctype-x86_64.c
+++ test/Sema/libbuiltins-ctype-x86_64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call i32 @isalnum(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call i32 @isalpha(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call i32 @isblank(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call i32 @iscntrl(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call i32 @isdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call i32 @isgraph(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call i32 @islower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call i32 @isprint(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call i32 @ispunct(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call i32 @isspace(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call i32 @isupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call i32 @isxdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call i32 @tolower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call i32 @toupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare i32 @isalnum(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isalpha(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isblank(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @iscntrl(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isgraph(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @islower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isprint(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @ispunct(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isspace(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isupper(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isxdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @tolower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/libbuiltins-ctype-powerpc64.c
===
--- test/Sema/libbuiltins-ctype-powerpc64.c
+++ test/Sema/libbuiltins-ctype-powerpc64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call signext i32 @isalnum(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call signext i32 @isalpha(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call signext i32 @isblank(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call signext i32 @iscntrl(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call signext i32 @isdigit(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call signext i32 @isgraph(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call signext i32 @islower(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call signext i32 @isprint(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call signext i32 @ispunct(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call signext i32 @isspace(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call signext i32 @isupper(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call signext i32 

Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-05-03 Thread Taewook Oh via cfe-commits
twoh added a comment.

Ping. Can someone please commit this patch for me? Thanks!


http://reviews.llvm.org/D19062



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


Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-04-28 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 55377.
twoh added a comment.

Addressing comments from @joerg. Two versions of the test provided, one for an 
architecture with signed char(x86_64) and the other for an architecture with 
unsigned char(powerpc64).


http://reviews.llvm.org/D19062

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype-powerpc64.c
  test/Sema/libbuiltins-ctype-x86_64.c

Index: test/Sema/libbuiltins-ctype-x86_64.c
===
--- test/Sema/libbuiltins-ctype-x86_64.c
+++ test/Sema/libbuiltins-ctype-x86_64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call i32 @isalnum(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call i32 @isalpha(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call i32 @isblank(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call i32 @iscntrl(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call i32 @isdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call i32 @isgraph(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call i32 @islower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call i32 @isprint(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call i32 @ispunct(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call i32 @isspace(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call i32 @isupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call i32 @isxdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call i32 @tolower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call i32 @toupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare i32 @isalnum(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isalpha(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isblank(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @iscntrl(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isgraph(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @islower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isprint(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @ispunct(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isspace(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isupper(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isxdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @tolower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/libbuiltins-ctype-powerpc64.c
===
--- test/Sema/libbuiltins-ctype-powerpc64.c
+++ test/Sema/libbuiltins-ctype-powerpc64.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -triple powerpc64-unknown-linux-gnu -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call signext i32 @isalnum(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call signext i32 @isalpha(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call signext i32 @isblank(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call signext i32 @iscntrl(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call signext i32 @isdigit(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call signext i32 @isgraph(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call signext i32 @islower(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call signext i32 @isprint(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call signext i32 @ispunct(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call signext i32 @isspace(i32 signext {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  

Re: [PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-04-22 Thread Taewook Oh via cfe-commits
twoh added a comment.

Ping. @joerg, could you please take a look?


http://reviews.llvm.org/D19062



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


Re: [PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-14 Thread Taewook Oh via cfe-commits
Joerg, 

Thank you for your comments. I submitted a new patch
(http://reviews.llvm.org/D19062) with a new test that checks attributes
but not types. I think this should cover both cases. What do you think?

Thanks,
Taewook

On 4/14/16, 2:46 AM, "Joerg Sonnenberger"  wrote:

>On Wed, Apr 13, 2016 at 03:02:09PM +, Taewook Oh wrote:
>> Sure, I'll take a look.
>> Thanks!
>
>Please provide two versions of the test, one hard-coded for an
>architecture with signed char, one hard-coded for an architecture with
>unsigned char. That should cover the difference.
>
>Joerg

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


[PATCH] D19062: Add functions in ctype.h to builtin function database (Fix)

2016-04-13 Thread Taewook Oh via cfe-commits
twoh created this revision.
twoh added a reviewer: aaron.ballman.
twoh added subscribers: joerg, cfe-commits, rsmith.

Add functions declared in ctype.h to builtin function database. All functions 
are annotated with nothrow and const attribute, which enables better 
optimization. 

This patch has been accepted and committed in 
r266199(http://reviews.llvm.org/D18970, http://reviews.llvm.org/rL266199), but 
reverted because newly added test caused build bot 
failures(http://reviews.llvm.org/rL266201). I fixed the test and resubmit patch 
here. 

http://reviews.llvm.org/D19062

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype.c

Index: test/Sema/libbuiltins-ctype.c
===
--- test/Sema/libbuiltins-ctype.c
+++ test/Sema/libbuiltins-ctype.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call {{.*}}isalnum{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call {{.*}}isalpha{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call {{.*}}isblank{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call {{.*}}iscntrl{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call {{.*}}isdigit{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call {{.*}}isgraph{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call {{.*}}islower{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call {{.*}}isprint{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call {{.*}}ispunct{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call {{.*}}isspace{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call {{.*}}isupper{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call {{.*}}isxdigit{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call {{.*}}tolower{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call {{.*}}toupper{{.*}} [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare {{.*}}isalnum{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isalpha{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isblank{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}iscntrl{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isdigit{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isgraph{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}islower{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isprint{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}ispunct{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isspace{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isupper{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}isxdigit{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}tolower{{.*}} [[NUW_RO:#[0-9]+]]
+// CHECK: declare {{.*}}toupper{{.*}} [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/enable_if.c
===
--- test/Sema/enable_if.c
+++ test/Sema/enable_if.c
@@ -72,8 +72,8 @@
   __attribute__((unavailable("'c' must have the value of an unsigned char or EOF")));
 
 void test3(int c) {
-  isdigit(c);
-  isdigit(10);
+  isdigit(c); // expected-warning{{ignoring return value of function declared with pure attribute}}
+  isdigit(10); // expected-warning{{ignoring return value of function declared with pure attribute}}
 #ifndef CODEGEN
   isdigit(-10);  // expected-error{{call to unavailable function 'isdigit': 'c' must have the value of an unsigned char or EOF}}
 #endif
Index: test/FixIt/typo.m
===
--- test/FixIt/typo.m
+++ test/FixIt/typo.m
@@ -113,8 +113,6 @@
   
 @end
 
-double *isupper(int);
-
 @interface Sub2 : Super
 - (int)method2;
 @end
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -274,16 +274,16 @@
 // so build a dependent node to describe the type.
 if (WantNontrivialTypeSourceInfo)
   return ActOnTypenameType(S, SourceLocation(), *SS, II, NameLoc).get();
-
+
 NestedNameSpecifierLoc QualifierLoc = SS->getWithLocInContext(Context);
 QualType T = CheckTypenameType(ETK_None, SourceLocation(), QualifierLoc,
II, NameLoc);
 return ParsedType::make(T);
   }
 
   return nullptr;
 }
-
+
 if 

Re: [PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-13 Thread Taewook Oh via cfe-commits
Sure, I'll take a look.
Thanks!

-- Taewook

On 4/13/16, 8:00 AM, "Aaron Ballman"  wrote:

>aaron.ballman added a comment.
>
>I reverted this in r266201; it was causing build bot failures like:
>
>https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_bu
>ilders_clang-2Dppc64be-2Dlinux_builds_3517=CwIFaQ=5VD0RTtNlTh3ycd41b3M
>Uw=kOsLCgQzH7N8ptZ7diJD9g=lY0h_n-Ss10lCixhInwZ0rdHJVh8NThGYMjXc95lcXI&
>s=jHcJfUPDOu_1aryqBoPpgyy4YSQAGSBc2Ay-uz13TFg=
>
>Can you please take a look?
>
>Thanks!
>
>
>https://urldefense.proofpoint.com/v2/url?u=http-3A__reviews.llvm.org_D1897
>0=CwIFaQ=5VD0RTtNlTh3ycd41b3MUw=kOsLCgQzH7N8ptZ7diJD9g=lY0h_n-Ss10
>lCixhInwZ0rdHJVh8NThGYMjXc95lcXI=kmrF5dkYE8pxLuu3VXReWZ6ogoJqmOHz1rTfU4L
>nQQ0= 
>
>
>

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


Re: [PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-12 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 53395.
twoh added a comment.

Addressing comments from @aaron.ballman. It would be great if someone can 
commit this patch for me, as I don't have the privilege yet.


http://reviews.llvm.org/D18970

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype.c

Index: test/Sema/libbuiltins-ctype.c
===
--- test/Sema/libbuiltins-ctype.c
+++ test/Sema/libbuiltins-ctype.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call i32 @isalnum(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call i32 @isalpha(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call i32 @isblank(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call i32 @iscntrl(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call i32 @isdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call i32 @isgraph(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call i32 @islower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call i32 @isprint(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call i32 @ispunct(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call i32 @isspace(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call i32 @isupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call i32 @isxdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call i32 @tolower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call i32 @toupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare i32 @isalnum(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isalpha(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isblank(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @iscntrl(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isgraph(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @islower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isprint(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @ispunct(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isspace(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isupper(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isxdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @tolower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/enable_if.c
===
--- test/Sema/enable_if.c
+++ test/Sema/enable_if.c
@@ -72,8 +72,8 @@
   __attribute__((unavailable("'c' must have the value of an unsigned char or EOF")));
 
 void test3(int c) {
-  isdigit(c);
-  isdigit(10);
+  isdigit(c); // expected-warning{{ignoring return value of function declared with pure attribute}}
+  isdigit(10); // expected-warning{{ignoring return value of function declared with pure attribute}}
 #ifndef CODEGEN
   isdigit(-10);  // expected-error{{call to unavailable function 'isdigit': 'c' must have the value of an unsigned char or EOF}}
 #endif
Index: test/FixIt/typo.m
===
--- test/FixIt/typo.m
+++ test/FixIt/typo.m
@@ -113,8 +113,6 @@
   
 @end
 
-double *isupper(int);
-
 @interface Sub2 : Super
 - (int)method2;
 @end
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -273,16 +273,16 @@
 // so build a dependent node to describe the type.
 if (WantNontrivialTypeSourceInfo)
   return ActOnTypenameType(S, SourceLocation(), *SS, II, NameLoc).get();
-
+
 NestedNameSpecifierLoc QualifierLoc = SS->getWithLocInContext(Context);
 QualType T = CheckTypenameType(ETK_None, SourceLocation(), QualifierLoc,
II, NameLoc);
 return ParsedType::make(T);
   }
 
   return nullptr;
 }
-
+
 if (!LookupCtx->isDependentContext() &&
 RequireCompleteDeclContext(*SS, LookupCtx))
   return nullptr;
@@ -303,7 +303,7 @@
 if (ObjectTypePtr && Result.empty()) {
   // C++ [basic.lookup.classref]p3:
   //   If the 

Re: [PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-12 Thread Taewook Oh via cfe-commits
twoh updated this revision to Diff 53369.
twoh added a comment.

Fix attribute annotation from 'const' to 'pure'. Add support for 'pure' 
attribute to builtin function database related code. Test case 
(test/Sema/libbuiltins-ctype.c) added. Line 116 of test/FixIt/typo.m is removed 
because it is not necessary for test but causes a warning that cannot be 
addressed by -fixit once isupper is registered to Builtins.def.


http://reviews.llvm.org/D18970

Files:
  include/clang/Basic/Builtins.def
  include/clang/Basic/Builtins.h
  lib/Sema/SemaDecl.cpp
  test/FixIt/typo.m
  test/Sema/enable_if.c
  test/Sema/libbuiltins-ctype.c

Index: test/Sema/libbuiltins-ctype.c
===
--- test/Sema/libbuiltins-ctype.c
+++ test/Sema/libbuiltins-ctype.c
@@ -0,0 +1,65 @@
+// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
+
+int isalnum(int);
+int isalpha(int);
+int isblank(int);
+int iscntrl(int);
+int isdigit(int);
+int isgraph(int);
+int islower(int);
+int isprint(int);
+int ispunct(int);
+int isspace(int);
+int isupper(int);
+int isxdigit(int);
+int tolower(int);
+int toupper(int);
+
+void test(int x) {
+  // CHECK: call i32 @isalnum(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalnum(x);
+  // CHECK: call i32 @isalpha(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isalpha(x);
+  // CHECK: call i32 @isblank(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isblank(x);
+  // CHECK: call i32 @iscntrl(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)iscntrl(x);
+  // CHECK: call i32 @isdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isdigit(x);
+  // CHECK: call i32 @isgraph(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isgraph(x);
+  // CHECK: call i32 @islower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)islower(x);
+  // CHECK: call i32 @isprint(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isprint(x);
+  // CHECK: call i32 @ispunct(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)ispunct(x);
+  // CHECK: call i32 @isspace(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isspace(x);
+  // CHECK: call i32 @isupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isupper(x);
+  // CHECK: call i32 @isxdigit(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)isxdigit(x);
+  // CHECK: call i32 @tolower(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)tolower(x);
+  // CHECK: call i32 @toupper(i32 {{%[0-9]+}}) [[NUW_RO_CALL:#[0-9]+]]
+  (void)toupper(x);
+}
+
+// CHECK: declare i32 @isalnum(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isalpha(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isblank(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @iscntrl(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isgraph(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @islower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isprint(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @ispunct(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isspace(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isupper(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @isxdigit(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @tolower(i32) [[NUW_RO:#[0-9]+]]
+// CHECK: declare i32 @toupper(i32) [[NUW_RO:#[0-9]+]]
+
+// CHECK: attributes [[NUW_RO]] = { nounwind readonly{{.*}} }
+// CHECK: attributes [[NUW_RO_CALL]] = { nounwind readonly }
Index: test/Sema/enable_if.c
===
--- test/Sema/enable_if.c
+++ test/Sema/enable_if.c
@@ -72,8 +72,8 @@
   __attribute__((unavailable("'c' must have the value of an unsigned char or EOF")));
 
 void test3(int c) {
-  isdigit(c);
-  isdigit(10);
+  isdigit(c); // expected-warning{{ignoring return value of function declared with pure attribute}}
+  isdigit(10); // expected-warning{{ignoring return value of function declared with pure attribute}}
 #ifndef CODEGEN
   isdigit(-10);  // expected-error{{call to unavailable function 'isdigit': 'c' must have the value of an unsigned char or EOF}}
 #endif
Index: test/FixIt/typo.m
===
--- test/FixIt/typo.m
+++ test/FixIt/typo.m
@@ -113,8 +113,6 @@
   
 @end
 
-double *isupper(int);
-
 @interface Sub2 : Super
 - (int)method2;
 @end
Index: lib/Sema/SemaDecl.cpp
===
--- lib/Sema/SemaDecl.cpp
+++ lib/Sema/SemaDecl.cpp
@@ -273,16 +273,16 @@
 // so build a dependent node to describe the type.
 if (WantNontrivialTypeSourceInfo)
   return ActOnTypenameType(S, SourceLocation(), *SS, II, NameLoc).get();
-
+
 NestedNameSpecifierLoc QualifierLoc = SS->getWithLocInContext(Context);
 QualType T = CheckTypenameType(ETK_None, SourceLocation(), QualifierLoc,
II, NameLoc);
 return ParsedType::make(T);
   }
 
   return nullptr;
 }
-
+
 if 

Re: [PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-11 Thread Taewook Oh via cfe-commits
twoh added a comment.

@joerg My bad. They surely read from globals. I'll fix the diff. Thanks for the 
catch!


http://reviews.llvm.org/D18970



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


[PATCH] D18970: Add functions in ctype.h to builtin function database

2016-04-11 Thread Taewook Oh via cfe-commits
twoh created this revision.
twoh added reviewers: rsmith, aaron.ballman.
twoh added a subscriber: cfe-commits.

Add functions declared in ctype.h to builtin function database. All functions 
are annotated with nothrow and const attribute, which enables better 
optimization. 

http://reviews.llvm.org/D18970

Files:
  include/clang/Basic/Builtins.def

Index: include/clang/Basic/Builtins.def
===
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -773,6 +773,22 @@
 LIBBUILTIN(vscanf, "icC*Ra",  "fS:0:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vfscanf, "iP*RcC*Ra",  "fS:1:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
+// C99 ctype.h
+LIBBUILTIN(isalnum, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isalpha, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isblank, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(iscntrl, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isdigit, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isgraph, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(islower, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isprint, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(ispunct, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isspace, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isupper, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isxdigit, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(tolower, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(toupper, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+
 // C99
 // In some systems setjmp is a macro that expands to _setjmp. We undefine
 // it here to avoid having two identical LIBBUILTIN entries.


Index: include/clang/Basic/Builtins.def
===
--- include/clang/Basic/Builtins.def
+++ include/clang/Basic/Builtins.def
@@ -773,6 +773,22 @@
 LIBBUILTIN(vscanf, "icC*Ra",  "fS:0:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vfscanf, "iP*RcC*Ra",  "fS:1:", "stdio.h", ALL_LANGUAGES)
 LIBBUILTIN(vsscanf, "icC*RcC*Ra", "fS:1:", "stdio.h", ALL_LANGUAGES)
+// C99 ctype.h
+LIBBUILTIN(isalnum, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isalpha, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isblank, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(iscntrl, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isdigit, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isgraph, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(islower, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isprint, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(ispunct, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isspace, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isupper, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(isxdigit, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(tolower, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+LIBBUILTIN(toupper, "ii", "fnc", "ctype.h", ALL_LANGUAGES)
+
 // C99
 // In some systems setjmp is a macro that expands to _setjmp. We undefine
 // it here to avoid having two identical LIBBUILTIN entries.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits