r365210 - NFC: Add an explicit return for safety and consistency

2019-07-05 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Fri Jul  5 07:36:08 2019
New Revision: 365210

URL: http://llvm.org/viewvc/llvm-project?rev=365210&view=rev
Log:
NFC: Add an explicit return for safety and consistency

This case implicitly falls-through, which is fine now as it's at the end of the
function, but it seems like an accident waiting to happen.

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

Modified: cfe/trunk/lib/CodeGen/CGDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGDecl.cpp?rev=365210&r1=365209&r2=365210&view=diff
==
--- cfe/trunk/lib/CodeGen/CGDecl.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGDecl.cpp Fri Jul  5 07:36:08 2019
@@ -153,6 +153,8 @@ void CodeGenFunction::EmitDecl(const Dec
 
 if (Ty->isVariablyModifiedType())
   EmitVariablyModifiedType(Ty);
+
+return;
   }
   }
 }


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


r359967 - [c++20] Implement P0428R2 - Familiar template syntax for generic lambdas

2019-05-04 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Sat May  4 03:49:46 2019
New Revision: 359967

URL: http://llvm.org/viewvc/llvm-project?rev=359967&view=rev
Log:
[c++20] Implement P0428R2 - Familiar template syntax for generic lambdas

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

Added:
cfe/trunk/test/CodeGenCXX/mangle-lambda-explicit-template-params.cpp
cfe/trunk/test/PCH/cxx2a-template-lambdas.cpp
cfe/trunk/test/Parser/cxx2a-template-lambdas.cpp
cfe/trunk/test/SemaCXX/cxx2a-template-lambdas.cpp

cfe/trunk/unittests/Tooling/RecursiveASTVisitorTests/LambdaTemplateParams.cpp
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/DeclTemplate.h
cfe/trunk/include/clang/AST/ExprCXX.h
cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
cfe/trunk/include/clang/Basic/DiagnosticParseKinds.td
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/include/clang/Sema/ScopeInfo.h
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/AST/DeclCXX.cpp
cfe/trunk/lib/AST/DeclPrinter.cpp
cfe/trunk/lib/AST/ExprCXX.cpp
cfe/trunk/lib/AST/ItaniumMangle.cpp
cfe/trunk/lib/AST/StmtPrinter.cpp
cfe/trunk/lib/AST/TypePrinter.cpp
cfe/trunk/lib/Parse/ParseExprCXX.cpp
cfe/trunk/lib/Sema/Sema.cpp
cfe/trunk/lib/Sema/SemaLambda.cpp
cfe/trunk/lib/Sema/SemaType.cpp
cfe/trunk/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
cfe/trunk/test/Index/print-display-names.cpp
cfe/trunk/test/PCH/cxx11-lambdas.mm
cfe/trunk/test/PCH/cxx1y-lambdas.mm
cfe/trunk/unittests/AST/StmtPrinterTest.cpp
cfe/trunk/www/cxx_status.html

Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=359967&r1=359966&r2=359967&view=diff
==
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Sat May  4 03:49:46 2019
@@ -1221,6 +1221,9 @@ public:
   /// lambda.
   TemplateParameterList *getGenericLambdaTemplateParameterList() const;
 
+  /// Retrieve the lambda template parameters that were specified explicitly.
+  ArrayRef getLambdaExplicitTemplateParameters() const;
+
   LambdaCaptureDefault getLambdaCaptureDefault() const {
 assert(isLambda());
 return static_cast(getLambdaData().CaptureDefault);

Modified: cfe/trunk/include/clang/AST/DeclTemplate.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclTemplate.h?rev=359967&r1=359966&r2=359967&view=diff
==
--- cfe/trunk/include/clang/AST/DeclTemplate.h (original)
+++ cfe/trunk/include/clang/AST/DeclTemplate.h Sat May  4 03:49:46 2019
@@ -176,6 +176,11 @@ public:
 return SourceRange(TemplateLoc, RAngleLoc);
   }
 
+  void print(raw_ostream &Out, const ASTContext &Context,
+ bool OmitTemplateKW = false) const;
+  void print(raw_ostream &Out, const ASTContext &Context,
+ const PrintingPolicy &Policy, bool OmitTemplateKW = false) const;
+
 public:
   // FIXME: workaround for MSVC 2013; remove when no longer needed
   using FixedSizeStorageOwner = TrailingObjects::FixedSizeStorageOwner;

Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=359967&r1=359966&r2=359967&view=diff
==
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sat May  4 03:49:46 2019
@@ -1899,6 +1899,10 @@ public:
   /// parameter list associated with it, or else return null.
   TemplateParameterList *getTemplateParameterList() const;
 
+  /// Get the template parameters were explicitly specified (as opposed to 
being
+  /// invented by use of an auto parameter).
+  ArrayRef getExplicitTemplateParameters() const;
+
   /// Whether this is a generic lambda.
   bool isGenericLambda() const { return getTemplateParameterList(); }
 

Modified: cfe/trunk/include/clang/AST/RecursiveASTVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/RecursiveASTVisitor.h?rev=359967&r1=359966&r2=359967&view=diff
==
--- cfe/trunk/include/clang/AST/RecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/RecursiveASTVisitor.h Sat May  4 03:49:46 2019
@@ -2423,6 +2423,10 @@ DEF_TRAVERSE_STMT(LambdaExpr, {
 TypeLoc TL = S->getCallOperator()->getTypeSourceInfo()->getTypeLoc();
 FunctionProtoTypeLoc Proto = TL.getAsAdjusted();
 
+for (Decl *D : S->getExplicitTemplateParameters()) {
+  // Visit explicit template parameters.
+  TRY_TO(TraverseDecl(D));
+}
 if (S->hasExplicitParameters()) {
   // Visit parameters.
   for (unsigned I = 0, N = Proto.getNumParams(); I != N; ++I)

Modified: cfe/trunk/include/clang/Basic/Diagnost

r348603 - [unittests] Add C++17 and C++2a support to the tooling tests

2018-12-07 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Fri Dec  7 07:46:29 2018
New Revision: 348603

URL: http://llvm.org/viewvc/llvm-project?rev=348603&view=rev
Log:
[unittests] Add C++17 and C++2a support to the tooling tests

Modified:
cfe/trunk/unittests/Tooling/TestVisitor.h

Modified: cfe/trunk/unittests/Tooling/TestVisitor.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Tooling/TestVisitor.h?rev=348603&r1=348602&r2=348603&view=diff
==
--- cfe/trunk/unittests/Tooling/TestVisitor.h (original)
+++ cfe/trunk/unittests/Tooling/TestVisitor.h Fri Dec  7 07:46:29 2018
@@ -44,6 +44,8 @@ public:
 Lang_CXX98,
 Lang_CXX11,
 Lang_CXX14,
+Lang_CXX17,
+Lang_CXX2a,
 Lang_OBJC,
 Lang_OBJCXX11,
 Lang_CXX = Lang_CXX98
@@ -60,6 +62,8 @@ public:
   case Lang_CXX98: Args.push_back("-std=c++98"); break;
   case Lang_CXX11: Args.push_back("-std=c++11"); break;
   case Lang_CXX14: Args.push_back("-std=c++14"); break;
+  case Lang_CXX17: Args.push_back("-std=c++17"); break;
+  case Lang_CXX2a: Args.push_back("-std=c++2a"); break;
   case Lang_OBJC:
 Args.push_back("-ObjC");
 Args.push_back("-fobjc-runtime=macosx-10.12.0");


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


r348589 - [unittests] Merge the PrintedStmtCXX..Matches functions (NFC)

2018-12-07 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Fri Dec  7 04:55:01 2018
New Revision: 348589

URL: http://llvm.org/viewvc/llvm-project?rev=348589&view=rev
Log:
[unittests] Merge the PrintedStmtCXX..Matches functions (NFC)

This was reviewed as part of https://reviews.llvm.org/D36527

Modified:
cfe/trunk/unittests/AST/StmtPrinterTest.cpp

Modified: cfe/trunk/unittests/AST/StmtPrinterTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/AST/StmtPrinterTest.cpp?rev=348589&r1=348588&r2=348589&view=diff
==
--- cfe/trunk/unittests/AST/StmtPrinterTest.cpp (original)
+++ cfe/trunk/unittests/AST/StmtPrinterTest.cpp Fri Dec  7 04:55:01 2018
@@ -106,64 +106,59 @@ PrintedStmtMatches(StringRef Code, const
   return ::testing::AssertionSuccess();
 }
 
-::testing::AssertionResult
-PrintedStmtCXX98Matches(StringRef Code, const StatementMatcher &NodeMatch,
-StringRef ExpectedPrinted) {
-  std::vector Args;
-  Args.push_back("-std=c++98");
-  Args.push_back("-Wno-unused-value");
-  return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted);
-}
-
-::testing::AssertionResult PrintedStmtCXX98Matches(
-  StringRef Code,
-  StringRef ContainingFunction,
-  StringRef ExpectedPrinted) {
-  std::vector Args;
-  Args.push_back("-std=c++98");
-  Args.push_back("-Wno-unused-value");
-  return PrintedStmtMatches(Code,
-Args,
-functionDecl(hasName(ContainingFunction),
- 
has(compoundStmt(has(stmt().bind("id"),
-ExpectedPrinted);
+enum class StdVer { CXX98, CXX11, CXX14, CXX17, CXX2a };
+
+DeclarationMatcher FunctionBodyMatcher(StringRef ContainingFunction) {
+  return functionDecl(hasName(ContainingFunction),
+  has(compoundStmt(has(stmt().bind("id");
 }
 
+template 
 ::testing::AssertionResult
-PrintedStmtCXX11Matches(StringRef Code, const StatementMatcher &NodeMatch,
-StringRef ExpectedPrinted,
-PolicyAdjusterType PolicyAdjuster = None) {
-  std::vector Args;
-  Args.push_back("-std=c++11");
-  Args.push_back("-Wno-unused-value");
+PrintedStmtCXXMatches(StdVer Standard, StringRef Code, const T &NodeMatch,
+  StringRef ExpectedPrinted,
+  PolicyAdjusterType PolicyAdjuster = None) {
+  const char *StdOpt;
+  switch (Standard) {
+  case StdVer::CXX98: StdOpt = "-std=c++98"; break;
+  case StdVer::CXX11: StdOpt = "-std=c++11"; break;
+  case StdVer::CXX14: StdOpt = "-std=c++14"; break;
+  case StdVer::CXX17: StdOpt = "-std=c++17"; break;
+  case StdVer::CXX2a: StdOpt = "-std=c++2a"; break;
+  }
+
+  std::vector Args = {
+StdOpt,
+"-Wno-unused-value",
+  };
   return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted,
 PolicyAdjuster);
 }
 
-::testing::AssertionResult PrintedStmtMSMatches(
-  StringRef Code,
-  StringRef ContainingFunction,
-  StringRef ExpectedPrinted) {
-  std::vector Args;
-  Args.push_back("-target");
-  Args.push_back("i686-pc-win32");
-  Args.push_back("-std=c++98");
-  Args.push_back("-fms-extensions");
-  Args.push_back("-Wno-unused-value");
-  return PrintedStmtMatches(Code,
-Args,
-functionDecl(hasName(ContainingFunction),
- 
has(compoundStmt(has(stmt().bind("id"),
-ExpectedPrinted);
+template 
+::testing::AssertionResult
+PrintedStmtMSMatches(StringRef Code, const T &NodeMatch,
+ StringRef ExpectedPrinted,
+ PolicyAdjusterType PolicyAdjuster = None) {
+  std::vector Args = {
+"-std=c++98",
+"-target", "i686-pc-win32",
+"-fms-extensions",
+"-Wno-unused-value",
+  };
+  return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted,
+PolicyAdjuster);
 }
 
+template 
 ::testing::AssertionResult
-PrintedStmtObjCMatches(StringRef Code, const StatementMatcher &NodeMatch,
+PrintedStmtObjCMatches(StringRef Code, const T &NodeMatch,
StringRef ExpectedPrinted,
PolicyAdjusterType PolicyAdjuster = None) {
-  std::vector Args;
-  Args.push_back("-ObjC");
-  Args.push_back("-fobjc-runtime=macosx-10.12.0");
+  std::vector Args = {
+"-ObjC",
+"-fobjc-runtime=macosx-10.12.0",
+  };
   return PrintedStmtMatches(Code, Args, NodeMatch, ExpectedPrinted,
 PolicyAdjuster);
 }
@@ -171,13 +166,13 @@ PrintedStmtObjCMatches(StringRef Code, c
 } // unnamed namespace
 
 TEST(StmtPrinter, TestIntegerLiteral) {

r341761 - Fix build bots after a mistake in r341760

2018-09-09 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Sun Sep  9 06:12:53 2018
New Revision: 341761

URL: http://llvm.org/viewvc/llvm-project?rev=341761&view=rev
Log:
Fix build bots after a mistake in r341760

Modified:
cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp

Modified: cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp?rev=341761&r1=341760&r2=341761&view=diff
==
--- cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp Sun Sep  9 
06:12:53 2018
@@ -188,7 +188,7 @@ struct TransferableCommand {
   }
 
   Cmd.CommandLine.insert(Cmd.CommandLine.end(),
- &OldArgs[OldPos], &OldArgs[Pos]);
+ OldArgs.data() + OldPos, OldArgs.data() + Pos);
 }
 
 if (Std != LangStandard::lang_unspecified) // -std take precedence over -x


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


r341760 - [Tooling] Improve handling of CL-style options

2018-09-09 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Sun Sep  9 05:06:35 2018
New Revision: 341760

URL: http://llvm.org/viewvc/llvm-project?rev=341760&view=rev
Log:
[Tooling] Improve handling of CL-style options

This patch fixes the handling of clang-cl options in 
InterpolatingCompilationDatabase.
They were previously ignored completely, which led to a lot of bugs:

Additional options were being added with the wrong syntax. E.g. a file was
specified as C++ by adding -x c++, which causes an error in CL mode.

The args were parsed and then rendered, which means that the aliasing 
information
was lost. E.g. /W4 was rendered to -Wall, which in CL mode means -Weverything.

CL options were ignored when checking things like -std=, so a lot of logic was
being bypassed.

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

Modified:
cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
cfe/trunk/unittests/Tooling/CompilationDatabaseTest.cpp

Modified: cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp?rev=341760&r1=341759&r2=341760&view=diff
==
--- cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp (original)
+++ cfe/trunk/lib/Tooling/InterpolatingCompilationDatabase.cpp Sun Sep  9 
05:06:35 2018
@@ -48,6 +48,7 @@
 #include "clang/Frontend/LangStandard.h"
 #include "clang/Tooling/CompilationDatabase.h"
 #include "llvm/ADT/DenseMap.h"
+#include "llvm/ADT/Optional.h"
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringSwitch.h"
 #include "llvm/Option/ArgList.h"
@@ -127,47 +128,68 @@ struct TransferableCommand {
   Optional Type;
   // Standard specified by -std.
   LangStandard::Kind Std = LangStandard::lang_unspecified;
+  // Whether the command line is for the cl-compatible driver.
+  bool ClangCLMode;
 
   TransferableCommand(CompileCommand C)
-  : Cmd(std::move(C)), Type(guessType(Cmd.Filename)) {
-std::vector NewArgs = {Cmd.CommandLine.front()};
+  : Cmd(std::move(C)), Type(guessType(Cmd.Filename)),
+ClangCLMode(checkIsCLMode(Cmd.CommandLine)) {
+std::vector OldArgs = std::move(Cmd.CommandLine);
+Cmd.CommandLine.clear();
+
+// Wrap the old arguments in an InputArgList.
+llvm::opt::InputArgList ArgList;
+{
+  SmallVector TmpArgv;
+  for (const std::string &S : OldArgs)
+TmpArgv.push_back(S.c_str());
+  ArgList = {TmpArgv.begin(), TmpArgv.end()};
+}
+
 // Parse the old args in order to strip out and record unwanted flags.
+// We parse each argument individually so that we can retain the exact
+// spelling of each argument; re-rendering is lossy for aliased flags.
+// E.g. in CL mode, /W4 maps to -Wall.
 auto OptTable = clang::driver::createDriverOptTable();
-std::vector Argv;
-for (unsigned I = 1; I < Cmd.CommandLine.size(); ++I)
-  Argv.push_back(Cmd.CommandLine[I].c_str());
-unsigned MissingI, MissingC;
-auto ArgList = OptTable->ParseArgs(Argv, MissingI, MissingC);
-for (const auto *Arg : ArgList) {
-  const auto &option = Arg->getOption();
+Cmd.CommandLine.emplace_back(OldArgs.front());
+for (unsigned Pos = 1; Pos < OldArgs.size();) {
+  using namespace driver::options;
+
+  const unsigned OldPos = Pos;
+  std::unique_ptr Arg(OptTable->ParseOneArg(
+  ArgList, Pos,
+  /* Include */ClangCLMode ? CoreOption | CLOption : 0,
+  /* Exclude */ClangCLMode ? 0 : CLOption));
+
+  if (!Arg)
+continue;
+
+  const llvm::opt::Option &Opt = Arg->getOption();
+
   // Strip input and output files.
-  if (option.matches(clang::driver::options::OPT_INPUT) ||
-  option.matches(clang::driver::options::OPT_o)) {
+  if (Opt.matches(OPT_INPUT) || Opt.matches(OPT_o) ||
+  (ClangCLMode && (Opt.matches(OPT__SLASH_Fa) ||
+   Opt.matches(OPT__SLASH_Fe) ||
+   Opt.matches(OPT__SLASH_Fi) ||
+   Opt.matches(OPT__SLASH_Fo
 continue;
-  }
+
   // Strip -x, but record the overridden language.
-  if (option.matches(clang::driver::options::OPT_x)) {
-for (const char *Value : Arg->getValues())
-  Type = types::lookupTypeForTypeSpecifier(Value);
+  if (const auto GivenType = tryParseTypeArg(*Arg)) {
+Type = *GivenType;
 continue;
   }
-  // Strip --std, but record the value.
-  if (option.matches(clang::driver::options::OPT_std_EQ)) {
-for (const char *Value : Arg->getValues()) {
-  Std = llvm::StringSwitch(Value)
-#define LANGSTANDARD(id, name, lang, desc, features)   
\
-  .Case(name, LangStandard::lang_##id)
-#define LANGSTANDARD_ALIAS(id, alias) .Case(alias, LangStandard::lang_##id)
-#include "clang/Frontend/LangStandards.def"
-.Default(Std);
-}
+
+  

r321494 - [NFC] Small const correctness fix

2017-12-27 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Wed Dec 27 10:05:29 2017
New Revision: 321494

URL: http://llvm.org/viewvc/llvm-project?rev=321494&view=rev
Log:
[NFC] Small const correctness fix

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

Modified: cfe/trunk/lib/Sema/SemaLookup.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaLookup.cpp?rev=321494&r1=321493&r2=321494&view=diff
==
--- cfe/trunk/lib/Sema/SemaLookup.cpp (original)
+++ cfe/trunk/lib/Sema/SemaLookup.cpp Wed Dec 27 10:05:29 2017
@@ -1589,7 +1589,7 @@ bool LookupResult::isVisibleSlow(Sema &S
 return false;
 
   // Find the extra places where we need to look.
-  llvm::DenseSet &LookupModules = SemaRef.getLookupModules();
+  const auto &LookupModules = SemaRef.getLookupModules();
   if (LookupModules.empty())
 return false;
 
@@ -1604,7 +1604,8 @@ bool LookupResult::isVisibleSlow(Sema &S
   // Check whether DeclModule is transitively exported to an import of
   // the lookup set.
   return std::any_of(LookupModules.begin(), LookupModules.end(),
- [&](Module *M) { return M->isModuleVisible(DeclModule); 
});
+ [&](const Module *M) {
+   return M->isModuleVisible(DeclModule); });
 }
 
 bool Sema::isVisibleSlow(const NamedDecl *D) {


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


[libcxx] r319631 - Corrected a typo in the building libc++ docs

2017-12-03 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Sun Dec  3 02:18:35 2017
New Revision: 319631

URL: http://llvm.org/viewvc/llvm-project?rev=319631&view=rev
Log:
Corrected a typo in the building libc++ docs

Modified:
libcxx/trunk/docs/BuildingLibcxx.rst

Modified: libcxx/trunk/docs/BuildingLibcxx.rst
URL: 
http://llvm.org/viewvc/llvm-project/libcxx/trunk/docs/BuildingLibcxx.rst?rev=319631&r1=319630&r2=319631&view=diff
==
--- libcxx/trunk/docs/BuildingLibcxx.rst (original)
+++ libcxx/trunk/docs/BuildingLibcxx.rst Sun Dec  3 02:18:35 2017
@@ -130,7 +130,7 @@ just specify a toolset.
   -DCMAKE_SYSTEM_NAME=Windows  
   ^
   -DCMAKE_C_COMPILER=clang-cl  
   ^
   -DCMAKE_C_FLAGS="-fms-compatibility-version=19.00 
--target=i686--windows"   ^
-  -DCMAKE_CXX_COMPILER=clang-c 
   ^
+  -DCMAKE_CXX_COMPILER=clang-cl
^
   -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.00 
--target=i686--windows" ^
   -DLLVM_PATH=/path/to/llvm/tree   
   ^
   -DLIBCXX_ENABLE_SHARED=YES   
   ^


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


r318744 - [Modules TS] Added module re-export support.

2017-11-21 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Tue Nov 21 01:42:42 2017
New Revision: 318744

URL: http://llvm.org/viewvc/llvm-project?rev=318744&view=rev
Log:
[Modules TS] Added module re-export support.

This implements [dcl.modules.export] from the C++ Modules TS, which lets a 
module re-export another module with the "export import" syntax.
Differential Revision: https://reviews.llvm.org/D40270

Added:
cfe/trunk/test/CXX/modules-ts/dcl.dcl/dcl.module/dcl.module.export/p1.cpp
Modified:
cfe/trunk/include/clang/Parse/Parser.h
cfe/trunk/lib/Parse/ParseObjc.cpp
cfe/trunk/lib/Parse/Parser.cpp
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/SemaCXX/modules-ts.cppm

Modified: cfe/trunk/include/clang/Parse/Parser.h
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Parse/Parser.h?rev=318744&r1=318743&r2=318744&view=diff
==
--- cfe/trunk/include/clang/Parse/Parser.h (original)
+++ cfe/trunk/include/clang/Parse/Parser.h Tue Nov 21 01:42:42 2017
@@ -2788,7 +2788,7 @@ private:
   
//======//
   // Modules
   DeclGroupPtrTy ParseModuleDecl();
-  DeclGroupPtrTy ParseModuleImport(SourceLocation AtLoc);
+  Decl *ParseModuleImport(SourceLocation AtLoc);
   bool parseMisplacedModuleImport();
   bool tryParseMisplacedModuleImport() {
 tok::TokenKind Kind = Tok.getKind();

Modified: cfe/trunk/lib/Parse/ParseObjc.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/ParseObjc.cpp?rev=318744&r1=318743&r2=318744&view=diff
==
--- cfe/trunk/lib/Parse/ParseObjc.cpp (original)
+++ cfe/trunk/lib/Parse/ParseObjc.cpp Tue Nov 21 01:42:42 2017
@@ -81,8 +81,10 @@ Parser::DeclGroupPtrTy Parser::ParseObjC
 SingleDecl = ParseObjCPropertyDynamic(AtLoc);
 break;
   case tok::objc_import:
-if (getLangOpts().Modules || getLangOpts().DebuggerSupport)
-  return ParseModuleImport(AtLoc);
+if (getLangOpts().Modules || getLangOpts().DebuggerSupport) {
+  SingleDecl = ParseModuleImport(AtLoc);
+  break;
+}
 Diag(AtLoc, diag::err_atimport);
 SkipUntil(tok::semi);
 return Actions.ConvertDeclToDeclGroup(nullptr);

Modified: cfe/trunk/lib/Parse/Parser.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Parse/Parser.cpp?rev=318744&r1=318743&r2=318744&view=diff
==
--- cfe/trunk/lib/Parse/Parser.cpp (original)
+++ cfe/trunk/lib/Parse/Parser.cpp Tue Nov 21 01:42:42 2017
@@ -556,10 +556,6 @@ bool Parser::ParseTopLevelDecl(DeclGroup
 HandlePragmaUnused();
 return false;
 
-  case tok::kw_import:
-Result = ParseModuleImport(SourceLocation());
-return false;
-
   case tok::kw_export:
 if (NextToken().isNot(tok::kw_module))
   break;
@@ -637,6 +633,9 @@ bool Parser::ParseTopLevelDecl(DeclGroup
 ///   ';'
 ///
 /// [C++0x/GNU] 'extern' 'template' declaration
+///
+/// [Modules-TS] module-import-declaration
+///
 Parser::DeclGroupPtrTy
 Parser::ParseExternalDeclaration(ParsedAttributesWithRange &attrs,
  ParsingDeclSpec *DS) {
@@ -764,6 +763,9 @@ Parser::ParseExternalDeclaration(ParsedA
 CurParsedObjCImpl ? Sema::PCC_ObjCImplementation : 
Sema::PCC_Namespace);
 cutOffParsing();
 return nullptr;
+  case tok::kw_import:
+SingleDecl = ParseModuleImport(SourceLocation());
+break;
   case tok::kw_export:
 if (getLangOpts().ModulesTS) {
   SingleDecl = ParseExportDeclaration();
@@ -2092,7 +2094,7 @@ Parser::DeclGroupPtrTy Parser::ParseModu
 ///   '@' 'import' module-name ';'
 /// [ModTS] module-import-declaration:
 ///   'import' module-name attribute-specifier-seq[opt] ';'
-Parser::DeclGroupPtrTy Parser::ParseModuleImport(SourceLocation AtLoc) {
+Decl *Parser::ParseModuleImport(SourceLocation AtLoc) {
   assert((AtLoc.isInvalid() ? Tok.is(tok::kw_import)
 : Tok.isObjCAtKeyword(tok::objc_import)) &&
  "Improper start to module import");
@@ -2119,7 +2121,7 @@ Parser::DeclGroupPtrTy Parser::ParseModu
   if (Import.isInvalid())
 return nullptr;
 
-  return Actions.ConvertDeclToDeclGroup(Import.get());
+  return Import.get();
 }
 
 /// Parse a C++ Modules TS / Objective-C module name (both forms use the same

Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=318744&r1=318743&r2=318744&view=diff
==
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Nov 21 01:42:42 2017
@@ -16171,7 +16171,7 @@ static void checkModuleImportContext(Sem
 DC = LSD->getParent();
   }
 
-  while (isa(DC))
+  while (isa(DC) || isa(DC))
 DC = DC->getParent();
 
   if (!isa(DC)) {
@@ -16349,12

r315231 - Testing commit access.

2017-10-09 Thread Hamza Sood via cfe-commits
Author: hamzasood
Date: Mon Oct  9 12:07:09 2017
New Revision: 315231

URL: http://llvm.org/viewvc/llvm-project?rev=315231&view=rev
Log:
Testing commit access.

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

Modified: cfe/trunk/lib/Driver/Compilation.cpp
URL: 
http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Compilation.cpp?rev=315231&r1=315230&r2=315231&view=diff
==
--- cfe/trunk/lib/Driver/Compilation.cpp (original)
+++ cfe/trunk/lib/Driver/Compilation.cpp Mon Oct  9 12:07:09 2017
@@ -28,7 +28,7 @@ Compilation::Compilation(const Driver &D
 : TheDriver(D), DefaultToolChain(_DefaultToolChain), ActiveOffloadMask(0u),
   Args(_Args), TranslatedArgs(_TranslatedArgs), ForDiagnostics(false),
   ContainsError(ContainsError) {
-  // The offloading host toolchain is the default tool chain.
+  // The offloading host toolchain is the default toolchain.
   OrderedOffloadingToolchains.insert(
   std::make_pair(Action::OFK_Host, &DefaultToolChain));
 }


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


Re: Fix for Visual Studio 2017

2017-01-05 Thread Hamza Sood via cfe-commits
I’ve submitted an updated version via Phabricator 
(https://reviews.llvm.org/D28365 ), so this 
one can be ignored.___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


Fix for Visual Studio 2017

2017-01-02 Thread Hamza Sood via cfe-commits
Visual Studio 2017 changes the layout of its compiler tools (described here: 
https://blogs.msdn.microsoft.com/vcblog/2016/10/07/compiler-tools-layout-in-visual-studio-15/).
If there are no other Visual Studio versions installed, Clang will be unable to 
find link.exe and hence will fail at the linking stage. This patch should fix 
that.



VS2017Fix.patch
Description: Binary data
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits