[PATCH] D34770: [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified

2017-07-01 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor added a comment.

> I'm not sure what you refer to by ` I just saw we actually have the 
> completion code in the Driver`. We are already auto completing both cc1 
> options and driver options, right?

Woops, I misread the code there. Never mind!

> What about completing cc1 options only when -cc1 is passed or -Xclang is 
> passed before current input?

That actually sounds like the best solution, let's go with that!


https://reviews.llvm.org/D34770



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


r306953 - Changed Opts.EABIVersion type string to llvm::EABI enum class

2017-07-01 Thread Yuka Takahashi via cfe-commits
Author: yamaguchi
Date: Sat Jul  1 00:57:23 2017
New Revision: 306953

URL: http://llvm.org/viewvc/llvm-project?rev=306953&view=rev
Log:
Changed Opts.EABIVersion type string to llvm::EABI enum class

Summary:
Changed EABIVersion type from string to llvm::EABI.
It seems it was just a typo and this is intended implementation.

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

Modified:
cfe/trunk/include/clang/Basic/TargetOptions.h
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/CodeGen/BackendUtil.cpp
cfe/trunk/lib/Frontend/CompilerInvocation.cpp

Modified: cfe/trunk/include/clang/Basic/TargetOptions.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/TargetOptions.h?rev=306953&r1=306952&r2=306953&view=diff
==
--- cfe/trunk/include/clang/Basic/TargetOptions.h (original)
+++ cfe/trunk/include/clang/Basic/TargetOptions.h Sat Jul  1 00:57:23 2017
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include "clang/Basic/OpenCLOptions.h"
+#include "llvm/Target/TargetOptions.h"
 
 namespace clang {
 
@@ -41,7 +42,7 @@ public:
   std::string ABI;
 
   /// The EABI version to use
-  std::string EABIVersion;
+  llvm::EABI EABIVersion;
 
   /// If given, the version string of the linker in use.
   std::string LinkerVersion;

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=306953&r1=306952&r2=306953&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Jul  1 00:57:23 2017
@@ -5443,7 +5443,7 @@ public:
 if (Triple.getOS() == llvm::Triple::Linux ||
 Triple.getOS() == llvm::Triple::UnknownOS)
   this->MCountName =
-  Opts.EABIVersion == "gnu" ? "\01__gnu_mcount_nc" : "\01mcount";
+  Opts.EABIVersion == llvm::EABI::GNU ? "\01__gnu_mcount_nc" : 
"\01mcount";
   }
 
   StringRef getABI() const override { return ABI; }
@@ -6283,7 +6283,7 @@ public:
 if (Triple.getOS() == llvm::Triple::Linux)
   this->MCountName = "\01_mcount";
 else if (Triple.getOS() == llvm::Triple::UnknownOS)
-  this->MCountName = Opts.EABIVersion == "gnu" ? "\01_mcount" : "mcount";
+  this->MCountName = Opts.EABIVersion == llvm::EABI::GNU ? "\01_mcount" : 
"mcount";
   }
 
   StringRef getABI() const override { return ABI; }

Modified: cfe/trunk/lib/CodeGen/BackendUtil.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/BackendUtil.cpp?rev=306953&r1=306952&r2=306953&view=diff
==
--- cfe/trunk/lib/CodeGen/BackendUtil.cpp (original)
+++ cfe/trunk/lib/CodeGen/BackendUtil.cpp Sat Jul  1 00:57:23 2017
@@ -415,11 +415,7 @@ static void initTargetOptions(llvm::Targ
   Options.RelaxELFRelocations = CodeGenOpts.RelaxELFRelocations;
 
   // Set EABI version.
-  Options.EABIVersion = llvm::StringSwitch(TargetOpts.EABIVersion)
-.Case("4", llvm::EABI::EABI4)
-.Case("5", llvm::EABI::EABI5)
-.Case("gnu", llvm::EABI::GNU)
-.Default(llvm::EABI::Default);
+  Options.EABIVersion = TargetOpts.EABIVersion;
 
   if (LangOpts.SjLjExceptions)
 Options.ExceptionModel = llvm::ExceptionHandling::SjLj;

Modified: cfe/trunk/lib/Frontend/CompilerInvocation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInvocation.cpp?rev=306953&r1=306952&r2=306953&view=diff
==
--- cfe/trunk/lib/Frontend/CompilerInvocation.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInvocation.cpp Sat Jul  1 00:57:23 2017
@@ -2568,7 +2568,7 @@ static void ParseTargetArgs(TargetOption
   Diags.Report(diag::err_drv_invalid_value) << A->getAsString(Args)
 << Value;
 else
-  Opts.EABIVersion = Value;
+  Opts.EABIVersion = EABIVersion;
   }
   Opts.CPU = Args.getLastArgValue(OPT_target_cpu);
   Opts.FPMath = Args.getLastArgValue(OPT_mfpmath);


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


r306954 - fix trivial typos; NFC

2017-07-01 Thread Hiroshi Inoue via cfe-commits
Author: inouehrs
Date: Sat Jul  1 01:46:43 2017
New Revision: 306954

URL: http://llvm.org/viewvc/llvm-project?rev=306954&view=rev
Log:
fix trivial typos; NFC

Modified:
cfe/trunk/lib/Basic/Targets.cpp
cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp
cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/lib/Serialization/ASTReader.cpp

Modified: cfe/trunk/lib/Basic/Targets.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Targets.cpp?rev=306954&r1=306953&r2=306954&view=diff
==
--- cfe/trunk/lib/Basic/Targets.cpp (original)
+++ cfe/trunk/lib/Basic/Targets.cpp Sat Jul  1 01:46:43 2017
@@ -2706,7 +2706,7 @@ class X86TargetInfo : public TargetInfo
 CK_C3_2,
 
 /// This enumerator is a bit odd, as GCC no longer accepts -march=yonah.
-/// Clang however has some logic to suport this.
+/// Clang however has some logic to support this.
 // FIXME: Warn, deprecate, and potentially remove this.
 CK_Yonah,
 //@}

Modified: cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp?rev=306954&r1=306953&r2=306954&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/MipsLinux.cpp Sat Jul  1 01:46:43 2017
@@ -109,7 +109,7 @@ std::string MipsLLVMToolChain::findLibCx
 void MipsLLVMToolChain::AddCXXStdlibLibArgs(const ArgList &Args,
 ArgStringList &CmdArgs) const {
   assert((GetCXXStdlibType(Args) == ToolChain::CST_Libcxx) &&
- "Only -lc++ (aka libxx) is suported in this toolchain.");
+ "Only -lc++ (aka libxx) is supported in this toolchain.");
 
   CmdArgs.push_back("-lc++");
   CmdArgs.push_back("-lc++abi");

Modified: cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp?rev=306954&r1=306953&r2=306954&view=diff
==
--- cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp (original)
+++ cfe/trunk/lib/Frontend/ModuleDependencyCollector.cpp Sat Jul  1 01:46:43 
2017
@@ -248,7 +248,7 @@ std::error_code ModuleDependencyCollecto
   // Always map a canonical src path to its real path into the YAML, by doing
   // this we map different virtual src paths to the same entry in the VFS
   // overlay, which is a way to emulate symlink inside the VFS; this is also
-  // needed for correctness, not doing that can lead to module redifinition
+  // needed for correctness, not doing that can lead to module redefinition
   // errors.
   addFileMapping(VirtualPath, CacheDst);
   return std::error_code();

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=306954&r1=306953&r2=306954&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Jul  1 01:46:43 2017
@@ -11975,7 +11975,7 @@ Sema::CheckForFunctionRedefinition(Funct
   if (canRedefineFunction(Definition, getLangOpts()))
 return;
 
-  // Don't emit an error when this is redifinition of a typo-corrected
+  // Don't emit an error when this is redefinition of a typo-corrected
   // definition.
   if (TypoCorrectedFunctionDefinitions.count(Definition))
 return;

Modified: cfe/trunk/lib/Serialization/ASTReader.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Serialization/ASTReader.cpp?rev=306954&r1=306953&r2=306954&view=diff
==
--- cfe/trunk/lib/Serialization/ASTReader.cpp (original)
+++ cfe/trunk/lib/Serialization/ASTReader.cpp Sat Jul  1 01:46:43 2017
@@ -8263,7 +8263,7 @@ ASTReader::getSourceDescriptor(unsigned
 return ExternalASTSource::ASTSourceDescriptor(*M);
 
   // If there is only a single PCH, return it instead.
-  // Chained PCH are not suported.
+  // Chained PCH are not supported.
   const auto &PCHChain = ModuleMgr.pch_modules();
   if (std::distance(std::begin(PCHChain), std::end(PCHChain))) {
 ModuleFile &MF = ModuleMgr.getPrimaryModule();


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


[PATCH] D34770: [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104982.
yamaguchi added a comment.

Update diff. Autocomplete cc1 flags when argv[1] is -cc1 or previous flag is 
-Xclang.


https://reviews.llvm.org/D34770

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/autocomplete.c
  clang/utils/bash-autocomplete.sh
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/Option/OptTable.cpp

Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -225,11 +225,15 @@
   return {};
 }
 
-std::vector OptTable::findByPrefix(StringRef Cur) const {
+std::vector
+OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const {
   std::vector Ret;
   for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
 if (!In.Prefixes)
   continue;
+if (In.Flags & DisableFlags)
+  continue;
+
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);
   if (StringRef(S).startswith(Cur))
Index: llvm/include/llvm/Option/OptTable.h
===
--- llvm/include/llvm/Option/OptTable.h
+++ llvm/include/llvm/Option/OptTable.h
@@ -140,7 +140,8 @@
   //  to start with.
   ///
   /// \return The vector of flags which start with Cur.
-  std::vector findByPrefix(StringRef Cur) const;
+  std::vector findByPrefix(StringRef Cur,
+unsigned short DisableFlags) const;
 
   /// \brief Parse a single argument; returning the new argument and
   /// updating Index.
Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -10,18 +10,23 @@
   # So, we need to partially undo bash tokenization here for integrity.
   local w1="${COMP_WORDS[$cword - 1]}"
   local w2="${COMP_WORDS[$cword - 2]}"
+  # Clang want to know if -cc1 option is specified or not, because we don't want to show
+  # cc1 options otherwise.
+  if [[ "${COMP_WORDS[1]}" == "-cc1" || "$w1" == "-Xclang" ]]; then
+arg="#"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
-arg="$cur"
+arg="$arg$cur"
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
 # -foo=
-arg="$w1=,"
+arg="$arg$w1=,"
   elif [[ "$w1" == -* ]]; then
 # -foo  or -foo bar
-arg="$w1,$cur"
+arg="$arg$w1,$cur"
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
 # -foo=bar
-arg="$w2=,$cur"
+arg="$arg$w2=,$cur"
   fi
 
   flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
Index: clang/test/Driver/autocomplete.c
===
--- clang/test/Driver/autocomplete.c
+++ clang/test/Driver/autocomplete.c
@@ -36,3 +36,7 @@
 // MTHREADMODELALL: posix single
 // RUN: %clang --autocomplete=-mrelocation-model, | FileCheck %s -check-prefix=MRELOCMODELALL
 // MRELOCMODELALL: dynamic-no-pic pic ropi ropi-rwpi rwpi static
+// RUN: %clang --autocomplete=-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CLANG
+// MRELOCMODEL_CLANG-NOT: -mrelocation-model
+// RUN: %clang --autocomplete=#-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1
+// MRELOCMODEL_CC1: -mrelocation-model
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1231,11 +1231,20 @@
 StringRef PassedFlags = A->getValue();
 std::vector SuggestedCompletions;
 
+unsigned short DisableFlags = options::NoDriverOption | options::Unsupported | options::Ignored;
+// We want to show cc1-only options only when clang is invoked as "clang -cc1".
+// When clang is invoked as "clang -cc1", we add "#" to ther beginning of an --autocomplete
+// option so that the clang driver can distinguish whether it is requested to show cc1-only options or not.
+if (PassedFlags[0] == '#') {
+  DisableFlags &= ~options::NoDriverOption;
+  PassedFlags = PassedFlags.substr(1);
+}
+
 if (PassedFlags.find(',') == StringRef::npos) {
   // If the flag is in the form of "--autocomplete=-foo",
   // we were requested to print out all option names that start with "-foo".
   // For example, "--autocomplete=-fsyn" is expanded to "-fsyntax-only".
-  SuggestedCompletions = Opts->findByPrefix(PassedFlags);
+  SuggestedCompletions = Opts->findByPrefix(PassedFlags, DisableFlags);
 } else {
   // If the flag is in the form of "--autocomplete=foo,bar", we were
   // requested to print out all option values for "-foo" that start with
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34770: [Bash-autocompletion] Auto complete cc1 options if -cc1 is specified

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104983.
yamaguchi added a comment.

Update code comments.


https://reviews.llvm.org/D34770

Files:
  clang/lib/Driver/Driver.cpp
  clang/test/Driver/autocomplete.c
  clang/utils/bash-autocomplete.sh
  llvm/include/llvm/Option/OptTable.h
  llvm/lib/Option/OptTable.cpp

Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -225,11 +225,15 @@
   return {};
 }
 
-std::vector OptTable::findByPrefix(StringRef Cur) const {
+std::vector
+OptTable::findByPrefix(StringRef Cur, unsigned short DisableFlags) const {
   std::vector Ret;
   for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
 if (!In.Prefixes)
   continue;
+if (In.Flags & DisableFlags)
+  continue;
+
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);
   if (StringRef(S).startswith(Cur))
Index: llvm/include/llvm/Option/OptTable.h
===
--- llvm/include/llvm/Option/OptTable.h
+++ llvm/include/llvm/Option/OptTable.h
@@ -140,7 +140,8 @@
   //  to start with.
   ///
   /// \return The vector of flags which start with Cur.
-  std::vector findByPrefix(StringRef Cur) const;
+  std::vector findByPrefix(StringRef Cur,
+unsigned short DisableFlags) const;
 
   /// \brief Parse a single argument; returning the new argument and
   /// updating Index.
Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -10,18 +10,23 @@
   # So, we need to partially undo bash tokenization here for integrity.
   local w1="${COMP_WORDS[$cword - 1]}"
   local w2="${COMP_WORDS[$cword - 2]}"
+  # Clang want to know if -cc1 or -Xclang option is specified or not, because we don't want to show
+  # cc1 options otherwise.
+  if [[ "${COMP_WORDS[1]}" == "-cc1" || "$w1" == "-Xclang" ]]; then
+arg="#"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
-arg="$cur"
+arg="$arg$cur"
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
 # -foo=
-arg="$w1=,"
+arg="$arg$w1=,"
   elif [[ "$w1" == -* ]]; then
 # -foo  or -foo bar
-arg="$w1,$cur"
+arg="$arg$w1,$cur"
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
 # -foo=bar
-arg="$w2=,$cur"
+arg="$arg$w2=,$cur"
   fi
 
   flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
Index: clang/test/Driver/autocomplete.c
===
--- clang/test/Driver/autocomplete.c
+++ clang/test/Driver/autocomplete.c
@@ -36,3 +36,7 @@
 // MTHREADMODELALL: posix single
 // RUN: %clang --autocomplete=-mrelocation-model, | FileCheck %s -check-prefix=MRELOCMODELALL
 // MRELOCMODELALL: dynamic-no-pic pic ropi ropi-rwpi rwpi static
+// RUN: %clang --autocomplete=-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CLANG
+// MRELOCMODEL_CLANG-NOT: -mrelocation-model
+// RUN: %clang --autocomplete=#-mrelocation-mode | FileCheck %s -check-prefix=MRELOCMODEL_CC1
+// MRELOCMODEL_CC1: -mrelocation-model
Index: clang/lib/Driver/Driver.cpp
===
--- clang/lib/Driver/Driver.cpp
+++ clang/lib/Driver/Driver.cpp
@@ -1231,11 +1231,20 @@
 StringRef PassedFlags = A->getValue();
 std::vector SuggestedCompletions;
 
+unsigned short DisableFlags = options::NoDriverOption | options::Unsupported | options::Ignored;
+// We want to show cc1-only options only when clang is invoked as "clang -cc1".
+// When clang is invoked as "clang -cc1", we add "#" to ther beginning of an --autocomplete
+// option so that the clang driver can distinguish whether it is requested to show cc1-only options or not.
+if (PassedFlags[0] == '#') {
+  DisableFlags &= ~options::NoDriverOption;
+  PassedFlags = PassedFlags.substr(1);
+}
+
 if (PassedFlags.find(',') == StringRef::npos) {
   // If the flag is in the form of "--autocomplete=-foo",
   // we were requested to print out all option names that start with "-foo".
   // For example, "--autocomplete=-fsyn" is expanded to "-fsyntax-only".
-  SuggestedCompletions = Opts->findByPrefix(PassedFlags);
+  SuggestedCompletions = Opts->findByPrefix(PassedFlags, DisableFlags);
 } else {
   // If the flag is in the form of "--autocomplete=foo,bar", we were
   // requested to print out all option values for "-foo" that start with
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Check if bash-completion is installed

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.

Bash-autocompletion for clang depends on bash-completion system and abort `bash:
_init_completion: command not found` when it is not installed.

Changed to return silently if bash-completion is not installed.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -2,6 +2,11 @@
 _clang()
 {
   local cur prev words cword arg flags
+  # Require bash-completion with _init_completion
+  _init_completion 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+return
+  fi
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -2,6 +2,11 @@
 _clang()
 {
   local cur prev words cword arg flags
+  # Require bash-completion with _init_completion
+  _init_completion 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+return
+  fi
   _init_completion -n : || return
 
   # bash always separates '=' as a token even if there's no space before/after '='.
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34888: [OpenMP] Fix mapping of scalars for combined directives

2017-07-01 Thread Jonas Hahnfeld via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306956: [OpenMP] Fix mapping of scalars for combined 
directives (authored by Hahnfeld).

Changed prior to commit:
  https://reviews.llvm.org/D34888?vs=104863&id=104986#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34888

Files:
  cfe/trunk/lib/Sema/SemaOpenMP.cpp
  cfe/trunk/test/OpenMP/target_map_codegen.cpp


Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp
===
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp
@@ -412,6 +412,30 @@
 return false;
   }
 
+  /// Do the check specified in \a Check to all component lists at a given 
level
+  /// and return true if any issue is found.
+  bool checkMappableExprComponentListsForDeclAtLevel(
+  ValueDecl *VD, unsigned Level,
+  const llvm::function_ref<
+  bool(OMPClauseMappableExprCommon::MappableExprComponentListRef,
+   OpenMPClauseKind)> &Check) {
+if (isStackEmpty())
+  return false;
+
+auto StartI = Stack.back().first.begin();
+auto EndI = Stack.back().first.end();
+if (std::distance(StartI, EndI) <= (int)Level)
+  return false;
+std::advance(StartI, Level);
+
+auto MI = StartI->MappedExprComponents.find(VD);
+if (MI != StartI->MappedExprComponents.end())
+  for (auto &L : MI->second.Components)
+if (Check(L, MI->second.Kind))
+  return true;
+return false;
+  }
+
   /// Create a new mappable expression component list associated with a given
   /// declaration and initialize it with the provided list of components.
   void addMappableExpressionComponents(
@@ -994,9 +1018,8 @@
 bool IsVariableUsedInMapClause = false;
 bool IsVariableAssociatedWithSection = false;
 
-DSAStack->checkMappableExprComponentListsForDecl(
-D, /*CurrentRegionOnly=*/true,
-[&](OMPClauseMappableExprCommon::MappableExprComponentListRef
+DSAStack->checkMappableExprComponentListsForDeclAtLevel(
+D, Level, [&](OMPClauseMappableExprCommon::MappableExprComponentListRef
 MapExprComponents,
 OpenMPClauseKind WhereFoundClauseKind) {
   // Only the map clause information influences how a variable is
Index: cfe/trunk/test/OpenMP/target_map_codegen.cpp
===
--- cfe/trunk/test/OpenMP/target_map_codegen.cpp
+++ cfe/trunk/test/OpenMP/target_map_codegen.cpp
@@ -1056,6 +1056,9 @@
 // CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] 
[i[[Z:64|32]] 4]
 // CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
 
+// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] 
[i[[Z:64|32]] 4]
+// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
+
 // CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
 // CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
 
@@ -1194,6 +1197,28 @@
 ++a;
   }
 
+  // Map of a scalar in nested region.
+  int b = a;
+
+  // Region 00n
+  // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, 
i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* 
[[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}})
+  // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, 
i{{.+}} 0
+  // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, 
i{{.+}} 0
+  // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
+  // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
+  // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
+  // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
+
+  // CK19: call void [[CALL00n:@.+]](i32* {{[^,]+}})
+  #pragma omp target map(alloc:b)
+  #pragma omp parallel
+  {
+++b;
+  }
+
   // Map of an array.
   int arra[100];
 
@@ -2388,6 +2413,7 @@
 }
 
 // CK19: define {{.+}}[[CALL00]]
+// CK19: define {{.+}}[[CALL00n]]
 // CK19: define {{.+}}[[CALL01]]
 // CK19: define {{.+}}[[CALL02]]
 // CK19: define {{.+}}[[CALL03]]


Index: cfe/trunk/lib/Sema/SemaOpenMP.cpp
===
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp
@@ -412,6 +412,30 @@
 return false;
   }
 
+  /// Do the check specified in \a Check to all component lists at a given level
+  /// and return true if any issue is found.
+  bool checkMappableExprComponentListsForDeclAtLevel(
+  ValueDecl *VD, unsigned Level,
+  const llvm::function_ref<
+  bool(OMPClauseMappableExprCommon::MappableExprComponentListRef,
+   OpenMPClauseKind)> &Check) {
+if (isStackEmpty())
+  return false;
+
+auto StartI = Stack.back().first.begin();
+auto EndI = Stack.

r306956 - [OpenMP] Fix mapping of scalars for combined directives

2017-07-01 Thread Jonas Hahnfeld via cfe-commits
Author: hahnfeld
Date: Sat Jul  1 03:40:50 2017
New Revision: 306956

URL: http://llvm.org/viewvc/llvm-project?rev=306956&view=rev
Log:
[OpenMP] Fix mapping of scalars for combined directives

Combined directives like 'target parallel' have two captured statements.
Sema has to check the right one from the right direction.

Previously, Sema::IsOpenMPCapturedByRef would return false for mapped
scalars on combined directives. This results in a wrong signature of
the outlined function which triggers an assertion:
void llvm::CallInst::init(llvm::FunctionType *, llvm::Value *, 
ArrayRef, ArrayRef, const llvm::Twine &): 
Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) == 
Args[i]->getType()) && "Calling a function with a bad signature!"' failed.

Fixes PR30975 (and PR31985). New function was taken from clang-ykt.

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

Modified:
cfe/trunk/lib/Sema/SemaOpenMP.cpp
cfe/trunk/test/OpenMP/target_map_codegen.cpp

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=306956&r1=306955&r2=306956&view=diff
==
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Sat Jul  1 03:40:50 2017
@@ -412,6 +412,30 @@ public:
 return false;
   }
 
+  /// Do the check specified in \a Check to all component lists at a given 
level
+  /// and return true if any issue is found.
+  bool checkMappableExprComponentListsForDeclAtLevel(
+  ValueDecl *VD, unsigned Level,
+  const llvm::function_ref<
+  bool(OMPClauseMappableExprCommon::MappableExprComponentListRef,
+   OpenMPClauseKind)> &Check) {
+if (isStackEmpty())
+  return false;
+
+auto StartI = Stack.back().first.begin();
+auto EndI = Stack.back().first.end();
+if (std::distance(StartI, EndI) <= (int)Level)
+  return false;
+std::advance(StartI, Level);
+
+auto MI = StartI->MappedExprComponents.find(VD);
+if (MI != StartI->MappedExprComponents.end())
+  for (auto &L : MI->second.Components)
+if (Check(L, MI->second.Kind))
+  return true;
+return false;
+  }
+
   /// Create a new mappable expression component list associated with a given
   /// declaration and initialize it with the provided list of components.
   void addMappableExpressionComponents(
@@ -994,9 +1018,8 @@ bool Sema::IsOpenMPCapturedByRef(ValueDe
 bool IsVariableUsedInMapClause = false;
 bool IsVariableAssociatedWithSection = false;
 
-DSAStack->checkMappableExprComponentListsForDecl(
-D, /*CurrentRegionOnly=*/true,
-[&](OMPClauseMappableExprCommon::MappableExprComponentListRef
+DSAStack->checkMappableExprComponentListsForDeclAtLevel(
+D, Level, [&](OMPClauseMappableExprCommon::MappableExprComponentListRef
 MapExprComponents,
 OpenMPClauseKind WhereFoundClauseKind) {
   // Only the map clause information influences how a variable is

Modified: cfe/trunk/test/OpenMP/target_map_codegen.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/OpenMP/target_map_codegen.cpp?rev=306956&r1=306955&r2=306956&view=diff
==
--- cfe/trunk/test/OpenMP/target_map_codegen.cpp (original)
+++ cfe/trunk/test/OpenMP/target_map_codegen.cpp Sat Jul  1 03:40:50 2017
@@ -1056,6 +1056,9 @@ void implicit_maps_template_type_capture
 // CK19: [[SIZE00:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] 
[i[[Z:64|32]] 4]
 // CK19: [[MTYPE00:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
 
+// CK19: [[SIZE00n:@.+]] = private {{.*}}constant [1 x i[[Z:64|32]]] 
[i[[Z:64|32]] 4]
+// CK19: [[MTYPE00n:@.+]] = private {{.*}}constant [1 x i32] [i32 32]
+
 // CK19: [[SIZE01:@.+]] = private {{.*}}constant [1 x i[[Z]]] [i[[Z]] 400]
 // CK19: [[MTYPE01:@.+]] = private {{.*}}constant [1 x i32] [i32 33]
 
@@ -1194,6 +1197,28 @@ void explicit_maps_single (int ii){
 ++a;
   }
 
+  // Map of a scalar in nested region.
+  int b = a;
+
+  // Region 00n
+  // CK19-DAG: call i32 @__tgt_target(i32 {{[^,]+}}, i8* {{[^,]+}}, i32 1, 
i8** [[GEPBP:%.+]], i8** [[GEPP:%.+]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* 
[[SIZE00n]], {{.+}}getelementptr {{.+}}[1 x i{{.+}}]* [[MTYPE00n]]{{.+}})
+  // CK19-DAG: [[GEPBP]] = getelementptr inbounds {{.+}}[[BP:%[^,]+]]
+  // CK19-DAG: [[GEPP]] = getelementptr inbounds {{.+}}[[P:%[^,]+]]
+
+  // CK19-DAG: [[BP0:%.+]] = getelementptr inbounds {{.+}}[[BP]], i{{.+}} 0, 
i{{.+}} 0
+  // CK19-DAG: [[P0:%.+]] = getelementptr inbounds {{.+}}[[P]], i{{.+}} 0, 
i{{.+}} 0
+  // CK19-DAG: [[CBP0:%.+]] = bitcast i8** [[BP0]] to i32**
+  // CK19-DAG: [[CP0:%.+]] = bitcast i8** [[P0]] to i32**
+  // CK19-DAG: store i32* [[VAR0:%.+]], i32** [[CBP0]]
+  // CK19-DAG: store i32* [[VAR0]], i32** [[CP0]]
+
+  // CK19: call void [[CALL00n:@.+]](i32* {{[^,]+}})
+  #p

[PATCH] D34924: [Bash-autocompletion] Check if bash-completion is installed or not

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104988.
yamaguchi added a comment.

Update patch and diff.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,31 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  _filedir 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=( $( compgen -f) )
+  fi
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # Require bash-completion with _init_completion
+  _init_completion -n 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +44,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2>/dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,31 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  _filedir 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=( $( compgen -f) )
+  fi
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # Require bash-completion with _init_completion
+  _init_completion -n 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +44,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2>/dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added inline comments.



Comment at: clang/utils/bash-autocomplete.sh:3
+
+_clang_filedir()
+{

Is the output of `compgen -f` the same as `_filedir`? If so, can you always use 
`compgen -f`?



Comment at: clang/utils/bash-autocomplete.sh:7
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=( $( compgen -f) )
+  fi

Let's be consistent on spacing. Please add a space after `-f`.



Comment at: clang/utils/bash-autocomplete.sh:15
+  # Require bash-completion with _init_completion
+  _init_completion -n 2>/dev/null
+  if [[ "$?" != 0 ]]; then

Likewise, add a space after `2>`.



Comment at: clang/utils/bash-autocomplete.sh:58
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2>/dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )

Is it okay to use compopt here? (I wonder how does this line work on macOS.)


https://reviews.llvm.org/D34924



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


[PATCH] D34925: [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.

`~/build/bin/clang -f[tab]` was executed without ~ expanded to $HOME, so 
changed this by expanding ~ to path using eval.


https://reviews.llvm.org/D34925

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -24,7 +24,9 @@
 arg="$w2=,$cur"
   fi
 
-  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
+  # expand ~ to $HOME
+  eval local path=${COMP_WORDS[0]}
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -24,7 +24,9 @@
 arg="$w2=,$cur"
   fi
 
-  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
+  # expand ~ to $HOME
+  eval local path=${COMP_WORDS[0]}
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi added inline comments.



Comment at: clang/utils/bash-autocomplete.sh:3
+
+_clang_filedir()
+{

ruiu wrote:
> Is the output of `compgen -f` the same as `_filedir`? If so, can you always 
> use `compgen -f`?
_filedir is better than `compgen -f`, because it honors spaces in filenames.



Comment at: clang/utils/bash-autocomplete.sh:58
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2>/dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )

ruiu wrote:
> Is it okay to use compopt here? (I wonder how does this line work on macOS.)
I thought it will just emit errors and proceed to next line. This part doesn't 
make a big difference in completion, so I thought we can just ignore it when 
compopt is not supported.


https://reviews.llvm.org/D34924



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104992.
yamaguchi marked 2 inline comments as done.
yamaguchi added a comment.

Update diff.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,31 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  _filedir 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=( $( compgen -f ) )
+  fi
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # Require bash-completion with _init_completion
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +44,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,31 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  _filedir 2>/dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=( $( compgen -f ) )
+  fi
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # Require bash-completion with _init_completion
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +44,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added inline comments.



Comment at: clang/utils/bash-autocomplete.sh:3
+
+_clang_filedir()
+{

yamaguchi wrote:
> ruiu wrote:
> > Is the output of `compgen -f` the same as `_filedir`? If so, can you always 
> > use `compgen -f`?
> _filedir is better than `compgen -f`, because it honors spaces in filenames.
You want to describe it in a comment: _filedir function provided by recent 
versions of bash-completion package is better than "compgen -f" because the 
former honors spaces in pathnames while the latter doesn't. So we use compgen 
only when _filedir is not provided.



Comment at: clang/utils/bash-autocomplete.sh:17-18
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi

It's not clear what this code does. Can you explain?


https://reviews.llvm.org/D34924



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104993.
yamaguchi added a comment.

Update diff.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames 
while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2>/dev/null
+  [[ "$?" != 0 ]] && COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by calling _get_comp_words_by_ref.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +46,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2>/dev/null
+  [[ "$?" != 0 ]] && COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by calling _get_comp_words_by_ref.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +46,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu added inline comments.



Comment at: clang/utils/bash-autocomplete.sh:8-9
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2>/dev/null
+  [[ "$?" != 0 ]] && COMPREPLY=( $( compgen -f ) )
+}

If this works, you can probably make it shorter

  _filedir 2> /dev/null || COMPREPLY=...



https://reviews.llvm.org/D34924



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104994.
yamaguchi marked an inline comment as done.
yamaguchi added a comment.

Update patch.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,32 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames 
while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by calling _get_comp_words_by_ref.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +45,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,32 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by calling _get_comp_words_by_ref.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+_get_comp_words_by_ref cur prev words cword
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +45,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu accepted this revision.
ruiu added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D34924



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


[PATCH] D34824: clang-format: add an option -verbose to list the files being processed

2017-07-01 Thread Sylvestre Ledru via Phabricator via cfe-commits
sylvestre.ledru updated this revision to Diff 104995.
Herald added a subscriber: klimek.

https://reviews.llvm.org/D34824

Files:
  docs/ClangFormat.rst
  docs/ReleaseNotes.rst
  test/Format/verbose.cpp
  tools/clang-format/ClangFormat.cpp


Index: tools/clang-format/ClangFormat.cpp
===
--- tools/clang-format/ClangFormat.cpp
+++ tools/clang-format/ClangFormat.cpp
@@ -102,6 +102,11 @@
  "SortIncludes style flag"),
 cl::cat(ClangFormatCategory));
 
+static cl::opt Verbose(
+"verbose",
+cl::desc("If set, shows the list of processed files"),
+cl::cat(ClangFormatCategory));
+
 static cl::list FileNames(cl::Positional, cl::desc("[ 
...]"),
cl::cat(ClangFormatCategory));
 
@@ -371,6 +376,8 @@
 break;
   case 1:
 Error = clang::format::format(FileNames[0]);
+if (Verbose.getNumOccurrences() != 0)
+errs() << "Formatting " << FileNames[0] << '\n';
 break;
   default:
 if (!Offsets.empty() || !Lengths.empty() || !LineRanges.empty()) {
@@ -378,8 +385,11 @@
 "single file.\n";
   return 1;
 }
-for (unsigned i = 0; i < FileNames.size(); ++i)
+for (unsigned i = 0; i < FileNames.size(); ++i) {
   Error |= clang::format::format(FileNames[i]);
+  if (Verbose.getNumOccurrences() != 0)
+  errs() << "Formatting " << FileNames[i] << '\n';
+}
 break;
   }
   return Error ? 1 : 0;
Index: test/Format/verbose.cpp
===
--- test/Format/verbose.cpp
+++ test/Format/verbose.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-format %s -verbose | FileCheck %s
+// CHECK: Formatting
+
+int a;
+
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -176,6 +176,9 @@
 * Comment reflow support added. Overly long comment lines will now be reflown 
with the rest of
   the paragraph instead of just broken. Option **ReflowComments** added and 
enabled by default.
 
+* Option -verbose added to the command line.
+  Shows the list of processed files.
+
 libclang
 
 
Index: docs/ClangFormat.rst
===
--- docs/ClangFormat.rst
+++ docs/ClangFormat.rst
@@ -71,6 +71,7 @@
 Use -style="{key: value, ...}" to set specific
 parameters, e.g.:
   -style="{BasedOnStyle: llvm, IndentWidth: 8}"
+-verbose  - If set, shows the list of processed files
 
   Generic Options:
 


Index: tools/clang-format/ClangFormat.cpp
===
--- tools/clang-format/ClangFormat.cpp
+++ tools/clang-format/ClangFormat.cpp
@@ -102,6 +102,11 @@
  "SortIncludes style flag"),
 cl::cat(ClangFormatCategory));
 
+static cl::opt Verbose(
+"verbose",
+cl::desc("If set, shows the list of processed files"),
+cl::cat(ClangFormatCategory));
+
 static cl::list FileNames(cl::Positional, cl::desc("[ ...]"),
cl::cat(ClangFormatCategory));
 
@@ -371,6 +376,8 @@
 break;
   case 1:
 Error = clang::format::format(FileNames[0]);
+if (Verbose.getNumOccurrences() != 0)
+errs() << "Formatting " << FileNames[0] << '\n';
 break;
   default:
 if (!Offsets.empty() || !Lengths.empty() || !LineRanges.empty()) {
@@ -378,8 +385,11 @@
 "single file.\n";
   return 1;
 }
-for (unsigned i = 0; i < FileNames.size(); ++i)
+for (unsigned i = 0; i < FileNames.size(); ++i) {
   Error |= clang::format::format(FileNames[i]);
+  if (Verbose.getNumOccurrences() != 0)
+  errs() << "Formatting " << FileNames[i] << '\n';
+}
 break;
   }
   return Error ? 1 : 0;
Index: test/Format/verbose.cpp
===
--- test/Format/verbose.cpp
+++ test/Format/verbose.cpp
@@ -0,0 +1,5 @@
+// RUN: clang-format %s -verbose | FileCheck %s
+// CHECK: Formatting
+
+int a;
+
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -176,6 +176,9 @@
 * Comment reflow support added. Overly long comment lines will now be reflown with the rest of
   the paragraph instead of just broken. Option **ReflowComments** added and enabled by default.
 
+* Option -verbose added to the command line.
+  Shows the list of processed files.
+
 libclang
 
 
Index: docs/ClangFormat.rst
===
--- docs/ClangFormat.rst
+++ docs/ClangFormat.rst
@@ -71,6 +71,7 @@
 Use -style="{key: value, ...}" to set specific
 parameters, e.g.:

[PATCH] D34925: [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

2017-07-01 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.
This revision is now accepted and ready to land.

That fixes my issue. LGTM.


https://reviews.llvm.org/D34925



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev accepted this revision.
v.g.vassilev added a comment.

It looks like this works with bash 3.2. I've tested this on mac and it works 
well.


https://reviews.llvm.org/D34924



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi updated this revision to Diff 104996.
yamaguchi added a comment.

_get_comp_words_by_ref still depends on older bash-completion package, so 
delete this and set cword and cur manualy.


https://reviews.llvm.org/D34924

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames 
while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by setting manualy.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +46,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by setting manualy.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -28,18 +46,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/

r306957 - [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

2017-07-01 Thread Yuka Takahashi via cfe-commits
Author: yamaguchi
Date: Sat Jul  1 09:30:02 2017
New Revision: 306957

URL: http://llvm.org/viewvc/llvm-project?rev=306957&view=rev
Log:
[Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

Summary: `~/build/bin/clang -f[tab]` was executed without ~ expanded to $HOME, 
so changed this by expanding ~ to path using eval.

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

Modified:
cfe/trunk/utils/bash-autocomplete.sh

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=306957&r1=306956&r2=306957&view=diff
==
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sat Jul  1 09:30:02 2017
@@ -24,7 +24,9 @@ _clang()
 arg="$w2=,$cur"
   fi
 
-  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
+  # expand ~ to $HOME
+  eval local path=${COMP_WORDS[0]}
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then


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


[PATCH] D34925: [Bash-completion] Fixed a bug that ~ doesn't expanded to $HOME

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306957: [Bash-completion] Fixed a bug that ~ doesn't 
expanded to $HOME (authored by yamaguchi).

Changed prior to commit:
  https://reviews.llvm.org/D34925?vs=104991&id=104997#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34925

Files:
  cfe/trunk/utils/bash-autocomplete.sh


Index: cfe/trunk/utils/bash-autocomplete.sh
===
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -24,7 +24,9 @@
 arg="$w2=,$cur"
   fi
 
-  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
+  # expand ~ to $HOME
+  eval local path=${COMP_WORDS[0]}
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then


Index: cfe/trunk/utils/bash-autocomplete.sh
===
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -24,7 +24,9 @@
 arg="$w2=,$cur"
   fi
 
-  flags=$( "${COMP_WORDS[0]}" --autocomplete="$arg" 2>/dev/null )
+  # expand ~ to $HOME
+  eval local path=${COMP_WORDS[0]}
+  flags=$( "$path" --autocomplete="$arg" 2>/dev/null )
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34926: Deprecation flag group + use for BB vectorizer options

2017-07-01 Thread Joerg Sonnenberger via Phabricator via cfe-commits
joerg created this revision.
Herald added a subscriber: rengolin.

As discussed on IRC when https://reviews.llvm.org/D34846 came up, removing 
flags is problematic from a UX experience.

This change introduces a new option group similar to the group GCC optimizer 
flags like -fexpensive-optimizations. This gives a warning by default, but can 
be silenced appropriately. Move the two BB vectorizer flags into this option 
group, test them and add a release note entry.


https://reviews.llvm.org/D34926

Files:
  docs/ReleaseNotes.rst
  include/clang/Basic/DiagnosticDriverKinds.td
  include/clang/Driver/Options.td
  lib/Driver/ToolChains/Clang.cpp
  test/Driver/clang_f_opts.c


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -356,6 +356,8 @@
 // RUN: -ftree-vrp\
 // RUN: -fno-devirtualize \
 // RUN: -fno-devirtualize-speculatively   \
+// RUN: -fslp-vectorize-aggressive\
+// RUN: -fno-slp-vectorize-aggressive \
 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
@@ -422,6 +424,8 @@
 // CHECK-WARNING-DAG: optimization flag '-ftree-vrp' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is 
not supported
+// CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been 
deprecated and will be ignored
+// CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been 
deprecated and will be ignored
 
 // Test that we mute the warning on these
 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument 
 \
Index: lib/Driver/ToolChains/Clang.cpp
===
--- lib/Driver/ToolChains/Clang.cpp
+++ lib/Driver/ToolChains/Clang.cpp
@@ -2974,6 +2974,12 @@
 A->claim();
   }
 
+  for (const Arg *A :
+   Args.filtered(options::OPT_clang_ignored_legacy_options_Group)) {
+D.Diag(diag::warn_ignored_clang_option) << A->getAsString(Args);
+A->claim();
+  }
+
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
Index: include/clang/Driver/Options.td
===
--- include/clang/Driver/Options.td
+++ include/clang/Driver/Options.td
@@ -194,6 +194,16 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Group for clang options in the process of deprecation.
+// Please include the version that deprecated the flag as comment to allow
+// easier garbage collection.
+def clang_ignored_legacy_options_Group : OptionGroup<"">,
+  Group, Flags<[Ignored]>;
+
+// Retired with clang-5.0
+def : Flag<["-"], "fslp-vectorize-aggressive">, 
Group;
+def : Flag<["-"], "fno-slp-vectorize-aggressive">, 
Group;
+
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;
Index: include/clang/Basic/DiagnosticDriverKinds.td
===
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -178,6 +178,8 @@
   InGroup;
 def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not 
supported">,
   InGroup;
+def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and 
will be ignored">,
+  InGroup;
 def warn_drv_unsupported_opt_for_target : Warning<
   "optimization flag '%0' is not supported for target '%1'">,
   InGroup;
Index: docs/ReleaseNotes.rst
===
--- docs/ReleaseNotes.rst
+++ docs/ReleaseNotes.rst
@@ -60,6 +60,16 @@
 
 The option 
 
+Deprecated Compiler Flags
+-
+
+The following options are deprecated and ignored. They will be removed in
+future versions of Clang.
+
+- -fslp-vectorize-aggressive used to enable the BB vectorizing passes. They 
have been superseeded
+  by the normal SLP vectorizer.
+- -fno-slp-vectorize-aggressive used to be the default behavior of clang.
+
 New Pragmas in Clang
 ---
 


Index: test/Driver/clang_f_opts.c
===
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -356,6 +356,8 @@
 // RUN: -ftree-vrp\
 // RUN: -fno-devirtualize \
 // RUN: -fno-devirtua

[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Rui Ueyama via Phabricator via cfe-commits
ruiu accepted this revision.
ruiu added a comment.

LGTM. Confirmed that it works as expected on my Mac which doesn't have the 
bash-autocomplete package.




Comment at: clang/utils/bash-autocomplete.sh:19
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"

I think you want to quote $COMP_WORD with "" so that it works even if 
$COMP_WORD contains space characters.
20  


https://reviews.llvm.org/D34924



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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor accepted this revision.
teemperor added a comment.

LGTM, everything still works in the latest bash on Linux.

Also thanks for the reviews Rui!


https://reviews.llvm.org/D34924



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


r306962 - [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via cfe-commits
Author: yamaguchi
Date: Sat Jul  1 11:32:55 2017
New Revision: 306962

URL: http://llvm.org/viewvc/llvm-project?rev=306962&view=rev
Log:
[Bash-autocompletion] Add support for older bash version.

Summary:
OS X seems to use older bash version which doesn't suport
_init_completion and compopt, so add support for this.

Reviewers: ruiu, v.g.vassilev, teemperor

Subscribers: cfe-commits

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

Modified:
cfe/trunk/utils/bash-autocomplete.sh

Modified: cfe/trunk/utils/bash-autocomplete.sh
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/bash-autocomplete.sh?rev=306962&r1=306961&r2=306962&view=diff
==
--- cfe/trunk/utils/bash-autocomplete.sh (original)
+++ cfe/trunk/utils/bash-autocomplete.sh Sat Jul  1 11:32:55 2017
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames 
while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by setting manualy.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -30,18 +48,18 @@ _clang()
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


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


[PATCH] D34924: [Bash-autocompletion] Add support for older bash version.

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306962: [Bash-autocompletion] Add support for older bash 
version. (authored by yamaguchi).

Changed prior to commit:
  https://reviews.llvm.org/D34924?vs=104996&id=104999#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34924

Files:
  cfe/trunk/utils/bash-autocomplete.sh


Index: cfe/trunk/utils/bash-autocomplete.sh
===
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use 
this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames 
while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by setting manualy.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after 
'='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of 
"-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -30,18 +48,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }


Index: cfe/trunk/utils/bash-autocomplete.sh
===
--- cfe/trunk/utils/bash-autocomplete.sh
+++ cfe/trunk/utils/bash-autocomplete.sh
@@ -1,15 +1,33 @@
 # Please add "source /path/to/bash-autocomplete.sh" to your .bashrc to use this.
+
+_clang_filedir()
+{
+  # _filedir function provided by recent versions of bash-completion package is
+  # better than "compgen -f" because the former honors spaces in pathnames while
+  # the latter doesn't. So we use compgen only when _filedir is not provided.
+  _filedir 2> /dev/null || COMPREPLY=( $( compgen -f ) )
+}
+
 _clang()
 {
-  local cur prev words cword arg flags
-  _init_completion -n : || return
+  local cur prev words cword arg flags w1 w2
+  # If latest bash-completion is not supported just initialize COMPREPLY and
+  # initialize variables by setting manualy.
+  _init_completion -n 2> /dev/null
+  if [[ "$?" != 0 ]]; then
+COMPREPLY=()
+cword=$COMP_CWORD
+cur="${COMP_WORDS[$cword]}"
+  fi
 
   # bash always separates '=' as a token even if there's no space before/after '='.
   # On the other hand, '=' is just a regular character for clang options that
   # contain '='. For example, "-stdlib=" is defined as is, instead of "-stdlib" and "=".
   # So, we need to partially undo bash tokenization here for integrity.
-  local w1="${COMP_WORDS[$cword - 1]}"
-  local w2="${COMP_WORDS[$cword - 2]}"
+  w1="${COMP_WORDS[$cword - 1]}"
+  if [[ $cword > 1 ]]; then
+w2="${COMP_WORDS[$cword - 2]}"
+  fi
   if [[ "$cur" == -* ]]; then
 # -foo
 arg="$cur"
@@ -30,18 +48,18 @@
   # If clang is old that it does not support --autocomplete,
   # fall back to the filename completion.
   if [[ "$?" != 0 ]]; then
-_filedir
+_clang_filedir
 return
   fi
 
   if [[ "$cur" == '=' ]]; then
 COMPREPLY=( $( compgen -W "$flags" -- "") )
   elif [[ "$flags" == "" || "$arg" == "" ]]; then
-_filedir
+_clang_filedir
   else
 # Bash automatically appends a space after '=' by default.
 # Disable it so that it works nicely for options in the form of -foo=bar.
-[[ "${flags: -1}" == '=' ]] && compopt -o nospace
+[[ "${flags: -1}" == '=' ]] && compopt -o nospace 2> /dev/null
 COMPREPLY=( $( compgen -W "$flags" -- "$cur" ) )
   fi
 }
_

[PATCH] D34927: [Bash-autocompletion] Fix a bug that -foo=bar doesn't handled properly

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.

Fixed a bug that -foo=bar wasn't handled properly on old version of bash.


https://reviews.llvm.org/D34927

Files:
  clang/utils/bash-autocomplete.sh


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -34,12 +34,18 @@
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
 # -foo=
 arg="$w1=,"
+  elif [[ ${cur:0:1} == '-' && ${cur: -1} == '=' ]]; then
+# -foo=
+arg="$cur,"
   elif [[ "$w1" == -* ]]; then
 # -foo  or -foo bar
 arg="$w1,$cur"
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
 # -foo=bar
 arg="$w2=,$cur"
+  elif [[ ${cur: -1} != '=' && ${cur/=} != $cur ]]; then
+# -foo=bar
+arg="${cur%=*}=,${cur#*=}"
   fi
 
   # expand ~ to $HOME


Index: clang/utils/bash-autocomplete.sh
===
--- clang/utils/bash-autocomplete.sh
+++ clang/utils/bash-autocomplete.sh
@@ -34,12 +34,18 @@
   elif [[ "$w1" == -*  && "$cur" == '=' ]]; then
 # -foo=
 arg="$w1=,"
+  elif [[ ${cur:0:1} == '-' && ${cur: -1} == '=' ]]; then
+# -foo=
+arg="$cur,"
   elif [[ "$w1" == -* ]]; then
 # -foo  or -foo bar
 arg="$w1,$cur"
   elif [[ "$w2" == -* && "$w1" == '=' ]]; then
 # -foo=bar
 arg="$w2=,$cur"
+  elif [[ ${cur: -1} != '=' && ${cur/=} != $cur ]]; then
+# -foo=bar
+arg="${cur%=*}=,${cur#*=}"
   fi
 
   # expand ~ to $HOME
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34928: Add docs for -foptimization-record-file=

2017-07-01 Thread Brian Gesiak via Phabricator via cfe-commits
modocache created this revision.

The Clang option was previously not included in the User's Manual.


https://reviews.llvm.org/D34928

Files:
  docs/UsersManual.rst


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -332,6 +332,19 @@
using a structured YAML format, users can parse or sort the remarks in a
convenient way.
 
+.. _opt_foptimization-record-file:
+
+**-foptimization-record-file**
+   Control the file to which optimization reports are written.
+
+   When optimization reports are being output (see
+   :ref:`-fsave-optimization-record `), this
+   option controls the file to which those reports are written.
+
+   If this option is not used, optimization records are output to a file named
+   after the primary file being compiled. If that's "foo.c", for example,
+   optimization records are output to "foo.opt.yaml".
+
 .. _opt_fdiagnostics-show-hotness:
 
 **-f[no-]diagnostics-show-hotness**


Index: docs/UsersManual.rst
===
--- docs/UsersManual.rst
+++ docs/UsersManual.rst
@@ -332,6 +332,19 @@
using a structured YAML format, users can parse or sort the remarks in a
convenient way.
 
+.. _opt_foptimization-record-file:
+
+**-foptimization-record-file**
+   Control the file to which optimization reports are written.
+
+   When optimization reports are being output (see
+   :ref:`-fsave-optimization-record `), this
+   option controls the file to which those reports are written.
+
+   If this option is not used, optimization records are output to a file named
+   after the primary file being compiled. If that's "foo.c", for example,
+   optimization records are output to "foo.opt.yaml".
+
 .. _opt_fdiagnostics-show-hotness:
 
 **-f[no-]diagnostics-show-hotness**
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


[PATCH] D34928: Add docs for -foptimization-record-file=

2017-07-01 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

LGTM


https://reviews.llvm.org/D34928



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


[PATCH] D34926: Deprecation flag group + use for BB vectorizer options

2017-07-01 Thread Hal Finkel via Phabricator via cfe-commits
hfinkel accepted this revision.
hfinkel added a comment.
This revision is now accepted and ready to land.

LGTM




Comment at: docs/ReleaseNotes.rst:69
+
+- -fslp-vectorize-aggressive used to enable the BB vectorizing passes. They 
have been superseeded
+  by the normal SLP vectorizer.

There was only one pass, so maybe say, "... to enable the 
basic-block-vectorization pass."


https://reviews.llvm.org/D34926



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


r306964 - [modules] Teach clang how to merge typedef over anonymous structs in C mode.

2017-07-01 Thread Vassil Vassilev via cfe-commits
Author: vvassilev
Date: Sat Jul  1 13:44:49 2017
New Revision: 306964

URL: http://llvm.org/viewvc/llvm-project?rev=306964&view=rev
Log:
[modules] Teach clang how to merge typedef over anonymous structs in C mode.

In C mode clang fails to merge the textually included definition with the one 
imported from a module. The C lookup rules fail to find the imported definition 
because its linkage is internal in non C++ mode.

This patch reinstates some of the ODR merging rules for typedefs of anonymous 
tags for languages other than C++.

Patch by Raphael Isemann and me (D34510).

Modified:
cfe/trunk/lib/AST/Decl.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Index/usrs.m

Modified: cfe/trunk/lib/AST/Decl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/Decl.cpp?rev=306964&r1=306963&r2=306964&view=diff
==
--- cfe/trunk/lib/AST/Decl.cpp (original)
+++ cfe/trunk/lib/AST/Decl.cpp Sat Jul  1 13:44:49 2017
@@ -1259,8 +1259,7 @@ static LinkageInfo computeLVForDecl(cons
 case Decl::TypeAlias:
   // A typedef declaration has linkage if it gives a type a name for
   // linkage purposes.
-  if (!D->getASTContext().getLangOpts().CPlusPlus ||
-  !cast(D)
+  if (!cast(D)
->getAnonDeclWithTypedefName(/*AnyRedecl*/true))
 return LinkageInfo::none();
   break;

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=306964&r1=306963&r2=306964&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Sat Jul  1 13:44:49 2017
@@ -1998,8 +1998,7 @@ static void filterNonConflictingPrevious
 
   // If both declarations give a tag declaration a typedef name for linkage
   // purposes, then they declare the same entity.
-  if (S.getLangOpts().CPlusPlus &&
-  OldTD->getAnonDeclWithTypedefName(/*AnyRedecl*/true) &&
+  if (OldTD->getAnonDeclWithTypedefName(/*AnyRedecl*/true) &&
   Decl->getAnonDeclWithTypedefName())
 continue;
 }
@@ -2117,7 +2116,7 @@ void Sema::MergeTypedefNameDecl(Scope *S
 auto *OldTag = OldTD->getAnonDeclWithTypedefName(/*AnyRedecl*/true);
 auto *NewTag = New->getAnonDeclWithTypedefName();
 NamedDecl *Hidden = nullptr;
-if (getLangOpts().CPlusPlus && OldTag && NewTag &&
+if (OldTag && NewTag &&
 OldTag->getCanonicalDecl() != NewTag->getCanonicalDecl() &&
 !hasVisibleDefinition(OldTag, &Hidden)) {
   // There is a definition of this tag, but it is not visible. Use it

Modified: cfe/trunk/test/Index/usrs.m
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/usrs.m?rev=306964&r1=306963&r2=306964&view=diff
==
--- cfe/trunk/test/Index/usrs.m (original)
+++ cfe/trunk/test/Index/usrs.m Sat Jul  1 13:44:49 2017
@@ -119,7 +119,7 @@ int test_multi_declaration(void) {
 // CHECK: usrs.m c:@SA@MyStruct Extent=[15:9 - 18:2]
 // CHECK: usrs.m c:@SA@MyStruct@FI@wa Extent=[16:3 - 16:9]
 // CHECK: usrs.m c:@SA@MyStruct@FI@moo Extent=[17:3 - 17:10]
-// CHECK: usrs.m c:usrs.m@T@MyStruct Extent=[15:1 - 18:11]
+// CHECK: usrs.m c:@T@MyStruct Extent=[15:1 - 18:11]
 // CHECK: usrs.m c:@E@Pizza Extent=[20:1 - 23:2]
 // CHECK: usrs.m c:@E@Pizza@CHEESE Extent=[21:3 - 21:9]
 // CHECK: usrs.m c:@E@Pizza@MUSHROOMS Extent=[22:3 - 22:12]


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


[PATCH] D34510: Teach clang how to merge typedef over anonymous structs in C mode.

2017-07-01 Thread Vassil Vassilev via Phabricator via cfe-commits
v.g.vassilev closed this revision.
v.g.vassilev added a comment.

Landed in r306964.


Repository:
  rL LLVM

https://reviews.llvm.org/D34510



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


r306965 - Add an option group for deprecated warnings. Add the removed

2017-07-01 Thread Joerg Sonnenberger via cfe-commits
Author: joerg
Date: Sat Jul  1 14:36:21 2017
New Revision: 306965

URL: http://llvm.org/viewvc/llvm-project?rev=306965&view=rev
Log:
Add an option group for deprecated warnings. Add the removed
-fslp-vectorize-aggressive and -fno-slp-vectorize-aggressive flags back
under this group and test for the warning. Document the future removal
in the ReleaseNotes.

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

Modified:
cfe/trunk/docs/ReleaseNotes.rst
cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
cfe/trunk/include/clang/Driver/Options.td
cfe/trunk/lib/Driver/ToolChains/Clang.cpp
cfe/trunk/test/Driver/clang_f_opts.c

Modified: cfe/trunk/docs/ReleaseNotes.rst
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/ReleaseNotes.rst?rev=306965&r1=306964&r2=306965&view=diff
==
--- cfe/trunk/docs/ReleaseNotes.rst (original)
+++ cfe/trunk/docs/ReleaseNotes.rst Sat Jul  1 14:36:21 2017
@@ -60,6 +60,16 @@ New Compiler Flags
 
 The option 
 
+Deprecated Compiler Flags
+-
+
+The following options are deprecated and ignored. They will be removed in
+future versions of Clang.
+
+- -fslp-vectorize-aggressive used to enable the BB vectorizing pass. They have 
been superseeded
+  by the normal SLP vectorizer.
+- -fno-slp-vectorize-aggressive used to be the default behavior of clang.
+
 New Pragmas in Clang
 ---
 

Modified: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td?rev=306965&r1=306964&r2=306965&view=diff
==
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td Sat Jul  1 14:36:21 
2017
@@ -178,6 +178,8 @@ def warn_drv_optimization_value : Warnin
   InGroup;
 def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not 
supported">,
   InGroup;
+def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and 
will be ignored">,
+  InGroup;
 def warn_drv_unsupported_opt_for_target : Warning<
   "optimization flag '%0' is not supported for target '%1'">,
   InGroup;

Modified: cfe/trunk/include/clang/Driver/Options.td
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Options.td?rev=306965&r1=306964&r2=306965&view=diff
==
--- cfe/trunk/include/clang/Driver/Options.td (original)
+++ cfe/trunk/include/clang/Driver/Options.td Sat Jul  1 14:36:21 2017
@@ -194,6 +194,16 @@ def clang_ignored_f_Group : OptionGroup<
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Group for clang options in the process of deprecation.
+// Please include the version that deprecated the flag as comment to allow
+// easier garbage collection.
+def clang_ignored_legacy_options_Group : OptionGroup<"">,
+  Group, Flags<[Ignored]>;
+
+// Retired with clang-5.0
+def : Flag<["-"], "fslp-vectorize-aggressive">, 
Group;
+def : Flag<["-"], "fno-slp-vectorize-aggressive">, 
Group;
+
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;

Modified: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Clang.cpp?rev=306965&r1=306964&r2=306965&view=diff
==
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp Sat Jul  1 14:36:21 2017
@@ -2974,6 +2974,12 @@ void Clang::ConstructJob(Compilation &C,
 A->claim();
   }
 
+  for (const Arg *A :
+   Args.filtered(options::OPT_clang_ignored_legacy_options_Group)) {
+D.Diag(diag::warn_ignored_clang_option) << A->getAsString(Args);
+A->claim();
+  }
+
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);

Modified: cfe/trunk/test/Driver/clang_f_opts.c
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang_f_opts.c?rev=306965&r1=306964&r2=306965&view=diff
==
--- cfe/trunk/test/Driver/clang_f_opts.c (original)
+++ cfe/trunk/test/Driver/clang_f_opts.c Sat Jul  1 14:36:21 2017
@@ -356,6 +356,8 @@
 // RUN: -ftree-vrp\
 // RUN: -fno-devirtualize \
 // RUN: -fno-devirtualize-speculatively   \
+// RUN: -fslp-vectorize-aggressive\
+// RUN: -fno-slp-vectorize-aggressive \
 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WA

[PATCH] D34926: Deprecation flag group + use for BB vectorizer options

2017-07-01 Thread Joerg Sonnenberger via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rL306965: Add an option group for deprecated warnings. Add the 
removed (authored by joerg).

Changed prior to commit:
  https://reviews.llvm.org/D34926?vs=104998&id=105004#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D34926

Files:
  cfe/trunk/docs/ReleaseNotes.rst
  cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
  cfe/trunk/include/clang/Driver/Options.td
  cfe/trunk/lib/Driver/ToolChains/Clang.cpp
  cfe/trunk/test/Driver/clang_f_opts.c


Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -2974,6 +2974,12 @@
 A->claim();
   }
 
+  for (const Arg *A :
+   Args.filtered(options::OPT_clang_ignored_legacy_options_Group)) {
+D.Diag(diag::warn_ignored_clang_option) << A->getAsString(Args);
+A->claim();
+  }
+
   claimNoWarnArgs(Args);
 
   Args.AddAllArgs(CmdArgs, options::OPT_R_Group);
Index: cfe/trunk/docs/ReleaseNotes.rst
===
--- cfe/trunk/docs/ReleaseNotes.rst
+++ cfe/trunk/docs/ReleaseNotes.rst
@@ -60,6 +60,16 @@
 
 The option 
 
+Deprecated Compiler Flags
+-
+
+The following options are deprecated and ignored. They will be removed in
+future versions of Clang.
+
+- -fslp-vectorize-aggressive used to enable the BB vectorizing pass. They have 
been superseeded
+  by the normal SLP vectorizer.
+- -fno-slp-vectorize-aggressive used to be the default behavior of clang.
+
 New Pragmas in Clang
 ---
 
Index: cfe/trunk/include/clang/Driver/Options.td
===
--- cfe/trunk/include/clang/Driver/Options.td
+++ cfe/trunk/include/clang/Driver/Options.td
@@ -194,6 +194,16 @@
 def clang_ignored_m_Group : OptionGroup<"">,
   Group, Flags<[Ignored]>;
 
+// Group for clang options in the process of deprecation.
+// Please include the version that deprecated the flag as comment to allow
+// easier garbage collection.
+def clang_ignored_legacy_options_Group : OptionGroup<"">,
+  Group, Flags<[Ignored]>;
+
+// Retired with clang-5.0
+def : Flag<["-"], "fslp-vectorize-aggressive">, 
Group;
+def : Flag<["-"], "fno-slp-vectorize-aggressive">, 
Group;
+
 // Group that ignores all gcc optimizations that won't be implemented
 def clang_ignored_gcc_optimization_f_Group : OptionGroup<
   "">, Group, 
Flags<[Ignored]>;
Index: cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
===
--- cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
+++ cfe/trunk/include/clang/Basic/DiagnosticDriverKinds.td
@@ -178,6 +178,8 @@
   InGroup;
 def warn_ignored_gcc_optimization : Warning<"optimization flag '%0' is not 
supported">,
   InGroup;
+def warn_ignored_clang_option : Warning<"the flag '%0' has been deprecated and 
will be ignored">,
+  InGroup;
 def warn_drv_unsupported_opt_for_target : Warning<
   "optimization flag '%0' is not supported for target '%1'">,
   InGroup;
Index: cfe/trunk/test/Driver/clang_f_opts.c
===
--- cfe/trunk/test/Driver/clang_f_opts.c
+++ cfe/trunk/test/Driver/clang_f_opts.c
@@ -356,6 +356,8 @@
 // RUN: -ftree-vrp\
 // RUN: -fno-devirtualize \
 // RUN: -fno-devirtualize-speculatively   \
+// RUN: -fslp-vectorize-aggressive\
+// RUN: -fno-slp-vectorize-aggressive \
 // RUN: %s 2>&1 | FileCheck --check-prefix=CHECK-WARNING %s
 // CHECK-WARNING-DAG: optimization flag '-finline-limit=1000' is not supported
 // CHECK-WARNING-DAG: optimization flag '-finline-limit' is not supported
@@ -422,6 +424,8 @@
 // CHECK-WARNING-DAG: optimization flag '-ftree-vrp' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize' is not supported
 // CHECK-WARNING-DAG: optimization flag '-fno-devirtualize-speculatively' is 
not supported
+// CHECK-WARNING-DAG: the flag '-fslp-vectorize-aggressive' has been 
deprecated and will be ignored
+// CHECK-WARNING-DAG: the flag '-fno-slp-vectorize-aggressive' has been 
deprecated and will be ignored
 
 // Test that we mute the warning on these
 // RUN: %clang -### -finline-limit=1000 -Wno-invalid-command-line-argument 
 \


Index: cfe/trunk/lib/Driver/ToolChains/Clang.cpp
===
--- cfe/trunk/lib/Driver/ToolChains/Clang.cpp
+++ cfe/trunk/lib/Driver/ToolChains/Clang.cpp
@@ -2974,6 +2974,12 @@
 A->claim();
   }
 
+  for (const Arg *A :
+   Args.filtered(options::OPT_clang_ignored_legacy_options_Group))

[PATCH] D34930: [Bash-autocompletion] Show flags which has HelpText or GroupID

2017-07-01 Thread Yuka Takahashi via Phabricator via cfe-commits
yamaguchi created this revision.
Herald added a subscriber: hiraditya.

Otherwise internal flags will be also completed.


https://reviews.llvm.org/D34930

Files:
  llvm/lib/Option/OptTable.cpp


Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -228,7 +228,7 @@
 std::vector OptTable::findByPrefix(StringRef Cur) const {
   std::vector Ret;
   for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
-if (!In.Prefixes)
+if (!In.Prefixes || (!In.HelpText && !In.GroupID))
   continue;
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);


Index: llvm/lib/Option/OptTable.cpp
===
--- llvm/lib/Option/OptTable.cpp
+++ llvm/lib/Option/OptTable.cpp
@@ -228,7 +228,7 @@
 std::vector OptTable::findByPrefix(StringRef Cur) const {
   std::vector Ret;
   for (const Info &In : OptionInfos.slice(FirstSearchableIndex)) {
-if (!In.Prefixes)
+if (!In.Prefixes || (!In.HelpText && !In.GroupID))
   continue;
 for (int I = 0; In.Prefixes[I]; I++) {
   std::string S = std::string(In.Prefixes[I]) + std::string(In.Name);
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


r306969 - fix trivial typos in comments; NFC

2017-07-01 Thread Hiroshi Inoue via cfe-commits
Author: inouehrs
Date: Sat Jul  1 23:12:49 2017
New Revision: 306969

URL: http://llvm.org/viewvc/llvm-project?rev=306969&view=rev
Log:
fix trivial typos in comments; NFC

Modified:
cfe/trunk/lib/Parse/ParseDecl.cpp
cfe/trunk/lib/Parse/ParseExpr.cpp
cfe/trunk/test/Sema/warn-documentation.cpp

Modified: cfe/trunk/lib/Parse/ParseDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseDecl.cpp?rev=306969&r1=306968&r2=306969&view=diff
==
--- cfe/trunk/lib/Parse/ParseDecl.cpp (original)
+++ cfe/trunk/lib/Parse/ParseDecl.cpp Sat Jul  1 23:12:49 2017
@@ -6650,7 +6650,7 @@ void Parser::ParseTypeofSpecifier(DeclSp
 return;
   }
 
-  // If we get here, the operand to the typeof was an expresion.
+  // If we get here, the operand to the typeof was an expression.
   if (Operand.isInvalid()) {
 DS.SetTypeSpecError();
 return;

Modified: cfe/trunk/lib/Parse/ParseExpr.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseExpr.cpp?rev=306969&r1=306968&r2=306969&view=diff
==
--- cfe/trunk/lib/Parse/ParseExpr.cpp (original)
+++ cfe/trunk/lib/Parse/ParseExpr.cpp Sat Jul  1 23:12:49 2017
@@ -1866,7 +1866,7 @@ Parser::ParseExprAfterUnaryExprOrTypeTra
 }
   }
 
-  // If we get here, the operand to the typeof/sizeof/alignof was an expresion.
+  // If we get here, the operand to the typeof/sizeof/alignof was an 
expression.
   isCastExpr = false;
   return Operand;
 }
@@ -1972,7 +1972,7 @@ ExprResult Parser::ParseUnaryExprOrTypeT
   if (OpTok.isOneOf(tok::kw_alignof, tok::kw__Alignof))
 Diag(OpTok, diag::ext_alignof_expr) << OpTok.getIdentifierInfo();
 
-  // If we get here, the operand to the sizeof/alignof was an expresion.
+  // If we get here, the operand to the sizeof/alignof was an expression.
   if (!Operand.isInvalid())
 Operand = Actions.ActOnUnaryExprOrTypeTraitExpr(OpTok.getLocation(),
 ExprKind,

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=306969&r1=306968&r2=306969&view=diff
==
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Sat Jul  1 23:12:49 2017
@@ -1186,7 +1186,7 @@ class Predicate
 /// @brief A C++ wrapper class for providing threaded access to a value
 /// of type T.
 ///
-/// A template specilization class.
+/// A template specialization class.
 //--
 template<> class Predicate
 {


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


[PATCH] D34930: [Bash-autocompletion] Show flags which has HelpText or GroupID

2017-07-01 Thread Raphael Isemann via Phabricator via cfe-commits
teemperor accepted this revision.
teemperor added a comment.
This revision is now accepted and ready to land.

For the record, one can get a (maybe incomplete) list of options that are 
without completion via: `curl "https://teemperor.de/pub/clang_flags.txt"; | grep 
-v HelpText | grep -v Group`.
The only options I can see that I would miss if they would disappear are the 
ones who are clearly meant to be public but just lack the HelpText (like our 
beloved `sysroot`, which is a public GCC flag). So I think this patch can go 
forward and someone will have to add a HelpText for those flags in the future.


https://reviews.llvm.org/D34930



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